diff --git a/.github/ISSUE_TEMPLATE/00-bug-performance-issue.md b/.github/ISSUE_TEMPLATE/00-bug-performance-issue.md index 34ba4cf9601..d64a1afd895 100644 --- a/.github/ISSUE_TEMPLATE/00-bug-performance-issue.md +++ b/.github/ISSUE_TEMPLATE/00-bug-performance-issue.md @@ -8,21 +8,17 @@ about: Use this template for reporting a bug or a performance issue. **System information** - Have I written custom code (as opposed to using a stock example script provided in TensorFlow): -- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): -- Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: +- OS Platform and Distribution (e.g., Linux Ubuntu 16.04 x86\_64): - TensorFlow installed from (source or binary): - TensorFlow version (use command below): -- Python version: +- Java version (i.e., the output of `java -version`): +- Java command line flags (e.g., GC parameters): +- Python version (if transferring a model trained in Python): - Bazel version (if compiling from source): - GCC/Compiler version (if compiling from source): - CUDA/cuDNN version: - GPU model and memory: - -You can collect some of this information using our environment capture [script](https://github.com/tensorflow/tensorflow/tree/master/tools/tf_env_collect.sh) -You can also obtain the TensorFlow version with -python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)" - **Describe the current behavior** **Describe the expected behavior** diff --git a/.github/ISSUE_TEMPLATE/10-build-installation-issue.md b/.github/ISSUE_TEMPLATE/10-build-installation-issue.md index 99c2fe61271..75d00465ed2 100644 --- a/.github/ISSUE_TEMPLATE/10-build-installation-issue.md +++ b/.github/ISSUE_TEMPLATE/10-build-installation-issue.md @@ -7,23 +7,21 @@ about: Use this template for build/installation issues Please make sure that this is a build/installation issue. As per our [GitHub Policy](https://github.com/tensorflow/tensorflow/blob/master/ISSUES.md), we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:build_template **System information** -- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): -- Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: +- OS Platform and Distribution (e.g., Linux Ubuntu 16.04 x86\_64): - TensorFlow installed from (source or binary): - TensorFlow version: -- Python version: -- Installed using virtualenv? pip? conda?: +- Java version (i.e., the output of `java -version`): +- Java command line flags (e.g., GC parameters): +- Installed from Maven Central?: - Bazel version (if compiling from source): - GCC/Compiler version (if compiling from source): - CUDA/cuDNN version: - GPU model and memory: - **Describe the problem** **Provide the exact sequence of commands / steps that you executed before running into the problem** - **Any other info / logs** Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. diff --git a/.github/ISSUE_TEMPLATE/50-other-issues.md b/.github/ISSUE_TEMPLATE/40-other-issues.md similarity index 100% rename from .github/ISSUE_TEMPLATE/50-other-issues.md rename to .github/ISSUE_TEMPLATE/40-other-issues.md diff --git a/.github/ISSUE_TEMPLATE/40-tflite-op-request.md b/.github/ISSUE_TEMPLATE/40-tflite-op-request.md deleted file mode 100644 index 7b391279e47..00000000000 --- a/.github/ISSUE_TEMPLATE/40-tflite-op-request.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -name: TensorFlow Lite Op Request -about: Use this template for reporting ops you are using or missing. - ---- - - -**System information** -- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): -- TensorFlow installed from (source or binary): -- TensorFlow version (or github SHA if from source): - - -**Provide the text output from tflite_convert** - -``` -# Copy and paste here -``` - -Also, please include a link to a GraphDef or the model if possible. - -**Any other info / logs** - -Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000000..b6641b00600 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,189 @@ +name: CI build +on: + push: + branches: + - master + - staging + - r[0-9]+.* + pull_request: + branches: + - master + - r[0-9]+.* + types: [opened, reopened, synchronize, labeled, unlabeled] +env: + DEPLOY: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/r')) }} +jobs: + check-format: + if: github.event_name == 'pull_request' + runs-on: ubuntu-22.04 + steps: + - name: Configure Java + uses: actions/setup-java@v5 + with: + distribution: 'adopt' + java-version: '17' + - name: Checkout repository + uses: actions/checkout@v6 + with: + fetch-depth: 0 + - name: Build project + run: | + gcc --version + mvn -version + mvn clean install -Pjdk17 -B -U -e -Dlint.skip=true -Dmaven.test.skip=true + - name: Run format checks + run: | + mvn spotless:check -Pjdk17 -B -U -e + linux-arm64: + runs-on: ubuntu-2204-arm64-2c + strategy: + matrix: + ext: [""] + steps: + - name: Install environment + run: | + sudo apt update + sudo apt install -y curl wget unzip tar git gcc g++ + - name: Configure Java + uses: actions/setup-java@v5 + with: + distribution: 'zulu' + java-version: '17' + architecture: 'aarch64' + - name: Checkout repository + uses: actions/checkout@v6 + - name: Build project + run: | + gcc --version + mvn -version + mvn clean install -pl '!tensorflow-framework' -B -U -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }} + - name: Build native artifact + run: mvn -f tensorflow-core/tensorflow-core-native/pom.xml package -B -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }} + - name: Upload native artifact + if: env.DEPLOY == 'true' + uses: actions/upload-artifact@v7 + with: + name: native-artifact-${{ github.job }}${{ matrix.ext }} + path: tensorflow-core/tensorflow-core-native/target/tensorflow-core-native-*-${{ github.job }}*.jar + if-no-files-found: error + retention-days: 1 + linux-x86_64: + runs-on: ubuntu-22.04 + strategy: + matrix: + ext: ["", -gpu] + steps: + - name: Configure Java + uses: actions/setup-java@v5 + with: + distribution: 'adopt' + java-version: '11' + - name: Checkout repository + uses: actions/checkout@v6 + - name: Build project + run: | + gcc --version + mvn -version + mvn clean install -pl '!tensorflow-framework' -B -U -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }} + - name: Build native artifact + run: mvn -f tensorflow-core/tensorflow-core-native/pom.xml package -B -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }} + - name: Upload native artifact + if: env.DEPLOY == 'true' + uses: actions/upload-artifact@v7 + with: + name: native-artifact-${{ github.job }}${{ matrix.ext }} + path: tensorflow-core/tensorflow-core-native/target/tensorflow-core-native-*-${{ github.job }}*.jar + if-no-files-found: error + retention-days: 1 + macosx-arm64: + runs-on: macos-14 + strategy: + matrix: + ext: [""] + steps: + - name: Configure Java + uses: actions/setup-java@v5 + with: + distribution: 'zulu' + java-version: '17' + architecture: 'arm64' + - name: Checkout repository + uses: actions/checkout@v6 + - name: Build project + run: | + clang --version + mvn -version + mvn clean install -pl '!tensorflow-framework' -B -U -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }} + - name: Build native artifact + run: mvn -f tensorflow-core/tensorflow-core-native/pom.xml package -B -e -Djavacpp.platform=${{ github.job }} -Djavacpp.platform.extension=${{ matrix.ext }} + - name: Upload native artifact + if: env.DEPLOY == 'true' + uses: actions/upload-artifact@v7 + with: + name: native-artifact-${{ github.job }}${{ matrix.ext }} + path: tensorflow-core/tensorflow-core-native/target/tensorflow-core-native-*-${{ github.job }}*.jar + if-no-files-found: error + retention-days: 1 + deploy: + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + needs: [linux-x86_64, macosx-arm64, linux-arm64] + runs-on: ubuntu-22.04 + steps: + - name: Configure Java + uses: actions/setup-java@v5 + with: + distribution: 'adopt' + java-version: '11' + server-id: central + server-username: MAVEN_USERNAME # env variable for username in deploy + server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy + - name: Checkout repository + uses: actions/checkout@v6 + - name: Download native artifacts + uses: actions/download-artifact@v8 + with: + pattern: native-artifact-* + path: tensorflow-core/tensorflow-core-native/target + merge-multiple: true + - name: Build and Deploy snapshot artifacts + env: + MAVEN_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }} + MAVEN_CENTRAL_TOKEN: ${{ secrets.CI_DEPLOY_PASSWORD }} + run: | + java -version + mvn -version + mvn deploy -Pdeploying -B -e + release: + if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/r') }} + needs: [linux-x86_64, macosx-arm64, linux-arm64] + runs-on: ubuntu-22.04 + steps: + - name: Configure Java + uses: actions/setup-java@v5 + with: + distribution: 'adopt' + java-version: '11' + server-id: central + server-username: MAVEN_USERNAME # env variable for username in deploy + server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE # Handled as an env variable name reference + - name: Checkout repository + uses: actions/checkout@v6 + - name: Download native artifacts + uses: actions/download-artifact@v8 + with: + pattern: native-artifact-* + path: tensorflow-core/tensorflow-core-native/target + merge-multiple: true + - name: Build and Deploy release artifacts + env: + MAVEN_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }} + MAVEN_CENTRAL_TOKEN: ${{ secrets.CI_DEPLOY_PASSWORD }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + MAVEN_GPG_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + run: | + java -version + mvn -version + mvn deploy -Pdeploying -Preleasing -B -e + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index be4a007f107..00000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,105 +0,0 @@ -name: CI jobs -on: [push, pull_request] - -jobs: - linux-x86_64: - runs-on: ubuntu-latest - container: nvidia/cuda:10.1-cudnn7-devel-centos7 - strategy: - matrix: - ext: ["", -mkl, -gpu, -mkl-gpu] - steps: - - name: Install environment - run: | - yum -y update - yum -y install centos-release-scl-rh epel-release - yum -y install java-1.8.0-openjdk-devel devtoolset-7 rh-git218 rh-maven35 patch python36-devel python36-pip python36-six - echo Downloading Bazel - curl -L https://github.com/bazelbuild/bazel/releases/download/0.29.1/bazel-0.29.1-installer-linux-x86_64.sh -o bazel.sh --retry 10 - bash bazel.sh - - name: Checkout repository - uses: actions/checkout@v1 - - name: Build project - run: | - source scl_source enable devtoolset-7 rh-git218 rh-maven35 || true - git --version - gcc --version - mvn -version - bazel version - df -h - echo Executing Maven without Wagon HTTP pool that fails under Docker - mvn clean install -B -U -e -Dmaven.wagon.http.pool=false -Djavacpp.platform=linux-x86_64 -Djavacpp.platform.extension=${{ matrix.ext }} - df -h - macosx-x86_64: - runs-on: macos-latest - strategy: - matrix: - ext: ["", -mkl] - steps: - - name: Install environment - run: | - python3 -m pip install six - echo Downloading Bazel - curl -L https://github.com/bazelbuild/bazel/releases/download/0.29.1/bazel-0.29.1-installer-darwin-x86_64.sh -o bazel.sh --retry 10 - bash bazel.sh - - name: Checkout repository - uses: actions/checkout@v1 - - name: Build project - run: | - git --version - clang --version - mvn -version - bazel version - df -h - echo Executing Maven - mvn clean install -B -U -e -Djavacpp.platform=macosx-x86_64 -Djavacpp.platform.extension=${{ matrix.ext }} - df -h - windows-x86_64: - runs-on: windows-latest - strategy: - matrix: - ext: ["", -mkl, -gpu, -mkl-gpu] - steps: - - name: Install environment - shell: cmd - run: | - python -m pip install six - echo Removing some unused stuff to avoid running out of disk space - rm.exe -Rf "C:/Program Files (x86)/Android" "C:/Program Files/dotnet" "%CONDA%" "%GOROOT_1_10_X64%" "%GOROOT_1_11_X64%" "%GOROOT_1_12_X64%" "%GOROOT_1_13_X64%" "C:\hostedtoolcache\windows\Ruby" "C:\Rust" - echo Removing old versions of MSVC that interfere with Bazel - bash.exe -lc "find 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/' -iname '14.1*' -exec rm -Rf {} \;" - echo Downloading Bazel - mkdir C:\bazel - curl.exe -L https://github.com/bazelbuild/bazel/releases/download/0.29.1/bazel-0.29.1-windows-x86_64.exe -o C:/bazel/bazel.exe --retry 10 - echo Installing CUDA - curl.exe -L http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_426.00_windows.exe -o cuda.exe - curl.exe -L https://developer.download.nvidia.com/compute/redist/cudnn/v7.6.4/cudnn-10.1-windows7-x64-v7.6.4.38.zip -o cudnn.zip - cuda.exe -s - mkdir cuda - unzip.exe cudnn.zip - cp.exe -a cuda/include cuda/lib cuda/bin "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/" - - name: Checkout repository - uses: actions/checkout@v1 - - name: Build project - shell: cmd - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64 - set "CUDA_PATH=%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v10.1" - set "CUDA_PATH_V10_1=%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v10.1" - set "PATH=C:\bazel;%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin;%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v10.1\libnvvp;%PATH%" - echo Shorten work paths to prevent Bazel from reaching MAX_PATH limit - set "TEST_TMPDIR=C:\tmp" - set "TMPDIR=C:\tmp" - set "TEMP=C:\tmp" - set "TMP=C:\tmp" - mkdir C:\tmp - git --version - cl - call mvn -version - bazel version - df -h - wmic pagefile list /format:list - echo Executing Maven - call mvn clean install -B -U -e -Djavacpp.platform=windows-x86_64 -Djavacpp.platform.extension=${{ matrix.ext }} - df -h - wmic pagefile list /format:list diff --git a/.gitignore b/.gitignore index 4a14794504c..d9e902d7d9e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ node_modules /.bazelrc.user /.tf_configure.bazelrc /**/bazel-* -/**/target/ /bazel_pip /tools/python_bin_path.sh /tensorflow/tools/git/gen @@ -17,6 +16,7 @@ __pycache__ cmake_build/ tensorflow/contrib/cmake/_build/ .idea/** +.run /build/ [Bb]uild/ /tensorflow/core/util/version_info.cc @@ -36,6 +36,14 @@ xcuserdata/** /api_init_files_list.txt /estimator_api_init_files_list.txt *.whl +tensorflow-core/tensorflow-core-api/downloads/ + +# Vim backups +*~ + +# Patch files +*.orig +*.rej # Android .gradle @@ -43,3 +51,19 @@ xcuserdata/** *.iml local.properties gradleBuild + +# VSCode +.settings/ +.project +.classpath + +**/target +.tf_configure.bazelrc +.clwb/ + +# Deployment Files +settings.xml +pom.xml.asc + +# Docs +docs/docs/apidocs/ \ No newline at end of file diff --git a/.mvn/jvm.config b/.mvn/jvm.config new file mode 100644 index 00000000000..8488a4fce61 --- /dev/null +++ b/.mvn/jvm.config @@ -0,0 +1,10 @@ +--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED +--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED +--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000000..9da8b9603aa --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,166 @@ +# Building and Contributing to TensorFlow Java + +## Contributing + +### Formatting + +Java sources should be formatted according to the [Google style guide](https://google.github.io/styleguide/javaguide.html). It can be included +in [IntelliJ](https://github.com/google/styleguide/blob/gh-pages/intellij-java-google-style.xml) and +[Eclipse](https://github.com/google/styleguide/blob/gh-pages/eclipse-java-google-style.xml). +[Google's C++ style guide](https://google.github.io/styleguide/cppguide.html) should also be used for C++ code. + +### Dependencies + +For dependencies, we can use anything compliant with [this list](https://opensource.google/docs/thirdparty/licenses/#notice), but we want to keep the core libraries as dependency free as possible. + +## Building + +To build all the artifacts locally, simply invoke the command `mvn install` at the root of this repository (or the Maven command of your choice). + +### JDK 16+ + +If you're using JDK 16+, you need to add some exports for the formatter plugin: + +``` +--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED +--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED +``` + +This can be done in `.mvn/jvm.config` or `MAVEN_OPTS`. + +### Native Builds + +By default, the build will attempt to download the existing TensorFlow binaries from the web for the platform it is running on (so you need to have an active internet connection). +If such binaries are not available for your platform, you will need to build the TensorFlow runtime library from sources, by appending the `-Pnative-build` argument to your Maven +command. This requires 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/source) for more details). Note that building from sources can take multiple hours on a regular laptop. + +To build for GPU, pass `-Djavacpp.platform.extension=-gpu` to maven. If you want to use TensorFlow Java with unsupported GPUs, set the environment variable `TF_CUDA_COMPUTE_CAPABILITIES`, or +configure it in a bazel rc file (i.e. `build --action_env TF_CUDA_COMPUTE_CAPABILITIES="6.1"`). + +### Native Crashes + +Occasionally tests will fail with a message like: + +``` +Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.0:test(default-test)on project tensorflow-core-api:There are test failures. + + Please refer to C:\mpicbg\workspace\tensorflow\java\tensorflow-core\tensorflow-core-api\target\surefire-reports for the individual test results. + Please refer to dump files(if any exist)[date]-jvmRun[N].dump,[date].dumpstream and[date]-jvmRun[N].dumpstream. + The forked VM terminated without properly saying goodbye.VM crash or System.exit called? + Command was cmd.exe/X/C"C:\Users\me\.jdks\adopt-openj9-1.8.0_275\jre\bin\java -jar C:\Users\me\AppData\Local\Temp\surefire236563113746082396\surefirebooter5751859365434514212.jar C:\Users\me\AppData\Local\Temp\surefire236563113746082396 2020-12-18T13-57-26_766-jvmRun1 surefire2445852067572510918tmp surefire_05950149004635894208tmp" + Error occurred in starting fork,check output in log + Process Exit Code:-1 + Crashed tests: + org.tensorflow.TensorFlowTest + org.apache.maven.surefire.booter.SurefireBooterForkException:The forked VM terminated without properly saying goodbye.VM crash or System.exit called? + Command was cmd.exe/X/C"C:\Users\me\.jdks\adopt-openj9-1.8.0_275\jre\bin\java -jar C:\Users\me\AppData\Local\Temp\surefire236563113746082396\surefirebooter5751859365434514212.jar C:\Users\me\AppData\Local\Temp\surefire236563113746082396 2020-12-18T13-57-26_766-jvmRun1 surefire2445852067572510918tmp surefire_05950149004635894208tmp" + Error occurred in starting fork,check output in log + Process Exit Code:-1 + Crashed tests: + org.tensorflow.TensorFlowTest + at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:671) + at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:533) + at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:278) + at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:244) +``` + +This is because the native code crashed (i.e. because of a segfault), and it should have created a dump file somewhere in the project that you can use +to tell what caused the issue. + +## Upgrading TensorFlow Version + +To upgrade the version of TensorFlow that is embedded within TensorFlow Java, please follow carefully these steps. + +### Upgrading TensorFlow Native Library + +1. Download locally the archive of the tensorflow release at https://github.com/tensorflow/tensorflow/archive/refs/tags/vX.X.X.tar.gz +2. Compute the SHA sum using the shell command `shasum -a 256 ` +3. Update `urls`, `sha256` and `strip_prefix` fields of the `org_tensorflow` archive rule in Bazel [workspace](https://github.com/tensorflow/java/blob/master/tensorflow-core/tensorflow-core-native/WORKSPACE#L19) +4. Extract the archive in a temporary folder +5. Copy the content of `tensorflow-x.x.x/.bazelrc` file to `tensorflow-core/tensorflow-core-native/tensorflow.bazelrc` under TensorFlow Java source tree +6. Copy the content of `tensorflow-x.x.x/WORKSPACE` after the "###### Copy content of..." notice to `tensorflow-core/tensorflow-core-native/WORKSPACE`, read notice for more details +7. Copy the content of `tensorflow-x.x.x/.bazelversion` file to `tensorflow-core/tensorflow-core-native/.bazelversion` +8. Validate that options in `tensorflow-core/tensorflow-core-native/.bazelrc` are still accurate or update them accordingly +9. Update URLs of existing TensorFlow binaries in the `tensorflow-core/tensorflow-core-native/scripts/dist_download` script +10. Update URLs of TensorFlow-Text binaries used for testing in the `tensorflow-core/tensorflow-core-api/scripts/test_download` script + +#### Patching TensorFlow Sources + +In order to build the TensorFlow native library to work with TensorFlow Java, we sometimes need to apply some patches to the TensorFlow sources. These +patches are found in `tensorflow-core/tensorflow-core-native/external`. + +- If you have an error like "Error in fail: Error applying patch //external:xxx.patch:", verify why the patch is failing by looking at the TensorFlow source code. + Chances are that this code has changed and the patch needs to be updated. +- To create a new patch or update one, you can make a copy of the TensorFlow source file to change, make your change and generate a patch using `git diff ` +- If more than one file needs to be added to the patch, it's easier to clone the [TensorFlow repository](https://github.com/tensorflow/tensorflow), apply the changes and use `git diff` at the root of the tree + +### Generating Java Bindings + +After upgrading the TensorFlow library, you need to regenerate all Java bindings that depends on the native code. That includes Java protos, C API bindings (JavaCPP) and +operator classes. You can trigger the regeneration of these bindings with the Maven command `mvn clean install -Pgenerating`. + +This will also trigger a small Bazel build of the TensorFlow sources to regenerate the Java protos, so make sure your [environment](CONTRIBUTING.md#native-builds) is setup properly. + +#### Operations Classification + +When generating the operator classes, the build process might prompt you to provide information about the new operations found in the targeted TensorFlow version. This will generate a new API definition +under the [tensorflow-core/tensorflow-core-api/api](https://github.com/tensorflow/java/tree/master/tensorflow-core/tensorflow-core-api/api) folder. The required +information is: +* The visibility for this op + * VISIBLE to force the creation of a Java class that will be also exposed by the `*Ops` API classes. + * HIDDEN for creating a Java class that won't be exposed by the `*Ops` API classes. + * SKIP for not creating a Java class for this operation + * DEFAULT to rely on the visibility settings set in TensorFlow sources +* The name group for this operator + * This name is used to place this operator under the right subpackage and `*Ops` API. + * For example, the group `nn` will place the operator `Conv` under the `org.tensorflow.op.nn` package and in the `NnOps` API class. + * When no group is specified, the operator will go under the `org.tensorflow.op.core` package and in the `Ops` API class. +* The name for this op + * By default is the name found in TensorFlow registry but can be useful in some cases to rename it in case it clashes with Java keywords (e.g. `Switch`-> `SwitchCond`) + * Can also be used to remove the suffix of an operation that has multiple versions (e.g. `RestoreV2` -> `Restore`) + +The actual classification process is a bit arbitrary and based on the good judgement of the developer. The reason is that most ops in Python +are being wrapped by a higher-level API and therefore are left unclassified, while in Java they are exposed and can be used directly by +the users. + +Please review the location of the new generated operators after the build is complete and make necessary adjustments to the API definitions protos +manually if some of them seems to be in the "wrong" place, making sure to repeat this process until satisfaction. + +#### New Operation Version + +Some operations might be just an upgrade of another existing operations. For instance, there are many version of the `BatchMatMul` kernel (V1, V2, V3...). +When you see that a new op is just an upgrade from another other one, make sure that the latest version has a valid endpoint and that all other +previous versions of this operation are marked as `VISIBILITY: SKIP`. + +### Java Protos Classification + +TensorFlow Java distributes a large number proto definitions found in the TensorFlow native library as Java classes. Again, new protos might not +be classified properly since they may be lacking the `option java_*` statements at the beginning of their definition. The build script will attempt +to mitigate this omission by generating the proto bindings under the same package as the `package` statement (if also present), and under the root package +`org.tensorflow.proto`. + +#### Custom Operators + +Code generation for `Ops` and related classes is done during `tensorflow-core-api`'s `compile` phase, using the annotation processor in +`tensorflow-core-generator`. If you change or add any operator classes (annotated with `org.tensorflow.op.annotation.Operator`), endpoint methods ( +annotated with `org.tensorflow.op.annotation.Endpoint`), or change the annotation processor, be sure to re-run a +`mvn clean install -Pgenerating` in `tensorflow-core-api`. + +## Known Issues + +### Missing Gradients + +In some cases, a op supported by Tensorflow Java will not have a gradient defined, resulting in errors like this: +``` +org.tensorflow.exceptions.TensorFlowException: No gradient defined for op: ReadVariableOp. Please see https://www.tensorflow.org/code/tensorflow/cc/gradients/README.md for instructions on how to add C++ gradients. + at org.tensorflow.internal.c_api.AbstractTF_Status.throwExceptionIfNotOK(AbstractTF_Status.java:101) + at org.tensorflow.Graph.addGradients(Graph.java:708) + at org.tensorflow.Graph.addGradients(Graph.java:291) +``` +The description in the [linked file](https://www.tensorflow.org/code/tensorflow/cc/gradients/README.md) are accurate for adding C++ Graph gradients, which are used by our `Graph`. Examples of doing that are [tensorflow/tensorflow#46115](https://github.com/tensorflow/tensorflow/pull/46115) and [tensorflow/tensorflow#47774](https://github.com/tensorflow/tensorflow/pull/47774). + +You can also code and register the missing gradients in Java, using the TensorFlow Java custom gradient registration capabilities. Check at the JavaDoc of `tensorflow-core-api` for more details. diff --git a/LICENSE b/LICENSE index 786bd07395c..261eeb9e9f8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,3 @@ -Copyright 2020 The TensorFlow Authors. All rights reserved. - Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ diff --git a/MIGRATING.md b/MIGRATING.md new file mode 100644 index 00000000000..61148063487 --- /dev/null +++ b/MIGRATING.md @@ -0,0 +1,149 @@ +# Migrating Between TensorFlow Java Releases + +This guide explains in detail how to migrate your code from a pre-1.0 release to a 1.0 or newer release. Post 1.0 +releases have API stability as much as possible, though upstream TensorFlow does remove ops from time to time and +consequently those ops will be removed from TensorFlow-Java + +## Migrating to 1.0.0 or newer + +TensorFlow-Java 1.0.0 requires Java 11 or later. + +### Native Artifact Renaming + +The native artifacts, that used to be distributed as `tensorflow-core-api`, are now distributed under `tensorflow-core-native`. If you still add +`tensorflow-core-platform` in your project, that won't affect you. But if you were adding dependencies to specific native runtimes, you need to update +them to reflect the new artifact name. + +For example, +```xml + + org.tensorflow + tensorflow-core-api + 0.5.0 + + + org.tensorflow + tensorflow-core-api + 0.5.0 + linux-x86_64 + +``` +will now be +```xml + + org.tensorflow + tensorflow-core-api + 1.0.0 + + + org.tensorflow + tensorflow-core-native + 1.0.0 + linux-x86_64 + +``` +### Java Module Renaming + +The Java Module (jigsaw) names has been updated to drop the leading `org.`, as follow: +- `tensorflow-core-api` : `tensorflow` (was `org.tensorflow` before) +- `tensorflow-core-generator` : `tensorflow.generator` (was `org.tensorflow-generator` before) +- `tensorflow-core-native` : `tensorflow.nativelib` +- `tensorflow-framework` : `tensorflow.framework` (was `org.tensorflow.framework` before) + +### GPU Support + +Previous versions of TF Java were building a `tensorflow-core-platform-gpu` artifact upon which application could depend +on to include any TensorFlow native library that GPU support enabled. Since TensorFlow has removed its support of GPU +on all platforms other than Linux, we removed our platform JAR in favour of simply adding a dependency on the +`linux-x86_64-gpu` native artifact. +```xml + + org.tensorflow + tensorflow-core-native + 1.0.0 + linux-x86_64-gpu + +``` +Please note that including this dependency won't work if your application also depends on `tensorflow-core-platform`. If +you need to support more platforms than Linux, you should include the other `tensorflow-core-native` dependencies +separately (see the [README](README.md) file). + +### Session Run Result + +In versions before 0.4.0 `Session.Runner.run` and `TensorFunction.call` returned a `List`. In newer versions +they return a `Result` class which is `AutoCloseable` to make management of the tensor lifetime simpler. To migrate +users should wrap the `run` invocation in a try-with-resources statement rather than closing the output tensors +individually. + +### Proto Definitions Moved + +Some proto definitions under `org.tensorflow.proto` have been moved to a different location under the same (`org.tensorflow.proto`) package. +Certain classes have moved packages, for example, `org.tensorflow.proto.example.Feature` to `org.tensorflow.proto.Feature`. +You will need to reimport these proto bindings to match the new location. Your IDE should easily be able to do this for you. + +## Migrating to 0.3.0 + +### Non-parameterized Typed Tensors + +In previous versions, the `Tensor` class was parameterized with its tensor type interface, which is part of the `TType` family. To access directly the memory +tensor from the JVM, an explicit conversion between `Tensor` and its tensor type was required by calling `tensor.data()`. + +In 0.3.0, tensors are always typed, making this generic parameter and explicit mapping obsolete. As soon as you get a handle to a tensor, you are able to +access directly its memory for reading (or writing for most tensor types) and no convertion is required. Any instances of a class in the `TType` family +can also now be manipulated directly as a `Tensor` (e.g. to be passed to a session for inference). + +Steps: +1. Replace a parameterized `Tensor` by its parameter (e.g. `Tensor` -> `TFloat32`) +2. Replace instance of `Tensor` with unknown parameter by `Tensor` +3. Remove any invocation to `Tensor.data()` (e.g. `tensor.data().getFloat()` -> `tensor.getFloat()`) +4. Replace any invocation to `Operand.data()` by `Operand.asTensor()` + +### Use of Java Type System instead of DataType + +In previous versions, the `DataType` class was used to carry information about the type of a `Tensor`, that can then be converted back to a tensor of that +type (see previous section). Since there were a exact parity between interfaces of the `TType` family and an instance of `DataType`, the latter has been dropped +in 0.3.0 to leverage instead the standard type system in Java, for a better idiomatic experience. + +Steps: +1. Replace all accesses to the `DTYPE` field of a `TType` interface by its class (e.g. `TFloat32.DTYPE` -> `TFloat32.class`) +2. Use Java type system for checking tensor types at runtime (e.g. using `instanceof` or `isAssignableFrom`) +3. Replace any invocation to `Tensor.expect()` by an explicit cast (e.g. `tensor.expect(TFloat32.DTYPE)` -> `(TFloat32)tensor`) + +### Example + +0.2.0: +``` +Session session = ...; + +try (Tensor tensor = TFloat32.tensorOf(Shape.of(1, 2))) { + TFloat32 tensorData = tensor.data(); + tensorData.setFloat(10.0f, 0); + tensorData.setFloat(20.0f, 1); + + try (Tensor result = session.runner().feed("x", tensor).fetch("y").run().get(0)) { + if (result.dataType() == TFloat32.DTYPE) { + Tensor typedResult = result.expect(TFloat32.DTYPE); + TFloat32 resultData = typedResult.data(); + System.out.println("Result is " + resultData.getFloat()); + } + } +} +``` + +0.3.0: +``` +Session session = ...; + +try (TFloat32 tensor = TFloat32.tensorOf(Shape.of(1, 2))) { + tensor.setFloat(10.0f, 0); + tensor.setFloat(20.0f, 1); + + try (Tensor result = session.runner().feed("x", tensor).fetch("y").run().get(0)) { + if (result instanceof TFloat32) { + TFloat32 typedResult = (TFloat32)result; + System.out.println("Result is " + typedResult.getFloat()); + } + } +} +``` + diff --git a/README.md b/README.md index 8e49e8acef7..8cbb89877bc 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,5 @@ # TensorFlow for Java -***!!! IMPORTANT NOTICE !!! This repository is UNDER CONSTRUCTION and does not yet host the code of the -offical TensorFlow Java artifacts!*** - -***Please refer to the [TensorFlow Java module](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/java) -of the main repository for the actual code.*** - ## Welcome to the Java world of TensorFlow! TensorFlow can run on any JVM for building, training and running machine learning models. It comes with @@ -25,57 +19,75 @@ 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: * `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. - -* `tensorflow-utils` - * Utility libraries that do not depend on the TensorFlow runtime but are useful for machine learning purposes - -* `tensorflow-frameworks` - * High-level APIs built on top of the core libraries for simplifying the usage of TensorFlow in Java. - -* `tensorflow-starters` - * Artifacts aggregating others for simplifying dependency management with TensorFlow - -*Note: Right now, only the `tensorflow-core` component is present* - -## Building Sources + * All artifacts that build up the core language bindings of TensorFlow for Java + * Intended audience: projects that provide their own APIs or frameworks on top of + TensorFlow and just want a thin layer to access the TensorFlow native library from the JVM + +* `tensorflow-framework` + * Primary API for building and training neural networks with TensorFlow + * Intended audience: neural network developers + * For more information: [tensorflow-framework/README.md](tensorflow-framework/README.md) -To build all the artifacts, simply invoke the command `mvn install` at the root of this repository (or -the Maven command of your choice). It is also possible to build artifacts with support for MKL enabled with -`mvn install -Djavacpp.platform.extension=-mkl` or CUDA with `mvn install -Djavacpp.platform.extension=-gpu` -or both with `mvn install -Djavacpp.platform.extension=-mkl-gpu`. +* `tensorflow-ndarray` + * API for creating and manipulating n-dimensional arrays, can be used independently from TensorFlow. -Note that in some cases, if a version of the TensorFlow runtime library is not found for your environment, -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/source) for more details. +## Communication + +This repository is maintained by TensorFlow JVM Special Interest Group (SIG). You can easily contact the group +by posting to the [TensorFlow Forum](https://discuss.tensorflow.org), adding the `sig_jvm` tag, or by writing to us on +the [sig-jvm Gitter channel](https://gitter.im/tensorflow/sig-jvm). You can also simply send pull requests +and raise issues to this repository. + +## Building Sources + +See [CONTRIBUTING.md](CONTRIBUTING.md#building). ## Using Maven Artifacts -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. There are also -`tensorflow-core-platform-mkl`, `tensorflow-core-platform-gpu`, and `tensorflow-core-platform-mkl-gpu` -artifacts that depend on artifacts with MKL and/or CUDA support enabled. +There are two options for adding TensorFlow Java as a dependency to your Maven project: with individual dependencies +for each targeted platform or with a single dependency that targets them all. + +### Individual dependencies + +With this option, you must first add a dependency to `tensorflow-core-api` and then one or multiple +dependencies to `tensorflow-core-native` with a classifier targeting a specific platform. This option is preferred as +it minimizes the size of your application by only including the TensorFlow builds you need, at the cost of being more +restrictive. + +While TensorFlow Java can be compiled for [multiple platforms](https://github.com/tensorflow/java/blob/master/tensorflow-core/pom.xml#L54), +only binaries for the following are being **supported and distributed** by this project: + +- `linux-x86_64`: Linux platforms on Intel/AMD chips +- `linux-x86_64-gpu`: Linux platforms on Intel/AMD chips with Cuda GPU support +- `linux-arm64`: Linux platforms on Arm chips +- `macosx-arm64`: MacOS X platforms on Apple Silicon chips + +Binaries for `macosx-x86_64` are available for TF-Java 1.0 series releases and earlier, they were dropped from +TF-Java 1.1 and newer as they are no longer supported or released by Google. Binaries for `windows-x86_64` are available +for TF-Java 1.1 and earlier, they were dropped for the 1.2 release and newer as the native binaries are no longer supported or +released by Google. 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: +systems with no GPU support, you should add the following dependencies: ```xml org.tensorflow tensorflow-core-api - 0.1.0-SNAPSHOT + 1.2.0 org.tensorflow - tensorflow-core-api - 0.1.0-SNAPSHOT - linux-x86_64${javacpp.platform.extension} + tensorflow-core-native + 1.2.0 + linux-x86_64 ``` +Or Gradle: +```groovy +def tfVersion = '1.2.0' +implementation "org.tensorflow:tensorflow-core-api:$tfVersion" +implementation "org.tensorflow:tensorflow-core-native:$tfVersion:linux-x86_64" +``` On the other hand, if you plan to deploy your JAR on more platforms, you need additional native dependencies as follows: @@ -83,50 +95,148 @@ native dependencies as follows: org.tensorflow tensorflow-core-api - 0.1.0-SNAPSHOT + 1.2.0 org.tensorflow - tensorflow-core-api - 0.1.0-SNAPSHOT - linux-x86_64${javacpp.platform.extension} + tensorflow-core-native + 1.2.0 + linux-arm64 org.tensorflow - tensorflow-core-api - 0.1.0-SNAPSHOT - macosx-x86_64${javacpp.platform.extension} + tensorflow-core-native + 1.2.0 + linux-x86_64-gpu org.tensorflow - tensorflow-core-api - 0.1.0-SNAPSHOT - windows-x86_64${javacpp.platform.extension} + tensorflow-core-native + 1.2.0 + macosx-arm64 ``` +Or Gradle: +```groovy +def tfVersion = '1.2.0' +implementation "org.tensorflow:tensorflow-core-api:$tfVersion" +implementation "org.tensorflow:tensorflow-core-native:$tfVersion:linux-x86_64-gpu" +implementation "org.tensorflow:tensorflow-core-native:$tfVersion:macosx-arm64" +``` -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-core-platform`, -`tensorflow-core-platform-mkl`, `tensorflow-core-platform-gpu`, or `tensorflow-core-platform-mkl-gpu` -artifact includes transitively all the artifacts above as a single dependency: +Only one dependency can be added per platform, meaning that you cannot add native dependencies to both `linux-x86_64` and +`linux-x86_64-gpu` within the same project. + +To use an NVIDIA GPU, you need to install the NVIDIA device driver, CUDA Toolkit, and cuDNN. +For Ubuntu 24.04, you can install them with the following command: +```sudo apt install -y nvidia-driver-550 nvidia-cuda-toolkit nvidia-cudnn``` + +### Single dependency + +In some cases, it might be preferable to add a single dependency that includes transitively all the artifacts +required to run TensorFlow Java on any [supported platforms](README.md#individual-dependencies) + +- `tensorflow-core-platform`: Includes `tensorflow-core-api`, plus native artifacts for `linux-x86_64`, `linux-arm64`, and `macosx-arm64` + +For example, to run TensorFlow Java on any CPU platform for which a binary is being distributed by this project, you can +simply add this dependency to your application: ```xml org.tensorflow - tensorflow-core-platform${javacpp.platform.extension} - 0.1.0-SNAPSHOT + tensorflow-core-platform + 1.2.0 ``` +Or Gradle: +```groovy +implementation "org.tensorflow:tensorflow-core-platform:1.2.0" +``` -Be aware though that the native library is quite large and including too many versions of it may -significantly increase the size of your JAR. So it is good practice to limit your dependencies to -the platforms you are targeting. For this purpose the `-platform` artifacts include profiles that follow +Be aware though that the builds of TensorFlow are quite voluminous and including too many native dependencies may +significantly increase the size of your application. So it is good practice to limit your dependencies to +the platforms you are targeting. For this purpose these artifacts include profiles that follow the conventions established on this page: * [Reducing the Number of Dependencies](https://github.com/bytedeco/javacpp-presets/wiki/Reducing-the-Number-of-Dependencies) -*Note: the `tensorflow-starters` artifact is not available at this moment* +### Snapshots + +Snapshots of TensorFlow Java artifacts are automatically distributed after each update in the code. To use them, you need +to add Sonatype OSS repository in your `pom.xml`, like the following + +```xml + + + tensorflow-snapshots + https://oss.sonatype.org/content/repositories/snapshots/ + + true + + + + + + + org.tensorflow + tensorflow-core-platform + 1.3.0-SNAPSHOT + + +``` +Or Gradle: +```groovy +repositories { + mavenCentral() + maven { + url = uri("https://oss.sonatype.org/content/repositories/snapshots") + } +} + +dependencies { + // Example of dependency, see section above for more options + implementation "org.tensorflow:tensorflow-core-platform:1.3.0-SNAPSHOT" +} +``` + +## TensorFlow native libraries + +TensorFlow-Java is built on top of the native TensorFlow library, and uses [JavaCPP](https://github.com/bytedeco/javacpp) +to call that library which in turn uses the Java Native Interface (JNI). In [Java 24 and newer](https://openjdk.org/jeps/472) +uses of JNI trigger a warning of the form: +``` +WARNING: A restricted method in java.lang.System has been called +WARNING: java.lang.System::loadLibrary has been called by org.bytedeco.javacpp.Loader in an unnamed module (file:/.../.m2/repository/org/bytedeco/javacpp/1.5.12/javacpp-1.5.12.jar) +WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module +WARNING: Restricted methods will be blocked in a future release unless native access is enabled +``` +This is expected, and adding the `--enable-native-access=ALL-UNNAMED` flag to enable JNI will suppress it. In a future +Java version this warning may be turned into an error and the flag will be required to use TensorFlow-Java. + +## TensorFlow Java Version Support + +This table shows the mapping between TensorFlow, TensorFlow Java and minimum supported Java versions. + +| TensorFlow Java Version | TensorFlow Version | Minimum Java Version | +|-------------------------|--------------------|----------------------| +| 0.2.0 | 2.3.1 | 8 | +| 0.3.0 | 2.4.1 | 8 | +| 0.3.1 | 2.4.1 | 8 | +| 0.3.2 | 2.4.1 | 8 | +| 0.3.3 | 2.4.1 | 8 | +| 0.4.0 | 2.7.0 | 8 | +| 0.4.1 | 2.7.1 | 8 | +| 0.4.2 | 2.7.4 | 8 | +| 0.5.0 | 2.10.1 | 11 | +| 1.0.0-rc.1 | 2.16.1 | 11 | +| 1.0.0-rc.2 | 2.16.2 | 11 | +| 1.0.0 | 2.16.2 | 11 | +| 1.1.0 | 2.18.0 | 11 | +| 1.2.0 | 2.21.0 | 11 | +| 1.3.0-SNAPSHOT | 2.21.0 | 11 | ## How to Contribute? -This repository is maintained by TensorFlow JVM Special Interest Group (SIG). You can easily join the group -by subscribing to the [jvm@tensorflow.org](https://groups.google.com/a/tensorflow.org/forum/#!forum/jvm) -mailing list, or you can simply send pull requests and raise issues to this repository. +Contributions are welcome, guidelines are located in [CONTRIBUTING.md](CONTRIBUTING.md). + +## Code and Usage Examples + +Please look at this repository: https://github.com/tensorflow/java-models diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 00000000000..4b943f2713d --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,177 @@ +# Releasing TensorFlow Java + +The +[TensorFlow Java API](https://github.com/tensorflow/java) is available on Maven Central +through artifacts uploaded to +[Maven Central](https://central.sonatype.com/). This +document describes the process of updating the release artifacts. It does _not_ describe how to use +the artifacts, for which the reader is referred to the +[TensorFlow for Java installation instructions](https://github.com/tensorflow/java/blob/master/README.md). + +## Background + +TensorFlow source (which is primarily in C++) is built using +[bazel](https://bazel.build) and not [maven](https://maven.apache.org/). TensorFlow Java +wraps over this native code and thus depends on platform (OS, architecture) specific native code. + +Hence, the process for building and uploading release artifacts is not a single `mvn deploy` command. + +## Release process overview + +The process of releasing TensorFlow Java is split in two major steps: +* Building and deploying the native artifacts +* Building and deploying all artifacts consolidated + +The first step is executed on different build servers, each responsible to build the native +artifact for a specific architecture and platform. The second step retrieves all native artifacts +built in the first step to consolidate them on a single server, and run a Maven `deploy` from there. + +It is important to note that any change pushed to a release branch (i.e. a branch prefixed +by `r`) will start a new release workflow. Therefore, these changes should always increment the +version number. + +### Pre-requisites + +- An account at [Maven Central](https://central.sonatype.com/), that has + permissions to update artifacts in the `org.tensorflow` group. If your + account does not have permissions, then you'll need to ask someone who does + to [file a ticket](mailto:central-support@sonatype.com) to add to the permissions. +- + Add your account username and token to the GitHub repository secrets as `CI_DEPLOY_USERNAME` and `CI_DEPLOY_PASSWORD` + respectively. + +- A [GPG signing key](http://central.sonatype.org/pages/apache-maven.html#gpg-signed-components) for signing the artifacts. + + The public key must be registered with a key server supported by Maven Central (e.g. https://keyserver.ubuntu.com/) and + the private key + passphrase should be stored in the GitHub repository secrets as `MAVEN_GPG_PRIVATE_KEY` and + `MAVEN_GPG_PASSPHRASE` respectively. See [GitHub documentation](https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-Apache-Maven) + for more details. + + +### Preparing a release + +#### Major or minor release + +1. Get a clean version of the source code by cloning the + [TensorFlow Java GitHub repository](https://github.com/tensorflow/java) + ``` + git clone https://github.com/tensorflow/java + ``` +2. Create a new branch for the release named `r.` + ``` + git checkout -b r1.0 + ``` +3. Update the version of the Maven artifacts to the full version of the release + ``` + mvn versions:set -DnewVersion=1.0.0 + ``` +4. Update the TensorFlow Java version to reflect the new release at the following locations: + - https://github.com/tensorflow/java/blob/master/docs/docs/install.md?plain=1#L69 + - https://github.com/tensorflow/java/blob/master/docs/docs/install.md?plain=1#L175 + - https://github.com/tensorflow/java/blob/master/README.md#using-maven-artifacts + - https://github.com/tensorflow/java/blob/master/README.md#tensorflow-java-version-support + +5. Commit the changes and push the new branch to the GitHub repository + ``` + git add . + git commit -m "Releasing 1.0.0" + git push --set-upstream origin r1.0 + ``` + +#### Patch release + +1. Get a clean version of the source code by cloning the + [TensorFlow Java GitHub repository](https://github.com/tensorflow/java) + ``` + git clone https://github.com/tensorflow/java + ``` +2. Switch to the release branch of the version to patch + ``` + git checkout r1.0 + ``` +3. Patch the code with your changes. For example, changes could be merged from another branch you + were working on or be applied directly to this branch when the required changes are minimal. + +4. Update the version of the Maven artifacts to the full version of the release + ``` + mvn versions:set -DnewVersion=1.0.1 + ``` +5. Update the TensorFlow Java version to reflect the new release at the following locations: + - https://github.com/tensorflow/java/blob/master/docs/docs/install.md?plain=1#L69 + - https://github.com/tensorflow/java/blob/master/docs/docs/install.md?plain=1#L175 + - https://github.com/tensorflow/java/blob/master/README.md#using-maven-artifacts + - https://github.com/tensorflow/java/blob/master/README.md#tensorflow-java-version-support + +6. Commit the changes and push the branch to the GitHub repository + ``` + git add . + git commit -m "Releasing 1.0.1" + git push + ``` + +### Performing the Release + +#### Release Workflow + +Pushing on a release branch will trigger a GitHub Actions workflow that builds the native artifacts for all supported architectures/platforms +and deploys them temporarily as GitHub Workflow artifacts. + +After this step, all native artifacts are retrieved and consolidated into the same target folder on single server in GitHub Action. +A final Maven `deploy` command on that server will take care of publishing all TensorFlow Java artifacts (include the native ones) to Maven +Central for staging. + +#### Publishing Approval + +After all artifacts have been published, you should log to [Maven Central](https://central.sonatype.com/), go to `Publish -> Deployments`, +and either drop the staging repository (if something is wrong) or publish it (if everything looks good). If you drop it, you will need to +retrigger the [release CI](#release-workflow). + +### Finishing a Release + +#### Release Notes + +Go to GitHub and automatically generate release notes for the new version by going to `Releases -> Draft a new release` +and selecting the tag for the release. You can edit the release notes as needed. + +#### Bumping Next Snapshot Version + +##### After a Major or Minor Release + +1. Checkout the master branch and merge back changes from the released branch + ``` + git checkout master + git merge r1.0 + ``` +2. In your local copy, checkout the master branch and increase the next snapshot version. + ``` + mvn versions:set -DnewVersion=1.3.0-SNAPSHOT + ``` +3. Update the TensorFlow Java version to reflect the new snapshot at the following locations: + - https://github.com/tensorflow/java/blob/master/docs/docs/install.md?plain=1#L112 + - https://github.com/tensorflow/java/blob/master/README.md#using-maven-artifacts + - https://github.com/tensorflow/java/blob/master/README.md#tensorflow-java-version-support + +4. Commit your changes and push the master branch to the GitHub repository + ``` + git add . + git commit -m "Increase version for next iteration" + git push + ``` + +##### After a Patch Release + +1. Checkout the master branch and merge back changes from the released branch + ``` + git checkout master + git merge r1.0 + ``` +2. Commit the changes and push the master branch to the GitHub repository + ``` + git add . + git commit -m "Merge release 1.0.1" + git push + ``` + +## References + +- [Maven Central guide](https://central.sonatype.org/register/central-portal/) for hosting releases. diff --git a/docs/_toc.yaml b/docs/_toc.yaml new file mode 100755 index 00000000000..93b4e5db2ae --- /dev/null +++ b/docs/_toc.yaml @@ -0,0 +1,18 @@ +# 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. +# +# ============================================================================== +toc: +- title: Install + path: /jvm/install diff --git a/docs/docs/assets/tensorflow.svg b/docs/docs/assets/tensorflow.svg new file mode 100644 index 00000000000..c0778626d66 --- /dev/null +++ b/docs/docs/assets/tensorflow.svg @@ -0,0 +1 @@ + diff --git a/docs/docs/index.md b/docs/docs/index.md new file mode 100755 index 00000000000..8db1ff0e089 --- /dev/null +++ b/docs/docs/index.md @@ -0,0 +1,42 @@ +# TensorFlow for Java + +TensorFlow Java can run on any JVM for building, training and running machine learning models. It comes with +a series of utilities and frameworks that help achieve most of the tasks common to data scientists +and developers working in this domain. Java and other JVM languages, such as Scala or Kotlin, are +frequently used in small-to-large enterprises all over the world, which makes TensorFlow a strategic +choice for adopting machine learning at a large scale. + +## The Repository + +In the early days, the Java language bindings for TensorFlow were hosted in the +[main TensorFlow repository](https://github.com/tensorflow/tensorflow) +and released only when a new version of the core library was ready to be distributed, which happens only +a few times a year. Now, all Java-related code has been moved to this repository so that it can evolve and +be released independently from official TensorFlow releases. In addition, most of the build tasks have been +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: + +### [tensorflow-core](https://github.com/tensorflow/java/tree/master/tensorflow-core) + * **Intended audience**: developers who wants to deploy a TensorFlow model on a JVM for inference. Also for projects + that provide their own APIs or frameworks on top of TensorFlow and just want a thin layer to access the TensorFlow runtime from the JVM. + * All artifacts that make up the core language bindings of TensorFlow for Java. + +### [tensorflow-framework](https://github.com/tensorflow/java/tree/master/tensorflow-framework) + * **Intended audience**: neural network developers. + * Primary API for building and training neural networks with TensorFlow. + +### [tensorflow-ndarray](https://github.com/tensorflow/java/tree/master/tensorflow-ndarray) + * **Intended audience**: any developer who needs a Java n-dimensional array implementation, whether or not they use it with TensorFlow. + * Generic utility library for n-dimensional data I/O operations. + * Used by TensorFlow but does not depend on TensorFlow. + +## Communication + +This repository is maintained by TensorFlow JVM Special Interest Group (SIG). You can easily contact the group +by posting to the [TensorFlow Forum](https://discuss.tensorflow.org), adding the `sig_jvm` tag, or by writing to us on +the [sig-jvm Gitter channel](https://gitter.im/tensorflow/sig-jvm). You can also simply send pull requests +and raise issues to this repository. + + + diff --git a/docs/docs/install.md b/docs/docs/install.md new file mode 100755 index 00000000000..564414316dd --- /dev/null +++ b/docs/docs/install.md @@ -0,0 +1,221 @@ +# Install TensorFlow Java + +[TensorFlow Java](https://github.com/tensorflow/java) can run on any JVM for +building, training and deploying machine learning models. It supports both CPU +and GPU execution, in graph or eager mode, and presents a rich API for using +TensorFlow in a JVM environment. Java and other JVM languages, like Scala and +Kotlin, are frequently used in large and small enterprises all over the world, +which makes TensorFlow Java a strategic choice for adopting machine learning at +a large scale. + +Note: Starting from version 1.0.0, the TensorFlow Java project follows the +[TensorFlow API stability guarantees](https://www.tensorflow.org/guide/versions#api_stability). +However, as these bindings are downstream of the TensorFlow C API, users should +be aware that stability is subject to the evolution of the upstream TensorFlow core. + +## Requirements + +TensorFlow Java runs on Java 11 and above, and supports out-of-the-box the +following platforms: + +* Ubuntu 20.04 or higher; 64-bit, x86 +* Ubuntu 22.04 or higher; 64-bit, arm +* macOS 14 or higher; 64-bit, arm + +Tensorflow Java 1.1 and earlier has binaries for: + +* Windows 10 or higher; 64-bit, x86 + +TensorFlow Java 1.0 series and earlier has binaries for: + +* macOS 12 or higher; 64-bit, x86 + +*Note: To use TensorFlow on Android, see [LiteRT](https://tensorflow.org/lite)* + +## Versions + +TensorFlow Java has its own release cycle, independent of the +[TensorFlow runtime](https://github.com/tensorflow/tensorflow). Consequently, +its version does not match the version of TensorFlow runtime it runs on. Consult +the TensorFlow Java +[versioning table](https://github.com/tensorflow/java/#tensorflow-version-support) +to list all versions available and their mapping with the TensorFlow runtime. + +## Artifacts + +There are +[several ways](https://github.com/tensorflow/java/#using-maven-artifacts) to add +TensorFlow Java to your project. The easiest one is to add a dependency on the +`tensorflow-core-platform` artifact, which includes both the TensorFlow Java +Core API and the native dependencies it requires to run on all supported +platforms. + +To include CUDA® support for Linux x86, select the `tensorflow-core-native:linux-x86_64-gpu` artifact. + +In addition, a separate dependency on the `tensorflow-framework` library can be +added to benefit from a rich set of utilities for TensorFlow-based machine +learning on the JVM. + +## Installing with Maven + +To include TensorFlow in your [Maven](http://maven.apache.org) application, add +a dependency on its [artifacts](#artifacts) to your project's `pom.xml` file. +For example, + +```xml + + org.tensorflow + tensorflow-core-platform + 1.2.0 + +``` + +### Reducing Number of Dependencies + +It is important to note that adding a dependency on a `tensorflow-core-platform` +artifact will import native libraries for all supported platforms, which can +significantly increase the size of your project. + +If you wish to target a subset of the available platforms then you can exclude +the unnecessary artifacts from the other platforms using the +[Maven Dependency Exclusion](https://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html#dependency-exclusions) +feature. + +Another way to select which platforms you want to include in your application is +to set JavaCPP system properties, in your Maven command line or in your +`pom.xml`. Please see JavaCPP +[documentation](https://github.com/bytedeco/javacpp-presets/wiki/Reducing-the-Number-of-Dependencies) +for more details. + +### Using Snapshots + +The latest TensorFlow Java development snapshots from the TensorFlow Java source +repository are available on the [OSS Sonatype](https://oss.sonatype.org) Nexus +repository. To depend on these artifacts, make sure to configure the OSS +snapshots repository in your `pom.xml`. + +```xml + + + tensorflow-snapshots + https://oss.sonatype.org/content/repositories/snapshots/ + + true + + + + + + + org.tensorflow + tensorflow-core-platform + 1.3.0-SNAPSHOT + + +``` + +## Installing with Gradle + +To include TensorFlow in your [Gradle](https://gradle.org) application, add a +dependency on its [artifacts](#artifacts) to your project's `build.gradle` file. +For example, + +```groovy +repositories { + mavenCentral() +} + +dependencies { + compile group: 'org.tensorflow', name: 'tensorflow-core-platform', version: '1.2.0' +} +``` + +### Reducing Number of Dependencies + +Excluding native artifacts from TensorFlow Java with Gradle is not as easy as +with Maven. We recommend that you use Gradle JavaCPP plugins to reduce this +number of dependencies. + +Please read at Gradle JavaCPP +[documentation](https://github.com/bytedeco/gradle-javacpp) for more details. + +## Installing from Sources + +To build TensorFlow Java from sources, and possibly customize it, please read +the following +[instructions](https://github.com/tensorflow/java/blob/master/CONTRIBUTING.md#building). + +*Note: Only official builds distributed by TensorFlow are supported by its +maintainers and custom builds should be used at the user's risk.* + +## Example Program + +This example shows how to build an Apache Maven project with TensorFlow. First, +add the TensorFlow dependency to the project's `pom.xml` file: + +```xml + + 4.0.0 + org.myorg + hellotensorflow + 1.0-SNAPSHOT + + + HelloTensorFlow + + 11 + 11 + + + + + + org.tensorflow + tensorflow-core-platform + 1.2.0 + + + +``` + +Create the source file `src/main/java/HelloTensorFlow.java`: + +```java +import org.tensorflow.ConcreteFunction; +import org.tensorflow.Signature; +import org.tensorflow.Tensor; +import org.tensorflow.TensorFlow; +import org.tensorflow.op.Ops; +import org.tensorflow.op.core.Placeholder; +import org.tensorflow.op.math.Add; +import org.tensorflow.types.TInt32; + +public class HelloTensorFlow { + + public static void main(String[] args) throws Exception { + System.out.println("Hello TensorFlow " + TensorFlow.version()); + + try (ConcreteFunction dbl = ConcreteFunction.create(HelloTensorFlow::dbl); + TInt32 x = TInt32.scalarOf(10); + TInt32 dblX = (TInt32)dbl.call(x)) { + System.out.println(x.getInt() + " doubled is " + dblX.getInt()); + } + } + + private static Signature dbl(Ops tf) { + Placeholder x = tf.placeholder(TInt32.class); + Add dblX = tf.math.add(x, x); + return Signature.builder().input("x", x).output("dbl", dblX).build(); + } +} +``` + +Compile and execute: + +
+mvn -q compile exec:java
+
+ +The command prints TensorFlow version and a simple calculation. + +Success! TensorFlow Java is configured. diff --git a/docs/docs/references.md b/docs/docs/references.md new file mode 100644 index 00000000000..524b23dc675 --- /dev/null +++ b/docs/docs/references.md @@ -0,0 +1,8 @@ +--- +hide: + - navigation + - toc + - title +--- +# + \ No newline at end of file diff --git a/docs/docs/stylesheets/extra.css b/docs/docs/stylesheets/extra.css new file mode 100644 index 00000000000..70aefe6843e --- /dev/null +++ b/docs/docs/stylesheets/extra.css @@ -0,0 +1,14 @@ +:root > * { + /*--md-primary-fg-color: #EE782F;*/ + /*--md-primary-fg-color--light: #455960;*/ + /*--md-primary-fg-color--dark: #90030C;*/ +} + +.md-typeset h1, .md-typeset h2 { + font-weight: 800; + letter-spacing: -.01em; +} + +.md-sidebar--primary { + display: none; +} \ No newline at end of file diff --git a/docs/legacy_tools/build_java_api_docs.py b/docs/legacy_tools/build_java_api_docs.py new file mode 100644 index 00000000000..77d3ba80f31 --- /dev/null +++ b/docs/legacy_tools/build_java_api_docs.py @@ -0,0 +1,132 @@ +# Lint as: python3 +# Copyright 2020 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== + +###################################################################################################################### +# IMPORTANT: Files in legacy_tools are no longer used to generate the TensorFlow-Java API docs as there are unfixed issues +# when using DocLava outside of the Google environment. We are keeping these for reference in case they are useful later. +###################################################################################################################### + + +"""Generate TensorFlow Java reference docs for TensorFlow.org.""" +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +import pathlib +import shutil +import tempfile +import io +import requests +import zipfile +from git import Repo + +from absl import app +from absl import flags + +from tensorflow_docs.api_generator import gen_java + +FLAGS = flags.FLAGS + +NDARRAY_VERSION = 'v1.0.0' +JAVACPP_VERSION = '1.5.11' +PROTOBUF_VERSION = 'v3.21.9' + +# __file__ is the path to this file +TOOLS_DIR = pathlib.Path(__file__).resolve().parent +DOCS_DIR = TOOLS_DIR.parent +REPO_ROOT = DOCS_DIR.parent +DOC_OUTPUT_DIR = DOCS_DIR.joinpath("output") + +SECTION_LABELS = { + 'org.tensorflow': 'Core', + 'org.tensorflow.ndarray': 'NdArray', + 'org.tensorflow.framework': 'Framework', +} + +# These flags are required by infrastructure, not all of them are used. +flags.DEFINE_string('output_dir', f"{DOC_OUTPUT_DIR}", + ("Use this branch as the root version and don't" + ' create in version directory')) + +flags.DEFINE_string('site_path', 'api_docs/', + 'Path prefix in the _toc.yaml') + +flags.DEFINE_string('code_url_prefix', None, + '[UNUSED] The url prefix for links to code.') + +flags.DEFINE_bool( + 'search_hints', True, + '[UNUSED] Include metadata search hints in the generated files') + + +def checkout_repo(repo_url: str, target_dir_name: str, version: str): + local_repo_path = f"{REPO_ROOT}/{target_dir_name}" + if not pathlib.Path(local_repo_path).exists(): + local_repo = Repo.clone_from(repo_url, local_repo_path) + else: + local_repo = Repo(local_repo_path) + local_repo.remotes['origin'].fetch() + local_repo.git.checkout(version) + + +def overlay(from_root, to_root): + for from_path in pathlib.Path(from_root).rglob('*'): + relpath = from_path.relative_to(from_root) + to_path = to_root/relpath + if from_path.is_file(): + assert not to_path.exists() + shutil.copyfile(from_path, to_path) + else: + to_path.mkdir(exist_ok=True) + + +def main(unused_argv): + checkout_repo('https://github.com/tensorflow/java-ndarray', 'ndarray', NDARRAY_VERSION) + checkout_repo('https://github.com/bytedeco/javacpp', 'javacpp', JAVACPP_VERSION) + response = requests.get('https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/3.21.9/protobuf-java-3.21.9-sources.jar') + with zipfile.ZipFile(io.BytesIO(response.content)) as z: + z.extractall(f"{REPO_ROOT}/protobuf") + response = requests.get('https://repo1.maven.org/maven2/org/osgi/osgi.annotation/8.1.0/osgi.annotation-8.1.0-sources.jar') + with zipfile.ZipFile(io.BytesIO(response.content)) as z: + z.extractall(f"{REPO_ROOT}/osgi") + + merged_source = pathlib.Path(tempfile.mkdtemp()) + (merged_source / 'java/org').mkdir(parents=True) + shutil.copytree(REPO_ROOT/'tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/', merged_source/'java/org/tensorflow') + overlay(REPO_ROOT/'tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow', merged_source/'java/org/tensorflow') + overlay(REPO_ROOT/'tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow', merged_source/'java/org/tensorflow') + overlay(REPO_ROOT/'tensorflow-core/tensorflow-core-native/src/gen/java/org/tensorflow/', merged_source/'java/org/tensorflow/') + overlay(REPO_ROOT/'tensorflow-core/tensorflow-core-native/src/main/java/org/tensorflow/', merged_source/'java/org/tensorflow/') + shutil.copytree(REPO_ROOT/'tensorflow-framework/src/main/java/org/tensorflow/framework', merged_source/'java/org/tensorflow/framework') + shutil.copytree(REPO_ROOT/'ndarray/ndarray/src/main/java/org/tensorflow/ndarray', merged_source/'java/org/tensorflow/ndarray') + shutil.copytree(REPO_ROOT/'javacpp/src/main/java/org/bytedeco', merged_source/'java/org/bytedeco') + shutil.copytree(REPO_ROOT/'protobuf/com/', merged_source/'java/com') + shutil.copytree(REPO_ROOT/'osgi/org/osgi', merged_source/'java/org/osgi') + + gen_java.gen_java_docs( + package='org.tensorflow', + source_path=merged_source / 'java', + output_dir=pathlib.Path(FLAGS.output_dir), + site_path=pathlib.Path(FLAGS.site_path), + section_labels=SECTION_LABELS, + # Uncomment for local testing: + script_path=pathlib.Path(TOOLS_DIR, 'run-javadoc-for-tf-local.sh'), + ) + + +if __name__ == '__main__': + flags.mark_flags_as_required(['output_dir']) + app.run(main) diff --git a/docs/legacy_tools/requirements.txt b/docs/legacy_tools/requirements.txt new file mode 100644 index 00000000000..4435ca4d4a9 --- /dev/null +++ b/docs/legacy_tools/requirements.txt @@ -0,0 +1,8 @@ +###################################################################################################################### +# IMPORTANT: Files in legacy_tools are no longer used to generate the TensorFlow-Java API docs as there are unfixed issues +# when using DocLava outside of the Google environment. We are keeping these for reference in case they are useful later. +###################################################################################################################### + +GitPython +requests +tensorflow-docs \ No newline at end of file diff --git a/docs/legacy_tools/run-javadoc-for-tf-local.sh b/docs/legacy_tools/run-javadoc-for-tf-local.sh new file mode 100644 index 00000000000..97d59ddfd6e --- /dev/null +++ b/docs/legacy_tools/run-javadoc-for-tf-local.sh @@ -0,0 +1,104 @@ +#!/bin/bash + +###################################################################################################################### +# IMPORTANT: Files in legacy_tools are no longer used to generate the TensorFlow-Java API docs as there are unfixed issues +# when using DocLava outside of the Google environment. We are keeping these for reference in case they are useful later. +###################################################################################################################### + +set -ex + +export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home # Or change to any JDK 11 home path + +# https://android.googlesource.com/platform/external/doclava/ +# There's a debian package: +# https://packages.debian.org/unstable/doclava-aosp +# Install with: +# +# $ sudo apt install doclava-aosp #v 6.0.1+r55-1+build1 +# +# https://unix.stackexchange.com/questions/594841/how-do-i-assign-a-value-to-a-bash-variable-iff-that-variable-is-null-unassigned +DOCLAVA_JAR=${DOCLAVA_JAR:-'tools/lib/doclava.jar'} # Build lib locally + + +# Install java clear silver templates with: +# +# $ sudo apt install libjsilver-aosp-java #v 6.0.1+r55-1+build1 +JSILVER_JAR=${JSILVER_JAR:-'tools/lib/jsilver.jar'} # Build lib locally + + +######### DELETE OUTPUT_DIR ################# + +# Empty the output directory in case a class has been deleted +rm -rf "${OUTPUT_DIR:?}"/* +############ RUN DOCLAVA ################### + +# $FEDERATED_DOCS is a space-separated string of url,file pairs. +read -a api_pairs <<< "${FEDERATED_DOCS}" +FEDERATED_PARAMS="" +for i in "${!api_pairs[@]}"; do + api_pair_str="${api_pairs[$i]}" # "url,api.txt" + read -a api_pair <<< "${api_pair_str//,/ }" + # Using the index as the API "name", build the federation params. Note that + # using 0 as an API name will evaluate to false and cause rendering bugs, + # so we preface with "api_". + FEDERATED_PARAMS+=" -federate api_${i} ${api_pair[0]}" + FEDERATED_PARAMS+=" -federationapi api_${i} ${api_pair[1]}" +done + +# To install javadoc, for example, use +# +# sudo apt install openjdk-11-jdk +# +# doclava doesn't work with openjdk-13 +# ``` +# javadoc: error - Class com.google.doclava.Doclava is not a valid doclet. +# Note: As of JDK 13, the com.sun.javadoc API is no longer supported. +# ``` +# It's used here: https://android.googlesource.com/platform/external/doclava/+/refs/heads/master/src/com/google/doclava/Doclava.java + +# Each package in $PACKAGE needs to prefaced with -subpackages, so do that. +SUBPACKAGES="" +read -r -a packages <<< "${PACKAGE}" +for pkg in "${packages[@]}"; do + SUBPACKAGES+=" -subpackages ${pkg}" +done +( # Capture the return code. it may be non-zero for minor errors. + /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/bin/javadoc \ + -sourcepath "${SOURCE_PATH}" \ + -docletpath "${DOCLAVA_JAR}:${JSILVER_JAR}" \ + -doclet com.google.doclava.Doclava \ + -toroot "${SITE_PATH}"/ \ + -yaml _toc.yaml \ + -templatedir "${TEMPLATES}" \ + -public \ + -d "${OUTPUT_DIR}" \ + ${FEDERATED_PARAMS} \ + ${SUBPACKAGES} +) + + +mv "${OUTPUT_DIR}"/reference/* "${OUTPUT_DIR}" + +################################################################### +################### START OF POST-PROCESSING ###################### +################################################################### +rm "${OUTPUT_DIR}/navtree_data.js" || true +rm "${OUTPUT_DIR}/hierarchy.html" || true + +find ${OUTPUT_DIR} -name "*.html" | xargs sed -i '' "s|${SITE_PATH}/reference|${SITE_PATH}|g" +find ${OUTPUT_DIR} -name "*.yaml" | xargs sed -i '' "s|${SITE_PATH}/reference|${SITE_PATH}|g" +find ${OUTPUT_DIR} -name "*.html" | xargs sed -i '' "s|a href=\"reference/org/tensorflow|a href=\"${SITE_PATH}/org/tensorflow|g" +find ${OUTPUT_DIR} -name "*.html" | xargs sed -i '' "s|a href=\"reference/com/google|a href=\"${SITE_PATH}/com/google|g" + +JAVA_LANG=https://docs.oracle.com/javase/8/docs/api +find ${OUTPUT_DIR} -name "*.html" | xargs sed -i '' "s|a href=\"reference/java/lang|a href=\"${JAVA_LANG}/java/lang|g" + +find ${OUTPUT_DIR} -name "*.html" | xargs sed -i '' 's|
|
|g'
+
+rm ${OUTPUT_DIR}/timestamp.js || true
+rm ${OUTPUT_DIR}/lists.js || true
+rm ${OUTPUT_DIR}/index.html || true
+
+cp ${TEMPLATES}/screen.css ${OUTPUT_DIR}/
+
+
diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml
new file mode 100644
index 00000000000..60d03a5f643
--- /dev/null
+++ b/docs/mkdocs.yml
@@ -0,0 +1,49 @@
+site_name: ''
+site_url: https://tensorflow.org
+repo_url: https://github.com/tensorflow/java
+site_description: Documentation of TensorFlow Java API and tools.
+copyright: "© TensorFlow Authors 2026"
+
+theme:
+  name: material
+  logo: assets/tensorflow.svg
+  features:
+    - navigation.indexes
+    - navigation.instant
+    - navigation.sections
+    - navigation.tabs
+    - navigation.tabs.sticky
+    - toc.follow
+  palette:
+    # Palette toggle for automatic mode
+    - media: "(prefers-color-scheme)"
+      toggle:
+        icon: material/brightness-auto
+        name: Switch to light mode
+    # Palette toggle for light mode
+    - media: "(prefers-color-scheme: light)"
+      scheme: default
+      primary: white
+      accent: orange
+      toggle:
+        icon: material/brightness-7
+        name: Switch to dark mode
+    # Palette toggle for dark mode
+    - media: "(prefers-color-scheme: dark)"
+      scheme: slate
+      primary: black
+      accent: orange
+      toggle:
+        icon: material/brightness-4
+        name: Switch to system preference
+
+extra_css:
+  - stylesheets/extra.css
+
+nav:
+  - Home:
+      - index.md
+  - Install:
+      - install.md
+  - API Reference:
+      - references.md
diff --git a/pom.xml b/pom.xml
index e26bb73311a..53e088b8c2e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,11 +1,13 @@
-
+
 
   4.0.0
 
   org.tensorflow
   tensorflow-java
-  0.1.0-SNAPSHOT
+  1.3.0-SNAPSHOT
   pom
 
   TensorFlow Java Parent
@@ -17,99 +19,523 @@
   
     
       The Apache Software License, Version 2.0
-      http://www.apache.org/licenses/LICENSE-2.0.txt
+      https://www.apache.org/licenses/LICENSE-2.0.txt
       repo
     
   
 
   
-    https://github.com/tensorflow/tensorflow.git
-    git@github.com:tensorflow/tensorflow.git
-    scm:git:https://github.com/tensorflow/tensorflow.git
+    https://github.com/tensorflow/java.git
+    scm:git@github.com:tensorflow/java.git
+    scm:git:https://github.com/tensorflow/java.git
   
 
   
-    tensorflow-tools
+    tensorflow-ndarray
     tensorflow-core
-    
-    
+    tensorflow-framework
   
 
   
-    1.8
-    1.8
-    4.12
-    1.21
+    ${os.name}-${os.arch}
+
+    UTF8
+    11
+    11
+    11
+    5.10.0
+    1.37
+    2.7
+    2.25.0
+    true
+    true
+    true
+    2.46.1
   
 
+  
+    
+      central-snapshots
+      Maven Central Snapshots
+      https://central.sonatype.com/repository/maven-snapshots/
+      
+        false
+      
+      
+        true
+      
+    
+  
+
+  
+    
+      central-snapshots
+      Maven Central Plugin Snapshots
+      https://central.sonatype.com/repository/maven-snapshots/
+      
+        false
+      
+      
+        true
+      
+    
+  
+
+  
+    
+      central
+      https://central.sonatype.com/repository/maven-snapshots
+    
+    
+      central
+      https://ossrh-staging-api.central.sonatype.com/service/local/staging/deployByRepositoryId/${stagingRepositoryId}/
+    
+  
+
   
     
       
-        junit
-        junit
+        org.junit.jupiter
+        junit-jupiter-api
+        ${junit.version}
+        test
+      
+      
+        org.junit.jupiter
+        junit-jupiter-engine
         ${junit.version}
+        test
       
-	  
-	    org.openjdk.jmh
-	    jmh-core
-	    ${jmh.version}
-  	    test
-	  
-	  
-	    org.openjdk.jmh
-	    jmh-generator-annprocess
-	    ${jmh.version}
+      
+        org.openjdk.jmh
+        jmh-core
+        ${jmh.version}
         test
-	  
+      
+      
+        org.openjdk.jmh
+        jmh-generator-annprocess
+        ${jmh.version}
+        test
+      
     
   
 
-  
   
+    
+    
+      dev
+      
+        false
+      
+    
+
+    
+    
+      deploying
+      
+        false
+        false
+      
+    
+
+    
+    
+      releasing
+      
+        false
+      
+      
+        
+          
+            maven-javadoc-plugin
+            3.12.0
+            
+              ./docs/overview.md
+              
+              Copyright 2015, 2026 The TensorFlow Authors. All Rights Reserved.
+              
+                -Xmaxerrs
+                65536
+                -Xmaxwarns
+                65536
+              
+              none
+              false
+              256m
+              2048m
+              
+                https://protobuf.dev/reference/java/api-docs
+                https://bytedeco.org/javacpp/apidocs
+              
+              true
+            
+            
+              
+                javadoc-site
+                
+                  javadoc
+                
+              
+              
+                attach-javadocs
+                
+                  jar
+                
+              
+            
+          
+        
+      
+    
+
+    
+      jdk17
+      
+        17
+        17
+        17
+      
+    
+
+    
+    
+      lint
+      
+        
+        
+          lint.skip
+          !true
+        
+      
+      
+        
+          
+            org.apache.maven.plugins
+            maven-compiler-plugin
+            3.11.0
+            
+              true
+              
+                 
+                -Xlint:all
+                -XDcompilePolicy=simple
+                
+                -J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
+                -J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
+
+                
+                -J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
+                -J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
+                -J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
+                -J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
+                -J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
+                -J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
+                -J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
+                -J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
+              
+              
+                
+                  com.google.errorprone
+                  error_prone_core
+                  ${errorprone.version}
+                
+              
+            
+          
+        
+      
+    
+
+    
+    
+      apply-format
+      
+        
+          
+            com.diffplug.spotless
+            spotless-maven-plugin
+            ${spotless.version}
+
+            
+              
+                
+                spotless-apply
+                initialize
+                
+                  apply
+                
+              
+            
+          
+        
+      
+    
+
+    
+    
+      check-format
+      
+        
+          
+            com.diffplug.spotless
+            spotless-maven-plugin
+            ${spotless.version}
+
+            
+              
+                
+                spotless-check
+                initialize
+                
+                  check
+                
+              
+            
+          
+        
+      
+    
+
+    
+      linuxos
+      
+        linux
+      
+      
+        linux
+        linux
+      
+    
+    
+      linux-x86_64
+      
+        
+          linux
+          amd64
+        
+        
+          !javacpp.platform.extension
+        
+      
+    
+    
+      linux-x86_64-gpu
+      
+        
+          linux
+          amd64
+        
+        
+          javacpp.platform.extension
+          -gpu
+        
+      
+    
+    
+      linux-arm64
+      
+        
+          linux
+          aarch64
+        
+        
+          !javacpp.platform.extension
+        
+      
+    
     
-      ossrh
-      
-        
-        
-          ossrh
-          https://oss.sonatype.org/content/repositories/snapshots
-        
-        
-          ossrh
-          https://oss.sonatype.org/service/local/staging/deploy/maven2/
-        
-      
-    
-    
-      bintray
-      
-        
-        
-          bintray
-          https://api.bintray.com/maven/google/tensorflow/tensorflow/;publish=0
-        
-      
+      macosx
+      
+        mac os x
+      
+      
+        darwin
+        macosx
+      
+    
+    
+      macosx-x86_64
+      
+        
+          mac os x
+          x86_64
+        
+      
+    
+    
+      macosx-arm64
+      
+        
+          mac os x
+          aarch64
+        
+      
+    
+    
+      windowsos
+      
+        windows
+      
+      
+        windows
+        windows
+      
+    
+    
+      windows-x86_64
+      
+        
+          windows
+          x86_64
+        
+      
+    
+    
+      arm
+      
+        arm
+      
+      
+        armhf
+      
+    
+    
+      aarch64
+      
+        aarch64
+      
+      
+        arm64
+      
+    
+    
+      armv8
+      
+        armv8
+      
+      
+        arm64
+      
+    
+    
+      amd64
+      
+        amd64
+      
+      
+        x86_64
+      
+    
+    
+      x86-64
+      
+        x86-64
+      
+      
+        x86_64
+      
+    
+
+    
+      linux
+      
+        
+          unix
+          Linux
+        
+      
+      
+        linux
+      
+    
+    
+      darwin
+      
+        
+          unix
+          Mac OS X
+        
+      
+      
+        darwin
+      
+    
+    
+      windows
+      
+        
+          windows
+        
+      
+      
+        windows
+      
     
   
 
   
   
     
-      TensorFlowers
+      SIG JVM
       TensorFlow
-      http://www.tensorflow.org
+      https://www.tensorflow.org
     
   
 
   
     
-      
-      
+        
+      
+      
+        org.apache.maven.plugins
+        maven-enforcer-plugin
+        3.4.1
+        
+          
+            enforce
+            
+              
+                
+                
+                  3.6
+                
+              
+            
+            
+              enforce
+            
+          
+        
+      
+      
         org.apache.maven.plugins
         maven-gpg-plugin
-        1.5
+        3.2.8
         
           
             sign-artifacts
@@ -119,8 +545,118 @@
             
           
         
-      
+        
+          bc
+        
+      
+      
+        maven-source-plugin
+        3.3.0
+        
+          
+            attach-sources
+            
+              jar-no-fork
+            
+          
+        
+      
+      
+        maven-javadoc-plugin
+        3.12.0
+      
+          ./docs/overview.md
+          
+          Copyright 2015, 2026 The TensorFlow Authors. All Rights Reserved.
+          
+              -Xmaxerrs
+              65536
+              -Xmaxwarns
+              65536
+          
+          false
+          256m
+          2048m
+          
+              https://protobuf.dev/reference/java/api-docs
+              https://bytedeco.org/javacpp/apidocs
+          
+      
+        
+            
+                javadoc-site
+                
+                    javadoc
+                
+            
+          
+            attach-javadocs
+            
+              jar
+            
+          
+        
+      
+      
+        org.codehaus.mojo
+        versions-maven-plugin
+        ${versions-plugin.version}
+        
+          false
+          true
+          true
+        
+      
+      
+        com.diffplug.spotless
+        spotless-maven-plugin
+        ${spotless.version}
+        
+          origin/master
+          
+          
+            
+              1.20.0
+            
+            
+          
+        
+      
+      
+        org.sonatype.central
+        central-publishing-maven-plugin
+      
     
+
+    
+      
+        
+          org.apache.maven.plugins
+          maven-jar-plugin
+          3.3.0
+        
+        
+          org.apache.maven.plugins
+          maven-surefire-plugin
+          3.1.2
+          
+            
+              **/*Test.java
+            
+            false
+          
+        
+        
+          org.sonatype.central
+          central-publishing-maven-plugin
+          0.11.0
+          true
+          
+            central
+          
+        
+      
+    
   
 
 
diff --git a/tensorflow-core/pom.xml b/tensorflow-core/pom.xml
index ef5568bcadb..16fbb636058 100644
--- a/tensorflow-core/pom.xml
+++ b/tensorflow-core/pom.xml
@@ -22,7 +22,7 @@
   
     org.tensorflow
     tensorflow-java
-    0.1.0-SNAPSHOT
+    1.3.0-SNAPSHOT
   
   tensorflow-core
   pom
@@ -31,744 +31,47 @@
   Parent POM of TensorFlow core artifacts
 
   
+    tensorflow-core-native
     tensorflow-core-generator
     tensorflow-core-api
-    tensorflow-core-platform${javacpp.platform.extension}
   
 
   
-    ${os.adjusted.name}-${os.arch}
-    false       
-    false     
-    false 
+    
+    4.31.1
+
+    ${javacpp.platform}${javacpp.platform.extension}
     
     ${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.2
-    0.21.2-${javacpp.version}
+    linux-armhf
+    linux-arm64
+    linux-x86_64
+    macosx-arm64
+    macosx-x86_64
+    windows-x86_64
+    linux-armhf${javacpp.platform.extension}
+    linux-arm64${javacpp.platform.extension}
+    linux-x86_64${javacpp.platform.extension}
+    macosx-arm64${javacpp.platform.extension}
+    macosx-x86_64${javacpp.platform.extension}
+    windows-x86_64${javacpp.platform.extension}
+    1.5.12
   
 
   
     
-      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.extension}
-      
-    
-
-    
-      javacpp.platform.linux-arm64-true
-      
-        
-          javacpp.platform.linux-arm64
-        
-      
-      
-        linux-arm64${javacpp.platform.extension}
-      
-    
-
-    
-      javacpp.platform.linux-ppc64le-true
-      
-        
-          javacpp.platform.linux-ppc64le
-        
-      
-      
-        linux-ppc64le${javacpp.platform.extension}
-      
-    
-
-    
-      javacpp.platform.linux-x86-true
-      
-        
-          javacpp.platform.linux-x86
-        
-      
-      
-        linux-x86${javacpp.platform.extension}
-      
-    
-
-    
-      javacpp.platform.linux-x86_64-true
-      
-        
-          javacpp.platform.linux-x86_64
-        
-      
-      
-        linux-x86_64${javacpp.platform.extension}
-      
-    
-
-    
-      javacpp.platform.macosx-x86_64-true
-      
-        
-          javacpp.platform.macosx-x86_64
-        
-      
-      
-        macosx-x86_64${javacpp.platform.extension}
-      
-    
-
-    
-      javacpp.platform.windows-x86-true
-      
-        
-          javacpp.platform.windows-x86
-        
-      
-      
-        windows-x86${javacpp.platform.extension}
-      
-    
-
-    
-      javacpp.platform.windows-x86_64-true
-      
-        
-          javacpp.platform.windows-x86_64
-        
-      
-      
-        windows-x86_64${javacpp.platform.extension}
-      
-    
-
-    
-      javacpp.platform.custom-linux-arm
-      
-        
-          javacpp.platform.host
-        
-        linuxarm
-      
-      
-        linux-armhf${javacpp.platform.extension}
-      
-    
-
-    
-      javacpp.platform.custom-linux-armhf
-      
-        
-          javacpp.platform.host
-        
-        linuxarmhf
-      
-      
-        linux-armhf${javacpp.platform.extension}
-      
-    
-
-    
-      javacpp.platform.custom-linux-aarch64
-      
-        
-          javacpp.platform.host
-        
-        linuxaarch64
-      
-      
-        linux-arm64${javacpp.platform.extension}
-      
-    
-
-    
-      javacpp.platform.custom-linux-armv8
-      
-        
-          javacpp.platform.host
-        
-        linuxarmv8
-      
-      
-        linux-arm64${javacpp.platform.extension}
-      
-    
-
-    
-      javacpp.platform.custom-linux-arm64
-      
-        
-          javacpp.platform.host
-        
-        linuxarm64
-      
-      
-        linux-arm64${javacpp.platform.extension}
-      
-    
-
-    
-      javacpp.platform.custom-linux-ppc64le
-      
-        
-          javacpp.platform.host
-        
-        linuxppc64le
-      
-      
-        linux-ppc64le${javacpp.platform.extension}
-      
-    
-
-    
-      javacpp.platform.custom-linux-amd64
-      
-        
-          javacpp.platform.host
-        
-        linuxamd64
-      
-      
-        linux-x86_64${javacpp.platform.extension}
-      
-    
-
-    
-      javacpp.platform.custom-linux-x86-64
-      
-        
-          javacpp.platform.host
-        
-        linuxx86-64
-      
-      
-        linux-x86_64${javacpp.platform.extension}
-      
-    
-
-    
-      javacpp.platform.custom-linux-x86_64
-      
-        
-          javacpp.platform.host
-        
-        linuxx86_64
-      
-      
-        linux-x86_64${javacpp.platform.extension}
-      
-    
-
-    
-      javacpp.platform.custom-macosx-amd64
-      
-        
-          javacpp.platform.host
-        
-        mac os xamd64
-      
-      
-        macosx-x86_64${javacpp.platform.extension}
-      
-    
-
-    
-      javacpp.platform.custom-macosx-x86-64
-      
-        
-          javacpp.platform.host
-        
-        mac os xx86-64
-      
-      
-        macosx-x86_64${javacpp.platform.extension}
-      
-    
-
-    
-      javacpp.platform.custom-macosx-x86_64
-      
-        
-          javacpp.platform.host
-        
-        mac os xx86_64
-      
-      
-        macosx-x86_64${javacpp.platform.extension}
-      
-    
-
-    
-      javacpp.platform.custom-windows-amd64
-      
-        
-          javacpp.platform.host
-        
-        windowsamd64
-      
-      
-        windows-x86_64${javacpp.platform.extension}
-      
-    
-
-    
-      javacpp.platform.custom-windows-x86-64
-      
-        
-          javacpp.platform.host
-        
-        windowsx86-64
-      
-      
-        windows-x86_64${javacpp.platform.extension}
-      
-    
-
-    
-      javacpp.platform.custom-windows-x86_64
-      
-        
-          javacpp.platform.host
-        
-        windowsx86_64
-      
-      
-        windows-x86_64${javacpp.platform.extension}
-      
-    
-
-    
-    
-      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
-      
+      
+      deploying
+      
+        tensorflow-core-platform
+      
     
   
-
 
-
diff --git a/tensorflow-core/tensorflow-core-api/.bazelrc b/tensorflow-core/tensorflow-core-api/.bazelrc
deleted file mode 100644
index 4b673d3fcfb..00000000000
--- a/tensorflow-core/tensorflow-core-api/.bazelrc
+++ /dev/null
@@ -1,172 +0,0 @@
-# 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
deleted file mode 100644
index 5fb3d1b53d0..00000000000
--- a/tensorflow-core/tensorflow-core-api/BUILD
+++ /dev/null
@@ -1,59 +0,0 @@
-load("@org_tensorflow//tensorflow:tensorflow.bzl", "tf_copts", "tf_cc_binary")
-load(":tensorflow-java.bzl", "tf_java_op_gen_srcjar")
-
-tf_java_op_gen_srcjar(
-    name = "java_op_gen_sources",
-    api_def_srcs = [
-        "@org_tensorflow//tensorflow/core/api_def:base_api_def",
-        ":java_api_def",
-    ],
-    base_package = "org.tensorflow.op",
-    gen_tool = ":java_op_gen_tool",
-)
-
-tf_cc_binary(
-    name = "java_op_gen_tool",
-    srcs = [
-        "src/bazel/op_generator/op_gen_main.cc",
-    ],
-    copts = tf_copts(),
-    linkopts = select({
-        "@org_tensorflow//tensorflow:windows": [],
-        "//conditions:default": ["-lm"],
-    }),
-    linkstatic = 1,
-    deps = [
-        ":java_op_gen_lib",
-        "@org_tensorflow//tensorflow/core:framework",
-        "@org_tensorflow//tensorflow/core:lib",
-        "@org_tensorflow//tensorflow/core:ops",
-    ],
-)
-
-cc_library(
-    name = "java_op_gen_lib",
-    srcs = [
-        "src/bazel/op_generator/op_generator.cc",
-        "src/bazel/op_generator/op_specs.cc",
-        "src/bazel/op_generator/source_writer.cc",
-    ],
-    hdrs = [
-        "src/bazel/op_generator/java_defs.h",
-        "src/bazel/op_generator/op_generator.h",
-        "src/bazel/op_generator/op_specs.h",
-        "src/bazel/op_generator/source_writer.h",
-    ],
-    copts = tf_copts(),
-    deps = [
-        "@org_tensorflow//tensorflow/core:framework",
-        "@org_tensorflow//tensorflow/core:lib",
-        "@org_tensorflow//tensorflow/core:op_gen_lib",
-        "@org_tensorflow//tensorflow/core:protos_all_cc",
-        "@com_googlesource_code_re2//:re2",
-    ],
-)
-
-filegroup(
-    name = "java_api_def",
-    srcs = glob(["src/bazel/api_def/*"])
-)
diff --git a/tensorflow-core/tensorflow-core-api/LICENSE b/tensorflow-core/tensorflow-core-api/LICENSE
deleted file mode 100644
index 69a5e5f0649..00000000000
--- a/tensorflow-core/tensorflow-core-api/LICENSE
+++ /dev/null
@@ -1,8062 +0,0 @@
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR third_party/icu/data/LICENSE
---------------------------------------------------------------------------------
-COPYRIGHT AND PERMISSION NOTICE (ICU 58 and later)
-
-Copyright © 1991-2018 Unicode, Inc. All rights reserved.
-Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of the Unicode data files and any associated documentation
-(the "Data Files") or Unicode software and any associated documentation
-(the "Software") to deal in the Data Files or Software
-without restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, and/or sell copies of
-the Data Files or Software, and to permit persons to whom the Data Files
-or Software are furnished to do so, provided that either
-(a) this copyright and permission notice appear with all copies
-of the Data Files or Software, or
-(b) this copyright and permission notice appear in associated
-Documentation.
-
-THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
-ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT OF THIRD PARTY RIGHTS.
-IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
-NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
-DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THE DATA FILES OR SOFTWARE.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale,
-use or other dealings in these Data Files or Software without prior
-written authorization of the copyright holder.
-
----------------------
-
-Third-Party Software Licenses
-
-This section contains third-party software notices and/or additional
-terms for licensed third-party software components included within ICU
-libraries.
-
-1. ICU License - ICU 1.8.1 to ICU 57.1
-
-COPYRIGHT AND PERMISSION NOTICE
-
-Copyright (c) 1995-2016 International Business Machines Corporation and others
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above
-copyright notice(s) and this permission notice appear in all copies of
-the Software and that both the above copyright notice(s) and this
-permission notice appear in supporting documentation.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
-SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
-CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in this Software without prior written authorization
-of the copyright holder.
-
-All trademarks and registered trademarks mentioned herein are the
-property of their respective owners.
-
-2. Chinese/Japanese Word Break Dictionary Data (cjdict.txt)
-
- #     The Google Chrome software developed by Google is licensed under
- # the BSD license. Other software included in this distribution is
- # provided under other licenses, as set forth below.
- #
- #  The BSD License
- #  http://opensource.org/licenses/bsd-license.php
- #  Copyright (C) 2006-2008, Google Inc.
- #
- #  All rights reserved.
- #
- #  Redistribution and use in source and binary forms, with or without
- # modification, are permitted provided that the following conditions are met:
- #
- #  Redistributions of source code must retain the above copyright notice,
- # this list of conditions and the following disclaimer.
- #  Redistributions in binary form must reproduce the above
- # copyright notice, this list of conditions and the following
- # disclaimer in the documentation and/or other materials provided with
- # the distribution.
- #  Neither the name of  Google Inc. nor the names of its
- # contributors may be used to endorse or promote products derived from
- # this software without specific prior written permission.
- #
- #
- #  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- #
- #
- #  The word list in cjdict.txt are generated by combining three word lists
- # listed below with further processing for compound word breaking. The
- # frequency is generated with an iterative training against Google web
- # corpora.
- #
- #  * Libtabe (Chinese)
- #    - https://sourceforge.net/project/?group_id=1519
- #    - Its license terms and conditions are shown below.
- #
- #  * IPADIC (Japanese)
- #    - http://chasen.aist-nara.ac.jp/chasen/distribution.html
- #    - Its license terms and conditions are shown below.
- #
- #  ---------COPYING.libtabe ---- BEGIN--------------------
- #
- #  /*
- #   * Copyright (c) 1999 TaBE Project.
- #   * Copyright (c) 1999 Pai-Hsiang Hsiao.
- #   * All rights reserved.
- #   *
- #   * Redistribution and use in source and binary forms, with or without
- #   * modification, are permitted provided that the following conditions
- #   * are met:
- #   *
- #   * . Redistributions of source code must retain the above copyright
- #   *   notice, this list of conditions and the following disclaimer.
- #   * . Redistributions in binary form must reproduce the above copyright
- #   *   notice, this list of conditions and the following disclaimer in
- #   *   the documentation and/or other materials provided with the
- #   *   distribution.
- #   * . Neither the name of the TaBE Project nor the names of its
- #   *   contributors may be used to endorse or promote products derived
- #   *   from this software without specific prior written permission.
- #   *
- #   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- #   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- #   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- #   * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- #   * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- #   * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- #   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- #   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- #   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- #   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- #   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- #   * OF THE POSSIBILITY OF SUCH DAMAGE.
- #   */
- #
- #  /*
- #   * Copyright (c) 1999 Computer Systems and Communication Lab,
- #   *                    Institute of Information Science, Academia
- #       *                    Sinica. All rights reserved.
- #   *
- #   * Redistribution and use in source and binary forms, with or without
- #   * modification, are permitted provided that the following conditions
- #   * are met:
- #   *
- #   * . Redistributions of source code must retain the above copyright
- #   *   notice, this list of conditions and the following disclaimer.
- #   * . Redistributions in binary form must reproduce the above copyright
- #   *   notice, this list of conditions and the following disclaimer in
- #   *   the documentation and/or other materials provided with the
- #   *   distribution.
- #   * . Neither the name of the Computer Systems and Communication Lab
- #   *   nor the names of its contributors may be used to endorse or
- #   *   promote products derived from this software without specific
- #   *   prior written permission.
- #   *
- #   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- #   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- #   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- #   * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- #   * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- #   * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- #   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- #   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- #   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- #   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- #   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- #   * OF THE POSSIBILITY OF SUCH DAMAGE.
- #   */
- #
- #  Copyright 1996 Chih-Hao Tsai @ Beckman Institute,
- #      University of Illinois
- #  c-tsai4@uiuc.edu  http://casper.beckman.uiuc.edu/~c-tsai4
- #
- #  ---------------COPYING.libtabe-----END--------------------------------
- #
- #
- #  ---------------COPYING.ipadic-----BEGIN-------------------------------
- #
- #  Copyright 2000, 2001, 2002, 2003 Nara Institute of Science
- #  and Technology.  All Rights Reserved.
- #
- #  Use, reproduction, and distribution of this software is permitted.
- #  Any copy of this software, whether in its original form or modified,
- #  must include both the above copyright notice and the following
- #  paragraphs.
- #
- #  Nara Institute of Science and Technology (NAIST),
- #  the copyright holders, disclaims all warranties with regard to this
- #  software, including all implied warranties of merchantability and
- #  fitness, in no event shall NAIST be liable for
- #  any special, indirect or consequential damages or any damages
- #  whatsoever resulting from loss of use, data or profits, whether in an
- #  action of contract, negligence or other tortuous action, arising out
- #  of or in connection with the use or performance of this software.
- #
- #  A large portion of the dictionary entries
- #  originate from ICOT Free Software.  The following conditions for ICOT
- #  Free Software applies to the current dictionary as well.
- #
- #  Each User may also freely distribute the Program, whether in its
- #  original form or modified, to any third party or parties, PROVIDED
- #  that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear
- #  on, or be attached to, the Program, which is distributed substantially
- #  in the same form as set out herein and that such intended
- #  distribution, if actually made, will neither violate or otherwise
- #  contravene any of the laws and regulations of the countries having
- #  jurisdiction over the User or the intended distribution itself.
- #
- #  NO WARRANTY
- #
- #  The program was produced on an experimental basis in the course of the
- #  research and development conducted during the project and is provided
- #  to users as so produced on an experimental basis.  Accordingly, the
- #  program is provided without any warranty whatsoever, whether express,
- #  implied, statutory or otherwise.  The term "warranty" used herein
- #  includes, but is not limited to, any warranty of the quality,
- #  performance, merchantability and fitness for a particular purpose of
- #  the program and the nonexistence of any infringement or violation of
- #  any right of any third party.
- #
- #  Each user of the program will agree and understand, and be deemed to
- #  have agreed and understood, that there is no warranty whatsoever for
- #  the program and, accordingly, the entire risk arising from or
- #  otherwise connected with the program is assumed by the user.
- #
- #  Therefore, neither ICOT, the copyright holder, or any other
- #  organization that participated in or was otherwise related to the
- #  development of the program and their respective officials, directors,
- #  officers and other employees shall be held liable for any and all
- #  damages, including, without limitation, general, special, incidental
- #  and consequential damages, arising out of or otherwise in connection
- #  with the use or inability to use the program or any product, material
- #  or result produced or otherwise obtained by using the program,
- #  regardless of whether they have been advised of, or otherwise had
- #  knowledge of, the possibility of such damages at any time during the
- #  project or thereafter.  Each user will be deemed to have agreed to the
- #  foregoing by his or her commencement of use of the program.  The term
- #  "use" as used herein includes, but is not limited to, the use,
- #  modification, copying and distribution of the program and the
- #  production of secondary products from the program.
- #
- #  In the case where the program, whether in its original form or
- #  modified, was distributed or delivered to or received by a user from
- #  any person, organization or entity other than ICOT, unless it makes or
- #  grants independently of ICOT any specific warranty to the user in
- #  writing, such person, organization or entity, will also be exempted
- #  from and not be held liable to the user for any such damages as noted
- #  above as far as the program is concerned.
- #
- #  ---------------COPYING.ipadic-----END----------------------------------
-
-3. Lao Word Break Dictionary Data (laodict.txt)
-
- #  Copyright (c) 2013 International Business Machines Corporation
- #  and others. All Rights Reserved.
- #
- # Project: http://code.google.com/p/lao-dictionary/
- # Dictionary: http://lao-dictionary.googlecode.com/git/Lao-Dictionary.txt
- # License: http://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt
- #              (copied below)
- #
- #  This file is derived from the above dictionary, with slight
- #  modifications.
- #  ----------------------------------------------------------------------
- #  Copyright (C) 2013 Brian Eugene Wilson, Robert Martin Campbell.
- #  All rights reserved.
- #
- #  Redistribution and use in source and binary forms, with or without
- #  modification,
- #  are permitted provided that the following conditions are met:
- #
- #
- # Redistributions of source code must retain the above copyright notice, this
- #  list of conditions and the following disclaimer. Redistributions in
- #  binary form must reproduce the above copyright notice, this list of
- #  conditions and the following disclaimer in the documentation and/or
- #  other materials provided with the distribution.
- #
- #
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- # OF THE POSSIBILITY OF SUCH DAMAGE.
- #  --------------------------------------------------------------------------
-
-4. Burmese Word Break Dictionary Data (burmesedict.txt)
-
- #  Copyright (c) 2014 International Business Machines Corporation
- #  and others. All Rights Reserved.
- #
- #  This list is part of a project hosted at:
- #    github.com/kanyawtech/myanmar-karen-word-lists
- #
- #  --------------------------------------------------------------------------
- #  Copyright (c) 2013, LeRoy Benjamin Sharon
- #  All rights reserved.
- #
- #  Redistribution and use in source and binary forms, with or without
- #  modification, are permitted provided that the following conditions
- #  are met: Redistributions of source code must retain the above
- #  copyright notice, this list of conditions and the following
- #  disclaimer.  Redistributions in binary form must reproduce the
- #  above copyright notice, this list of conditions and the following
- #  disclaimer in the documentation and/or other materials provided
- #  with the distribution.
- #
- #    Neither the name Myanmar Karen Word Lists, nor the names of its
- #    contributors may be used to endorse or promote products derived
- #    from this software without specific prior written permission.
- #
- #  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- #  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- #  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- #  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- #  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
- #  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- #  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- #  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- #  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- #  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- #  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- #  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- #  SUCH DAMAGE.
- #  --------------------------------------------------------------------------
-
-5. Time Zone Database
-
-  ICU uses the public domain data and code derived from Time Zone
-Database for its time zone support. The ownership of the TZ database
-is explained in BCP 175: Procedure for Maintaining the Time Zone
-Database section 7.
-
- # 7.  Database Ownership
- #
- #    The TZ database itself is not an IETF Contribution or an IETF
- #    document.  Rather it is a pre-existing and regularly updated work
- #    that is in the public domain, and is intended to remain in the
- #    public domain.  Therefore, BCPs 78 [RFC5378] and 79 [RFC3979] do
- #    not apply to the TZ Database or contributions that individuals make
- #    to it.  Should any claims be made and substantiated against the TZ
- #    Database, the organization that is providing the IANA
- #    Considerations defined in this RFC, under the memorandum of
- #    understanding with the IETF, currently ICANN, may act in accordance
- #    with all competent court orders.  No ownership claims will be made
- #    by ICANN or the IETF Trust on the database or the code.  Any person
- #    making a contribution to the database or code waives all rights to
- #    future claims in that contribution or in the TZ Database.
-
-6. Google double-conversion
-
-Copyright 2006-2011, the V8 project authors. All rights reserved.
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of Google Inc. nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------------
-END LICENSE FOR third_party/icu/data/LICENSE
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR third_party/hadoop/LICENSE.txt
---------------------------------------------------------------------------------
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-
-
-APACHE HADOOP SUBCOMPONENTS:
-
-The Apache Hadoop project contains subcomponents with separate copyright
-notices and license terms. Your use of the source code for the these
-subcomponents is subject to the terms and conditions of the following
-licenses. 
-
-For the org.apache.hadoop.util.bloom.* classes:
-
-/**
- *
- * Copyright (c) 2005, European Commission project OneLab under contract
- * 034819 (http://www.one-lab.org)
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or 
- * without modification, are permitted provided that the following 
- * conditions are met:
- *  - Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *  - Redistributions in binary form must reproduce the above copyright 
- *    notice, this list of conditions and the following disclaimer in 
- *    the documentation and/or other materials provided with the distribution.
- *  - Neither the name of the University Catholique de Louvain - UCL
- *    nor the names of its contributors may be used to endorse or 
- *    promote products derived from this software without specific prior 
- *    written permission.
- *    
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-For portions of the native implementation of slicing-by-8 CRC calculation
-in src/main/native/src/org/apache/hadoop/util:
-
-/**
- *   Copyright 2008,2009,2010 Massachusetts Institute of Technology.
- *   All rights reserved. Use of this source code is governed by a
- *   BSD-style license that can be found in the LICENSE file.
- */
-
- For src/main/native/src/org/apache/hadoop/io/compress/lz4/lz4.c:
-
-/*
-   LZ4 - Fast LZ compression algorithm
-   Copyright (C) 2011, Yann Collet.
-   BSD License
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are
-   met:
-  
-       * Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above
-   copyright notice, this list of conditions and the following disclaimer
-   in the documentation and/or other materials provided with the
-   distribution.
-  
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
---------------------------------------------------------------------------------
-END LICENSE FOR third_party/hadoop/LICENSE.txt
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR third_party/eigen3/LICENSE
---------------------------------------------------------------------------------
-Eigen is primarily MPL2 licensed. See COPYING.MPL2 and these links:
-  http://www.mozilla.org/MPL/2.0/
-  http://www.mozilla.org/MPL/2.0/FAQ.html
-
-Some files contain third-party code under BSD or LGPL licenses, whence
-the other COPYING.* files here.
-
-All the LGPL code is either LGPL 2.1-only, or LGPL 2.1-or-later.
-For this reason, the COPYING.LGPL file contains the LGPL 2.1 text.
-
-If you want to guarantee that the Eigen code that you are #including
-is licensed under the MPL2 and possibly more permissive licenses (like
-BSD), #define this preprocessor symbol: EIGEN_MPL2_ONLY 
-For example, with most compilers, you could add this to your project
-      CXXFLAGS: -DEIGEN_MPL2_ONLY 
-This will cause a compilation error to be generated if you #include
-any code that is LGPL licensed.
-
-----------------------------------------------------------------------
-Following applies to:
-./test/mapstaticmethods.cpp
-./test/schur_real.cpp
-./test/prec_inverse_4x4.cpp
-./test/smallvectors.cpp
-./test/redux.cpp
-./test/special_numbers.cpp
-./test/adjoint.cpp
-./test/resize.cpp
-./test/mixingtypes.cpp
-./test/product_trmv.cpp
-./test/sparse_solvers.cpp
-./test/cholesky.cpp
-./test/geo_quaternion.cpp
-./test/miscmatrices.cpp
-./test/stddeque.cpp
-./test/integer_types.cpp
-./test/product_large.cpp
-./test/eigensolver_generic.cpp
-./test/householder.cpp
-./test/geo_orthomethods.cpp
-./test/array_for_matrix.cpp
-./test/sparseLM.cpp
-./test/upperbidiagonalization.cpp
-./test/nomalloc.cpp
-./test/packetmath.cpp
-./test/jacobisvd.cpp
-./test/geo_transformations.cpp
-./test/swap.cpp
-./test/eigensolver_selfadjoint.cpp
-./test/inverse.cpp
-./test/product_selfadjoint.cpp
-./test/product_trsolve.cpp
-./test/product_extra.cpp
-./test/sparse_solver.h
-./test/mapstride.cpp
-./test/mapped_matrix.cpp
-./test/geo_eulerangles.cpp
-./test/eigen2support.cpp
-./test/denseLM.cpp
-./test/stdvector.cpp
-./test/nesting_ops.cpp
-./test/sparse_permutations.cpp
-./test/zerosized.cpp
-./test/exceptions.cpp
-./test/vectorwiseop.cpp
-./test/cwiseop.cpp
-./test/basicstuff.cpp
-./test/product_trmm.cpp
-./test/linearstructure.cpp
-./test/sparse_product.cpp
-./test/stdvector_overload.cpp
-./test/stable_norm.cpp
-./test/umeyama.cpp
-./test/unalignedcount.cpp
-./test/triangular.cpp
-./test/product_mmtr.cpp
-./test/sparse_basic.cpp
-./test/sparse_vector.cpp
-./test/meta.cpp
-./test/real_qz.cpp
-./test/ref.cpp
-./test/eigensolver_complex.cpp
-./test/cholmod_support.cpp
-./test/conjugate_gradient.cpp
-./test/sparse.h
-./test/simplicial_cholesky.cpp
-./test/bicgstab.cpp
-./test/dynalloc.cpp
-./test/product_notemporary.cpp
-./test/geo_hyperplane.cpp
-./test/lu.cpp
-./test/qr.cpp
-./test/hessenberg.cpp
-./test/sizeof.cpp
-./test/main.h
-./test/selfadjoint.cpp
-./test/permutationmatrices.cpp
-./test/superlu_support.cpp
-./test/qtvector.cpp
-./test/geo_homogeneous.cpp
-./test/determinant.cpp
-./test/array_reverse.cpp
-./test/unalignedassert.cpp
-./test/stdlist.cpp
-./test/product_symm.cpp
-./test/corners.cpp
-./test/dontalign.cpp
-./test/visitor.cpp
-./test/geo_alignedbox.cpp
-./test/diagonalmatrices.cpp
-./test/product_small.cpp
-./test/eigensolver_generalized_real.cpp
-./test/umfpack_support.cpp
-./test/first_aligned.cpp
-./test/qr_fullpivoting.cpp
-./test/array_replicate.cpp
-./test/geo_parametrizedline.cpp
-./test/eigen2/eigen2_unalignedassert.cpp
-./test/eigen2/eigen2_prec_inverse_4x4.cpp
-./test/eigen2/eigen2_alignedbox.cpp
-./test/eigen2/eigen2_sparse_product.cpp
-./test/eigen2/eigen2_meta.cpp
-./test/eigen2/eigen2_nomalloc.cpp
-./test/eigen2/eigen2_visitor.cpp
-./test/eigen2/eigen2_packetmath.cpp
-./test/eigen2/eigen2_svd.cpp
-./test/eigen2/eigen2_mixingtypes.cpp
-./test/eigen2/eigen2_qr.cpp
-./test/eigen2/eigen2_cwiseop.cpp
-./test/eigen2/eigen2_geometry_with_eigen2_prefix.cpp
-./test/eigen2/eigen2_smallvectors.cpp
-./test/eigen2/eigen2_commainitializer.cpp
-./test/eigen2/eigen2_sparse_solvers.cpp
-./test/eigen2/eigen2_hyperplane.cpp
-./test/eigen2/eigen2_eigensolver.cpp
-./test/eigen2/eigen2_linearstructure.cpp
-./test/eigen2/eigen2_sizeof.cpp
-./test/eigen2/eigen2_parametrizedline.cpp
-./test/eigen2/eigen2_lu.cpp
-./test/eigen2/eigen2_adjoint.cpp
-./test/eigen2/eigen2_geometry.cpp
-./test/eigen2/eigen2_stdvector.cpp
-./test/eigen2/eigen2_newstdvector.cpp
-./test/eigen2/eigen2_submatrices.cpp
-./test/eigen2/sparse.h
-./test/eigen2/eigen2_swap.cpp
-./test/eigen2/eigen2_triangular.cpp
-./test/eigen2/eigen2_basicstuff.cpp
-./test/eigen2/gsl_helper.h
-./test/eigen2/eigen2_dynalloc.cpp
-./test/eigen2/eigen2_array.cpp
-./test/eigen2/eigen2_map.cpp
-./test/eigen2/main.h
-./test/eigen2/eigen2_miscmatrices.cpp
-./test/eigen2/eigen2_product_large.cpp
-./test/eigen2/eigen2_first_aligned.cpp
-./test/eigen2/eigen2_cholesky.cpp
-./test/eigen2/eigen2_determinant.cpp
-./test/eigen2/eigen2_sum.cpp
-./test/eigen2/eigen2_inverse.cpp
-./test/eigen2/eigen2_regression.cpp
-./test/eigen2/eigen2_product_small.cpp
-./test/eigen2/eigen2_qtvector.cpp
-./test/eigen2/eigen2_sparse_vector.cpp
-./test/eigen2/product.h
-./test/eigen2/eigen2_sparse_basic.cpp
-./test/eigen2/eigen2_bug_132.cpp
-./test/array.cpp
-./test/product_syrk.cpp
-./test/commainitializer.cpp
-./test/conservative_resize.cpp
-./test/qr_colpivoting.cpp
-./test/nullary.cpp
-./test/bandmatrix.cpp
-./test/pastix_support.cpp
-./test/product.h
-./test/block.cpp
-./test/vectorization_logic.cpp
-./test/jacobi.cpp
-./test/diagonal.cpp
-./test/schur_complex.cpp
-./test/sizeoverflow.cpp
-./bench/BenchTimer.h
-./bench/benchFFT.cpp
-./bench/eig33.cpp
-./bench/spbench/spbenchsolver.h
-./bench/spbench/spbenchstyle.h
-./lapack/complex_double.cpp
-./lapack/cholesky.cpp
-./lapack/lapack_common.h
-./lapack/eigenvalues.cpp
-./lapack/single.cpp
-./lapack/lu.cpp
-./lapack/complex_single.cpp
-./lapack/double.cpp
-./demos/mix_eigen_and_c/binary_library.cpp
-./demos/mix_eigen_and_c/binary_library.h
-./demos/mix_eigen_and_c/example.c
-./demos/mandelbrot/mandelbrot.cpp
-./demos/mandelbrot/mandelbrot.h
-./demos/opengl/icosphere.cpp
-./demos/opengl/icosphere.h
-./demos/opengl/camera.cpp
-./demos/opengl/quaternion_demo.h
-./demos/opengl/camera.h
-./demos/opengl/trackball.h
-./demos/opengl/gpuhelper.h
-./demos/opengl/trackball.cpp
-./demos/opengl/gpuhelper.cpp
-./demos/opengl/quaternion_demo.cpp
-./debug/gdb/printers.py
-./unsupported/test/minres.cpp
-./unsupported/test/openglsupport.cpp
-./unsupported/test/jacobisvd.cpp
-./unsupported/test/dgmres.cpp
-./unsupported/test/matrix_square_root.cpp
-./unsupported/test/bdcsvd.cpp
-./unsupported/test/matrix_exponential.cpp
-./unsupported/test/forward_adolc.cpp
-./unsupported/test/polynomialsolver.cpp
-./unsupported/test/matrix_function.cpp
-./unsupported/test/sparse_extra.cpp
-./unsupported/test/matrix_functions.h
-./unsupported/test/svd_common.h
-./unsupported/test/FFTW.cpp
-./unsupported/test/alignedvector3.cpp
-./unsupported/test/autodiff.cpp
-./unsupported/test/gmres.cpp
-./unsupported/test/BVH.cpp
-./unsupported/test/levenberg_marquardt.cpp
-./unsupported/test/matrix_power.cpp
-./unsupported/test/kronecker_product.cpp
-./unsupported/test/splines.cpp
-./unsupported/test/polynomialutils.cpp
-./unsupported/bench/bench_svd.cpp
-./unsupported/Eigen/IterativeSolvers
-./unsupported/Eigen/src/IterativeSolvers/DGMRES.h
-./unsupported/Eigen/src/IterativeSolvers/IncompleteLU.h
-./unsupported/Eigen/src/IterativeSolvers/GMRES.h
-./unsupported/Eigen/src/IterativeSolvers/IncompleteCholesky.h
-./unsupported/Eigen/src/IterativeSolvers/Scaling.h
-./unsupported/Eigen/src/IterativeSolvers/MINRES.h
-./unsupported/Eigen/src/SparseExtra/RandomSetter.h
-./unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h
-./unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h
-./unsupported/Eigen/src/SparseExtra/MarketIO.h
-./unsupported/Eigen/src/SparseExtra/BlockOfDynamicSparseMatrix.h
-./unsupported/Eigen/src/KroneckerProduct/KroneckerTensorProduct.h
-./unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h
-./unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h
-./unsupported/Eigen/src/BVH/BVAlgorithms.h
-./unsupported/Eigen/src/BVH/KdBVH.h
-./unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
-./unsupported/Eigen/src/AutoDiff/AutoDiffJacobian.h
-./unsupported/Eigen/src/AutoDiff/AutoDiffVector.h
-./unsupported/Eigen/src/Splines/Spline.h
-./unsupported/Eigen/src/Splines/SplineFitting.h
-./unsupported/Eigen/src/Splines/SplineFwd.h
-./unsupported/Eigen/src/SVD/JacobiSVD.h
-./unsupported/Eigen/src/SVD/BDCSVD.h
-./unsupported/Eigen/src/SVD/SVDBase.h
-./unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h
-./unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h
-./unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h
-./unsupported/Eigen/src/MatrixFunctions/StemFunction.h
-./unsupported/Eigen/src/MatrixFunctions/MatrixPower.h
-./unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
-./unsupported/Eigen/src/MatrixFunctions/MatrixFunctionAtomic.h
-./unsupported/Eigen/src/MoreVectorization/MathFunctions.h
-./unsupported/Eigen/src/LevenbergMarquardt/LevenbergMarquardt.h
-./unsupported/Eigen/src/FFT/ei_fftw_impl.h
-./unsupported/Eigen/src/FFT/ei_kissfft_impl.h
-./unsupported/Eigen/src/Polynomials/PolynomialSolver.h
-./unsupported/Eigen/src/Polynomials/Companion.h
-./unsupported/Eigen/src/Polynomials/PolynomialUtils.h
-./unsupported/Eigen/src/NumericalDiff/NumericalDiff.h
-./unsupported/Eigen/src/Skyline/SkylineProduct.h
-./unsupported/Eigen/src/Skyline/SkylineMatrixBase.h
-./unsupported/Eigen/src/Skyline/SkylineStorage.h
-./unsupported/Eigen/src/Skyline/SkylineUtil.h
-./unsupported/Eigen/src/Skyline/SkylineInplaceLU.h
-./unsupported/Eigen/src/Skyline/SkylineMatrix.h
-./unsupported/Eigen/SparseExtra
-./unsupported/Eigen/AdolcForward
-./unsupported/Eigen/KroneckerProduct
-./unsupported/Eigen/NonLinearOptimization
-./unsupported/Eigen/BVH
-./unsupported/Eigen/OpenGLSupport
-./unsupported/Eigen/ArpackSupport
-./unsupported/Eigen/AutoDiff
-./unsupported/Eigen/Splines
-./unsupported/Eigen/MPRealSupport
-./unsupported/Eigen/MatrixFunctions
-./unsupported/Eigen/MoreVectorization
-./unsupported/Eigen/LevenbergMarquardt
-./unsupported/Eigen/AlignedVector3
-./unsupported/Eigen/FFT
-./unsupported/Eigen/Polynomials
-./unsupported/Eigen/NumericalDiff
-./unsupported/Eigen/Skyline
-./COPYING.README
-./COPYING.README
-./LICENSE
-./LICENSE
-./LICENSE
-./Eigen/Eigen2Support
-./Eigen/src/Eigen2Support/VectorBlock.h
-./Eigen/src/Eigen2Support/Cwise.h
-./Eigen/src/Eigen2Support/Minor.h
-./Eigen/src/Eigen2Support/Lazy.h
-./Eigen/src/Eigen2Support/Memory.h
-./Eigen/src/Eigen2Support/MathFunctions.h
-./Eigen/src/Eigen2Support/Geometry/AlignedBox.h
-./Eigen/src/Eigen2Support/Geometry/Hyperplane.h
-./Eigen/src/Eigen2Support/Geometry/Quaternion.h
-./Eigen/src/Eigen2Support/Geometry/Rotation2D.h
-./Eigen/src/Eigen2Support/Geometry/ParametrizedLine.h
-./Eigen/src/Eigen2Support/Geometry/RotationBase.h
-./Eigen/src/Eigen2Support/Geometry/Translation.h
-./Eigen/src/Eigen2Support/Geometry/Scaling.h
-./Eigen/src/Eigen2Support/Geometry/AngleAxis.h
-./Eigen/src/Eigen2Support/Geometry/Transform.h
-./Eigen/src/Eigen2Support/TriangularSolver.h
-./Eigen/src/Eigen2Support/LU.h
-./Eigen/src/Eigen2Support/QR.h
-./Eigen/src/Eigen2Support/SVD.h
-./Eigen/src/Eigen2Support/Meta.h
-./Eigen/src/Eigen2Support/Block.h
-./Eigen/src/Eigen2Support/Macros.h
-./Eigen/src/Eigen2Support/LeastSquares.h
-./Eigen/src/Eigen2Support/CwiseOperators.h
-./Eigen/src/Jacobi/Jacobi.h
-./Eigen/src/misc/Kernel.h
-./Eigen/src/misc/SparseSolve.h
-./Eigen/src/misc/Solve.h
-./Eigen/src/misc/Image.h
-./Eigen/src/SparseCore/SparseColEtree.h
-./Eigen/src/SparseCore/SparseTranspose.h
-./Eigen/src/SparseCore/SparseUtil.h
-./Eigen/src/SparseCore/SparseCwiseBinaryOp.h
-./Eigen/src/SparseCore/SparseDiagonalProduct.h
-./Eigen/src/SparseCore/SparseProduct.h
-./Eigen/src/SparseCore/SparseDot.h
-./Eigen/src/SparseCore/SparseCwiseUnaryOp.h
-./Eigen/src/SparseCore/SparseSparseProductWithPruning.h
-./Eigen/src/SparseCore/SparseBlock.h
-./Eigen/src/SparseCore/SparseDenseProduct.h
-./Eigen/src/SparseCore/CompressedStorage.h
-./Eigen/src/SparseCore/SparseMatrixBase.h
-./Eigen/src/SparseCore/MappedSparseMatrix.h
-./Eigen/src/SparseCore/SparseTriangularView.h
-./Eigen/src/SparseCore/SparseView.h
-./Eigen/src/SparseCore/SparseFuzzy.h
-./Eigen/src/SparseCore/TriangularSolver.h
-./Eigen/src/SparseCore/SparseSelfAdjointView.h
-./Eigen/src/SparseCore/SparseMatrix.h
-./Eigen/src/SparseCore/SparseVector.h
-./Eigen/src/SparseCore/AmbiVector.h
-./Eigen/src/SparseCore/ConservativeSparseSparseProduct.h
-./Eigen/src/SparseCore/SparseRedux.h
-./Eigen/src/SparseCore/SparsePermutation.h
-./Eigen/src/Eigenvalues/RealSchur.h
-./Eigen/src/Eigenvalues/ComplexEigenSolver.h
-./Eigen/src/Eigenvalues/GeneralizedEigenSolver.h
-./Eigen/src/Eigenvalues/ComplexSchur.h
-./Eigen/src/Eigenvalues/RealQZ.h
-./Eigen/src/Eigenvalues/EigenSolver.h
-./Eigen/src/Eigenvalues/HessenbergDecomposition.h
-./Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h
-./Eigen/src/Eigenvalues/Tridiagonalization.h
-./Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h
-./Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h
-./Eigen/src/SuperLUSupport/SuperLUSupport.h
-./Eigen/src/StlSupport/StdDeque.h
-./Eigen/src/StlSupport/StdVector.h
-./Eigen/src/StlSupport/StdList.h
-./Eigen/src/StlSupport/details.h
-./Eigen/src/SparseQR/SparseQR.h
-./Eigen/src/LU/Inverse.h
-./Eigen/src/LU/arch/Inverse_SSE.h
-./Eigen/src/LU/Determinant.h
-./Eigen/src/LU/PartialPivLU.h
-./Eigen/src/LU/FullPivLU.h
-./Eigen/src/UmfPackSupport/UmfPackSupport.h
-./Eigen/src/OrderingMethods/Ordering.h
-./Eigen/src/OrderingMethods/Eigen_Colamd.h
-./Eigen/src/QR/HouseholderQR.h
-./Eigen/src/QR/ColPivHouseholderQR.h
-./Eigen/src/QR/FullPivHouseholderQR.h
-./Eigen/src/SVD/JacobiSVD.h
-./Eigen/src/SVD/UpperBidiagonalization.h
-./Eigen/src/Geometry/OrthoMethods.h
-./Eigen/src/Geometry/AlignedBox.h
-./Eigen/src/Geometry/Hyperplane.h
-./Eigen/src/Geometry/Quaternion.h
-./Eigen/src/Geometry/EulerAngles.h
-./Eigen/src/Geometry/Rotation2D.h
-./Eigen/src/Geometry/ParametrizedLine.h
-./Eigen/src/Geometry/RotationBase.h
-./Eigen/src/Geometry/arch/Geometry_SSE.h
-./Eigen/src/Geometry/Umeyama.h
-./Eigen/src/Geometry/Homogeneous.h
-./Eigen/src/Geometry/Translation.h
-./Eigen/src/Geometry/Scaling.h
-./Eigen/src/Geometry/AngleAxis.h
-./Eigen/src/Geometry/Transform.h
-./Eigen/src/plugins/BlockMethods.h
-./Eigen/src/plugins/CommonCwiseUnaryOps.h
-./Eigen/src/plugins/CommonCwiseBinaryOps.h
-./Eigen/src/plugins/MatrixCwiseUnaryOps.h
-./Eigen/src/plugins/MatrixCwiseBinaryOps.h
-./Eigen/src/Householder/Householder.h
-./Eigen/src/Householder/HouseholderSequence.h
-./Eigen/src/Householder/BlockHouseholder.h
-./Eigen/src/Core/VectorBlock.h
-./Eigen/src/Core/Matrix.h
-./Eigen/src/Core/Ref.h
-./Eigen/src/Core/SelfAdjointView.h
-./Eigen/src/Core/MathFunctions.h
-./Eigen/src/Core/GlobalFunctions.h
-./Eigen/src/Core/MapBase.h
-./Eigen/src/Core/EigenBase.h
-./Eigen/src/Core/GenericPacketMath.h
-./Eigen/src/Core/NestByValue.h
-./Eigen/src/Core/CwiseUnaryOp.h
-./Eigen/src/Core/SolveTriangular.h
-./Eigen/src/Core/Fuzzy.h
-./Eigen/src/Core/Visitor.h
-./Eigen/src/Core/Map.h
-./Eigen/src/Core/NoAlias.h
-./Eigen/src/Core/Diagonal.h
-./Eigen/src/Core/StableNorm.h
-./Eigen/src/Core/CoreIterators.h
-./Eigen/src/Core/products/Parallelizer.h
-./Eigen/src/Core/products/SelfadjointMatrixVector.h
-./Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h
-./Eigen/src/Core/products/TriangularSolverMatrix.h
-./Eigen/src/Core/products/GeneralMatrixMatrix.h
-./Eigen/src/Core/products/SelfadjointProduct.h
-./Eigen/src/Core/products/CoeffBasedProduct.h
-./Eigen/src/Core/products/TriangularMatrixVector.h
-./Eigen/src/Core/products/SelfadjointMatrixMatrix.h
-./Eigen/src/Core/products/TriangularSolverVector.h
-./Eigen/src/Core/products/SelfadjointRank2Update.h
-./Eigen/src/Core/products/GeneralBlockPanelKernel.h
-./Eigen/src/Core/products/GeneralMatrixVector.h
-./Eigen/src/Core/products/TriangularMatrixMatrix.h
-./Eigen/src/Core/Reverse.h
-./Eigen/src/Core/BooleanRedux.h
-./Eigen/src/Core/Replicate.h
-./Eigen/src/Core/arch/AltiVec/PacketMath.h
-./Eigen/src/Core/arch/AltiVec/Complex.h
-./Eigen/src/Core/arch/SSE/PacketMath.h
-./Eigen/src/Core/arch/SSE/Complex.h
-./Eigen/src/Core/arch/SSE/MathFunctions.h
-./Eigen/src/Core/arch/NEON/PacketMath.h
-./Eigen/src/Core/arch/NEON/Complex.h
-./Eigen/src/Core/arch/Default/Settings.h
-./Eigen/src/Core/CwiseUnaryView.h
-./Eigen/src/Core/Array.h
-./Eigen/src/Core/ArrayWrapper.h
-./Eigen/src/Core/Swap.h
-./Eigen/src/Core/Transpositions.h
-./Eigen/src/Core/Random.h
-./Eigen/src/Core/IO.h
-./Eigen/src/Core/SelfCwiseBinaryOp.h
-./Eigen/src/Core/VectorwiseOp.h
-./Eigen/src/Core/Select.h
-./Eigen/src/Core/ArrayBase.h
-./Eigen/src/Core/DenseCoeffsBase.h
-./Eigen/src/Core/DiagonalProduct.h
-./Eigen/src/Core/Assign.h
-./Eigen/src/Core/Redux.h
-./Eigen/src/Core/ForceAlignedAccess.h
-./Eigen/src/Core/BandMatrix.h
-./Eigen/src/Core/PlainObjectBase.h
-./Eigen/src/Core/DenseBase.h
-./Eigen/src/Core/Flagged.h
-./Eigen/src/Core/CwiseBinaryOp.h
-./Eigen/src/Core/ProductBase.h
-./Eigen/src/Core/TriangularMatrix.h
-./Eigen/src/Core/Transpose.h
-./Eigen/src/Core/DiagonalMatrix.h
-./Eigen/src/Core/Dot.h
-./Eigen/src/Core/Functors.h
-./Eigen/src/Core/PermutationMatrix.h
-./Eigen/src/Core/NumTraits.h
-./Eigen/src/Core/MatrixBase.h
-./Eigen/src/Core/DenseStorage.h
-./Eigen/src/Core/util/Memory.h
-./Eigen/src/Core/util/StaticAssert.h
-./Eigen/src/Core/util/BlasUtil.h
-./Eigen/src/Core/util/MatrixMapper.h
-./Eigen/src/Core/util/XprHelper.h
-./Eigen/src/Core/util/ForwardDeclarations.h
-./Eigen/src/Core/util/Meta.h
-./Eigen/src/Core/util/Macros.h
-./Eigen/src/Core/util/Constants.h
-./Eigen/src/Core/CwiseNullaryOp.h
-./Eigen/src/Core/Block.h
-./Eigen/src/Core/GeneralProduct.h
-./Eigen/src/Core/CommaInitializer.h
-./Eigen/src/Core/ReturnByValue.h
-./Eigen/src/Core/Stride.h
-./Eigen/src/SPQRSupport/SuiteSparseQRSupport.h
-./Eigen/src/SparseLU/SparseLU_column_dfs.h
-./Eigen/src/SparseLU/SparseLU_panel_dfs.h
-./Eigen/src/SparseLU/SparseLU_relax_snode.h
-./Eigen/src/SparseLU/SparseLU_panel_bmod.h
-./Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h
-./Eigen/src/SparseLU/SparseLU_Utils.h
-./Eigen/src/SparseLU/SparseLU_gemm_kernel.h
-./Eigen/src/SparseLU/SparseLU_kernel_bmod.h
-./Eigen/src/SparseLU/SparseLU_pivotL.h
-./Eigen/src/SparseLU/SparseLU_Memory.h
-./Eigen/src/SparseLU/SparseLU_heap_relax_snode.h
-./Eigen/src/SparseLU/SparseLUImpl.h
-./Eigen/src/SparseLU/SparseLU_copy_to_ucol.h
-./Eigen/src/SparseLU/SparseLU_Structs.h
-./Eigen/src/SparseLU/SparseLU.h
-./Eigen/src/SparseLU/SparseLU_column_bmod.h
-./Eigen/src/SparseLU/SparseLU_pruneL.h
-./Eigen/src/IterativeLinearSolvers/IncompleteLUT.h
-./Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h
-./Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h
-./Eigen/src/IterativeLinearSolvers/ConjugateGradient.h
-./Eigen/src/IterativeLinearSolvers/BiCGSTAB.h
-./Eigen/src/SparseCholesky/SimplicialCholesky.h
-./Eigen/src/Cholesky/LDLT.h
-./Eigen/src/Cholesky/LLT.h
-./Eigen/src/CholmodSupport/CholmodSupport.h
-./Eigen/src/PaStiXSupport/PaStiXSupport.h
-./Eigen/src/MetisSupport/MetisSupport.h
-./Eigen/StdVector
-./Eigen/Core
-./Eigen/SparseLU
-./Eigen/StdList
-./Eigen/StdDeque
-./Eigen/SparseCholesky
-./scripts/relicense.py
-./scripts/relicense.py
-./blas/BandTriangularSolver.h
-./blas/PackedTriangularMatrixVector.h
-./blas/complex_double.cpp
-./blas/level2_real_impl.h
-./blas/level1_cplx_impl.h
-./blas/level1_impl.h
-./blas/level1_real_impl.h
-./blas/level3_impl.h
-./blas/single.cpp
-./blas/level2_cplx_impl.h
-./blas/PackedSelfadjointProduct.h
-./blas/Rank2Update.h
-./blas/complex_single.cpp
-./blas/PackedTriangularSolverVector.h
-./blas/double.cpp
-./blas/common.h
-./blas/level2_impl.h
-./blas/GeneralRank1Update.h
-
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
-    means each individual or legal entity that creates, contributes to
-    the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
-    means the combination of the Contributions of others (if any) used
-    by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
-    means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
-    means Source Code Form to which the initial Contributor has attached
-    the notice in Exhibit A, the Executable Form of such Source Code
-    Form, and Modifications of such Source Code Form, in each case
-    including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
-    means
-
-    (a) that the initial Contributor has attached the notice described
-        in Exhibit B to the Covered Software; or
-
-    (b) that the Covered Software was made available under the terms of
-        version 1.1 or earlier of the License, but not also under the
-        terms of a Secondary License.
-
-1.6. "Executable Form"
-    means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
-    means a work that combines Covered Software with other material, in 
-    a separate file or files, that is not Covered Software.
-
-1.8. "License"
-    means this document.
-
-1.9. "Licensable"
-    means having the right to grant, to the maximum extent possible,
-    whether at the time of the initial grant or subsequently, any and
-    all of the rights conveyed by this License.
-
-1.10. "Modifications"
-    means any of the following:
-
-    (a) any file in Source Code Form that results from an addition to,
-        deletion from, or modification of the contents of Covered
-        Software; or
-
-    (b) any new file in Source Code Form that contains any Covered
-        Software.
-
-1.11. "Patent Claims" of a Contributor
-    means any patent claim(s), including without limitation, method,
-    process, and apparatus claims, in any patent Licensable by such
-    Contributor that would be infringed, but for the grant of the
-    License, by the making, using, selling, offering for sale, having
-    made, import, or transfer of either its Contributions or its
-    Contributor Version.
-
-1.12. "Secondary License"
-    means either the GNU General Public License, Version 2.0, the GNU
-    Lesser General Public License, Version 2.1, the GNU Affero General
-    Public License, Version 3.0, or any later versions of those
-    licenses.
-
-1.13. "Source Code Form"
-    means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
-    means an individual or a legal entity exercising rights under this
-    License. For legal entities, "You" includes any entity that
-    controls, is controlled by, or is under common control with You. For
-    purposes of this definition, "control" means (a) the power, direct
-    or indirect, to cause the direction or management of such entity,
-    whether by contract or otherwise, or (b) ownership of more than
-    fifty percent (50%) of the outstanding shares or beneficial
-    ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
-    Licensable by such Contributor to use, reproduce, make available,
-    modify, display, perform, distribute, and otherwise exploit its
-    Contributions, either on an unmodified basis, with Modifications, or
-    as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
-    for sale, have made, import, and otherwise transfer either its
-    Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
-    or
-
-(b) for infringements caused by: (i) Your and any other third party's
-    modifications of Covered Software, or (ii) the combination of its
-    Contributions with other software (except as part of its Contributor
-    Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
-    its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
-    Form, as described in Section 3.1, and You must inform recipients of
-    the Executable Form how they can obtain a copy of such Source Code
-    Form by reasonable means in a timely manner, at a charge no more
-    than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
-    License, or sublicense it under different terms, provided that the
-    license for the Executable Form does not attempt to limit or alter
-    the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-*                                                                      *
-*  6. Disclaimer of Warranty                                           *
-*  -------------------------                                           *
-*                                                                      *
-*  Covered Software is provided under this License on an "as is"       *
-*  basis, without warranty of any kind, either expressed, implied, or  *
-*  statutory, including, without limitation, warranties that the       *
-*  Covered Software is free of defects, merchantable, fit for a        *
-*  particular purpose or non-infringing. The entire risk as to the     *
-*  quality and performance of the Covered Software is with You.        *
-*  Should any Covered Software prove defective in any respect, You     *
-*  (not any Contributor) assume the cost of any necessary servicing,   *
-*  repair, or correction. This disclaimer of warranty constitutes an   *
-*  essential part of this License. No use of any Covered Software is   *
-*  authorized under this License except under this disclaimer.         *
-*                                                                      *
-************************************************************************
-
-************************************************************************
-*                                                                      *
-*  7. Limitation of Liability                                          *
-*  --------------------------                                          *
-*                                                                      *
-*  Under no circumstances and under no legal theory, whether tort      *
-*  (including negligence), contract, or otherwise, shall any           *
-*  Contributor, or anyone who distributes Covered Software as          *
-*  permitted above, be liable to You for any direct, indirect,         *
-*  special, incidental, or consequential damages of any character      *
-*  including, without limitation, damages for lost profits, loss of    *
-*  goodwill, work stoppage, computer failure or malfunction, or any    *
-*  and all other commercial damages or losses, even if such party      *
-*  shall have been informed of the possibility of such damages. This   *
-*  limitation of liability shall not apply to liability for death or   *
-*  personal injury resulting from such party's negligence to the       *
-*  extent applicable law prohibits such limitation. Some               *
-*  jurisdictions do not allow the exclusion or limitation of           *
-*  incidental or consequential damages, so this exclusion and          *
-*  limitation may not apply to You.                                    *
-*                                                                      *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
-  This Source Code Form is subject to the terms of the Mozilla Public
-  License, v. 2.0. If a copy of the MPL was not distributed with this
-  file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
-  This Source Code Form is "Incompatible With Secondary Licenses", as
-  defined by the Mozilla Public License, v. 2.0.
-
-----------------------------------------------------------------------
-Following applies to:
-./doc/UsingIntelMKL.dox
-./doc/UsingIntelMKL.dox
-./Eigen/src/Eigenvalues/ComplexSchur_MKL.h
-./Eigen/src/Eigenvalues/ComplexSchur_MKL.h
-./Eigen/src/Eigenvalues/SelfAdjointEigenSolver_MKL.h
-./Eigen/src/Eigenvalues/SelfAdjointEigenSolver_MKL.h
-./Eigen/src/Eigenvalues/RealSchur_MKL.h
-./Eigen/src/Eigenvalues/RealSchur_MKL.h
-./Eigen/src/LU/arch/Inverse_SSE.h
-./Eigen/src/LU/arch/Inverse_SSE.h
-./Eigen/src/LU/PartialPivLU_MKL.h
-./Eigen/src/LU/PartialPivLU_MKL.h
-./Eigen/src/QR/HouseholderQR_MKL.h
-./Eigen/src/QR/HouseholderQR_MKL.h
-./Eigen/src/QR/ColPivHouseholderQR_MKL.h
-./Eigen/src/QR/ColPivHouseholderQR_MKL.h
-./Eigen/src/SVD/JacobiSVD_MKL.h
-./Eigen/src/SVD/JacobiSVD_MKL.h
-./Eigen/src/PardisoSupport/PardisoSupport.h
-./Eigen/src/PardisoSupport/PardisoSupport.h
-./Eigen/src/Core/Assign_MKL.h
-./Eigen/src/Core/Assign_MKL.h
-./Eigen/src/Core/products/SelfadjointMatrixVector_MKL.h
-./Eigen/src/Core/products/SelfadjointMatrixVector_MKL.h
-./Eigen/src/Core/products/GeneralMatrixVector_MKL.h
-./Eigen/src/Core/products/GeneralMatrixVector_MKL.h
-./Eigen/src/Core/products/SelfadjointMatrixMatrix_MKL.h
-./Eigen/src/Core/products/SelfadjointMatrixMatrix_MKL.h
-./Eigen/src/Core/products/TriangularMatrixMatrix_MKL.h
-./Eigen/src/Core/products/TriangularMatrixMatrix_MKL.h
-./Eigen/src/Core/products/GeneralMatrixMatrix_MKL.h
-./Eigen/src/Core/products/GeneralMatrixMatrix_MKL.h
-./Eigen/src/Core/products/TriangularMatrixVector_MKL.h
-./Eigen/src/Core/products/TriangularMatrixVector_MKL.h
-./Eigen/src/Core/products/GeneralMatrixMatrixTriangular_MKL.h
-./Eigen/src/Core/products/GeneralMatrixMatrixTriangular_MKL.h
-./Eigen/src/Core/products/TriangularSolverMatrix_MKL.h
-./Eigen/src/Core/products/TriangularSolverMatrix_MKL.h
-./Eigen/src/Core/util/MKL_support.h
-./Eigen/src/Core/util/MKL_support.h
-./Eigen/src/Cholesky/LLT_MKL.h
-./Eigen/src/Cholesky/LLT_MKL.h
-
-/*
- Copyright (c) 2011, Intel Corporation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- * Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.  *
-   Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the
-   distribution.  * Neither the name of Intel Corporation nor the
-   names of its contributors may be used to endorse or promote
-   products derived from this software without specific prior written
-   permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-----------------------------------------------------------------------
-Following applies to:
-  everything under ./bench/btl
-
-                    GNU GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. 
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                            Preamble
-
-  The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-  The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works.  By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.  We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors.  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
-  To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights.  Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received.  You must make sure that they, too, receive
-or can get the source code.  And you must show them these terms so they
-know their rights.
-
-  Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-  For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software.  For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-  Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so.  This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software.  The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable.  Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products.  If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
-  Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary.  To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-                       TERMS AND CONDITIONS
-
-  0. Definitions.
-
-  "This License" refers to version 3 of the GNU General Public License.
-
-  "Copyright" also means copyright-like laws that apply to other kinds
-of works, such as semiconductor masks.
-
-  "The Program" refers to any copyrightable work licensed under this
-License.  Each licensee is addressed as "you".  "Licensees" and
-"recipients" may be individuals or organizations.
-
-  To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy.  The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
-  A "covered work" means either the unmodified Program or a work based
-on the Program.
-
-  To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy.  Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
-  To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies.  Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
-  An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License.  If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
-  1. Source Code.
-
-  The "source code" for a work means the preferred form of the work
-for making modifications to it.  "Object code" means any non-source
-form of a work.
-
-  A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
-  The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form.  A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
-  The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities.  However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work.  For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
-  The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
-  The Corresponding Source for a work in source code form is that
-same work.
-
-  2. Basic Permissions.
-
-  All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met.  This License explicitly affirms your unlimited
-permission to run the unmodified Program.  The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work.  This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
-  You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force.  You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright.  Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
-  Conveying under any other circumstances is permitted solely under
-the conditions stated below.  Sublicensing is not allowed; section 10
-makes it unnecessary.
-
-  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
-  No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
-  When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
-  4. Conveying Verbatim Copies.
-
-  You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
-  You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
-  5. Conveying Modified Source Versions.
-
-  You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
-    a) The work must carry prominent notices stating that you modified
-    it, and giving a relevant date.
-
-    b) The work must carry prominent notices stating that it is
-    released under this License and any conditions added under section
-    7.  This requirement modifies the requirement in section 4 to
-    "keep intact all notices".
-
-    c) You must license the entire work, as a whole, under this
-    License to anyone who comes into possession of a copy.  This
-    License will therefore apply, along with any applicable section 7
-    additional terms, to the whole of the work, and all its parts,
-    regardless of how they are packaged.  This License gives no
-    permission to license the work in any other way, but it does not
-    invalidate such permission if you have separately received it.
-
-    d) If the work has interactive user interfaces, each must display
-    Appropriate Legal Notices; however, if the Program has interactive
-    interfaces that do not display Appropriate Legal Notices, your
-    work need not make them do so.
-
-  A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit.  Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
-  6. Conveying Non-Source Forms.
-
-  You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
-    a) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by the
-    Corresponding Source fixed on a durable physical medium
-    customarily used for software interchange.
-
-    b) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by a
-    written offer, valid for at least three years and valid for as
-    long as you offer spare parts or customer support for that product
-    model, to give anyone who possesses the object code either (1) a
-    copy of the Corresponding Source for all the software in the
-    product that is covered by this License, on a durable physical
-    medium customarily used for software interchange, for a price no
-    more than your reasonable cost of physically performing this
-    conveying of source, or (2) access to copy the
-    Corresponding Source from a network server at no charge.
-
-    c) Convey individual copies of the object code with a copy of the
-    written offer to provide the Corresponding Source.  This
-    alternative is allowed only occasionally and noncommercially, and
-    only if you received the object code with such an offer, in accord
-    with subsection 6b.
-
-    d) Convey the object code by offering access from a designated
-    place (gratis or for a charge), and offer equivalent access to the
-    Corresponding Source in the same way through the same place at no
-    further charge.  You need not require recipients to copy the
-    Corresponding Source along with the object code.  If the place to
-    copy the object code is a network server, the Corresponding Source
-    may be on a different server (operated by you or a third party)
-    that supports equivalent copying facilities, provided you maintain
-    clear directions next to the object code saying where to find the
-    Corresponding Source.  Regardless of what server hosts the
-    Corresponding Source, you remain obligated to ensure that it is
-    available for as long as needed to satisfy these requirements.
-
-    e) Convey the object code using peer-to-peer transmission, provided
-    you inform other peers where the object code and Corresponding
-    Source of the work are being offered to the general public at no
-    charge under subsection 6d.
-
-  A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
-  A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal,
-family, or household purposes, or (2) anything designed or sold for
-incorporation into a dwelling.  In determining whether a product is a
-consumer product, doubtful cases shall be resolved in favor of
-coverage.  For a particular product received by a particular user,
-"normally used" refers to a typical or common use of that class of
-product, regardless of the status of the particular user or of the way
-in which the particular user actually uses, or expects or is expected
-to use, the product.  A product is a consumer product regardless of
-whether the product has substantial commercial, industrial or
-non-consumer uses, unless such uses represent the only significant
-mode of use of the product.
-
-  "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to
-install and execute modified versions of a covered work in that User
-Product from a modified version of its Corresponding Source.  The
-information must suffice to ensure that the continued functioning of
-the modified object code is in no case prevented or interfered with
-solely because modification has been made.
-
-  If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information.  But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
-  The requirement to provide Installation Information does not include
-a requirement to continue to provide support service, warranty, or
-updates for a work that has been modified or installed by the
-recipient, or for the User Product in which it has been modified or
-installed.  Access to a network may be denied when the modification
-itself materially and adversely affects the operation of the network
-or violates the rules and protocols for communication across the
-network.
-
-  Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
-  7. Additional Terms.
-
-  "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law.  If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
-  When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it.  (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.)  You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
-  Notwithstanding any other provision of this License, for material
-you add to a covered work, you may (if authorized by the copyright
-holders of that material) supplement the terms of this License with
-terms:
-
-    a) Disclaiming warranty or limiting liability differently from the
-    terms of sections 15 and 16 of this License; or
-
-    b) Requiring preservation of specified reasonable legal notices or
-    author attributions in that material or in the Appropriate Legal
-    Notices displayed by works containing it; or
-
-    c) Prohibiting misrepresentation of the origin of that material, or
-    requiring that modified versions of such material be marked in
-    reasonable ways as different from the original version; or
-
-    d) Limiting the use for publicity purposes of names of licensors or
-    authors of the material; or
-
-    e) Declining to grant rights under trademark law for use of some
-    trade names, trademarks, or service marks; or
-
-    f) Requiring indemnification of licensors and authors of that
-    material by anyone who conveys the material (or modified versions
-    of it) with contractual assumptions of liability to the recipient,
-    for any liability that these contractual assumptions directly
-    impose on those licensors and authors.
-
-  All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10.  If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term.  If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
-  If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
-  Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
-  8. Termination.
-
-  You may not propagate or modify a covered work except as expressly
-provided under this License.  Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
-  However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
-  Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
-  Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License.  If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
-  9. Acceptance Not Required for Having Copies.
-
-  You are not required to accept this License in order to receive or
-run a copy of the Program.  Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance.  However,
-nothing other than this License grants you permission to propagate or
-modify any covered work.  These actions infringe copyright if you do
-not accept this License.  Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
-  10. Automatic Licensing of Downstream Recipients.
-
-  Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License.  You are not responsible
-for enforcing compliance by third parties with this License.
-
-  An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations.  If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
-  You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License.  For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
-  11. Patents.
-
-  A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based.  The
-work thus licensed is called the contributor's "contributor version".
-
-  A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version.  For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
-  Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
-  In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement).  To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
-  If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients.  "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
-  If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
-  A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License.  You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
-  Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
-  12. No Surrender of Others' Freedom.
-
-  If conditions are imposed on you (whether by court order, agreement
-or otherwise) that contradict the conditions of this License, they do
-not excuse you from the conditions of this License.  If you cannot
-convey a covered work so as to satisfy simultaneously your obligations
-under this License and any other pertinent obligations, then as a
-consequence you may not convey it at all.  For example, if you agree
-to terms that obligate you to collect a royalty for further conveying
-from those to whom you convey the Program, the only way you could
-satisfy both those terms and this License would be to refrain entirely
-from conveying the Program.
-
-  13. Use with the GNU Affero General Public License.
-
-  Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work.  The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
-  14. Revised Versions of this License.
-
-  The Free Software Foundation may publish revised and/or new versions
-of the GNU General Public License from time to time.  Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
-  Each version is given a distinguishing version number.  If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation.  If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
-  If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
-  Later license versions may give you additional or different
-permissions.  However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
-  15. Disclaimer of Warranty.
-
-  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
-WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND
-PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE
-DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
-CORRECTION.
-
-  16. Limitation of Liability.
-
-  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES
-AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
-DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
-DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM
-(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
-INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF
-THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
-OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-  17. Interpretation of Sections 15 and 16.
-
-  If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
-                     END OF TERMS AND CONDITIONS
-
-            How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these
-terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    
-    Copyright (C)  
-
-    This program is free software: you can redistribute it and/or
-    modify it under the terms of the GNU General Public License as
-    published by the Free Software Foundation, either version 3 of the
-    License, or (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see
-    .
-
-Also add information on how to contact you by electronic and paper mail.
-
-  If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
-     Copyright (C)   This program comes
-    with ABSOLUTELY NO WARRANTY; for details type `show w'.  This is
-    free software, and you are welcome to redistribute it under
-    certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the
-appropriate parts of the General Public License.  Of course, your
-program's commands might be different; for a GUI interface, you would
-use an "about box".
-
-  You should also get your employer (if you work as a programmer) or
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  For more information on this, and how to apply and follow
-the GNU GPL, see .
-
-  The GNU General Public License does not permit incorporating your
-program into proprietary programs.  If your program is a subroutine
-library, you may consider it more useful to permit linking proprietary
-applications with the library.  If this is what you want to do, use
-the GNU Lesser General Public License instead of this License.  But
-first, please read .
-
-
-----------------------------------------------------------------------
-Following applies to:
-./test/metis_support.cpp
-./test/sparselu.cpp
-./unsupported/test/mpreal/mpreal.h
-./unsupported/Eigen/src/IterativeSolvers/IterationController.h
-./unsupported/Eigen/src/IterativeSolvers/ConstrainedConjGrad.h
-./unsupported/Eigen/src/Eigenvalues/ArpackSelfAdjointEigenSolver.h
-./Eigen/src/OrderingMethods/Amd.h
-./Eigen/src/SparseCholesky/SimplicialCholesky_impl.h
-
-                  GNU LESSER GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. 
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
-  This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
-  0. Additional Definitions. 
-
-  As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the
-GNU General Public License.
-
-  "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
-  An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
-  A "Combined Work" is a work produced by combining or linking an
-Application with the Library.  The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
-  The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
-  The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
-  1. Exception to Section 3 of the GNU GPL.
-
-  You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
-  2. Conveying Modified Versions.
-
-  If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
-   a) under this License, provided that you make a good faith effort to
-   ensure that, in the event an Application does not supply the
-   function or data, the facility still operates, and performs
-   whatever part of its purpose remains meaningful, or
-
-   b) under the GNU GPL, with none of the additional permissions of
-   this License applicable to that copy.
-
-  3. Object Code Incorporating Material from Library Header Files.
-
-  The object code form of an Application may incorporate material from
-a header file that is part of the Library.  You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
-   a) Give prominent notice with each copy of the object code that the
-   Library is used in it and that the Library and its use are
-   covered by this License.
-
-   b) Accompany the object code with a copy of the GNU GPL and this
-   license document.
-
-  4. Combined Works.
-
-  You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
-   a) Give prominent notice with each copy of the Combined Work that
-   the Library is used in it and that the Library and its use are
-   covered by this License.
-
-   b) Accompany the Combined Work with a copy of the GNU GPL and this
-   license document.
-
-   c) For a Combined Work that displays copyright notices during
-   execution, include the copyright notice for the Library among
-   these notices, as well as a reference directing the user to the
-   copies of the GNU GPL and this license document.
-
-   d) Do one of the following:
-
-       0) Convey the Minimal Corresponding Source under the terms of
-       this License, and the Corresponding Application Code in a form
-       suitable for, and under terms that permit, the user to
-       recombine or relink the Application with a modified version of
-       the Linked Version to produce a modified Combined Work, in the
-       manner specified by section 6 of the GNU GPL for conveying
-       Corresponding Source.
-
-       1) Use a suitable shared library mechanism for linking with the
-       Library.  A suitable mechanism is one that (a) uses at run time
-       a copy of the Library already present on the user's computer
-       system, and (b) will operate properly with a modified version
-       of the Library that is interface-compatible with the Linked
-       Version. 
-
-   e) Provide Installation Information, but only if you would otherwise
-   be required to provide such information under section 6 of the
-   GNU GPL, and only to the extent that such information is
-   necessary to install and execute a modified version of the
-   Combined Work produced by recombining or relinking the
-   Application with a modified version of the Linked Version. (If
-   you use option 4d0, the Installation Information must accompany
-   the Minimal Corresponding Source and Corresponding Application
-   Code. If you use option 4d1, you must provide the Installation
-   Information in the manner specified by section 6 of the GNU GPL
-   for conveying Corresponding Source.)
-
-  5. Combined Libraries.
-
-  You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
-   a) Accompany the combined library with a copy of the same work based
-   on the Library, uncombined with any other library facilities,
-   conveyed under the terms of this License.
-
-   b) Give prominent notice with the combined library that part of it
-   is a work based on the Library, and explaining where to find the
-   accompanying uncombined form of the same work.
-
-  6. Revised Versions of the GNU Lesser General Public License.
-
-  The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
-  Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
-  If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
-
-
-----------------------------------------------------------------------
-Following applies to:
-./unsupported/Eigen/src/LevenbergMarquardt/LevenbergMarquardt.h
-./unsupported/Eigen/src/LevenbergMarquardt/LMcovar.h
-./unsupported/Eigen/src/LevenbergMarquardt/LMonestep.h
-./unsupported/Eigen/src/LevenbergMarquardt/LMpar.h
-./unsupported/Eigen/src/LevenbergMarquardt/LMqrsolv.h
-
-Minpack Copyright Notice (1999) University of Chicago.  All rights
-reserved
-
-Redistribution and use in source and binary forms, with or
-without modification, are permitted provided that the
-following conditions are met:
-
-1. Redistributions of source code must retain the above
-copyright notice, this list of conditions and the following
-disclaimer.
-
-2. Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following
-disclaimer in the documentation and/or other materials
-provided with the distribution.
-
-3. The end-user documentation included with the
-redistribution, if any, must include the following
-acknowledgment:
-
-   "This product includes software developed by the
-   University of Chicago, as Operator of Argonne National
-   Laboratory.
-
-Alternately, this acknowledgment may appear in the software
-itself, if and wherever such third-party acknowledgments
-normally appear.
-
-4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"
-WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE
-UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND
-THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE
-OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY
-OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
-USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF
-THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)
-DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION
-UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL
-BE CORRECTED.
-
-5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT
-HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF
-ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,
-INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF
-ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF
-PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER
-SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT
-(INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,
-EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE
-POSSIBILITY OF SUCH LOSS OR DAMAGES.
---------------------------------------------------------------------------------
-END LICENSE FOR third_party/eigen3/LICENSE
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR third_party/fft2d/LICENSE
---------------------------------------------------------------------------------
-Copyright(C) 1997,2001 Takuya OOURA (email: ooura@kurims.kyoto-u.ac.jp).
-You may use, copy, modify this code for any purpose and 
-without fee. You may distribute this ORIGINAL package.
---------------------------------------------------------------------------------
-END LICENSE FOR third_party/fft2d/LICENSE
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR external/boringssl/LICENSE
---------------------------------------------------------------------------------
-BoringSSL is a fork of OpenSSL. As such, large parts of it fall under OpenSSL
-licensing. Files that are completely new have a Google copyright and an ISC
-license. This license is reproduced at the bottom of this file.
-
-Contributors to BoringSSL are required to follow the CLA rules for Chromium:
-https://cla.developers.google.com/clas
-
-Files in third_party/ have their own licenses, as described therein. The MIT
-license, for third_party/fiat, which, unlike other third_party directories, is
-compiled into non-test libraries, is included below.
-
-The OpenSSL toolkit stays under a dual license, i.e. both the conditions of the
-OpenSSL License and the original SSLeay license apply to the toolkit. See below
-for the actual license texts. Actually both licenses are BSD-style Open Source
-licenses. In case of any license issues related to OpenSSL please contact
-openssl-core@openssl.org.
-
-The following are Google-internal bug numbers where explicit permission from
-some authors is recorded for use of their work. (This is purely for our own
-record keeping.)
-  27287199
-  27287880
-  27287883
-
-  OpenSSL License
-  ---------------
-
-/* ====================================================================
- * Copyright (c) 1998-2011 The OpenSSL Project.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- *    software must display the following acknowledgment:
- *    "This product includes software developed by the OpenSSL Project
- *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- *    endorse or promote products derived from this software without
- *    prior written permission. For written permission, please contact
- *    openssl-core@openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- *    nor may "OpenSSL" appear in their names without prior written
- *    permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- *    acknowledgment:
- *    "This product includes software developed by the OpenSSL Project
- *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- *
- * This product includes cryptographic software written by Eric Young
- * (eay@cryptsoft.com).  This product includes software written by Tim
- * Hudson (tjh@cryptsoft.com).
- *
- */
-
- Original SSLeay License
- -----------------------
-
-/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay@cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- * 
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to.  The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attribution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *    "This product includes cryptographic software written by
- *     Eric Young (eay@cryptsoft.com)"
- *    The word 'cryptographic' can be left out if the rouines from the library
- *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
- *    the apps directory (application code) you must include an acknowledgement:
- *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * 
- * The licence and distribution terms for any publically available version or
- * derivative of this code cannot be changed.  i.e. this code cannot simply be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-
-ISC license used for completely new code in BoringSSL:
-
-/* Copyright (c) 2015, Google Inc.
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
-
-
-The code in third_party/fiat carries the MIT license:
-
-Copyright (c) 2015-2016 the fiat-crypto authors (see
-https://github.com/mit-plv/fiat-crypto/blob/master/AUTHORS).
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-
-Licenses for support code
--------------------------
-
-Parts of the TLS test suite are under the Go license. This code is not included
-in BoringSSL (i.e. libcrypto and libssl) when compiled, however, so
-distributing code linked against BoringSSL does not trigger this license:
-
-Copyright (c) 2009 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-   * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-   * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-   * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-BoringSSL uses the Chromium test infrastructure to run a continuous build,
-trybots etc. The scripts which manage this, and the script for generating build
-metadata, are under the Chromium license. Distributing code linked against
-BoringSSL does not trigger this license.
-
-Copyright 2015 The Chromium Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-   * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-   * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-   * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------------
-END LICENSE FOR external/boringssl/LICENSE
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR external/com_googlesource_code_re2/LICENSE
---------------------------------------------------------------------------------
-// Copyright (c) 2009 The RE2 Authors. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//    * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//    * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//    * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------------
-END LICENSE FOR external/com_googlesource_code_re2/LICENSE
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR external/curl/COPYING
---------------------------------------------------------------------------------
-COPYRIGHT AND PERMISSION NOTICE
-
-Copyright (c) 1996 - 2018, Daniel Stenberg, , and many
-contributors, see the THANKS file.
-
-All rights reserved.
-
-Permission to use, copy, modify, and distribute this software for any purpose
-with or without fee is hereby granted, provided that the above copyright
-notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
-NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
-OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of a copyright holder shall not
-be used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization of the copyright holder.
---------------------------------------------------------------------------------
-END LICENSE FOR external/curl/COPYING
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR external/double_conversion/LICENSE
---------------------------------------------------------------------------------
-Copyright 2006-2011, the V8 project authors. All rights reserved.
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of Google Inc. nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------------
-END LICENSE FOR external/double_conversion/LICENSE
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR external/eigen_archive/COPYING.MPL2
---------------------------------------------------------------------------------
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
-    means each individual or legal entity that creates, contributes to
-    the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
-    means the combination of the Contributions of others (if any) used
-    by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
-    means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
-    means Source Code Form to which the initial Contributor has attached
-    the notice in Exhibit A, the Executable Form of such Source Code
-    Form, and Modifications of such Source Code Form, in each case
-    including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
-    means
-
-    (a) that the initial Contributor has attached the notice described
-        in Exhibit B to the Covered Software; or
-
-    (b) that the Covered Software was made available under the terms of
-        version 1.1 or earlier of the License, but not also under the
-        terms of a Secondary License.
-
-1.6. "Executable Form"
-    means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
-    means a work that combines Covered Software with other material, in 
-    a separate file or files, that is not Covered Software.
-
-1.8. "License"
-    means this document.
-
-1.9. "Licensable"
-    means having the right to grant, to the maximum extent possible,
-    whether at the time of the initial grant or subsequently, any and
-    all of the rights conveyed by this License.
-
-1.10. "Modifications"
-    means any of the following:
-
-    (a) any file in Source Code Form that results from an addition to,
-        deletion from, or modification of the contents of Covered
-        Software; or
-
-    (b) any new file in Source Code Form that contains any Covered
-        Software.
-
-1.11. "Patent Claims" of a Contributor
-    means any patent claim(s), including without limitation, method,
-    process, and apparatus claims, in any patent Licensable by such
-    Contributor that would be infringed, but for the grant of the
-    License, by the making, using, selling, offering for sale, having
-    made, import, or transfer of either its Contributions or its
-    Contributor Version.
-
-1.12. "Secondary License"
-    means either the GNU General Public License, Version 2.0, the GNU
-    Lesser General Public License, Version 2.1, the GNU Affero General
-    Public License, Version 3.0, or any later versions of those
-    licenses.
-
-1.13. "Source Code Form"
-    means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
-    means an individual or a legal entity exercising rights under this
-    License. For legal entities, "You" includes any entity that
-    controls, is controlled by, or is under common control with You. For
-    purposes of this definition, "control" means (a) the power, direct
-    or indirect, to cause the direction or management of such entity,
-    whether by contract or otherwise, or (b) ownership of more than
-    fifty percent (50%) of the outstanding shares or beneficial
-    ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
-    Licensable by such Contributor to use, reproduce, make available,
-    modify, display, perform, distribute, and otherwise exploit its
-    Contributions, either on an unmodified basis, with Modifications, or
-    as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
-    for sale, have made, import, and otherwise transfer either its
-    Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
-    or
-
-(b) for infringements caused by: (i) Your and any other third party's
-    modifications of Covered Software, or (ii) the combination of its
-    Contributions with other software (except as part of its Contributor
-    Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
-    its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
-    Form, as described in Section 3.1, and You must inform recipients of
-    the Executable Form how they can obtain a copy of such Source Code
-    Form by reasonable means in a timely manner, at a charge no more
-    than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
-    License, or sublicense it under different terms, provided that the
-    license for the Executable Form does not attempt to limit or alter
-    the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-*                                                                      *
-*  6. Disclaimer of Warranty                                           *
-*  -------------------------                                           *
-*                                                                      *
-*  Covered Software is provided under this License on an "as is"       *
-*  basis, without warranty of any kind, either expressed, implied, or  *
-*  statutory, including, without limitation, warranties that the       *
-*  Covered Software is free of defects, merchantable, fit for a        *
-*  particular purpose or non-infringing. The entire risk as to the     *
-*  quality and performance of the Covered Software is with You.        *
-*  Should any Covered Software prove defective in any respect, You     *
-*  (not any Contributor) assume the cost of any necessary servicing,   *
-*  repair, or correction. This disclaimer of warranty constitutes an   *
-*  essential part of this License. No use of any Covered Software is   *
-*  authorized under this License except under this disclaimer.         *
-*                                                                      *
-************************************************************************
-
-************************************************************************
-*                                                                      *
-*  7. Limitation of Liability                                          *
-*  --------------------------                                          *
-*                                                                      *
-*  Under no circumstances and under no legal theory, whether tort      *
-*  (including negligence), contract, or otherwise, shall any           *
-*  Contributor, or anyone who distributes Covered Software as          *
-*  permitted above, be liable to You for any direct, indirect,         *
-*  special, incidental, or consequential damages of any character      *
-*  including, without limitation, damages for lost profits, loss of    *
-*  goodwill, work stoppage, computer failure or malfunction, or any    *
-*  and all other commercial damages or losses, even if such party      *
-*  shall have been informed of the possibility of such damages. This   *
-*  limitation of liability shall not apply to liability for death or   *
-*  personal injury resulting from such party's negligence to the       *
-*  extent applicable law prohibits such limitation. Some               *
-*  jurisdictions do not allow the exclusion or limitation of           *
-*  incidental or consequential damages, so this exclusion and          *
-*  limitation may not apply to You.                                    *
-*                                                                      *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
-  This Source Code Form is subject to the terms of the Mozilla Public
-  License, v. 2.0. If a copy of the MPL was not distributed with this
-  file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
-  This Source Code Form is "Incompatible With Secondary Licenses", as
-  defined by the Mozilla Public License, v. 2.0.
---------------------------------------------------------------------------------
-END LICENSE FOR external/eigen_archive/COPYING.MPL2
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR external/farmhash_archive/COPYING
---------------------------------------------------------------------------------
-// Copyright (c) 2014 Google, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
---------------------------------------------------------------------------------
-END LICENSE FOR external/farmhash_archive/COPYING
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR external/fft2d/fft/readme.txt
---------------------------------------------------------------------------------
-General Purpose FFT (Fast Fourier/Cosine/Sine Transform) Package
-
-Description:
-    A package to calculate Discrete Fourier/Cosine/Sine Transforms of 
-    1-dimensional sequences of length 2^N.
-
-Files:
-    fft4g.c    : FFT Package in C       - Fast Version   I   (radix 4,2)
-    fft4g.f    : FFT Package in Fortran - Fast Version   I   (radix 4,2)
-    fft4g_h.c  : FFT Package in C       - Simple Version I   (radix 4,2)
-    fft8g.c    : FFT Package in C       - Fast Version   II  (radix 8,4,2)
-    fft8g.f    : FFT Package in Fortran - Fast Version   II  (radix 8,4,2)
-    fft8g_h.c  : FFT Package in C       - Simple Version II  (radix 8,4,2)
-    fftsg.c    : FFT Package in C       - Fast Version   III (Split-Radix)
-    fftsg.f    : FFT Package in Fortran - Fast Version   III (Split-Radix)
-    fftsg_h.c  : FFT Package in C       - Simple Version III (Split-Radix)
-    readme.txt : Readme File
-    sample1/   : Test Directory
-        Makefile    : for gcc, cc
-        Makefile.f77: for Fortran
-        testxg.c    : Test Program for "fft*g.c"
-        testxg.f    : Test Program for "fft*g.f"
-        testxg_h.c  : Test Program for "fft*g_h.c"
-    sample2/   : Benchmark Directory
-        Makefile    : for gcc, cc
-        Makefile.pth: POSIX Thread version
-        pi_fft.c    : PI(= 3.1415926535897932384626...) Calculation Program
-                      for a Benchmark Test for "fft*g.c"
-
-Difference of the Files:
-    C and Fortran versions are equal and 
-    the same routines are in each version.
-    "fft4g*.*" are optimized for most machines.
-    "fft8g*.*" are fast on the UltraSPARC.
-    "fftsg*.*" are optimized for the machines that 
-    have the multi-level (L1,L2,etc) cache.
-    The simple versions "fft*g_h.c" use no work area, but 
-    the fast versions "fft*g.*" use work areas.
-    The fast versions "fft*g.*" have the same specification.
-
-Routines in the Package:
-    cdft: Complex Discrete Fourier Transform
-    rdft: Real Discrete Fourier Transform
-    ddct: Discrete Cosine Transform
-    ddst: Discrete Sine Transform
-    dfct: Cosine Transform of RDFT (Real Symmetric DFT)
-    dfst: Sine Transform of RDFT (Real Anti-symmetric DFT)
-
-Usage:
-    Please refer to the comments in the "fft**.*" file which 
-    you want to use. Brief explanations are in the block 
-    comments of each package. The examples are also given in 
-    the test programs.
-
-Method:
-    -------- cdft --------
-    fft4g*.*, fft8g*.*:
-        A method of in-place, radix 2^M, Sande-Tukey (decimation in 
-        frequency). Index of the butterfly loop is in bit 
-        reverse order to keep continuous memory access.
-    fftsg*.*:
-        A method of in-place, Split-Radix, recursive fast 
-        algorithm.
-    -------- rdft --------
-    A method with a following butterfly operation appended to "cdft".
-    In forward transform :
-        A[k] = sum_j=0^n-1 a[j]*W(n)^(j*k), 0<=k<=n/2, 
-            W(n) = exp(2*pi*i/n), 
-    this routine makes an array x[] :
-        x[j] = a[2*j] + i*a[2*j+1], 0<=j \.  All Rights Reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-- Redistributions of source code must retain the above copyright notice,
-  this list of conditions and the following disclaimer.
-- Redistributions in binary form must reproduce the above copyright notice,
-  this list of conditions and the following disclaimer in the documentation
-  and/or other materials provided with the distribution.
-- Neither the name of the libjpeg-turbo Project nor the names of its
-  contributors may be used to endorse or promote products derived from this
-  software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-
-The zlib License
-================
-
-Copyright (C) \, \.
-
-This software is provided 'as-is', without any express or implied
-warranty.  In no event will the authors be held liable for any damages
-arising from the use of this software.
-
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it
-freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must not
-   claim that you wrote the original software. If you use this software
-   in a product, an acknowledgment in the product documentation would be
-   appreciated but is not required.
-2. Altered source versions must be plainly marked as such, and must not be
-   misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-
-
-Why Three Licenses?
-===================
-
-The zlib License could have been used instead of the Modified (3-clause) BSD
-License, and since the IJG License effectively subsumes the distribution
-conditions of the zlib License, this would have effectively placed
-libjpeg-turbo binary distributions under the IJG License.  However, the IJG
-License specifically refers to the Independent JPEG Group and does not extend
-attribution and endorsement protections to other entities.  Thus, it was
-desirable to choose a license that granted us the same protections for new code
-that were granted to the IJG for code derived from their software.
---------------------------------------------------------------------------------
-END LICENSE FOR external/jpeg/LICENSE.md
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR external/llvm/LICENSE.TXT
---------------------------------------------------------------------------------
-==============================================================================
-LLVM Release License
-==============================================================================
-University of Illinois/NCSA
-Open Source License
-
-Copyright (c) 2003-2018 University of Illinois at Urbana-Champaign.
-All rights reserved.
-
-Developed by:
-
-    LLVM Team
-
-    University of Illinois at Urbana-Champaign
-
-    http://llvm.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal with
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-    * Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimers.
-
-    * Redistributions in binary form must reproduce the above copyright notice,
-      this list of conditions and the following disclaimers in the
-      documentation and/or other materials provided with the distribution.
-
-    * Neither the names of the LLVM Team, University of Illinois at
-      Urbana-Champaign, nor the names of its contributors may be used to
-      endorse or promote products derived from this Software without specific
-      prior written permission.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
-SOFTWARE.
-
-==============================================================================
-Copyrights and Licenses for Third Party Software Distributed with LLVM:
-==============================================================================
-The LLVM software contains code written by third parties.  Such software will
-have its own individual LICENSE.TXT file in the directory in which it appears.
-This file will describe the copyrights, license, and restrictions which apply
-to that code.
-
-The disclaimer of warranty in the University of Illinois Open Source License
-applies to all code in the LLVM Distribution, and nothing in any of the
-other licenses gives permission to use the names of the LLVM Team or the
-University of Illinois to endorse or promote products derived from this
-Software.
-
-The following pieces of software have additional or alternate copyrights,
-licenses, and/or restrictions:
-
-Program             Directory
--------             ---------
-Google Test         llvm/utils/unittest/googletest
-OpenBSD regex       llvm/lib/Support/{reg*, COPYRIGHT.regex}
-pyyaml tests        llvm/test/YAMLParser/{*.data, LICENSE.TXT}
-ARM contributions   llvm/lib/Target/ARM/LICENSE.TXT
-md5 contributions   llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h
---------------------------------------------------------------------------------
-END LICENSE FOR external/llvm/LICENSE.TXT
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR external/lmdb/LICENSE
---------------------------------------------------------------------------------
-The OpenLDAP Public License
-  Version 2.8, 17 August 2003
-
-Redistribution and use of this software and associated documentation
-("Software"), with or without modification, are permitted provided
-that the following conditions are met:
-
-1. Redistributions in source form must retain copyright statements
-   and notices,
-
-2. Redistributions in binary form must reproduce applicable copyright
-   statements and notices, this list of conditions, and the following
-   disclaimer in the documentation and/or other materials provided
-   with the distribution, and
-
-3. Redistributions must contain a verbatim copy of this document.
-
-The OpenLDAP Foundation may revise this license from time to time.
-Each revision is distinguished by a version number.  You may use
-this Software under terms of this license revision or under the
-terms of any subsequent revision of the license.
-
-THIS SOFTWARE IS PROVIDED BY THE OPENLDAP FOUNDATION AND ITS
-CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT
-SHALL THE OPENLDAP FOUNDATION, ITS CONTRIBUTORS, OR THE AUTHOR(S)
-OR OWNER(S) OF THE SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-The names of the authors and copyright holders must not be used in
-advertising or otherwise to promote the sale, use or other dealing
-in this Software without specific, written prior permission.  Title
-to copyright in this Software shall at all times remain with copyright
-holders.
-
-OpenLDAP is a registered trademark of the OpenLDAP Foundation.
-
-Copyright 1999-2003 The OpenLDAP Foundation, Redwood City,
-California, USA.  All Rights Reserved.  Permission to copy and
-distribute verbatim copies of this document is granted.
---------------------------------------------------------------------------------
-END LICENSE FOR external/lmdb/LICENSE
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR external/local_config_sycl/sycl/LICENSE.text
---------------------------------------------------------------------------------
-
----------------------------------------------------------------------
-
-SOFTWARE LICENSE AGREEMENT
-
----------------------------------------------------------------------
----------------------------------------------------------------------
-
-By downloading, installing, copying, or otherwise using the
-ComputeCpp Community Edition software, including any associated
-components, media, printed materials, and electronic documentation
-("Software"), the user agrees to the following terms and conditions
-of this Software License Agreement ("Agreement"). Please read the
-terms of this Agreement carefully before beginning your download, as
-pressing the "I AGREE" button at the end of this Agreement will
-confirm your assent. If you do not agree to these terms, then
-Codeplay Software Limited is unwilling to license the Software to
-you; so please press the "CANCEL" button to cancel your download.
-
- 1. License. Codeplay Software Ltd., a company incorporated in
-    England and Wales with registered number 04567874 and having its
-    registered office at Regent House, 316 Beulah Hill, London,
-    United Kingdom, SE19 3HF ("Codeplay") hereby grants the user,
-    free of charge, a non-exclusive worldwide license to use and
-    replicate (but not modify) the Software for any use, whether
-    commercial or non-commercial, in accordance with this Agreement.
-    Codeplay reserves all rights to the Software that are not
-    expressly granted by this Agreement.
- 2. Redistribution. The user may copy and redistribute unmodified
-    copies of only those components of the Software which are
-    specified below ("Redistributable Components"), in object code
-    form, as part of the user’s software applications or libraries
-    ("Applications"). The user acknowledges and agrees that it has no
-    right to modify the Redistributable Components in any way. Any
-    use of the Redistributable Components within the user’s
-    Applications will continue to be subject to the terms and
-    conditions of this Agreement, and the user must also distribute a
-    copy of this Agreement and reproduce and include all notices of
-    copyrights or other proprietary rights in the Software. The
-    user’s redistribution of the Redistributable Components will not
-    entitle it to any payment from Codeplay. The user may not
-    transfer any of its rights or obligations under this Agreement.
-
-+-------------------------------------------+
-|Redistributable Component|File Name        |
-|-------------------------+-----------------|
-|Runtime (for Linux)      |libComputeCpp.so |
-|-------------------------+-----------------|
-|Runtime (for Windows)    |libComputeCpp.dll|
-+-------------------------------------------+
-
- 3. Restrictions. The user shall not:
-
-     a. circumvent or bypass any technological protection measures in
-        or relating to the Software;
-     b. use the Software to perform any unauthorized transfer of
-        information or for any illegal purpose;
-     c. de-compile, decrypt, disassemble, hack, emulate, exploit or
-        reverse-engineer the Software (other than to the limited
-        extent permitted by law);
-     d. copy or redistribute any components of the Software that are
-        not listed in the table of Redistributable Components;
-     e. publish, rent, lease, sell, export, import, or lend the
-        Software;
-     f. represent in any way that it is selling the Software itself
-        or any license to use the Software, nor refer to Codeplay or
-        ComputeCpp within its marketing materials, without the
-        express prior written permission of Codeplay.
- 4. Support. Codeplay does not provide any guarantees of support for
-    the Software to the user. Codeplay will use reasonable endeavors
-    to respond to users' support requests, for the most recent
-    release only, via the community support website at https://
-    computecpp.codeplay.com.
- 5. Intellectual Property. The Software is owned by Codeplay or its
-    licensors, and is protected by the copyright laws of the United
-    Kingdom and other countries and international treaty provisions.
-    Codeplay (and/or its licensors, as the case may be) retains all
-    copyrights, trade secrets and other proprietary rights in the
-    Software, including the rights to make and license the use of all
-    copies. To the extent that any patents owned by Codeplay or its
-    licensors relate to any component of the Software, the license
-    granted to the user in accordance with this Agreement allows for
-    the lawful use of such patents but only for the purposes of this
-    Agreement and not further or otherwise. Therefore, the user may
-    make no copies of the Software, or the written materials that
-    accompany the Software, or reproduce it in any way, except as set
-    forth above.
- 6. Terms. This Agreement is effective until terminated. Codeplay or
-    the user may terminate it immediately at any time. Any violation
-    of the terms of this Agreement by the user will result in
-    immediate termination by Codeplay. Upon termination, the user
-    must return or destroy the Software and accompanying materials
-    and notify Codeplay of its actions by email to info@codeplay.com.
- 7. NO WARRANTIES. Codeplay expressly disclaims any warranty for the
-    Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
-    ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-    WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
-    AND NON-INFRINGEMENT. IN NO EVENT SHALL CODEPLAY BE LIABLE FOR
-    ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-    CONTRACT, DELICT OR TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-    CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-    SOFTWARE. In particular, Codeplay provides no guarantees of
-    application performance on the target hardware.
- 8. General. The invalidity of any portion or provision of this
-    Agreement shall not affect any other portions or provisions. This
-    Agreement shall be governed by the laws of Scotland. This
-    Agreement is the complete and exclusive agreement between the
-    user and Codeplay regarding the Software, and it supersedes any
-    prior agreement, oral or written, and any other communication
-    between the user and Codeplay relating to the subject matter of
-    the Agreement. Any amendment or modification of this Agreement
-    must be in writing and signed by both parties. If the user does
-    not agree to the terms of this Agreement, the user must not
-    install or use the Software.
- 9. Third Party Licenses. The following licenses are for third-party
-    components included in the software.
-
-     a. License for Clang/LLVM compiler technology components:
-
-==============================================================================
-
-LLVM Release License
-
-==============================================================================
-
-University of Illinois/NCSA
-
-Open Source License
-
-Copyright (c) 2007-2014 University of Illinois at Urbana-Champaign.
-
-All rights reserved.
-
-Developed by:
-
- LLVM Team
-
- University of Illinois at Urbana-Champaign
-
- http://llvm.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal with
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimers.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimers in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the names of the LLVM Team, University of Illinois at
- Urbana-Champaign, nor the names of its contributors may be used to
- endorse or promote products derived from this Software without specific
- prior written permission.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
-SOFTWARE.
-
-==============================================================================
-
- b. License for OpenBSD regex components:
-
-$OpenBSD: COPYRIGHT,v 1.3 2003/06/02 20:18:36 millert Exp $
-Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved.
-This software is not subject to any license of the American Telephone
-and Telegraph Company or of the Regents of the University of California.
-Permission is granted to anyone to use this software for any purpose on
-any computer system, and to alter it and redistribute it, subject
-to the following restrictions:
-
-1. The author is not responsible for the consequences of use of this
- software, no matter how awful, even if they arise from flaws in it.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission. Since few users ever read sources,
- credits must appear in the documentation.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software. Since few users
- ever read sources, credits must appear in the documentation.
-
-4. This notice may not be removed or altered.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-/*-
- * Copyright (c) 1994
- *      The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *                  @(#)COPYRIGHT8.1 (Berkeley) 3/16/94
- */
-
- c. License for MD5 components:
-
-/*
- * This code is derived from (original license follows):
- *
- * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
- * MD5 Message-Digest Algorithm (RFC 1321).
- *
- * Homepage:
- *  http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
- *
- * Author:
- * Alexander Peslyak, better known as Solar Designer 
- *
- * This software was written by Alexander Peslyak in 2001. No copyright is
- * claimed, and the software is hereby placed in the public domain.
- * In case this attempt to disclaim copyright and place the software in the
- * public domain is deemed null and void, then the software is
- * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
- * general public under the following terms:
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted.
- *
- * There's ABSOLUTELY NO WARRANTY, express or implied.
- *
- * (This is a heavily cut-down "BSD license".)
- *
- * This differs from Colin Plumb's older public domain implementation in that
- * no exactly 32-bit integer data type is required (any 32-bit or wider
- * unsigned integer data type will do), there's no compile-time endianness
- * configuration, and the function prototypes match OpenSSL's. No code from
- * Colin Plumb's implementation has been reused; this comment merely compares
- * the properties of the two independent implementations.
- *
- * The primary goals of this implementation are portability and ease of use.
- * It is meant to be fast, but not as fast as possible. Some known
- * optimizations are not included to reduce source code size and avoid
- * compile-time configuration.
- */
-
-
---------------------------------------------------------------------------------
-END LICENSE FOR external/local_config_sycl/sycl/LICENSE.text
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR external/nasm/LICENSE
---------------------------------------------------------------------------------
-NASM is now licensed under the 2-clause BSD license, also known as the
-simplified BSD license.
-
-    Copyright 1996-2010 the NASM Authors - All rights reserved.
-
-    Redistribution and use in source and binary forms, with or without
-    modification, are permitted provided that the following
-    conditions are met:
-
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-      
-      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
-      CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-      INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-      MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-      DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-      CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-      SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-      NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-      LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-      HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-      CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-      OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-      EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------------
-END LICENSE FOR external/nasm/LICENSE
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR external/nsync/LICENSE
---------------------------------------------------------------------------------
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
---------------------------------------------------------------------------------
-END LICENSE FOR external/nsync/LICENSE
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR external/png_archive/LICENSE
---------------------------------------------------------------------------------
-
-This copy of the libpng notices is provided for your convenience.  In case of
-any discrepancy between this copy and the notices in the file png.h that is
-included in the libpng distribution, the latter shall prevail.
-
-COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
-
-If you modify libpng you may insert additional notices immediately following
-this sentence.
-
-This code is released under the libpng license.
-
-libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are
-Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
-derived from libpng-1.0.6, and are distributed according to the same
-disclaimer and license as libpng-1.0.6 with the following individuals
-added to the list of Contributing Authors:
-
-   Simon-Pierre Cadieux
-   Eric S. Raymond
-   Mans Rullgard
-   Cosmin Truta
-   Gilles Vollant
-   James Yu
-   Mandar Sahastrabuddhe
-   Google Inc.
-   Vadim Barkov
-
-and with the following additions to the disclaimer:
-
-   There is no warranty against interference with your enjoyment of the
-   library or against infringement.  There is no warranty that our
-   efforts or the library will fulfill any of your particular purposes
-   or needs.  This library is provided with all faults, and the entire
-   risk of satisfactory quality, performance, accuracy, and effort is with
-   the user.
-
-Some files in the "contrib" directory and some configure-generated
-files that are distributed with libpng have other copyright owners and
-are released under other open source licenses.
-
-libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
-Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
-libpng-0.96, and are distributed according to the same disclaimer and
-license as libpng-0.96, with the following individuals added to the list
-of Contributing Authors:
-
-   Tom Lane
-   Glenn Randers-Pehrson
-   Willem van Schaik
-
-libpng versions 0.89, June 1996, through 0.96, May 1997, are
-Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
-and are distributed according to the same disclaimer and license as
-libpng-0.88, with the following individuals added to the list of
-Contributing Authors:
-
-   John Bowler
-   Kevin Bracey
-   Sam Bushell
-   Magnus Holmgren
-   Greg Roelofs
-   Tom Tanner
-
-Some files in the "scripts" directory have other copyright owners
-but are released under this license.
-
-libpng versions 0.5, May 1995, through 0.88, January 1996, are
-Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-
-For the purposes of this copyright and license, "Contributing Authors"
-is defined as the following set of individuals:
-
-   Andreas Dilger
-   Dave Martindale
-   Guy Eric Schalnat
-   Paul Schmidt
-   Tim Wegner
-
-The PNG Reference Library is supplied "AS IS".  The Contributing Authors
-and Group 42, Inc. disclaim all warranties, expressed or implied,
-including, without limitation, the warranties of merchantability and of
-fitness for any purpose.  The Contributing Authors and Group 42, Inc.
-assume no liability for direct, indirect, incidental, special, exemplary,
-or consequential damages, which may result from the use of the PNG
-Reference Library, even if advised of the possibility of such damage.
-
-Permission is hereby granted to use, copy, modify, and distribute this
-source code, or portions hereof, for any purpose, without fee, subject
-to the following restrictions:
-
-  1. The origin of this source code must not be misrepresented.
-
-  2. Altered versions must be plainly marked as such and must not
-     be misrepresented as being the original source.
-
-  3. This Copyright notice may not be removed or altered from any
-     source or altered source distribution.
-
-The Contributing Authors and Group 42, Inc. specifically permit, without
-fee, and encourage the use of this source code as a component to
-supporting the PNG file format in commercial products.  If you use this
-source code in a product, acknowledgment is not required but would be
-appreciated.
-
-END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
-
-TRADEMARK:
-
-The name "libpng" has not been registered by the Copyright owner
-as a trademark in any jurisdiction.  However, because libpng has
-been distributed and maintained world-wide, continually since 1995,
-the Copyright owner claims "common-law trademark protection" in any
-jurisdiction where common-law trademark is recognized.
-
-OSI CERTIFICATION:
-
-Libpng is OSI Certified Open Source Software.  OSI Certified Open Source is
-a certification mark of the Open Source Initiative. OSI has not addressed
-the additional disclaimers inserted at version 1.0.7.
-
-EXPORT CONTROL:
-
-The Copyright owner believes that the Export Control Classification
-Number (ECCN) for libpng is EAR99, which means not subject to export
-controls or International Traffic in Arms Regulations (ITAR) because
-it is open source, publicly available software, that does not contain
-any encryption software.  See the EAR, paragraphs 734.3(b)(3) and
-734.7(b).
-
-Glenn Randers-Pehrson
-glennrp at users.sourceforge.net
-September 29, 2017
---------------------------------------------------------------------------------
-END LICENSE FOR external/png_archive/LICENSE
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR external/protobuf_archive/LICENSE
---------------------------------------------------------------------------------
-Copyright 2008 Google Inc.  All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-    * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-    * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-Code generated by the Protocol Buffer compiler is owned by the owner
-of the input file used when generating it.  This code is not
-standalone and requires a support library to be linked with it.  This
-support library is itself covered by the above license.
---------------------------------------------------------------------------------
-END LICENSE FOR external/protobuf_archive/LICENSE
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR external/snappy/COPYING
---------------------------------------------------------------------------------
-Copyright 2011, Google Inc.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-    * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-    * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-===
-
-Some of the benchmark data in testdata/ is licensed differently:
-
- - fireworks.jpeg is Copyright 2013 Steinar H. Gunderson, and
-   is licensed under the Creative Commons Attribution 3.0 license
-   (CC-BY-3.0). See https://creativecommons.org/licenses/by/3.0/
-   for more information.
-
- - kppkn.gtb is taken from the Gaviota chess tablebase set, and
-   is licensed under the MIT License. See
-   https://sites.google.com/site/gaviotachessengine/Home/endgame-tablebases-1
-   for more information.
-
- - paper-100k.pdf is an excerpt (bytes 92160 to 194560) from the paper
-   “Combinatorial Modeling of Chromatin Features Quantitatively Predicts DNA
-   Replication Timing in _Drosophila_” by Federico Comoglio and Renato Paro,
-   which is licensed under the CC-BY license. See
-   http://www.ploscompbiol.org/static/license for more ifnormation.
-
- - alice29.txt, asyoulik.txt, plrabn12.txt and lcet10.txt are from Project
-   Gutenberg. The first three have expired copyrights and are in the public
-   domain; the latter does not have expired copyright, but is still in the
-   public domain according to the license information
-   (http://www.gutenberg.org/ebooks/53).
---------------------------------------------------------------------------------
-END LICENSE FOR external/snappy/COPYING
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR external/zlib_archive/zlib.h
---------------------------------------------------------------------------------
-/* zlib.h -- interface of the 'zlib' general purpose compression library
-  version 1.2.11, January 15th, 2017
-
-  Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jean-loup Gailly        Mark Adler
-  jloup@gzip.org          madler@alumni.caltech.edu
-
-
-  The data format used by the zlib library is described by RFCs (Request for
-  Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950
-  (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
-*/
-
-#ifndef ZLIB_H
-#define ZLIB_H
-
-#include "zconf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define ZLIB_VERSION "1.2.11"
-#define ZLIB_VERNUM 0x12b0
-#define ZLIB_VER_MAJOR 1
-#define ZLIB_VER_MINOR 2
-#define ZLIB_VER_REVISION 11
-#define ZLIB_VER_SUBREVISION 0
-
-/*
-    The 'zlib' compression library provides in-memory compression and
-  decompression functions, including integrity checks of the uncompressed data.
-  This version of the library supports only one compression method (deflation)
-  but other algorithms will be added later and will have the same stream
-  interface.
-
-    Compression can be done in a single step if the buffers are large enough,
-  or can be done by repeated calls of the compression function.  In the latter
-  case, the application must provide more input and/or consume the output
-  (providing more output space) before each call.
-
-    The compressed data format used by default by the in-memory functions is
-  the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
-  around a deflate stream, which is itself documented in RFC 1951.
-
-    The library also supports reading and writing files in gzip (.gz) format
-  with an interface similar to that of stdio using the functions that start
-  with "gz".  The gzip format is different from the zlib format.  gzip is a
-  gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
-
-    This library can optionally read and write gzip and raw deflate streams in
-  memory as well.
-
-    The zlib format was designed to be compact and fast for use in memory
-  and on communications channels.  The gzip format was designed for single-
-  file compression on file systems, has a larger header than zlib to maintain
-  directory information, and uses a different, slower check method than zlib.
-
-    The library does not install any signal handler.  The decoder checks
-  the consistency of the compressed data, so the library should never crash
-  even in the case of corrupted input.
-*/
-
-typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
-typedef void   (*free_func)  OF((voidpf opaque, voidpf address));
-
-struct internal_state;
-
-typedef struct z_stream_s {
-    z_const Bytef *next_in;     /* next input byte */
-    uInt     avail_in;  /* number of bytes available at next_in */
-    uLong    total_in;  /* total number of input bytes read so far */
-
-    Bytef    *next_out; /* next output byte will go here */
-    uInt     avail_out; /* remaining free space at next_out */
-    uLong    total_out; /* total number of bytes output so far */
-
-    z_const char *msg;  /* last error message, NULL if no error */
-    struct internal_state FAR *state; /* not visible by applications */
-
-    alloc_func zalloc;  /* used to allocate the internal state */
-    free_func  zfree;   /* used to free the internal state */
-    voidpf     opaque;  /* private data object passed to zalloc and zfree */
-
-    int     data_type;  /* best guess about the data type: binary or text
-                           for deflate, or the decoding state for inflate */
-    uLong   adler;      /* Adler-32 or CRC-32 value of the uncompressed data */
-    uLong   reserved;   /* reserved for future use */
-} z_stream;
-
-typedef z_stream FAR *z_streamp;
-
-/*
-     gzip header information passed to and from zlib routines.  See RFC 1952
-  for more details on the meanings of these fields.
-*/
-typedef struct gz_header_s {
-    int     text;       /* true if compressed data believed to be text */
-    uLong   time;       /* modification time */
-    int     xflags;     /* extra flags (not used when writing a gzip file) */
-    int     os;         /* operating system */
-    Bytef   *extra;     /* pointer to extra field or Z_NULL if none */
-    uInt    extra_len;  /* extra field length (valid if extra != Z_NULL) */
-    uInt    extra_max;  /* space at extra (only when reading header) */
-    Bytef   *name;      /* pointer to zero-terminated file name or Z_NULL */
-    uInt    name_max;   /* space at name (only when reading header) */
-    Bytef   *comment;   /* pointer to zero-terminated comment or Z_NULL */
-    uInt    comm_max;   /* space at comment (only when reading header) */
-    int     hcrc;       /* true if there was or will be a header crc */
-    int     done;       /* true when done reading gzip header (not used
-                           when writing a gzip file) */
-} gz_header;
-
-typedef gz_header FAR *gz_headerp;
-
-/*
-     The application must update next_in and avail_in when avail_in has dropped
-   to zero.  It must update next_out and avail_out when avail_out has dropped
-   to zero.  The application must initialize zalloc, zfree and opaque before
-   calling the init function.  All other fields are set by the compression
-   library and must not be updated by the application.
-
-     The opaque value provided by the application will be passed as the first
-   parameter for calls of zalloc and zfree.  This can be useful for custom
-   memory management.  The compression library attaches no meaning to the
-   opaque value.
-
-     zalloc must return Z_NULL if there is not enough memory for the object.
-   If zlib is used in a multi-threaded application, zalloc and zfree must be
-   thread safe.  In that case, zlib is thread-safe.  When zalloc and zfree are
-   Z_NULL on entry to the initialization function, they are set to internal
-   routines that use the standard library functions malloc() and free().
-
-     On 16-bit systems, the functions zalloc and zfree must be able to allocate
-   exactly 65536 bytes, but will not be required to allocate more than this if
-   the symbol MAXSEG_64K is defined (see zconf.h).  WARNING: On MSDOS, pointers
-   returned by zalloc for objects of exactly 65536 bytes *must* have their
-   offset normalized to zero.  The default allocation function provided by this
-   library ensures this (see zutil.c).  To reduce memory requirements and avoid
-   any allocation of 64K objects, at the expense of compression ratio, compile
-   the library with -DMAX_WBITS=14 (see zconf.h).
-
-     The fields total_in and total_out can be used for statistics or progress
-   reports.  After compression, total_in holds the total size of the
-   uncompressed data and may be saved for use by the decompressor (particularly
-   if the decompressor wants to decompress everything in a single step).
-*/
-
-                        /* constants */
-
-#define Z_NO_FLUSH      0
-#define Z_PARTIAL_FLUSH 1
-#define Z_SYNC_FLUSH    2
-#define Z_FULL_FLUSH    3
-#define Z_FINISH        4
-#define Z_BLOCK         5
-#define Z_TREES         6
-/* Allowed flush values; see deflate() and inflate() below for details */
-
-#define Z_OK            0
-#define Z_STREAM_END    1
-#define Z_NEED_DICT     2
-#define Z_ERRNO        (-1)
-#define Z_STREAM_ERROR (-2)
-#define Z_DATA_ERROR   (-3)
-#define Z_MEM_ERROR    (-4)
-#define Z_BUF_ERROR    (-5)
-#define Z_VERSION_ERROR (-6)
-/* Return codes for the compression/decompression functions. Negative values
- * are errors, positive values are used for special but normal events.
- */
-
-#define Z_NO_COMPRESSION         0
-#define Z_BEST_SPEED             1
-#define Z_BEST_COMPRESSION       9
-#define Z_DEFAULT_COMPRESSION  (-1)
-/* compression levels */
-
-#define Z_FILTERED            1
-#define Z_HUFFMAN_ONLY        2
-#define Z_RLE                 3
-#define Z_FIXED               4
-#define Z_DEFAULT_STRATEGY    0
-/* compression strategy; see deflateInit2() below for details */
-
-#define Z_BINARY   0
-#define Z_TEXT     1
-#define Z_ASCII    Z_TEXT   /* for compatibility with 1.2.2 and earlier */
-#define Z_UNKNOWN  2
-/* Possible values of the data_type field for deflate() */
-
-#define Z_DEFLATED   8
-/* The deflate compression method (the only one supported in this version) */
-
-#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
-
-#define zlib_version zlibVersion()
-/* for compatibility with versions < 1.0.2 */
-
-
-                        /* basic functions */
-
-ZEXTERN const char * ZEXPORT zlibVersion OF((void));
-/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
-   If the first character differs, the library code actually used is not
-   compatible with the zlib.h header file used by the application.  This check
-   is automatically made by deflateInit and inflateInit.
- */
-
-/*
-ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
-
-     Initializes the internal stream state for compression.  The fields
-   zalloc, zfree and opaque must be initialized before by the caller.  If
-   zalloc and zfree are set to Z_NULL, deflateInit updates them to use default
-   allocation functions.
-
-     The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
-   1 gives best speed, 9 gives best compression, 0 gives no compression at all
-   (the input data is simply copied a block at a time).  Z_DEFAULT_COMPRESSION
-   requests a default compromise between speed and compression (currently
-   equivalent to level 6).
-
-     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
-   memory, Z_STREAM_ERROR if level is not a valid compression level, or
-   Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
-   with the version assumed by the caller (ZLIB_VERSION).  msg is set to null
-   if there is no error message.  deflateInit does not perform any compression:
-   this will be done by deflate().
-*/
-
-
-ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
-/*
-    deflate compresses as much data as possible, and stops when the input
-  buffer becomes empty or the output buffer becomes full.  It may introduce
-  some output latency (reading input without producing any output) except when
-  forced to flush.
-
-    The detailed semantics are as follows.  deflate performs one or both of the
-  following actions:
-
-  - Compress more input starting at next_in and update next_in and avail_in
-    accordingly.  If not all input can be processed (because there is not
-    enough room in the output buffer), next_in and avail_in are updated and
-    processing will resume at this point for the next call of deflate().
-
-  - Generate more output starting at next_out and update next_out and avail_out
-    accordingly.  This action is forced if the parameter flush is non zero.
-    Forcing flush frequently degrades the compression ratio, so this parameter
-    should be set only when necessary.  Some output may be provided even if
-    flush is zero.
-
-    Before the call of deflate(), the application should ensure that at least
-  one of the actions is possible, by providing more input and/or consuming more
-  output, and updating avail_in or avail_out accordingly; avail_out should
-  never be zero before the call.  The application can consume the compressed
-  output when it wants, for example when the output buffer is full (avail_out
-  == 0), or after each call of deflate().  If deflate returns Z_OK and with
-  zero avail_out, it must be called again after making room in the output
-  buffer because there might be more output pending. See deflatePending(),
-  which can be used if desired to determine whether or not there is more ouput
-  in that case.
-
-    Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
-  decide how much data to accumulate before producing output, in order to
-  maximize compression.
-
-    If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
-  flushed to the output buffer and the output is aligned on a byte boundary, so
-  that the decompressor can get all input data available so far.  (In
-  particular avail_in is zero after the call if enough output space has been
-  provided before the call.) Flushing may degrade compression for some
-  compression algorithms and so it should be used only when necessary.  This
-  completes the current deflate block and follows it with an empty stored block
-  that is three bits plus filler bits to the next byte, followed by four bytes
-  (00 00 ff ff).
-
-    If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the
-  output buffer, but the output is not aligned to a byte boundary.  All of the
-  input data so far will be available to the decompressor, as for Z_SYNC_FLUSH.
-  This completes the current deflate block and follows it with an empty fixed
-  codes block that is 10 bits long.  This assures that enough bytes are output
-  in order for the decompressor to finish the block before the empty fixed
-  codes block.
-
-    If flush is set to Z_BLOCK, a deflate block is completed and emitted, as
-  for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to
-  seven bits of the current block are held to be written as the next byte after
-  the next deflate block is completed.  In this case, the decompressor may not
-  be provided enough bits at this point in order to complete decompression of
-  the data provided so far to the compressor.  It may need to wait for the next
-  block to be emitted.  This is for advanced applications that need to control
-  the emission of deflate blocks.
-
-    If flush is set to Z_FULL_FLUSH, all output is flushed as with
-  Z_SYNC_FLUSH, and the compression state is reset so that decompression can
-  restart from this point if previous compressed data has been damaged or if
-  random access is desired.  Using Z_FULL_FLUSH too often can seriously degrade
-  compression.
-
-    If deflate returns with avail_out == 0, this function must be called again
-  with the same value of the flush parameter and more output space (updated
-  avail_out), until the flush is complete (deflate returns with non-zero
-  avail_out).  In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
-  avail_out is greater than six to avoid repeated flush markers due to
-  avail_out == 0 on return.
-
-    If the parameter flush is set to Z_FINISH, pending input is processed,
-  pending output is flushed and deflate returns with Z_STREAM_END if there was
-  enough output space.  If deflate returns with Z_OK or Z_BUF_ERROR, this
-  function must be called again with Z_FINISH and more output space (updated
-  avail_out) but no more input data, until it returns with Z_STREAM_END or an
-  error.  After deflate has returned Z_STREAM_END, the only possible operations
-  on the stream are deflateReset or deflateEnd.
-
-    Z_FINISH can be used in the first deflate call after deflateInit if all the
-  compression is to be done in a single step.  In order to complete in one
-  call, avail_out must be at least the value returned by deflateBound (see
-  below).  Then deflate is guaranteed to return Z_STREAM_END.  If not enough
-  output space is provided, deflate will not return Z_STREAM_END, and it must
-  be called again as described above.
-
-    deflate() sets strm->adler to the Adler-32 checksum of all input read
-  so far (that is, total_in bytes).  If a gzip stream is being generated, then
-  strm->adler will be the CRC-32 checksum of the input read so far.  (See
-  deflateInit2 below.)
-
-    deflate() may update strm->data_type if it can make a good guess about
-  the input data type (Z_BINARY or Z_TEXT).  If in doubt, the data is
-  considered binary.  This field is only for information purposes and does not
-  affect the compression algorithm in any manner.
-
-    deflate() returns Z_OK if some progress has been made (more input
-  processed or more output produced), Z_STREAM_END if all input has been
-  consumed and all output has been produced (only when flush is set to
-  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
-  if next_in or next_out was Z_NULL or the state was inadvertently written over
-  by the application), or Z_BUF_ERROR if no progress is possible (for example
-  avail_in or avail_out was zero).  Note that Z_BUF_ERROR is not fatal, and
-  deflate() can be called again with more input and more output space to
-  continue compressing.
-*/
-
-
-ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
-/*
-     All dynamically allocated data structures for this stream are freed.
-   This function discards any unprocessed input and does not flush any pending
-   output.
-
-     deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
-   stream state was inconsistent, Z_DATA_ERROR if the stream was freed
-   prematurely (some input or output was discarded).  In the error case, msg
-   may be set but then points to a static string (which must not be
-   deallocated).
-*/
-
-
-/*
-ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
-
-     Initializes the internal stream state for decompression.  The fields
-   next_in, avail_in, zalloc, zfree and opaque must be initialized before by
-   the caller.  In the current version of inflate, the provided input is not
-   read or consumed.  The allocation of a sliding window will be deferred to
-   the first call of inflate (if the decompression does not complete on the
-   first call).  If zalloc and zfree are set to Z_NULL, inflateInit updates
-   them to use default allocation functions.
-
-     inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
-   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
-   version assumed by the caller, or Z_STREAM_ERROR if the parameters are
-   invalid, such as a null pointer to the structure.  msg is set to null if
-   there is no error message.  inflateInit does not perform any decompression.
-   Actual decompression will be done by inflate().  So next_in, and avail_in,
-   next_out, and avail_out are unused and unchanged.  The current
-   implementation of inflateInit() does not process any header information --
-   that is deferred until inflate() is called.
-*/
-
-
-ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
-/*
-    inflate decompresses as much data as possible, and stops when the input
-  buffer becomes empty or the output buffer becomes full.  It may introduce
-  some output latency (reading input without producing any output) except when
-  forced to flush.
-
-  The detailed semantics are as follows.  inflate performs one or both of the
-  following actions:
-
-  - Decompress more input starting at next_in and update next_in and avail_in
-    accordingly.  If not all input can be processed (because there is not
-    enough room in the output buffer), then next_in and avail_in are updated
-    accordingly, and processing will resume at this point for the next call of
-    inflate().
-
-  - Generate more output starting at next_out and update next_out and avail_out
-    accordingly.  inflate() provides as much output as possible, until there is
-    no more input data or no more space in the output buffer (see below about
-    the flush parameter).
-
-    Before the call of inflate(), the application should ensure that at least
-  one of the actions is possible, by providing more input and/or consuming more
-  output, and updating the next_* and avail_* values accordingly.  If the
-  caller of inflate() does not provide both available input and available
-  output space, it is possible that there will be no progress made.  The
-  application can consume the uncompressed output when it wants, for example
-  when the output buffer is full (avail_out == 0), or after each call of
-  inflate().  If inflate returns Z_OK and with zero avail_out, it must be
-  called again after making room in the output buffer because there might be
-  more output pending.
-
-    The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH,
-  Z_BLOCK, or Z_TREES.  Z_SYNC_FLUSH requests that inflate() flush as much
-  output as possible to the output buffer.  Z_BLOCK requests that inflate()
-  stop if and when it gets to the next deflate block boundary.  When decoding
-  the zlib or gzip format, this will cause inflate() to return immediately
-  after the header and before the first block.  When doing a raw inflate,
-  inflate() will go ahead and process the first block, and will return when it
-  gets to the end of that block, or when it runs out of data.
-
-    The Z_BLOCK option assists in appending to or combining deflate streams.
-  To assist in this, on return inflate() always sets strm->data_type to the
-  number of unused bits in the last byte taken from strm->next_in, plus 64 if
-  inflate() is currently decoding the last block in the deflate stream, plus
-  128 if inflate() returned immediately after decoding an end-of-block code or
-  decoding the complete header up to just before the first byte of the deflate
-  stream.  The end-of-block will not be indicated until all of the uncompressed
-  data from that block has been written to strm->next_out.  The number of
-  unused bits may in general be greater than seven, except when bit 7 of
-  data_type is set, in which case the number of unused bits will be less than
-  eight.  data_type is set as noted here every time inflate() returns for all
-  flush options, and so can be used to determine the amount of currently
-  consumed input in bits.
-
-    The Z_TREES option behaves as Z_BLOCK does, but it also returns when the
-  end of each deflate block header is reached, before any actual data in that
-  block is decoded.  This allows the caller to determine the length of the
-  deflate block header for later use in random access within a deflate block.
-  256 is added to the value of strm->data_type when inflate() returns
-  immediately after reaching the end of the deflate block header.
-
-    inflate() should normally be called until it returns Z_STREAM_END or an
-  error.  However if all decompression is to be performed in a single step (a
-  single call of inflate), the parameter flush should be set to Z_FINISH.  In
-  this case all pending input is processed and all pending output is flushed;
-  avail_out must be large enough to hold all of the uncompressed data for the
-  operation to complete.  (The size of the uncompressed data may have been
-  saved by the compressor for this purpose.)  The use of Z_FINISH is not
-  required to perform an inflation in one step.  However it may be used to
-  inform inflate that a faster approach can be used for the single inflate()
-  call.  Z_FINISH also informs inflate to not maintain a sliding window if the
-  stream completes, which reduces inflate's memory footprint.  If the stream
-  does not complete, either because not all of the stream is provided or not
-  enough output space is provided, then a sliding window will be allocated and
-  inflate() can be called again to continue the operation as if Z_NO_FLUSH had
-  been used.
-
-     In this implementation, inflate() always flushes as much output as
-  possible to the output buffer, and always uses the faster approach on the
-  first call.  So the effects of the flush parameter in this implementation are
-  on the return value of inflate() as noted below, when inflate() returns early
-  when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of
-  memory for a sliding window when Z_FINISH is used.
-
-     If a preset dictionary is needed after this call (see inflateSetDictionary
-  below), inflate sets strm->adler to the Adler-32 checksum of the dictionary
-  chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
-  strm->adler to the Adler-32 checksum of all output produced so far (that is,
-  total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
-  below.  At the end of the stream, inflate() checks that its computed Adler-32
-  checksum is equal to that saved by the compressor and returns Z_STREAM_END
-  only if the checksum is correct.
-
-    inflate() can decompress and check either zlib-wrapped or gzip-wrapped
-  deflate data.  The header type is detected automatically, if requested when
-  initializing with inflateInit2().  Any information contained in the gzip
-  header is not retained unless inflateGetHeader() is used.  When processing
-  gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output
-  produced so far.  The CRC-32 is checked against the gzip trailer, as is the
-  uncompressed length, modulo 2^32.
-
-    inflate() returns Z_OK if some progress has been made (more input processed
-  or more output produced), Z_STREAM_END if the end of the compressed data has
-  been reached and all uncompressed output has been produced, Z_NEED_DICT if a
-  preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
-  corrupted (input stream not conforming to the zlib format or incorrect check
-  value, in which case strm->msg points to a string with a more specific
-  error), Z_STREAM_ERROR if the stream structure was inconsistent (for example
-  next_in or next_out was Z_NULL, or the state was inadvertently written over
-  by the application), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR
-  if no progress was possible or if there was not enough room in the output
-  buffer when Z_FINISH is used.  Note that Z_BUF_ERROR is not fatal, and
-  inflate() can be called again with more input and more output space to
-  continue decompressing.  If Z_DATA_ERROR is returned, the application may
-  then call inflateSync() to look for a good compression block if a partial
-  recovery of the data is to be attempted.
-*/
-
-
-ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
-/*
-     All dynamically allocated data structures for this stream are freed.
-   This function discards any unprocessed input and does not flush any pending
-   output.
-
-     inflateEnd returns Z_OK if success, or Z_STREAM_ERROR if the stream state
-   was inconsistent.
-*/
-
-
-                        /* Advanced functions */
-
-/*
-    The following functions are needed only in some special applications.
-*/
-
-/*
-ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
-                                     int  level,
-                                     int  method,
-                                     int  windowBits,
-                                     int  memLevel,
-                                     int  strategy));
-
-     This is another version of deflateInit with more compression options.  The
-   fields next_in, zalloc, zfree and opaque must be initialized before by the
-   caller.
-
-     The method parameter is the compression method.  It must be Z_DEFLATED in
-   this version of the library.
-
-     The windowBits parameter is the base two logarithm of the window size
-   (the size of the history buffer).  It should be in the range 8..15 for this
-   version of the library.  Larger values of this parameter result in better
-   compression at the expense of memory usage.  The default value is 15 if
-   deflateInit is used instead.
-
-     For the current implementation of deflate(), a windowBits value of 8 (a
-   window size of 256 bytes) is not supported.  As a result, a request for 8
-   will result in 9 (a 512-byte window).  In that case, providing 8 to
-   inflateInit2() will result in an error when the zlib header with 9 is
-   checked against the initialization of inflate().  The remedy is to not use 8
-   with deflateInit2() with this initialization, or at least in that case use 9
-   with inflateInit2().
-
-     windowBits can also be -8..-15 for raw deflate.  In this case, -windowBits
-   determines the window size.  deflate() will then generate raw deflate data
-   with no zlib header or trailer, and will not compute a check value.
-
-     windowBits can also be greater than 15 for optional gzip encoding.  Add
-   16 to windowBits to write a simple gzip header and trailer around the
-   compressed data instead of a zlib wrapper.  The gzip header will have no
-   file name, no extra data, no comment, no modification time (set to zero), no
-   header crc, and the operating system will be set to the appropriate value,
-   if the operating system was determined at compile time.  If a gzip stream is
-   being written, strm->adler is a CRC-32 instead of an Adler-32.
-
-     For raw deflate or gzip encoding, a request for a 256-byte window is
-   rejected as invalid, since only the zlib header provides a means of
-   transmitting the window size to the decompressor.
-
-     The memLevel parameter specifies how much memory should be allocated
-   for the internal compression state.  memLevel=1 uses minimum memory but is
-   slow and reduces compression ratio; memLevel=9 uses maximum memory for
-   optimal speed.  The default value is 8.  See zconf.h for total memory usage
-   as a function of windowBits and memLevel.
-
-     The strategy parameter is used to tune the compression algorithm.  Use the
-   value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
-   filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
-   string match), or Z_RLE to limit match distances to one (run-length
-   encoding).  Filtered data consists mostly of small values with a somewhat
-   random distribution.  In this case, the compression algorithm is tuned to
-   compress them better.  The effect of Z_FILTERED is to force more Huffman
-   coding and less string matching; it is somewhat intermediate between
-   Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY.  Z_RLE is designed to be almost as
-   fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data.  The
-   strategy parameter only affects the compression ratio but not the
-   correctness of the compressed output even if it is not set appropriately.
-   Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler
-   decoder for special applications.
-
-     deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
-   memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid
-   method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is
-   incompatible with the version assumed by the caller (ZLIB_VERSION).  msg is
-   set to null if there is no error message.  deflateInit2 does not perform any
-   compression: this will be done by deflate().
-*/
-
-ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
-                                             const Bytef *dictionary,
-                                             uInt  dictLength));
-/*
-     Initializes the compression dictionary from the given byte sequence
-   without producing any compressed output.  When using the zlib format, this
-   function must be called immediately after deflateInit, deflateInit2 or
-   deflateReset, and before any call of deflate.  When doing raw deflate, this
-   function must be called either before any call of deflate, or immediately
-   after the completion of a deflate block, i.e. after all input has been
-   consumed and all output has been delivered when using any of the flush
-   options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH.  The
-   compressor and decompressor must use exactly the same dictionary (see
-   inflateSetDictionary).
-
-     The dictionary should consist of strings (byte sequences) that are likely
-   to be encountered later in the data to be compressed, with the most commonly
-   used strings preferably put towards the end of the dictionary.  Using a
-   dictionary is most useful when the data to be compressed is short and can be
-   predicted with good accuracy; the data can then be compressed better than
-   with the default empty dictionary.
-
-     Depending on the size of the compression data structures selected by
-   deflateInit or deflateInit2, a part of the dictionary may in effect be
-   discarded, for example if the dictionary is larger than the window size
-   provided in deflateInit or deflateInit2.  Thus the strings most likely to be
-   useful should be put at the end of the dictionary, not at the front.  In
-   addition, the current implementation of deflate will use at most the window
-   size minus 262 bytes of the provided dictionary.
-
-     Upon return of this function, strm->adler is set to the Adler-32 value
-   of the dictionary; the decompressor may later use this value to determine
-   which dictionary has been used by the compressor.  (The Adler-32 value
-   applies to the whole dictionary even if only a subset of the dictionary is
-   actually used by the compressor.) If a raw deflate was requested, then the
-   Adler-32 value is not computed and strm->adler is not set.
-
-     deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
-   parameter is invalid (e.g.  dictionary being Z_NULL) or the stream state is
-   inconsistent (for example if deflate has already been called for this stream
-   or if not at a block boundary for raw deflate).  deflateSetDictionary does
-   not perform any compression: this will be done by deflate().
-*/
-
-ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm,
-                                             Bytef *dictionary,
-                                             uInt  *dictLength));
-/*
-     Returns the sliding dictionary being maintained by deflate.  dictLength is
-   set to the number of bytes in the dictionary, and that many bytes are copied
-   to dictionary.  dictionary must have enough space, where 32768 bytes is
-   always enough.  If deflateGetDictionary() is called with dictionary equal to
-   Z_NULL, then only the dictionary length is returned, and nothing is copied.
-   Similary, if dictLength is Z_NULL, then it is not set.
-
-     deflateGetDictionary() may return a length less than the window size, even
-   when more than the window size in input has been provided. It may return up
-   to 258 bytes less in that case, due to how zlib's implementation of deflate
-   manages the sliding window and lookahead for matches, where matches can be
-   up to 258 bytes long. If the application needs the last window-size bytes of
-   input, then that would need to be saved by the application outside of zlib.
-
-     deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
-   stream state is inconsistent.
-*/
-
-ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
-                                    z_streamp source));
-/*
-     Sets the destination stream as a complete copy of the source stream.
-
-     This function can be useful when several compression strategies will be
-   tried, for example when there are several ways of pre-processing the input
-   data with a filter.  The streams that will be discarded should then be freed
-   by calling deflateEnd.  Note that deflateCopy duplicates the internal
-   compression state which can be quite large, so this strategy is slow and can
-   consume lots of memory.
-
-     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
-   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
-   (such as zalloc being Z_NULL).  msg is left unchanged in both source and
-   destination.
-*/
-
-ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
-/*
-     This function is equivalent to deflateEnd followed by deflateInit, but
-   does not free and reallocate the internal compression state.  The stream
-   will leave the compression level and any other attributes that may have been
-   set unchanged.
-
-     deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
-   stream state was inconsistent (such as zalloc or state being Z_NULL).
-*/
-
-ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
-                                      int level,
-                                      int strategy));
-/*
-     Dynamically update the compression level and compression strategy.  The
-   interpretation of level and strategy is as in deflateInit2().  This can be
-   used to switch between compression and straight copy of the input data, or
-   to switch to a different kind of input data requiring a different strategy.
-   If the compression approach (which is a function of the level) or the
-   strategy is changed, and if any input has been consumed in a previous
-   deflate() call, then the input available so far is compressed with the old
-   level and strategy using deflate(strm, Z_BLOCK).  There are three approaches
-   for the compression levels 0, 1..3, and 4..9 respectively.  The new level
-   and strategy will take effect at the next call of deflate().
-
-     If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does
-   not have enough output space to complete, then the parameter change will not
-   take effect.  In this case, deflateParams() can be called again with the
-   same parameters and more output space to try again.
-
-     In order to assure a change in the parameters on the first try, the
-   deflate stream should be flushed using deflate() with Z_BLOCK or other flush
-   request until strm.avail_out is not zero, before calling deflateParams().
-   Then no more input data should be provided before the deflateParams() call.
-   If this is done, the old level and strategy will be applied to the data
-   compressed before deflateParams(), and the new level and strategy will be
-   applied to the the data compressed after deflateParams().
-
-     deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream
-   state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if
-   there was not enough output space to complete the compression of the
-   available input data before a change in the strategy or approach.  Note that
-   in the case of a Z_BUF_ERROR, the parameters are not changed.  A return
-   value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be
-   retried with more output space.
-*/
-
-ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
-                                    int good_length,
-                                    int max_lazy,
-                                    int nice_length,
-                                    int max_chain));
-/*
-     Fine tune deflate's internal compression parameters.  This should only be
-   used by someone who understands the algorithm used by zlib's deflate for
-   searching for the best matching string, and even then only by the most
-   fanatic optimizer trying to squeeze out the last compressed bit for their
-   specific input data.  Read the deflate.c source code for the meaning of the
-   max_lazy, good_length, nice_length, and max_chain parameters.
-
-     deflateTune() can be called after deflateInit() or deflateInit2(), and
-   returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
- */
-
-ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
-                                       uLong sourceLen));
-/*
-     deflateBound() returns an upper bound on the compressed size after
-   deflation of sourceLen bytes.  It must be called after deflateInit() or
-   deflateInit2(), and after deflateSetHeader(), if used.  This would be used
-   to allocate an output buffer for deflation in a single pass, and so would be
-   called before deflate().  If that first deflate() call is provided the
-   sourceLen input bytes, an output buffer allocated to the size returned by
-   deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed
-   to return Z_STREAM_END.  Note that it is possible for the compressed size to
-   be larger than the value returned by deflateBound() if flush options other
-   than Z_FINISH or Z_NO_FLUSH are used.
-*/
-
-ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm,
-                                       unsigned *pending,
-                                       int *bits));
-/*
-     deflatePending() returns the number of bytes and bits of output that have
-   been generated, but not yet provided in the available output.  The bytes not
-   provided would be due to the available output space having being consumed.
-   The number of bits of output not provided are between 0 and 7, where they
-   await more bits to join them in order to fill out a full byte.  If pending
-   or bits are Z_NULL, then those values are not set.
-
-     deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source
-   stream state was inconsistent.
- */
-
-ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
-                                     int bits,
-                                     int value));
-/*
-     deflatePrime() inserts bits in the deflate output stream.  The intent
-   is that this function is used to start off the deflate output with the bits
-   leftover from a previous deflate stream when appending to it.  As such, this
-   function can only be used for raw deflate, and must be used before the first
-   deflate() call after a deflateInit2() or deflateReset().  bits must be less
-   than or equal to 16, and that many of the least significant bits of value
-   will be inserted in the output.
-
-     deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough
-   room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the
-   source stream state was inconsistent.
-*/
-
-ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
-                                         gz_headerp head));
-/*
-     deflateSetHeader() provides gzip header information for when a gzip
-   stream is requested by deflateInit2().  deflateSetHeader() may be called
-   after deflateInit2() or deflateReset() and before the first call of
-   deflate().  The text, time, os, extra field, name, and comment information
-   in the provided gz_header structure are written to the gzip header (xflag is
-   ignored -- the extra flags are set according to the compression level).  The
-   caller must assure that, if not Z_NULL, name and comment are terminated with
-   a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
-   available there.  If hcrc is true, a gzip header crc is included.  Note that
-   the current versions of the command-line version of gzip (up through version
-   1.3.x) do not support header crc's, and will report that it is a "multi-part
-   gzip file" and give up.
-
-     If deflateSetHeader is not used, the default gzip header has text false,
-   the time set to zero, and os set to 255, with no extra, name, or comment
-   fields.  The gzip header is returned to the default state by deflateReset().
-
-     deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
-   stream state was inconsistent.
-*/
-
-/*
-ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
-                                     int  windowBits));
-
-     This is another version of inflateInit with an extra parameter.  The
-   fields next_in, avail_in, zalloc, zfree and opaque must be initialized
-   before by the caller.
-
-     The windowBits parameter is the base two logarithm of the maximum window
-   size (the size of the history buffer).  It should be in the range 8..15 for
-   this version of the library.  The default value is 15 if inflateInit is used
-   instead.  windowBits must be greater than or equal to the windowBits value
-   provided to deflateInit2() while compressing, or it must be equal to 15 if
-   deflateInit2() was not used.  If a compressed stream with a larger window
-   size is given as input, inflate() will return with the error code
-   Z_DATA_ERROR instead of trying to allocate a larger window.
-
-     windowBits can also be zero to request that inflate use the window size in
-   the zlib header of the compressed stream.
-
-     windowBits can also be -8..-15 for raw inflate.  In this case, -windowBits
-   determines the window size.  inflate() will then process raw deflate data,
-   not looking for a zlib or gzip header, not generating a check value, and not
-   looking for any check values for comparison at the end of the stream.  This
-   is for use with other formats that use the deflate compressed data format
-   such as zip.  Those formats provide their own check values.  If a custom
-   format is developed using the raw deflate format for compressed data, it is
-   recommended that a check value such as an Adler-32 or a CRC-32 be applied to
-   the uncompressed data as is done in the zlib, gzip, and zip formats.  For
-   most applications, the zlib format should be used as is.  Note that comments
-   above on the use in deflateInit2() applies to the magnitude of windowBits.
-
-     windowBits can also be greater than 15 for optional gzip decoding.  Add
-   32 to windowBits to enable zlib and gzip decoding with automatic header
-   detection, or add 16 to decode only the gzip format (the zlib format will
-   return a Z_DATA_ERROR).  If a gzip stream is being decoded, strm->adler is a
-   CRC-32 instead of an Adler-32.  Unlike the gunzip utility and gzread() (see
-   below), inflate() will not automatically decode concatenated gzip streams.
-   inflate() will return Z_STREAM_END at the end of the gzip stream.  The state
-   would need to be reset to continue decoding a subsequent gzip stream.
-
-     inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
-   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
-   version assumed by the caller, or Z_STREAM_ERROR if the parameters are
-   invalid, such as a null pointer to the structure.  msg is set to null if
-   there is no error message.  inflateInit2 does not perform any decompression
-   apart from possibly reading the zlib header if present: actual decompression
-   will be done by inflate().  (So next_in and avail_in may be modified, but
-   next_out and avail_out are unused and unchanged.) The current implementation
-   of inflateInit2() does not process any header information -- that is
-   deferred until inflate() is called.
-*/
-
-ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
-                                             const Bytef *dictionary,
-                                             uInt  dictLength));
-/*
-     Initializes the decompression dictionary from the given uncompressed byte
-   sequence.  This function must be called immediately after a call of inflate,
-   if that call returned Z_NEED_DICT.  The dictionary chosen by the compressor
-   can be determined from the Adler-32 value returned by that call of inflate.
-   The compressor and decompressor must use exactly the same dictionary (see
-   deflateSetDictionary).  For raw inflate, this function can be called at any
-   time to set the dictionary.  If the provided dictionary is smaller than the
-   window and there is already data in the window, then the provided dictionary
-   will amend what's there.  The application must insure that the dictionary
-   that was used for compression is provided.
-
-     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
-   parameter is invalid (e.g.  dictionary being Z_NULL) or the stream state is
-   inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
-   expected one (incorrect Adler-32 value).  inflateSetDictionary does not
-   perform any decompression: this will be done by subsequent calls of
-   inflate().
-*/
-
-ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm,
-                                             Bytef *dictionary,
-                                             uInt  *dictLength));
-/*
-     Returns the sliding dictionary being maintained by inflate.  dictLength is
-   set to the number of bytes in the dictionary, and that many bytes are copied
-   to dictionary.  dictionary must have enough space, where 32768 bytes is
-   always enough.  If inflateGetDictionary() is called with dictionary equal to
-   Z_NULL, then only the dictionary length is returned, and nothing is copied.
-   Similary, if dictLength is Z_NULL, then it is not set.
-
-     inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
-   stream state is inconsistent.
-*/
-
-ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
-/*
-     Skips invalid compressed data until a possible full flush point (see above
-   for the description of deflate with Z_FULL_FLUSH) can be found, or until all
-   available input is skipped.  No output is provided.
-
-     inflateSync searches for a 00 00 FF FF pattern in the compressed data.
-   All full flush points have this pattern, but not all occurrences of this
-   pattern are full flush points.
-
-     inflateSync returns Z_OK if a possible full flush point has been found,
-   Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point
-   has been found, or Z_STREAM_ERROR if the stream structure was inconsistent.
-   In the success case, the application may save the current current value of
-   total_in which indicates where valid compressed data was found.  In the
-   error case, the application may repeatedly call inflateSync, providing more
-   input each time, until success or end of the input data.
-*/
-
-ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
-                                    z_streamp source));
-/*
-     Sets the destination stream as a complete copy of the source stream.
-
-     This function can be useful when randomly accessing a large stream.  The
-   first pass through the stream can periodically record the inflate state,
-   allowing restarting inflate at those points when randomly accessing the
-   stream.
-
-     inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
-   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
-   (such as zalloc being Z_NULL).  msg is left unchanged in both source and
-   destination.
-*/
-
-ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
-/*
-     This function is equivalent to inflateEnd followed by inflateInit,
-   but does not free and reallocate the internal decompression state.  The
-   stream will keep attributes that may have been set by inflateInit2.
-
-     inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
-   stream state was inconsistent (such as zalloc or state being Z_NULL).
-*/
-
-ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
-                                      int windowBits));
-/*
-     This function is the same as inflateReset, but it also permits changing
-   the wrap and window size requests.  The windowBits parameter is interpreted
-   the same as it is for inflateInit2.  If the window size is changed, then the
-   memory allocated for the window is freed, and the window will be reallocated
-   by inflate() if needed.
-
-     inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source
-   stream state was inconsistent (such as zalloc or state being Z_NULL), or if
-   the windowBits parameter is invalid.
-*/
-
-ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
-                                     int bits,
-                                     int value));
-/*
-     This function inserts bits in the inflate input stream.  The intent is
-   that this function is used to start inflating at a bit position in the
-   middle of a byte.  The provided bits will be used before any bytes are used
-   from next_in.  This function should only be used with raw inflate, and
-   should be used before the first inflate() call after inflateInit2() or
-   inflateReset().  bits must be less than or equal to 16, and that many of the
-   least significant bits of value will be inserted in the input.
-
-     If bits is negative, then the input stream bit buffer is emptied.  Then
-   inflatePrime() can be called again to put bits in the buffer.  This is used
-   to clear out bits leftover after feeding inflate a block description prior
-   to feeding inflate codes.
-
-     inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
-   stream state was inconsistent.
-*/
-
-ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
-/*
-     This function returns two values, one in the lower 16 bits of the return
-   value, and the other in the remaining upper bits, obtained by shifting the
-   return value down 16 bits.  If the upper value is -1 and the lower value is
-   zero, then inflate() is currently decoding information outside of a block.
-   If the upper value is -1 and the lower value is non-zero, then inflate is in
-   the middle of a stored block, with the lower value equaling the number of
-   bytes from the input remaining to copy.  If the upper value is not -1, then
-   it is the number of bits back from the current bit position in the input of
-   the code (literal or length/distance pair) currently being processed.  In
-   that case the lower value is the number of bytes already emitted for that
-   code.
-
-     A code is being processed if inflate is waiting for more input to complete
-   decoding of the code, or if it has completed decoding but is waiting for
-   more output space to write the literal or match data.
-
-     inflateMark() is used to mark locations in the input data for random
-   access, which may be at bit positions, and to note those cases where the
-   output of a code may span boundaries of random access blocks.  The current
-   location in the input stream can be determined from avail_in and data_type
-   as noted in the description for the Z_BLOCK flush parameter for inflate.
-
-     inflateMark returns the value noted above, or -65536 if the provided
-   source stream state was inconsistent.
-*/
-
-ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
-                                         gz_headerp head));
-/*
-     inflateGetHeader() requests that gzip header information be stored in the
-   provided gz_header structure.  inflateGetHeader() may be called after
-   inflateInit2() or inflateReset(), and before the first call of inflate().
-   As inflate() processes the gzip stream, head->done is zero until the header
-   is completed, at which time head->done is set to one.  If a zlib stream is
-   being decoded, then head->done is set to -1 to indicate that there will be
-   no gzip header information forthcoming.  Note that Z_BLOCK or Z_TREES can be
-   used to force inflate() to return immediately after header processing is
-   complete and before any actual data is decompressed.
-
-     The text, time, xflags, and os fields are filled in with the gzip header
-   contents.  hcrc is set to true if there is a header CRC.  (The header CRC
-   was valid if done is set to one.) If extra is not Z_NULL, then extra_max
-   contains the maximum number of bytes to write to extra.  Once done is true,
-   extra_len contains the actual extra field length, and extra contains the
-   extra field, or that field truncated if extra_max is less than extra_len.
-   If name is not Z_NULL, then up to name_max characters are written there,
-   terminated with a zero unless the length is greater than name_max.  If
-   comment is not Z_NULL, then up to comm_max characters are written there,
-   terminated with a zero unless the length is greater than comm_max.  When any
-   of extra, name, or comment are not Z_NULL and the respective field is not
-   present in the header, then that field is set to Z_NULL to signal its
-   absence.  This allows the use of deflateSetHeader() with the returned
-   structure to duplicate the header.  However if those fields are set to
-   allocated memory, then the application will need to save those pointers
-   elsewhere so that they can be eventually freed.
-
-     If inflateGetHeader is not used, then the header information is simply
-   discarded.  The header is always checked for validity, including the header
-   CRC if present.  inflateReset() will reset the process to discard the header
-   information.  The application would need to call inflateGetHeader() again to
-   retrieve the header from the next gzip stream.
-
-     inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
-   stream state was inconsistent.
-*/
-
-/*
-ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
-                                        unsigned char FAR *window));
-
-     Initialize the internal stream state for decompression using inflateBack()
-   calls.  The fields zalloc, zfree and opaque in strm must be initialized
-   before the call.  If zalloc and zfree are Z_NULL, then the default library-
-   derived memory allocation routines are used.  windowBits is the base two
-   logarithm of the window size, in the range 8..15.  window is a caller
-   supplied buffer of that size.  Except for special applications where it is
-   assured that deflate was used with small window sizes, windowBits must be 15
-   and a 32K byte window must be supplied to be able to decompress general
-   deflate streams.
-
-     See inflateBack() for the usage of these routines.
-
-     inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
-   the parameters are invalid, Z_MEM_ERROR if the internal state could not be
-   allocated, or Z_VERSION_ERROR if the version of the library does not match
-   the version of the header file.
-*/
-
-typedef unsigned (*in_func) OF((void FAR *,
-                                z_const unsigned char FAR * FAR *));
-typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
-
-ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
-                                    in_func in, void FAR *in_desc,
-                                    out_func out, void FAR *out_desc));
-/*
-     inflateBack() does a raw inflate with a single call using a call-back
-   interface for input and output.  This is potentially more efficient than
-   inflate() for file i/o applications, in that it avoids copying between the
-   output and the sliding window by simply making the window itself the output
-   buffer.  inflate() can be faster on modern CPUs when used with large
-   buffers.  inflateBack() trusts the application to not change the output
-   buffer passed by the output function, at least until inflateBack() returns.
-
-     inflateBackInit() must be called first to allocate the internal state
-   and to initialize the state with the user-provided window buffer.
-   inflateBack() may then be used multiple times to inflate a complete, raw
-   deflate stream with each call.  inflateBackEnd() is then called to free the
-   allocated state.
-
-     A raw deflate stream is one with no zlib or gzip header or trailer.
-   This routine would normally be used in a utility that reads zip or gzip
-   files and writes out uncompressed files.  The utility would decode the
-   header and process the trailer on its own, hence this routine expects only
-   the raw deflate stream to decompress.  This is different from the default
-   behavior of inflate(), which expects a zlib header and trailer around the
-   deflate stream.
-
-     inflateBack() uses two subroutines supplied by the caller that are then
-   called by inflateBack() for input and output.  inflateBack() calls those
-   routines until it reads a complete deflate stream and writes out all of the
-   uncompressed data, or until it encounters an error.  The function's
-   parameters and return types are defined above in the in_func and out_func
-   typedefs.  inflateBack() will call in(in_desc, &buf) which should return the
-   number of bytes of provided input, and a pointer to that input in buf.  If
-   there is no input available, in() must return zero -- buf is ignored in that
-   case -- and inflateBack() will return a buffer error.  inflateBack() will
-   call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].
-   out() should return zero on success, or non-zero on failure.  If out()
-   returns non-zero, inflateBack() will return with an error.  Neither in() nor
-   out() are permitted to change the contents of the window provided to
-   inflateBackInit(), which is also the buffer that out() uses to write from.
-   The length written by out() will be at most the window size.  Any non-zero
-   amount of input may be provided by in().
-
-     For convenience, inflateBack() can be provided input on the first call by
-   setting strm->next_in and strm->avail_in.  If that input is exhausted, then
-   in() will be called.  Therefore strm->next_in must be initialized before
-   calling inflateBack().  If strm->next_in is Z_NULL, then in() will be called
-   immediately for input.  If strm->next_in is not Z_NULL, then strm->avail_in
-   must also be initialized, and then if strm->avail_in is not zero, input will
-   initially be taken from strm->next_in[0 ..  strm->avail_in - 1].
-
-     The in_desc and out_desc parameters of inflateBack() is passed as the
-   first parameter of in() and out() respectively when they are called.  These
-   descriptors can be optionally used to pass any information that the caller-
-   supplied in() and out() functions need to do their job.
-
-     On return, inflateBack() will set strm->next_in and strm->avail_in to
-   pass back any unused input that was provided by the last in() call.  The
-   return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
-   if in() or out() returned an error, Z_DATA_ERROR if there was a format error
-   in the deflate stream (in which case strm->msg is set to indicate the nature
-   of the error), or Z_STREAM_ERROR if the stream was not properly initialized.
-   In the case of Z_BUF_ERROR, an input or output error can be distinguished
-   using strm->next_in which will be Z_NULL only if in() returned an error.  If
-   strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning
-   non-zero.  (in() will always be called before out(), so strm->next_in is
-   assured to be defined if out() returns non-zero.)  Note that inflateBack()
-   cannot return Z_OK.
-*/
-
-ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
-/*
-     All memory allocated by inflateBackInit() is freed.
-
-     inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
-   state was inconsistent.
-*/
-
-ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
-/* Return flags indicating compile-time options.
-
-    Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
-     1.0: size of uInt
-     3.2: size of uLong
-     5.4: size of voidpf (pointer)
-     7.6: size of z_off_t
-
-    Compiler, assembler, and debug options:
-     8: ZLIB_DEBUG
-     9: ASMV or ASMINF -- use ASM code
-     10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
-     11: 0 (reserved)
-
-    One-time table building (smaller code, but not thread-safe if true):
-     12: BUILDFIXED -- build static block decoding tables when needed
-     13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
-     14,15: 0 (reserved)
-
-    Library content (indicates missing functionality):
-     16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
-                          deflate code when not needed)
-     17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
-                    and decode gzip streams (to avoid linking crc code)
-     18-19: 0 (reserved)
-
-    Operation variations (changes in library functionality):
-     20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
-     21: FASTEST -- deflate algorithm with only one, lowest compression level
-     22,23: 0 (reserved)
-
-    The sprintf variant used by gzprintf (zero is best):
-     24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
-     25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
-     26: 0 = returns value, 1 = void -- 1 means inferred string length returned
-
-    Remainder:
-     27-31: 0 (reserved)
- */
-
-#ifndef Z_SOLO
-
-                        /* utility functions */
-
-/*
-     The following utility functions are implemented on top of the basic
-   stream-oriented functions.  To simplify the interface, some default options
-   are assumed (compression level and memory usage, standard memory allocation
-   functions).  The source code of these utility functions can be modified if
-   you need special options.
-*/
-
-ZEXTERN int ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,
-                                 const Bytef *source, uLong sourceLen));
-/*
-     Compresses the source buffer into the destination buffer.  sourceLen is
-   the byte length of the source buffer.  Upon entry, destLen is the total size
-   of the destination buffer, which must be at least the value returned by
-   compressBound(sourceLen).  Upon exit, destLen is the actual size of the
-   compressed data.  compress() is equivalent to compress2() with a level
-   parameter of Z_DEFAULT_COMPRESSION.
-
-     compress returns Z_OK if success, Z_MEM_ERROR if there was not
-   enough memory, Z_BUF_ERROR if there was not enough room in the output
-   buffer.
-*/
-
-ZEXTERN int ZEXPORT compress2 OF((Bytef *dest,   uLongf *destLen,
-                                  const Bytef *source, uLong sourceLen,
-                                  int level));
-/*
-     Compresses the source buffer into the destination buffer.  The level
-   parameter has the same meaning as in deflateInit.  sourceLen is the byte
-   length of the source buffer.  Upon entry, destLen is the total size of the
-   destination buffer, which must be at least the value returned by
-   compressBound(sourceLen).  Upon exit, destLen is the actual size of the
-   compressed data.
-
-     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
-   memory, Z_BUF_ERROR if there was not enough room in the output buffer,
-   Z_STREAM_ERROR if the level parameter is invalid.
-*/
-
-ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
-/*
-     compressBound() returns an upper bound on the compressed size after
-   compress() or compress2() on sourceLen bytes.  It would be used before a
-   compress() or compress2() call to allocate the destination buffer.
-*/
-
-ZEXTERN int ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,
-                                   const Bytef *source, uLong sourceLen));
-/*
-     Decompresses the source buffer into the destination buffer.  sourceLen is
-   the byte length of the source buffer.  Upon entry, destLen is the total size
-   of the destination buffer, which must be large enough to hold the entire
-   uncompressed data.  (The size of the uncompressed data must have been saved
-   previously by the compressor and transmitted to the decompressor by some
-   mechanism outside the scope of this compression library.) Upon exit, destLen
-   is the actual size of the uncompressed data.
-
-     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
-   enough memory, Z_BUF_ERROR if there was not enough room in the output
-   buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.  In
-   the case where there is not enough room, uncompress() will fill the output
-   buffer with the uncompressed data up to that point.
-*/
-
-ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest,   uLongf *destLen,
-                                    const Bytef *source, uLong *sourceLen));
-/*
-     Same as uncompress, except that sourceLen is a pointer, where the
-   length of the source is *sourceLen.  On return, *sourceLen is the number of
-   source bytes consumed.
-*/
-
-                        /* gzip file access functions */
-
-/*
-     This library supports reading and writing files in gzip (.gz) format with
-   an interface similar to that of stdio, using the functions that start with
-   "gz".  The gzip format is different from the zlib format.  gzip is a gzip
-   wrapper, documented in RFC 1952, wrapped around a deflate stream.
-*/
-
-typedef struct gzFile_s *gzFile;    /* semi-opaque gzip file descriptor */
-
-/*
-ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
-
-     Opens a gzip (.gz) file for reading or writing.  The mode parameter is as
-   in fopen ("rb" or "wb") but can also include a compression level ("wb9") or
-   a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only
-   compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F'
-   for fixed code compression as in "wb9F".  (See the description of
-   deflateInit2 for more information about the strategy parameter.)  'T' will
-   request transparent writing or appending with no compression and not using
-   the gzip format.
-
-     "a" can be used instead of "w" to request that the gzip stream that will
-   be written be appended to the file.  "+" will result in an error, since
-   reading and writing to the same gzip file is not supported.  The addition of
-   "x" when writing will create the file exclusively, which fails if the file
-   already exists.  On systems that support it, the addition of "e" when
-   reading or writing will set the flag to close the file on an execve() call.
-
-     These functions, as well as gzip, will read and decode a sequence of gzip
-   streams in a file.  The append function of gzopen() can be used to create
-   such a file.  (Also see gzflush() for another way to do this.)  When
-   appending, gzopen does not test whether the file begins with a gzip stream,
-   nor does it look for the end of the gzip streams to begin appending.  gzopen
-   will simply append a gzip stream to the existing file.
-
-     gzopen can be used to read a file which is not in gzip format; in this
-   case gzread will directly read from the file without decompression.  When
-   reading, this will be detected automatically by looking for the magic two-
-   byte gzip header.
-
-     gzopen returns NULL if the file could not be opened, if there was
-   insufficient memory to allocate the gzFile state, or if an invalid mode was
-   specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).
-   errno can be checked to determine if the reason gzopen failed was that the
-   file could not be opened.
-*/
-
-ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
-/*
-     gzdopen associates a gzFile with the file descriptor fd.  File descriptors
-   are obtained from calls like open, dup, creat, pipe or fileno (if the file
-   has been previously opened with fopen).  The mode parameter is as in gzopen.
-
-     The next call of gzclose on the returned gzFile will also close the file
-   descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
-   fd.  If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd,
-   mode);.  The duplicated descriptor should be saved to avoid a leak, since
-   gzdopen does not close fd if it fails.  If you are using fileno() to get the
-   file descriptor from a FILE *, then you will have to use dup() to avoid
-   double-close()ing the file descriptor.  Both gzclose() and fclose() will
-   close the associated file descriptor, so they need to have different file
-   descriptors.
-
-     gzdopen returns NULL if there was insufficient memory to allocate the
-   gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not
-   provided, or '+' was provided), or if fd is -1.  The file descriptor is not
-   used until the next gz* read, write, seek, or close operation, so gzdopen
-   will not detect if fd is invalid (unless fd is -1).
-*/
-
-ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
-/*
-     Set the internal buffer size used by this library's functions.  The
-   default buffer size is 8192 bytes.  This function must be called after
-   gzopen() or gzdopen(), and before any other calls that read or write the
-   file.  The buffer memory allocation is always deferred to the first read or
-   write.  Three times that size in buffer space is allocated.  A larger buffer
-   size of, for example, 64K or 128K bytes will noticeably increase the speed
-   of decompression (reading).
-
-     The new buffer size also affects the maximum length for gzprintf().
-
-     gzbuffer() returns 0 on success, or -1 on failure, such as being called
-   too late.
-*/
-
-ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
-/*
-     Dynamically update the compression level or strategy.  See the description
-   of deflateInit2 for the meaning of these parameters.  Previously provided
-   data is flushed before the parameter change.
-
-     gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not
-   opened for writing, Z_ERRNO if there is an error writing the flushed data,
-   or Z_MEM_ERROR if there is a memory allocation error.
-*/
-
-ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
-/*
-     Reads the given number of uncompressed bytes from the compressed file.  If
-   the input file is not in gzip format, gzread copies the given number of
-   bytes into the buffer directly from the file.
-
-     After reaching the end of a gzip stream in the input, gzread will continue
-   to read, looking for another gzip stream.  Any number of gzip streams may be
-   concatenated in the input file, and will all be decompressed by gzread().
-   If something other than a gzip stream is encountered after a gzip stream,
-   that remaining trailing garbage is ignored (and no error is returned).
-
-     gzread can be used to read a gzip file that is being concurrently written.
-   Upon reaching the end of the input, gzread will return with the available
-   data.  If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then
-   gzclearerr can be used to clear the end of file indicator in order to permit
-   gzread to be tried again.  Z_OK indicates that a gzip stream was completed
-   on the last gzread.  Z_BUF_ERROR indicates that the input file ended in the
-   middle of a gzip stream.  Note that gzread does not return -1 in the event
-   of an incomplete gzip stream.  This error is deferred until gzclose(), which
-   will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip
-   stream.  Alternatively, gzerror can be used before gzclose to detect this
-   case.
-
-     gzread returns the number of uncompressed bytes actually read, less than
-   len for end of file, or -1 for error.  If len is too large to fit in an int,
-   then nothing is read, -1 is returned, and the error state is set to
-   Z_STREAM_ERROR.
-*/
-
-ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems,
-                                     gzFile file));
-/*
-     Read up to nitems items of size size from file to buf, otherwise operating
-   as gzread() does.  This duplicates the interface of stdio's fread(), with
-   size_t request and return types.  If the library defines size_t, then
-   z_size_t is identical to size_t.  If not, then z_size_t is an unsigned
-   integer type that can contain a pointer.
-
-     gzfread() returns the number of full items read of size size, or zero if
-   the end of the file was reached and a full item could not be read, or if
-   there was an error.  gzerror() must be consulted if zero is returned in
-   order to determine if there was an error.  If the multiplication of size and
-   nitems overflows, i.e. the product does not fit in a z_size_t, then nothing
-   is read, zero is returned, and the error state is set to Z_STREAM_ERROR.
-
-     In the event that the end of file is reached and only a partial item is
-   available at the end, i.e. the remaining uncompressed data length is not a
-   multiple of size, then the final partial item is nevetheless read into buf
-   and the end-of-file flag is set.  The length of the partial item read is not
-   provided, but could be inferred from the result of gztell().  This behavior
-   is the same as the behavior of fread() implementations in common libraries,
-   but it prevents the direct use of gzfread() to read a concurrently written
-   file, reseting and retrying on end-of-file, when size is not 1.
-*/
-
-ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
-                                voidpc buf, unsigned len));
-/*
-     Writes the given number of uncompressed bytes into the compressed file.
-   gzwrite returns the number of uncompressed bytes written or 0 in case of
-   error.
-*/
-
-ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size,
-                                      z_size_t nitems, gzFile file));
-/*
-     gzfwrite() writes nitems items of size size from buf to file, duplicating
-   the interface of stdio's fwrite(), with size_t request and return types.  If
-   the library defines size_t, then z_size_t is identical to size_t.  If not,
-   then z_size_t is an unsigned integer type that can contain a pointer.
-
-     gzfwrite() returns the number of full items written of size size, or zero
-   if there was an error.  If the multiplication of size and nitems overflows,
-   i.e. the product does not fit in a z_size_t, then nothing is written, zero
-   is returned, and the error state is set to Z_STREAM_ERROR.
-*/
-
-ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...));
-/*
-     Converts, formats, and writes the arguments to the compressed file under
-   control of the format string, as in fprintf.  gzprintf returns the number of
-   uncompressed bytes actually written, or a negative zlib error code in case
-   of error.  The number of uncompressed bytes written is limited to 8191, or
-   one less than the buffer size given to gzbuffer().  The caller should assure
-   that this limit is not exceeded.  If it is exceeded, then gzprintf() will
-   return an error (0) with nothing written.  In this case, there may also be a
-   buffer overflow with unpredictable consequences, which is possible only if
-   zlib was compiled with the insecure functions sprintf() or vsprintf()
-   because the secure snprintf() or vsnprintf() functions were not available.
-   This can be determined using zlibCompileFlags().
-*/
-
-ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
-/*
-     Writes the given null-terminated string to the compressed file, excluding
-   the terminating null character.
-
-     gzputs returns the number of characters written, or -1 in case of error.
-*/
-
-ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
-/*
-     Reads bytes from the compressed file until len-1 characters are read, or a
-   newline character is read and transferred to buf, or an end-of-file
-   condition is encountered.  If any characters are read or if len == 1, the
-   string is terminated with a null character.  If no characters are read due
-   to an end-of-file or len < 1, then the buffer is left untouched.
-
-     gzgets returns buf which is a null-terminated string, or it returns NULL
-   for end-of-file or in case of error.  If there was an error, the contents at
-   buf are indeterminate.
-*/
-
-ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
-/*
-     Writes c, converted to an unsigned char, into the compressed file.  gzputc
-   returns the value that was written, or -1 in case of error.
-*/
-
-ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
-/*
-     Reads one byte from the compressed file.  gzgetc returns this byte or -1
-   in case of end of file or error.  This is implemented as a macro for speed.
-   As such, it does not do all of the checking the other functions do.  I.e.
-   it does not check to see if file is NULL, nor whether the structure file
-   points to has been clobbered or not.
-*/
-
-ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
-/*
-     Push one character back onto the stream to be read as the first character
-   on the next read.  At least one character of push-back is allowed.
-   gzungetc() returns the character pushed, or -1 on failure.  gzungetc() will
-   fail if c is -1, and may fail if a character has been pushed but not read
-   yet.  If gzungetc is used immediately after gzopen or gzdopen, at least the
-   output buffer size of pushed characters is allowed.  (See gzbuffer above.)
-   The pushed character will be discarded if the stream is repositioned with
-   gzseek() or gzrewind().
-*/
-
-ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
-/*
-     Flushes all pending output into the compressed file.  The parameter flush
-   is as in the deflate() function.  The return value is the zlib error number
-   (see function gzerror below).  gzflush is only permitted when writing.
-
-     If the flush parameter is Z_FINISH, the remaining data is written and the
-   gzip stream is completed in the output.  If gzwrite() is called again, a new
-   gzip stream will be started in the output.  gzread() is able to read such
-   concatenated gzip streams.
-
-     gzflush should be called only when strictly necessary because it will
-   degrade compression if called too often.
-*/
-
-/*
-ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
-                                   z_off_t offset, int whence));
-
-     Sets the starting position for the next gzread or gzwrite on the given
-   compressed file.  The offset represents a number of bytes in the
-   uncompressed data stream.  The whence parameter is defined as in lseek(2);
-   the value SEEK_END is not supported.
-
-     If the file is opened for reading, this function is emulated but can be
-   extremely slow.  If the file is opened for writing, only forward seeks are
-   supported; gzseek then compresses a sequence of zeroes up to the new
-   starting position.
-
-     gzseek returns the resulting offset location as measured in bytes from
-   the beginning of the uncompressed stream, or -1 in case of error, in
-   particular if the file is opened for writing and the new starting position
-   would be before the current position.
-*/
-
-ZEXTERN int ZEXPORT    gzrewind OF((gzFile file));
-/*
-     Rewinds the given file. This function is supported only for reading.
-
-     gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
-*/
-
-/*
-ZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));
-
-     Returns the starting position for the next gzread or gzwrite on the given
-   compressed file.  This position represents a number of bytes in the
-   uncompressed data stream, and is zero when starting, even if appending or
-   reading a gzip stream from the middle of a file using gzdopen().
-
-     gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
-*/
-
-/*
-ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
-
-     Returns the current offset in the file being read or written.  This offset
-   includes the count of bytes that precede the gzip stream, for example when
-   appending or when using gzdopen() for reading.  When reading, the offset
-   does not include as yet unused buffered input.  This information can be used
-   for a progress indicator.  On error, gzoffset() returns -1.
-*/
-
-ZEXTERN int ZEXPORT gzeof OF((gzFile file));
-/*
-     Returns true (1) if the end-of-file indicator has been set while reading,
-   false (0) otherwise.  Note that the end-of-file indicator is set only if the
-   read tried to go past the end of the input, but came up short.  Therefore,
-   just like feof(), gzeof() may return false even if there is no more data to
-   read, in the event that the last read request was for the exact number of
-   bytes remaining in the input file.  This will happen if the input file size
-   is an exact multiple of the buffer size.
-
-     If gzeof() returns true, then the read functions will return no more data,
-   unless the end-of-file indicator is reset by gzclearerr() and the input file
-   has grown since the previous end of file was detected.
-*/
-
-ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
-/*
-     Returns true (1) if file is being copied directly while reading, or false
-   (0) if file is a gzip stream being decompressed.
-
-     If the input file is empty, gzdirect() will return true, since the input
-   does not contain a gzip stream.
-
-     If gzdirect() is used immediately after gzopen() or gzdopen() it will
-   cause buffers to be allocated to allow reading the file to determine if it
-   is a gzip file.  Therefore if gzbuffer() is used, it should be called before
-   gzdirect().
-
-     When writing, gzdirect() returns true (1) if transparent writing was
-   requested ("wT" for the gzopen() mode), or false (0) otherwise.  (Note:
-   gzdirect() is not needed when writing.  Transparent writing must be
-   explicitly requested, so the application already knows the answer.  When
-   linking statically, using gzdirect() will include all of the zlib code for
-   gzip file reading and decompression, which may not be desired.)
-*/
-
-ZEXTERN int ZEXPORT    gzclose OF((gzFile file));
-/*
-     Flushes all pending output if necessary, closes the compressed file and
-   deallocates the (de)compression state.  Note that once file is closed, you
-   cannot call gzerror with file, since its structures have been deallocated.
-   gzclose must not be called more than once on the same file, just as free
-   must not be called more than once on the same allocation.
-
-     gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a
-   file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the
-   last read ended in the middle of a gzip stream, or Z_OK on success.
-*/
-
-ZEXTERN int ZEXPORT gzclose_r OF((gzFile file));
-ZEXTERN int ZEXPORT gzclose_w OF((gzFile file));
-/*
-     Same as gzclose(), but gzclose_r() is only for use when reading, and
-   gzclose_w() is only for use when writing or appending.  The advantage to
-   using these instead of gzclose() is that they avoid linking in zlib
-   compression or decompression code that is not used when only reading or only
-   writing respectively.  If gzclose() is used, then both compression and
-   decompression code will be included the application when linking to a static
-   zlib library.
-*/
-
-ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
-/*
-     Returns the error message for the last error which occurred on the given
-   compressed file.  errnum is set to zlib error number.  If an error occurred
-   in the file system and not in the compression library, errnum is set to
-   Z_ERRNO and the application may consult errno to get the exact error code.
-
-     The application must not modify the returned string.  Future calls to
-   this function may invalidate the previously returned string.  If file is
-   closed, then the string previously returned by gzerror will no longer be
-   available.
-
-     gzerror() should be used to distinguish errors from end-of-file for those
-   functions above that do not distinguish those cases in their return values.
-*/
-
-ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
-/*
-     Clears the error and end-of-file flags for file.  This is analogous to the
-   clearerr() function in stdio.  This is useful for continuing to read a gzip
-   file that is being written concurrently.
-*/
-
-#endif /* !Z_SOLO */
-
-                        /* checksum functions */
-
-/*
-     These functions are not related to compression but are exported
-   anyway because they might be useful in applications using the compression
-   library.
-*/
-
-ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
-/*
-     Update a running Adler-32 checksum with the bytes buf[0..len-1] and
-   return the updated checksum.  If buf is Z_NULL, this function returns the
-   required initial value for the checksum.
-
-     An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed
-   much faster.
-
-   Usage example:
-
-     uLong adler = adler32(0L, Z_NULL, 0);
-
-     while (read_buffer(buffer, length) != EOF) {
-       adler = adler32(adler, buffer, length);
-     }
-     if (adler != original_adler) error();
-*/
-
-ZEXTERN uLong ZEXPORT adler32_z OF((uLong adler, const Bytef *buf,
-                                    z_size_t len));
-/*
-     Same as adler32(), but with a size_t length.
-*/
-
-/*
-ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
-                                          z_off_t len2));
-
-     Combine two Adler-32 checksums into one.  For two sequences of bytes, seq1
-   and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
-   each, adler1 and adler2.  adler32_combine() returns the Adler-32 checksum of
-   seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.  Note
-   that the z_off_t type (like off_t) is a signed integer.  If len2 is
-   negative, the result has no meaning or utility.
-*/
-
-ZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
-/*
-     Update a running CRC-32 with the bytes buf[0..len-1] and return the
-   updated CRC-32.  If buf is Z_NULL, this function returns the required
-   initial value for the crc.  Pre- and post-conditioning (one's complement) is
-   performed within this function so it shouldn't be done by the application.
-
-   Usage example:
-
-     uLong crc = crc32(0L, Z_NULL, 0);
-
-     while (read_buffer(buffer, length) != EOF) {
-       crc = crc32(crc, buffer, length);
-     }
-     if (crc != original_crc) error();
-*/
-
-ZEXTERN uLong ZEXPORT crc32_z OF((uLong adler, const Bytef *buf,
-                                  z_size_t len));
-/*
-     Same as crc32(), but with a size_t length.
-*/
-
-/*
-ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
-
-     Combine two CRC-32 check values into one.  For two sequences of bytes,
-   seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
-   calculated for each, crc1 and crc2.  crc32_combine() returns the CRC-32
-   check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
-   len2.
-*/
-
-
-                        /* various hacks, don't look :) */
-
-/* deflateInit and inflateInit are macros to allow checking the zlib version
- * and the compiler's view of z_stream:
- */
-ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
-                                     const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
-                                     const char *version, int stream_size));
-ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,
-                                      int windowBits, int memLevel,
-                                      int strategy, const char *version,
-                                      int stream_size));
-ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
-                                      const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
-                                         unsigned char FAR *window,
-                                         const char *version,
-                                         int stream_size));
-#ifdef Z_PREFIX_SET
-#  define z_deflateInit(strm, level) \
-          deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
-#  define z_inflateInit(strm) \
-          inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
-#  define z_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
-          deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
-                        (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
-#  define z_inflateInit2(strm, windowBits) \
-          inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
-                        (int)sizeof(z_stream))
-#  define z_inflateBackInit(strm, windowBits, window) \
-          inflateBackInit_((strm), (windowBits), (window), \
-                           ZLIB_VERSION, (int)sizeof(z_stream))
-#else
-#  define deflateInit(strm, level) \
-          deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
-#  define inflateInit(strm) \
-          inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
-#  define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
-          deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
-                        (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
-#  define inflateInit2(strm, windowBits) \
-          inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
-                        (int)sizeof(z_stream))
-#  define inflateBackInit(strm, windowBits, window) \
-          inflateBackInit_((strm), (windowBits), (window), \
-                           ZLIB_VERSION, (int)sizeof(z_stream))
-#endif
-
-#ifndef Z_SOLO
-
-/* gzgetc() macro and its supporting function and exposed data structure.  Note
- * that the real internal state is much larger than the exposed structure.
- * This abbreviated structure exposes just enough for the gzgetc() macro.  The
- * user should not mess with these exposed elements, since their names or
- * behavior could change in the future, perhaps even capriciously.  They can
- * only be used by the gzgetc() macro.  You have been warned.
- */
-struct gzFile_s {
-    unsigned have;
-    unsigned char *next;
-    z_off64_t pos;
-};
-ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file));  /* backward compatibility */
-#ifdef Z_PREFIX_SET
-#  undef z_gzgetc
-#  define z_gzgetc(g) \
-          ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g))
-#else
-#  define gzgetc(g) \
-          ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g))
-#endif
-
-/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
- * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
- * both are true, the application gets the *64 functions, and the regular
- * functions are changed to 64 bits) -- in case these are set on systems
- * without large file support, _LFS64_LARGEFILE must also be true
- */
-#ifdef Z_LARGE64
-   ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
-   ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
-   ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
-   ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
-   ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
-   ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
-#endif
-
-#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
-#  ifdef Z_PREFIX_SET
-#    define z_gzopen z_gzopen64
-#    define z_gzseek z_gzseek64
-#    define z_gztell z_gztell64
-#    define z_gzoffset z_gzoffset64
-#    define z_adler32_combine z_adler32_combine64
-#    define z_crc32_combine z_crc32_combine64
-#  else
-#    define gzopen gzopen64
-#    define gzseek gzseek64
-#    define gztell gztell64
-#    define gzoffset gzoffset64
-#    define adler32_combine adler32_combine64
-#    define crc32_combine crc32_combine64
-#  endif
-#  ifndef Z_LARGE64
-     ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
-     ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
-     ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
-     ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));
-     ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
-     ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
-#  endif
-#else
-   ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
-   ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
-   ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));
-   ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
-   ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
-   ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
-#endif
-
-#else /* Z_SOLO */
-
-   ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
-   ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
-
-#endif /* !Z_SOLO */
-
-/* undocumented functions */
-ZEXTERN const char   * ZEXPORT zError           OF((int));
-ZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp));
-ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table    OF((void));
-ZEXTERN int            ZEXPORT inflateUndermine OF((z_streamp, int));
-ZEXTERN int            ZEXPORT inflateValidate OF((z_streamp, int));
-ZEXTERN unsigned long  ZEXPORT inflateCodesUsed OF ((z_streamp));
-ZEXTERN int            ZEXPORT inflateResetKeep OF((z_streamp));
-ZEXTERN int            ZEXPORT deflateResetKeep OF((z_streamp));
-#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO)
-ZEXTERN gzFile         ZEXPORT gzopen_w OF((const wchar_t *path,
-                                            const char *mode));
-#endif
-#if defined(STDC) || defined(Z_HAVE_STDARG_H)
-#  ifndef Z_SOLO
-ZEXTERN int            ZEXPORTVA gzvprintf Z_ARG((gzFile file,
-                                                  const char *format,
-                                                  va_list va));
-#  endif
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ZLIB_H */
---------------------------------------------------------------------------------
-END LICENSE FOR external/zlib_archive/zlib.h
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR external/grpc/LICENSE
---------------------------------------------------------------------------------
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
---------------------------------------------------------------------------------
-END LICENSE FOR external/grpc/LICENSE
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR external/grpc/third_party/address_sorting/LICENSE
---------------------------------------------------------------------------------
-Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-3. Neither the name of the project nor the names of its contributors
-   may be used to endorse or promote products derived from this software
-   without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
---------------------------------------------------------------------------------
-END LICENSE FOR external/grpc/third_party/address_sorting/LICENSE
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR external/aws/LICENSE
---------------------------------------------------------------------------------
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "{}"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright {yyyy} {name of copyright owner}
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
---------------------------------------------------------------------------------
-END LICENSE FOR external/aws/LICENSE
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-BEGIN LICENSE FOR external/com_github_googlecloudplatform_google_cloud_cpp/LICENSE
---------------------------------------------------------------------------------
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
---------------------------------------------------------------------------------
-END LICENSE FOR external/com_github_googlecloudplatform_google_cloud_cpp/LICENSE
---------------------------------------------------------------------------------
diff --git a/tensorflow-core/tensorflow-core-api/WORKSPACE b/tensorflow-core/tensorflow-core-api/WORKSPACE
deleted file mode 100644
index 8dfcdf6d57c..00000000000
--- a/tensorflow-core/tensorflow-core-api/WORKSPACE
+++ /dev/null
@@ -1,50 +0,0 @@
-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",
-    patches = [
-        ":tensorflow-windows.patch", # https://github.com/tensorflow/tensorflow/issues/25213
-        ":tensorflow-api-def.patch"
-    ],
-    patch_args = ["-p1"],
-    urls = [
-       "https://mirror.bazel.build/github.com/tensorflow/tensorflow/archive/v2.1.0-rc2.tar.gz",
-       "https://github.com/tensorflow/tensorflow/archive/v2.1.0-rc2.tar.gz",
-    ],
-    sha256 = "8f0c227024fe2dffc691e71f4498c217f604d045079db254a300720db1eb4693",
-    strip_prefix = "tensorflow-2.1.0-rc2"
-)
-
-# 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
deleted file mode 100755
index 5238676d46c..00000000000
--- a/tensorflow-core/tensorflow-core-api/build.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/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 but also elsewhere
-    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` --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 --linkopt=-lstdc++ --host_linkopt=-lstdc++"
-    export PYTHON_BIN_PATH=$(which python3)
-fi
-
-if [[ "${EXTENSION:-}" == *mkl* ]]; then
-    export BUILD_FLAGS="$BUILD_FLAGS --config=mkl"
-fi
-
-if [[ "${EXTENSION:-}" == *gpu* ]]; then
-    export BUILD_FLAGS="$BUILD_FLAGS --config=cuda"
-    if [[ -z ${TF_CUDA_PATHS:-} ]] && [[ -d ${CUDA_PATH:-} ]]; then
-        # Work around some issue with Bazel preventing it from detecting CUDA on Windows
-        export TF_CUDA_PATHS="$CUDA_PATH"
-    fi
-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 --output_filter=DONT_MATCH_ANYTHING --verbose_failures @org_tensorflow//tensorflow:tensorflow :java_op_gen_sources
-ls -l bazel-bin/external/org_tensorflow/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_LIBS=(bazel-bin/external/org_tensorflow/tensorflow/tensorflow.dll.if.lib bazel-bin/external/org_tensorflow/tensorflow/libtensorflow.dll.ifso)
-for TENSORFLOW_LIB in ${TENSORFLOW_LIBS[@]}; do
-    if [[ -f $TENSORFLOW_LIB ]]; then
-        ln -sf $(basename $TENSORFLOW_LIB) bazel-bin/external/org_tensorflow/tensorflow/tensorflow.lib
-    fi
-done
-
-# Copy only main generated Java source files for ops
-mkdir -p src/gen/java/
-cp -r bazel-genfiles/ops/src/* src/gen/java/
diff --git a/tensorflow-core/tensorflow-core-api/external/tensorflow-api-def.patch b/tensorflow-core/tensorflow-core-api/external/tensorflow-api-def.patch
deleted file mode 100644
index 791e0e2e9c6..00000000000
--- a/tensorflow-core/tensorflow-core-api/external/tensorflow-api-def.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/tensorflow/core/api_def/BUILD b/tensorflow/core/api_def/BUILD
-index f96645ad9f..63f94d3b87 100644
---- a/tensorflow/core/api_def/BUILD
-+++ b/tensorflow/core/api_def/BUILD
-@@ -28,7 +28,7 @@ package(
- filegroup(
-     name = "base_api_def",
-     srcs = glob(["base_api/*"]),
--    visibility = ["//tensorflow:internal"],
-+    visibility = ["//visibility:public"],
- )
- 
- filegroup(
diff --git a/tensorflow-core/tensorflow-core-api/external/tensorflow-windows.patch b/tensorflow-core/tensorflow-core-api/external/tensorflow-windows.patch
deleted file mode 100644
index df96098954f..00000000000
--- a/tensorflow-core/tensorflow-core-api/external/tensorflow-windows.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-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
index d5c82ff9179..09af0ac7cf4 100644
--- a/tensorflow-core/tensorflow-core-api/pom.xml
+++ b/tensorflow-core/tensorflow-core-api/pom.xml
@@ -6,48 +6,192 @@
   
     org.tensorflow
     tensorflow-core
-    0.1.0-SNAPSHOT
+    1.3.0-SNAPSHOT
   
   tensorflow-core-api
   jar
 
-  TensorFlow Core API Library
+  TensorFlow API
   Platform-dependent native code and pure-Java code for the TensorFlow machine intelligence library.
 
+  
+    1.1.5
+    false
+    ${project.build.directory}/tf-text-download/
+  
+
   
     
-      org.bytedeco
-      javacpp
-      ${javacpp.version}
+      org.tensorflow
+      tensorflow-ndarray
+      ${project.version}
     
     
       org.tensorflow
-      tensorflow-core-generator
+      tensorflow-core-native
       ${project.version}
-      true 
     
     
       org.tensorflow
-      tensorflow-tools
+      tensorflow-core-native
       ${project.version}
+      ${native.classifier}
+      test
+    
+    
+      org.junit.jupiter
+      junit-jupiter-api
+      test
+    
+    
+      org.junit.jupiter
+      junit-jupiter-engine
+      test
+    
+    
+      org.openjdk.jmh
+      jmh-core
+      test
+    
+    
+      com.google.truth
+      truth
+      ${truth.version}
+      test
     
     
-      junit
-      junit
-      4.12
+      org.openjdk.jmh
+      jmh-generator-annprocess
       test
     
   
 
+  
+    
+      
+      generating
+      
+        
+          
+            org.codehaus.mojo
+            exec-maven-plugin
+            3.1.0
+            
+              
+                
+                generate-ops
+                
+                  java
+                
+                generate-sources
+                
+                  false
+                  true
+                  org.tensorflow.generator.op.OpGenerator
+                  
+                    -a
+                    ${project.basedir}/src/api
+                    -o
+                    ${project.basedir}/src/gen/java
+                    -c
+                  
+                
+              
+            
+            
+              
+                org.tensorflow
+                tensorflow-core-generator
+                ${project.version}
+              
+            
+          
+
+          
+            maven-compiler-plugin
+            3.11.0
+            
+              
+                
+                default-compile
+                
+                  
+                    org.tensorflow.generator.op.processor.OperatorProcessor
+                  
+                  
+                    
+                      org.tensorflow
+                      tensorflow-core-generator
+                      ${project.version}
+                    
+                  
+                  
+                  ${project.basedir}/src/gen/annotations
+                
+              
+            
+          
+
+          
+            maven-clean-plugin
+            3.3.2
+            
+              
+                
+                generated-sources-clean
+                clean
+                
+                  clean
+                
+                
+                  
+                    
+                      src/gen
+                    
+                  
+                
+              
+            
+          
+        
+      
+    
+  
+
   
     
       
         org.codehaus.mojo
         build-helper-maven-plugin
-        3.0.0
+        3.4.0
         
           
-            add-source
+            
+            add-gen-sources
             generate-sources
             
               add-source
@@ -55,256 +199,51 @@
             
               
                 ${project.basedir}/src/gen/java
+                ${project.basedir}/src/gen/annotations
               
             
           
         
       
-      
-        maven-resources-plugin
-        3.1.0
-        
-          
-            javacpp-parser
-            generate-sources
-            
-              resources
-            
-          
-        
-      
-      
-        maven-compiler-plugin
-        3.8.0
-        
-          
-            default-compile
-            
-              
-                org.tensorflow.processor.operator.OperatorProcessor
-              
-              
-              ${project.basedir}/src/gen/annotations
-            
-          
-          
-            javacpp-parser
-            generate-sources
-            
-              compile
-            
-            
-              
-                org/tensorflow/internal/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
-              
-              
-                ${javacpp.platform.extension}
-              
-              ${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.internal.c_api.presets.*
-            
-          
-          
-            javacpp-compiler
-            process-classes
-            
-              build
-            
-            
-              ${project.build.directory}/native/org/tensorflow/internal/c_api/${javacpp.platform}${javacpp.platform.extension}/
-              ${javacpp.compiler.skip}
-              org.tensorflow.internal.c_api.**
-              true
-              true
-            
-          
-        
-      
-      
-        maven-surefire-plugin
-        2.22.0
-        
-          
-            -Djava.library.path=${project.build.directory}/native/org/tensorflow/internal/c_api/${javacpp.platform}${javacpp.platform.extension}
-          
-          ${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/internal/c_api/${javacpp.platform}${javacpp.platform.extension}/
-              
-              ${project.build.directory}/native
-              
-                org/tensorflow/internal/c_api/${javacpp.platform}${javacpp.platform.extension}/*.exp
-                org/tensorflow/internal/c_api/${javacpp.platform}${javacpp.platform.extension}/*.lib
-                org/tensorflow/internal/c_api/${javacpp.platform}${javacpp.platform.extension}/*.obj
-                org/tensorflow/internal/c_api/${javacpp.platform}${javacpp.platform.extension}/*mklml*
-                org/tensorflow/internal/c_api/${javacpp.platform}${javacpp.platform.extension}/*iomp5*
-                org/tensorflow/internal/c_api/${javacpp.platform}${javacpp.platform.extension}/*msvcr120*
-              
-            
-          
-        
-      
+
       
         maven-source-plugin
-        3.0.1
+        3.3.0
         
           
             attach-sources
-            leave-disabled-to-not-generate-sources-twice-on-release
-          
-          
-            attach-source
             
               jar-no-fork
             
           
         
       
+
       
-        maven-javadoc-plugin
-        3.0.1
+        org.codehaus.mojo
+        exec-maven-plugin
+        3.1.0
         
           
-            attach-javadocs
+            
+            dist-download
+            test-compile
             
-              jar
+              exec
             
             
-              false
-              256m
-              2048m
-              
-                http://bytedeco.org/javacpp/apidocs
-              
+              ${test.download.skip}
+              bash
+              
+                scripts/test_download.sh
+                ${test.download.folder}
+              
+              
+                ${native.classifier}
+              
+              ${project.basedir}
             
           
         
diff --git a/tensorflow-core/tensorflow-core-api/scripts/test_download.sh b/tensorflow-core/tensorflow-core-api/scripts/test_download.sh
new file mode 100755
index 00000000000..22666bb2b80
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/scripts/test_download.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+set -e
+
+DOWNLOAD_FOLDER="$1"
+
+case ${PLATFORM:-} in
+  'linux-x86_64')
+    TEXT_WHEEL_URL='https://files.pythonhosted.org/packages/a9/b9/02707723d44e5d0fe5f7d27ba4237528bc654bac1b0f638efe37988584b1/tensorflow_text-2.20.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl'
+    ;;
+  'linux-arm64')
+    TEXT_WHEEL_URL='https://files.pythonhosted.org/packages/17/99/b397038628a660a1446bb79c8be284443a28500d072227a77ebaeb5cd149/tensorflow_text-2.20.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl'
+    ;;
+  'macosx-arm64')
+    TEXT_WHEEL_URL='https://files.pythonhosted.org/packages/61/b8/ccb0c3b048f268860f4c92f6bb7ab55c6af6c2fe4e26746c8dc384063915/tensorflow_text-2.20.1-cp313-cp313-macosx_11_0_arm64.whl'
+    ;;
+  *)
+    echo "TensorFlow Text distribution for ${PLATFORM} is not supported for download"
+    exit 0;
+esac
+
+mkdir -p "$DOWNLOAD_FOLDER"
+cd "$DOWNLOAD_FOLDER"
+
+if [[ -n "$TEXT_WHEEL_URL" ]]; then
+  echo "Downloading $TEXT_WHEEL_URL"
+  if [ ! -f 'tensorflow-text.whl' ]; then
+    curl -L $TEXT_WHEEL_URL --output 'tensorflow-text.whl'
+  fi
+  yes | unzip -q -u 'tensorflow-text.whl' # use 'yes' because for some reasons -u does not work on Windows
+fi
+
+ls -l .
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Abort.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Abort.pbtxt
new file mode 100644
index 00000000000..7d90f6d9fc7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Abort.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Abort"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Abs.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Abs.pbtxt
new file mode 100644
index 00000000000..5ae7934e3cf
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Abs.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Abs"
+  endpoint {
+    name: "math.Abs"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AccumulateNV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AccumulateNV2.pbtxt
new file mode 100644
index 00000000000..ae2d6e0c7fd
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AccumulateNV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AccumulateNV2"
+  endpoint {
+    name: "math.AccumulateN"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AccumulatorApplyGradient.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AccumulatorApplyGradient.pbtxt
new file mode 100644
index 00000000000..ecf18bfde4d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AccumulatorApplyGradient.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AccumulatorApplyGradient"
+  endpoint {
+    name: "train.AccumulatorApplyGradient"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AccumulatorNumAccumulated.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AccumulatorNumAccumulated.pbtxt
new file mode 100644
index 00000000000..c9f5db313ee
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AccumulatorNumAccumulated.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AccumulatorNumAccumulated"
+  endpoint {
+    name: "train.AccumulatorNumAccumulated"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AccumulatorSetGlobalStep.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AccumulatorSetGlobalStep.pbtxt
new file mode 100644
index 00000000000..53dbca3a28a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AccumulatorSetGlobalStep.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AccumulatorSetGlobalStep"
+  endpoint {
+    name: "train.AccumulatorSetGlobalStep"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AccumulatorTakeGradient.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AccumulatorTakeGradient.pbtxt
new file mode 100644
index 00000000000..d8482bfef55
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AccumulatorTakeGradient.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AccumulatorTakeGradient"
+  endpoint {
+    name: "train.AccumulatorTakeGradient"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Acos.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Acos.pbtxt
new file mode 100644
index 00000000000..d730005b322
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Acos.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Acos"
+  endpoint {
+    name: "math.Acos"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Acosh.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Acosh.pbtxt
new file mode 100644
index 00000000000..7f880491eae
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Acosh.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Acosh"
+  endpoint {
+    name: "math.Acosh"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Add.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Add.pbtxt
new file mode 100644
index 00000000000..b213eb8dd32
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Add.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Add"
+  endpoint {
+    name: "math.Add"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AddManySparseToTensorsMap.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AddManySparseToTensorsMap.pbtxt
new file mode 100644
index 00000000000..8dcebf4c82b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AddManySparseToTensorsMap.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AddManySparseToTensorsMap"
+  endpoint {
+    name: "sparse.AddManySparseToTensorsMap"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AddN.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AddN.pbtxt
new file mode 100644
index 00000000000..8807e161276
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AddN.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AddN"
+  endpoint {
+    name: "math.AddN"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AddSparseToTensorsMap.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AddSparseToTensorsMap.pbtxt
new file mode 100644
index 00000000000..d46dc06cd51
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AddSparseToTensorsMap.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AddSparseToTensorsMap"
+  endpoint {
+    name: "sparse.AddSparseToTensorsMap"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_AddV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AddV2.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_AddV2.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_AddV2.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_AdjustContrast.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AdjustContrast.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_AdjustContrast.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_AdjustContrast.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AdjustContrastv2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AdjustContrastv2.pbtxt
new file mode 100644
index 00000000000..bbf539a05de
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AdjustContrastv2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AdjustContrastv2"
+  endpoint {
+    name: "image.AdjustContrast"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AdjustHue.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AdjustHue.pbtxt
new file mode 100644
index 00000000000..9cfca205fb5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AdjustHue.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AdjustHue"
+  endpoint {
+    name: "image.AdjustHue"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AdjustSaturation.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AdjustSaturation.pbtxt
new file mode 100644
index 00000000000..679b1d48ab9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AdjustSaturation.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AdjustSaturation"
+  endpoint {
+    name: "image.AdjustSaturation"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_All.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_All.pbtxt
new file mode 100644
index 00000000000..89ab8929419
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_All.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "All"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AllCandidateSampler.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AllCandidateSampler.pbtxt
new file mode 100644
index 00000000000..2a260b630af
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AllCandidateSampler.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AllCandidateSampler"
+  endpoint {
+    name: "random.AllCandidateSampler"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AllToAll.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AllToAll.pbtxt
new file mode 100644
index 00000000000..1ce77f7d74a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AllToAll.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AllToAll"
+  endpoint {
+    name: "tpu.AllToAll"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Angle.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Angle.pbtxt
new file mode 100644
index 00000000000..fd3770221f8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Angle.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Angle"
+  endpoint {
+    name: "math.Angle"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousHashTable.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousHashTable.pbtxt
new file mode 100644
index 00000000000..5b60d123270
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousHashTable.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AnonymousHashTable"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousIterator.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousIterator.pbtxt
new file mode 100644
index 00000000000..ae420ea5020
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousIterator.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "AnonymousIterator"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousIteratorV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousIteratorV2.pbtxt
new file mode 100644
index 00000000000..71b6959cf2d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousIteratorV2.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "AnonymousIteratorV2"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousIteratorV3.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousIteratorV3.pbtxt
new file mode 100644
index 00000000000..0f12f6f369c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousIteratorV3.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "AnonymousIteratorV3"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.AnonymousIterator"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousMemoryCache.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousMemoryCache.pbtxt
new file mode 100644
index 00000000000..fcde7026956
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousMemoryCache.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AnonymousMemoryCache"
+  endpoint {
+    name: "data.AnonymousMemoryCache"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousMultiDeviceIterator.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousMultiDeviceIterator.pbtxt
new file mode 100644
index 00000000000..f7b39a05c9c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousMultiDeviceIterator.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "AnonymousMultiDeviceIterator"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousMultiDeviceIteratorV3.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousMultiDeviceIteratorV3.pbtxt
new file mode 100644
index 00000000000..08238a57e52
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousMultiDeviceIteratorV3.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "AnonymousMultiDeviceIteratorV3"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.AnonymousMultiDeviceIterator"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousMutableDenseHashTable.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousMutableDenseHashTable.pbtxt
new file mode 100644
index 00000000000..fe75322c561
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousMutableDenseHashTable.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AnonymousMutableDenseHashTable"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousMutableHashTable.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousMutableHashTable.pbtxt
new file mode 100644
index 00000000000..69f531da488
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousMutableHashTable.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AnonymousMutableHashTable"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousMutableHashTableOfTensors.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousMutableHashTableOfTensors.pbtxt
new file mode 100644
index 00000000000..409abc6f6d0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousMutableHashTableOfTensors.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AnonymousMutableHashTableOfTensors"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousRandomSeedGenerator.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousRandomSeedGenerator.pbtxt
new file mode 100644
index 00000000000..4c3c3cd98a6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousRandomSeedGenerator.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AnonymousRandomSeedGenerator"
+  endpoint {
+    name: "random.AnonymousRandomSeedGenerator"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousSeedGenerator.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousSeedGenerator.pbtxt
new file mode 100644
index 00000000000..cf4c8f4f339
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AnonymousSeedGenerator.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AnonymousSeedGenerator"
+  endpoint {
+    name: "random.AnonymousSeedGenerator"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Any.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Any.pbtxt
new file mode 100644
index 00000000000..c96baa7525d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Any.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Any"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyAdaMax.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyAdaMax.pbtxt
new file mode 100644
index 00000000000..b552249c876
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyAdaMax.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ApplyAdaMax"
+  endpoint {
+    name: "train.ApplyAdaMax"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyAdadelta.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyAdadelta.pbtxt
new file mode 100644
index 00000000000..e16875bc976
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyAdadelta.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ApplyAdadelta"
+  endpoint {
+    name: "train.ApplyAdadelta"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyAdagrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyAdagrad.pbtxt
new file mode 100644
index 00000000000..3de2b67d1b5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyAdagrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ApplyAdagrad"
+  endpoint {
+    name: "train.ApplyAdagrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyAdagradDA.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyAdagradDA.pbtxt
new file mode 100644
index 00000000000..e51c4bd8155
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyAdagradDA.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ApplyAdagradDA"
+  endpoint {
+    name: "train.ApplyAdagradDa"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyAdagradV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyAdagradV2.pbtxt
new file mode 100644
index 00000000000..cfa90ac82c2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyAdagradV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ApplyAdagradV2"
+  endpoint {
+    name: "train.ApplyAdagradV2"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyAdam.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyAdam.pbtxt
new file mode 100644
index 00000000000..85ff2d1bad3
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyAdam.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ApplyAdam"
+  endpoint {
+    name: "train.ApplyAdam"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyAddSign.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyAddSign.pbtxt
new file mode 100644
index 00000000000..21a5f40a078
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyAddSign.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ApplyAddSign"
+  endpoint {
+    name: "train.ApplyAddSign"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyCenteredRMSProp.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyCenteredRMSProp.pbtxt
new file mode 100644
index 00000000000..ec1b6380779
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyCenteredRMSProp.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ApplyCenteredRMSProp"
+  endpoint {
+    name: "train.ApplyCenteredRmsProp"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ApplyFtrl.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyFtrl.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ApplyFtrl.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyFtrl.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyFtrlV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyFtrlV2.pbtxt
new file mode 100644
index 00000000000..08a86347aef
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyFtrlV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ApplyFtrlV2"
+  endpoint {
+    name: "train.ApplyFtrl"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyGradientDescent.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyGradientDescent.pbtxt
new file mode 100644
index 00000000000..335095ef520
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyGradientDescent.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ApplyGradientDescent"
+  endpoint {
+    name: "train.ApplyGradientDescent"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyMomentum.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyMomentum.pbtxt
new file mode 100644
index 00000000000..4a7079316b4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyMomentum.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ApplyMomentum"
+  endpoint {
+    name: "train.ApplyMomentum"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyPowerSign.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyPowerSign.pbtxt
new file mode 100644
index 00000000000..0a816803266
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyPowerSign.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ApplyPowerSign"
+  endpoint {
+    name: "train.ApplyPowerSign"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyProximalAdagrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyProximalAdagrad.pbtxt
new file mode 100644
index 00000000000..774d00e707c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyProximalAdagrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ApplyProximalAdagrad"
+  endpoint {
+    name: "train.ApplyProximalAdagrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyProximalGradientDescent.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyProximalGradientDescent.pbtxt
new file mode 100644
index 00000000000..3458df77763
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyProximalGradientDescent.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ApplyProximalGradientDescent"
+  endpoint {
+    name: "train.ApplyProximalGradientDescent"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyRMSProp.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyRMSProp.pbtxt
new file mode 100644
index 00000000000..259b5512e16
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApplyRMSProp.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ApplyRMSProp"
+  endpoint {
+    name: "train.ApplyRmsProp"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ApproxTopK.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApproxTopK.pbtxt
new file mode 100644
index 00000000000..51b0cc7c01f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApproxTopK.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ApproxTopK"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ApproximateEqual.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApproximateEqual.pbtxt
new file mode 100644
index 00000000000..d392987d60a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ApproximateEqual.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ApproximateEqual"
+  endpoint {
+    name: "math.ApproximateEqual"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ArgMax.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ArgMax.pbtxt
new file mode 100644
index 00000000000..5627186359b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ArgMax.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ArgMax"
+  endpoint {
+    name: "math.ArgMax"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ArgMin.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ArgMin.pbtxt
new file mode 100644
index 00000000000..e01e5f2e72b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ArgMin.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ArgMin"
+  endpoint {
+    name: "math.ArgMin"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AsString.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AsString.pbtxt
new file mode 100644
index 00000000000..a020c7aef85
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AsString.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AsString"
+  endpoint {
+    name: "dtypes.AsString"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Asin.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Asin.pbtxt
new file mode 100644
index 00000000000..7b71c08eede
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Asin.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Asin"
+  endpoint {
+    name: "math.Asin"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Asinh.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Asinh.pbtxt
new file mode 100644
index 00000000000..2a371a10071
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Asinh.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Asinh"
+  endpoint {
+    name: "math.Asinh"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Assert.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Assert.pbtxt
new file mode 100644
index 00000000000..44d1ce33dd7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Assert.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Assert"
+  endpoint {
+    name: "AssertThat"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AssertCardinalityDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AssertCardinalityDataset.pbtxt
new file mode 100644
index 00000000000..fc93c13b627
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AssertCardinalityDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "AssertCardinalityDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.AssertCardinalityDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AssertNextDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AssertNextDataset.pbtxt
new file mode 100644
index 00000000000..d85694ae56e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AssertNextDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "AssertNextDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.AssertNextDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AssertPrevDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AssertPrevDataset.pbtxt
new file mode 100644
index 00000000000..246fdd58a4a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AssertPrevDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AssertPrevDataset"
+  endpoint {
+    name: "data.AssertPrevDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Assign.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Assign.pbtxt
new file mode 100644
index 00000000000..51c43e54d2e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Assign.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Assign"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AssignAdd.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AssignAdd.pbtxt
new file mode 100644
index 00000000000..9f29218e945
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AssignAdd.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AssignAdd"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AssignAddVariableOp.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AssignAddVariableOp.pbtxt
new file mode 100644
index 00000000000..f724f706878
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AssignAddVariableOp.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AssignAddVariableOp"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AssignSub.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AssignSub.pbtxt
new file mode 100644
index 00000000000..a492c335154
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AssignSub.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AssignSub"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AssignSubVariableOp.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AssignSubVariableOp.pbtxt
new file mode 100644
index 00000000000..768f4c47169
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AssignSubVariableOp.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AssignSubVariableOp"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AssignVariableOp.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AssignVariableOp.pbtxt
new file mode 100644
index 00000000000..9e61072ca68
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AssignVariableOp.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AssignVariableOp"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AssignVariableXlaConcatND.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AssignVariableXlaConcatND.pbtxt
new file mode 100644
index 00000000000..9bf3d7734a6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AssignVariableXlaConcatND.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AssignVariableXlaConcatND"
+  endpoint {
+    name: "xla.AssignVariableConcatND"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Atan.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Atan.pbtxt
new file mode 100644
index 00000000000..bb00076b52d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Atan.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Atan"
+  endpoint {
+    name: "math.Atan"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Atan2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Atan2.pbtxt
new file mode 100644
index 00000000000..f313a44b032
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Atan2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Atan2"
+  endpoint {
+    name: "math.Atan2"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Atanh.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Atanh.pbtxt
new file mode 100644
index 00000000000..59e98471ce1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Atanh.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Atanh"
+  endpoint {
+    name: "math.Atanh"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AudioSpectrogram.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AudioSpectrogram.pbtxt
new file mode 100644
index 00000000000..8731927d50c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AudioSpectrogram.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AudioSpectrogram"
+  endpoint {
+    name: "audio.AudioSpectrogram"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_AudioSummary.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AudioSummary.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_AudioSummary.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_AudioSummary.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AudioSummaryV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AudioSummaryV2.pbtxt
new file mode 100644
index 00000000000..954dbf9bb50
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AudioSummaryV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AudioSummaryV2"
+  endpoint {
+    name: "summary.AudioSummary"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AutoShardDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AutoShardDataset.pbtxt
new file mode 100644
index 00000000000..75488eb84eb
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AutoShardDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "AutoShardDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.AutoShardDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AvgPool.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AvgPool.pbtxt
new file mode 100644
index 00000000000..970557d9c96
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AvgPool.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AvgPool"
+  endpoint {
+    name: "nn.AvgPool"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AvgPool3D.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AvgPool3D.pbtxt
new file mode 100644
index 00000000000..be8667cf31c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AvgPool3D.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AvgPool3D"
+  endpoint {
+    name: "nn.AvgPool3d"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AvgPool3DGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AvgPool3DGrad.pbtxt
new file mode 100644
index 00000000000..6bc2df28667
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AvgPool3DGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AvgPool3DGrad"
+  endpoint {
+    name: "nn.AvgPool3dGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_AvgPoolGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_AvgPoolGrad.pbtxt
new file mode 100644
index 00000000000..097ba7213f1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_AvgPoolGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "AvgPoolGrad"
+  endpoint {
+    name: "nn.AvgPoolGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BandedTriangularSolve.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BandedTriangularSolve.pbtxt
new file mode 100644
index 00000000000..9cf217624c6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BandedTriangularSolve.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BandedTriangularSolve"
+  endpoint {
+    name: "linalg.BandedTriangularSolve"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Barrier.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Barrier.pbtxt
new file mode 100644
index 00000000000..7aada11ec00
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Barrier.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Barrier"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BarrierClose.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BarrierClose.pbtxt
new file mode 100644
index 00000000000..75d923401c4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BarrierClose.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BarrierClose"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BarrierIncompleteSize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BarrierIncompleteSize.pbtxt
new file mode 100644
index 00000000000..53729fe5652
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BarrierIncompleteSize.pbtxt
@@ -0,0 +1,8 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BarrierIncompleteSize"
+  out_arg {
+    name: "size"
+    rename_to: "output"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BarrierInsertMany.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BarrierInsertMany.pbtxt
new file mode 100644
index 00000000000..163cfbeae5b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BarrierInsertMany.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BarrierInsertMany"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BarrierReadySize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BarrierReadySize.pbtxt
new file mode 100644
index 00000000000..f648bb15560
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BarrierReadySize.pbtxt
@@ -0,0 +1,8 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BarrierReadySize"
+  out_arg {
+    name: "size"
+    rename_to: "output"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BarrierTakeMany.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BarrierTakeMany.pbtxt
new file mode 100644
index 00000000000..5c6508a6963
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BarrierTakeMany.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BarrierTakeMany"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Batch.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Batch.pbtxt
new file mode 100644
index 00000000000..0204a66e576
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Batch.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "Batch"
+  visibility: VISIBLE
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchCholesky.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchCholesky.pbtxt
new file mode 100644
index 00000000000..c1cdb6b892e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchCholesky.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchCholesky"
+  endpoint {
+    name: "linalg.BatchCholesky"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchCholeskyGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchCholeskyGrad.pbtxt
new file mode 100644
index 00000000000..c8e9b4060e7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchCholeskyGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchCholeskyGrad"
+  endpoint {
+    name: "linalg.BatchCholeskyGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_BatchDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchDataset.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_BatchDataset.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_BatchDataset.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchDatasetV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchDatasetV2.pbtxt
new file mode 100644
index 00000000000..4fb0ad6f29c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchDatasetV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "BatchDatasetV2"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.BatchDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchFFT.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchFFT.pbtxt
new file mode 100644
index 00000000000..cf02316b08c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchFFT.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchFFT"
+  endpoint {
+    name: "signal.BatchFft"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchFFT2D.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchFFT2D.pbtxt
new file mode 100644
index 00000000000..4b09c73a82b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchFFT2D.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchFFT2D"
+  endpoint {
+    name: "signal.BatchFft2d"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchFFT3D.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchFFT3D.pbtxt
new file mode 100644
index 00000000000..0b4cdfac071
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchFFT3D.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchFFT3D"
+  endpoint {
+    name: "signal.BatchFft3d"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchFunction.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchFunction.pbtxt
new file mode 100644
index 00000000000..2160e9f7b8a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchFunction.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchFunction"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchIFFT.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchIFFT.pbtxt
new file mode 100644
index 00000000000..491d21ad4c4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchIFFT.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchIFFT"
+  endpoint {
+    name: "signal.BatchIfft"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchIFFT2D.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchIFFT2D.pbtxt
new file mode 100644
index 00000000000..61a773b3f76
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchIFFT2D.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchIFFT2D"
+  endpoint {
+    name: "signal.BatchIfft2d"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchIFFT3D.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchIFFT3D.pbtxt
new file mode 100644
index 00000000000..6111f4c6006
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchIFFT3D.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchIFFT3D"
+  endpoint {
+    name: "signal.BatchIfft3d"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatMul.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatMul.pbtxt
new file mode 100644
index 00000000000..f973cd5b664
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatMul.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "BatchMatMul"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatMulV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatMulV2.pbtxt
new file mode 100644
index 00000000000..a3fd55b55f5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatMulV2.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "BatchMatMulV2"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatMulV3.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatMulV3.pbtxt
new file mode 100644
index 00000000000..8a70e8e6e55
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatMulV3.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchMatMulV3"
+  endpoint {
+    name: "train.BatchMatMul"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixBandPart.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixBandPart.pbtxt
new file mode 100644
index 00000000000..af80b346df8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixBandPart.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchMatrixBandPart"
+  endpoint {
+    name: "linalg.BatchMatrixBandPart"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixDeterminant.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixDeterminant.pbtxt
new file mode 100644
index 00000000000..ac3c9b2a5ec
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixDeterminant.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchMatrixDeterminant"
+  endpoint {
+    name: "linalg.BatchMatrixDeterminant"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixDiag.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixDiag.pbtxt
new file mode 100644
index 00000000000..c30ccfb3e28
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixDiag.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchMatrixDiag"
+  endpoint {
+    name: "linalg.BatchMatrixDiag"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixDiagPart.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixDiagPart.pbtxt
new file mode 100644
index 00000000000..cf215430e8e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixDiagPart.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchMatrixDiagPart"
+  endpoint {
+    name: "linalg.BatchMatrixDiagPart"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixInverse.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixInverse.pbtxt
new file mode 100644
index 00000000000..113f9e268d7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixInverse.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchMatrixInverse"
+  endpoint {
+    name: "linalg.BatchMatrixInverse"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixSetDiag.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixSetDiag.pbtxt
new file mode 100644
index 00000000000..4d402f61466
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixSetDiag.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchMatrixSetDiag"
+  endpoint {
+    name: "linalg.BatchMatrixSetDiag"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixSolve.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixSolve.pbtxt
new file mode 100644
index 00000000000..2b5a9c70205
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixSolve.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchMatrixSolve"
+  endpoint {
+    name: "linalg.BatchMatrixSolve"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixSolveLs.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixSolveLs.pbtxt
new file mode 100644
index 00000000000..b95a4b7f1aa
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixSolveLs.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchMatrixSolveLs"
+  endpoint {
+    name: "linalg.BatchMatrixSolveLs"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixTriangularSolve.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixTriangularSolve.pbtxt
new file mode 100644
index 00000000000..39f614c58a2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchMatrixTriangularSolve.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchMatrixTriangularSolve"
+  endpoint {
+    name: "linalg.BatchMatrixTriangularSolve"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchNormWithGlobalNormalization.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchNormWithGlobalNormalization.pbtxt
new file mode 100644
index 00000000000..0b8ed84a609
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchNormWithGlobalNormalization.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchNormWithGlobalNormalization"
+  endpoint {
+    name: "nn.BatchNormWithGlobalNormalization"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchNormWithGlobalNormalizationGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchNormWithGlobalNormalizationGrad.pbtxt
new file mode 100644
index 00000000000..4aa3b421147
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchNormWithGlobalNormalizationGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchNormWithGlobalNormalizationGrad"
+  endpoint {
+    name: "nn.BatchNormWithGlobalNormalizationGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_BatchSelfAdjointEig.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchSelfAdjointEig.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_BatchSelfAdjointEig.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_BatchSelfAdjointEig.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchSelfAdjointEigV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchSelfAdjointEigV2.pbtxt
new file mode 100644
index 00000000000..4137098cf32
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchSelfAdjointEigV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchSelfAdjointEigV2"
+  endpoint {
+    name: "linalg.BatchSelfAdjointEig"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchSvd.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchSvd.pbtxt
new file mode 100644
index 00000000000..73f619b157c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchSvd.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchSvd"
+  endpoint {
+    name: "linalg.BatchSvd"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchToSpace.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchToSpace.pbtxt
new file mode 100644
index 00000000000..2cd926bf567
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchToSpace.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchToSpace"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchToSpaceND.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchToSpaceND.pbtxt
new file mode 100644
index 00000000000..93d4335ac31
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BatchToSpaceND.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BatchToSpaceND"
+  endpoint {
+    name: "BatchToSpaceNd"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselI0.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselI0.pbtxt
new file mode 100644
index 00000000000..88301e94ba7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselI0.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BesselI0"
+  endpoint {
+    name: "math.BesselI0"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselI0e.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselI0e.pbtxt
new file mode 100644
index 00000000000..f80adf8b7e6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselI0e.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BesselI0e"
+  endpoint {
+    name: "math.BesselI0e"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselI1.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselI1.pbtxt
new file mode 100644
index 00000000000..bbba9f7549f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselI1.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BesselI1"
+  endpoint {
+    name: "math.BesselI1"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselI1e.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselI1e.pbtxt
new file mode 100644
index 00000000000..e91b37684b8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselI1e.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BesselI1e"
+  endpoint {
+    name: "math.BesselI1e"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselJ0.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselJ0.pbtxt
new file mode 100644
index 00000000000..1898e526094
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselJ0.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BesselJ0"
+  endpoint {
+    name: "math.special.BesselJ0"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselJ1.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselJ1.pbtxt
new file mode 100644
index 00000000000..cbe95c525cc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselJ1.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BesselJ1"
+  endpoint {
+    name: "math.special.BesselJ1"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselK0.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselK0.pbtxt
new file mode 100644
index 00000000000..ba380554645
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselK0.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BesselK0"
+  endpoint {
+    name: "math.special.BesselK0"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselK0e.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselK0e.pbtxt
new file mode 100644
index 00000000000..09659504093
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselK0e.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BesselK0e"
+  endpoint {
+    name: "math.special.BesselK0e"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselK1.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselK1.pbtxt
new file mode 100644
index 00000000000..91c3f998864
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselK1.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BesselK1"
+  endpoint {
+    name: "math.special.BesselK1"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselK1e.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselK1e.pbtxt
new file mode 100644
index 00000000000..334c1025b5f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselK1e.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BesselK1e"
+  endpoint {
+    name: "math.special.BesselK1e"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselY0.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselY0.pbtxt
new file mode 100644
index 00000000000..a813593994b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselY0.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BesselY0"
+  endpoint {
+    name: "math.special.BesselY0"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselY1.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselY1.pbtxt
new file mode 100644
index 00000000000..cb7a004e1a2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BesselY1.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BesselY1"
+  endpoint {
+    name: "math.special.BesselY1"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Betainc.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Betainc.pbtxt
new file mode 100644
index 00000000000..1931537fa76
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Betainc.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Betainc"
+  endpoint {
+    name: "math.Betainc"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BiasAdd.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BiasAdd.pbtxt
new file mode 100644
index 00000000000..fa509206f83
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BiasAdd.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BiasAdd"
+  endpoint {
+    name: "nn.BiasAdd"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BiasAddGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BiasAddGrad.pbtxt
new file mode 100644
index 00000000000..f36f4d41ca5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BiasAddGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BiasAddGrad"
+  endpoint {
+    name: "nn.BiasAddGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_BiasAddV1.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BiasAddV1.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_BiasAddV1.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_BiasAddV1.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_BigQueryReader.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BigQueryReader.pbtxt
similarity index 80%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_BigQueryReader.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_BigQueryReader.pbtxt
index 5b6e11687a2..b98f8304793 100644
--- a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_BigQueryReader.pbtxt
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BigQueryReader.pbtxt
@@ -1,4 +1,5 @@
 op {
+  visibility: VISIBLE
   graph_op_name: "BigQueryReader"
   endpoint {
     name: "io.BigQueryReader"
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Bincount.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Bincount.pbtxt
new file mode 100644
index 00000000000..d16999a510b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Bincount.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Bincount"
+  endpoint {
+    name: "math.Bincount"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Bitcast.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Bitcast.pbtxt
new file mode 100644
index 00000000000..0b55c90620a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Bitcast.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Bitcast"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BitwiseAnd.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BitwiseAnd.pbtxt
new file mode 100644
index 00000000000..0b791ac5dda
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BitwiseAnd.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BitwiseAnd"
+  endpoint {
+    name: "bitwise.BitwiseAnd"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BitwiseOr.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BitwiseOr.pbtxt
new file mode 100644
index 00000000000..45796b0bf30
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BitwiseOr.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BitwiseOr"
+  endpoint {
+    name: "bitwise.BitwiseOr"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BitwiseXor.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BitwiseXor.pbtxt
new file mode 100644
index 00000000000..c83fee544c6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BitwiseXor.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BitwiseXor"
+  endpoint {
+    name: "bitwise.BitwiseXor"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BlockLSTM.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BlockLSTM.pbtxt
new file mode 100644
index 00000000000..4da75127e34
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BlockLSTM.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "BlockLSTM"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BlockLSTMGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BlockLSTMGrad.pbtxt
new file mode 100644
index 00000000000..425aa327062
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BlockLSTMGrad.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "BlockLSTMGrad"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BlockLSTMGradV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BlockLSTMGradV2.pbtxt
new file mode 100644
index 00000000000..d88c6c62f86
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BlockLSTMGradV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BlockLSTMGradV2"
+  endpoint {
+    name: "nn.BlockLSTMGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BlockLSTMV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BlockLSTMV2.pbtxt
new file mode 100644
index 00000000000..f20e824d7dc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BlockLSTMV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BlockLSTMV2"
+  endpoint {
+    name: "nn.BlockLSTM"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesAggregateStats.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesAggregateStats.pbtxt
new file mode 100644
index 00000000000..58978e6b6ba
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesAggregateStats.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesAggregateStats"
+  endpoint {
+    name: "estimator.BoostedTreesAggregateStats"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesBucketize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesBucketize.pbtxt
new file mode 100644
index 00000000000..d55fffeb182
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesBucketize.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesBucketize"
+  endpoint {
+    name: "estimator.BoostedTreesBucketize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesCalculateBestFeatureSplit.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesCalculateBestFeatureSplit.pbtxt
new file mode 100644
index 00000000000..43ce3d8a8b8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesCalculateBestFeatureSplit.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesCalculateBestFeatureSplit"
+  endpoint {
+    name: "estimator.BoostedTreesCalculateBestFeatureSplit"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesCalculateBestFeatureSplitV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesCalculateBestFeatureSplitV2.pbtxt
new file mode 100644
index 00000000000..d920e9bf6b5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesCalculateBestFeatureSplitV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesCalculateBestFeatureSplitV2"
+  endpoint {
+    name: "estimator.BoostedTreesCalculateBestFeatureSplitV2"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesCalculateBestGainsPerFeature.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesCalculateBestGainsPerFeature.pbtxt
new file mode 100644
index 00000000000..cab624efd61
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesCalculateBestGainsPerFeature.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesCalculateBestGainsPerFeature"
+  endpoint {
+    name: "estimator.BoostedTreesCalculateBestGainsPerFeature"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesCenterBias.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesCenterBias.pbtxt
new file mode 100644
index 00000000000..055cb5b067d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesCenterBias.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesCenterBias"
+  endpoint {
+    name: "estimator.BoostedTreesCenterBias"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesCreateEnsemble.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesCreateEnsemble.pbtxt
new file mode 100644
index 00000000000..01e25eb2270
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesCreateEnsemble.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesCreateEnsemble"
+  endpoint {
+    name: "estimator.BoostedTreesCreateEnsemble"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesCreateQuantileStreamResource.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesCreateQuantileStreamResource.pbtxt
new file mode 100644
index 00000000000..7105d2a13ca
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesCreateQuantileStreamResource.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesCreateQuantileStreamResource"
+  endpoint {
+    name: "estimator.BoostedTreesCreateQuantileStreamResource"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesDeserializeEnsemble.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesDeserializeEnsemble.pbtxt
new file mode 100644
index 00000000000..7dbb508bad1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesDeserializeEnsemble.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesDeserializeEnsemble"
+  endpoint {
+    name: "estimator.BoostedTreesDeserializeEnsemble"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesEnsembleResourceHandleOp.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesEnsembleResourceHandleOp.pbtxt
new file mode 100644
index 00000000000..43f0f618a9d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesEnsembleResourceHandleOp.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesEnsembleResourceHandleOp"
+  endpoint {
+    name: "estimator.BoostedTreesEnsembleResourceHandleOp"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesExampleDebugOutputs.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesExampleDebugOutputs.pbtxt
new file mode 100644
index 00000000000..0768f7ea464
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesExampleDebugOutputs.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesExampleDebugOutputs"
+  endpoint {
+    name: "estimator.BoostedTreesExampleDebugOutputs"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesFlushQuantileSummaries.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesFlushQuantileSummaries.pbtxt
new file mode 100644
index 00000000000..c5949350c42
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesFlushQuantileSummaries.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesFlushQuantileSummaries"
+  endpoint {
+    name: "estimator.BoostedTreesFlushQuantileSummaries"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesGetEnsembleStates.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesGetEnsembleStates.pbtxt
new file mode 100644
index 00000000000..1973e3ce0b6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesGetEnsembleStates.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesGetEnsembleStates"
+  endpoint {
+    name: "estimator.BoostedTreesGetEnsembleStates"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesMakeQuantileSummaries.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesMakeQuantileSummaries.pbtxt
new file mode 100644
index 00000000000..f4de8855e9a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesMakeQuantileSummaries.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesMakeQuantileSummaries"
+  endpoint {
+    name: "estimator.BoostedTreesMakeQuantileSummaries"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesMakeStatsSummary.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesMakeStatsSummary.pbtxt
new file mode 100644
index 00000000000..5414e2aae97
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesMakeStatsSummary.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesMakeStatsSummary"
+  endpoint {
+    name: "estimator.BoostedTreesMakeStatsSummary"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesPredict.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesPredict.pbtxt
new file mode 100644
index 00000000000..7c93fcfdfc2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesPredict.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesPredict"
+  endpoint {
+    name: "estimator.BoostedTreesPredict"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesQuantileStreamResourceAddSummaries.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesQuantileStreamResourceAddSummaries.pbtxt
new file mode 100644
index 00000000000..ab449a57d5c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesQuantileStreamResourceAddSummaries.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesQuantileStreamResourceAddSummaries"
+  endpoint {
+    name: "estimator.BoostedTreesQuantileStreamResourceAddSummaries"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesQuantileStreamResourceDeserialize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesQuantileStreamResourceDeserialize.pbtxt
new file mode 100644
index 00000000000..45103ae088a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesQuantileStreamResourceDeserialize.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesQuantileStreamResourceDeserialize"
+  endpoint {
+    name: "estimator.BoostedTreesQuantileStreamResourceDeserialize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesQuantileStreamResourceFlush.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesQuantileStreamResourceFlush.pbtxt
new file mode 100644
index 00000000000..16b68e4ac83
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesQuantileStreamResourceFlush.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesQuantileStreamResourceFlush"
+  endpoint {
+    name: "estimator.BoostedTreesQuantileStreamResourceFlush"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesQuantileStreamResourceGetBucketBoundaries.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesQuantileStreamResourceGetBucketBoundaries.pbtxt
new file mode 100644
index 00000000000..990abb4effe
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesQuantileStreamResourceGetBucketBoundaries.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesQuantileStreamResourceGetBucketBoundaries"
+  endpoint {
+    name: "estimator.BoostedTreesQuantileStreamResourceGetBucketBoundaries"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesQuantileStreamResourceHandleOp.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesQuantileStreamResourceHandleOp.pbtxt
new file mode 100644
index 00000000000..12600896ec9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesQuantileStreamResourceHandleOp.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesQuantileStreamResourceHandleOp"
+  endpoint {
+    name: "estimator.BoostedTreesQuantileStreamResourceHandleOp"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesSerializeEnsemble.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesSerializeEnsemble.pbtxt
new file mode 100644
index 00000000000..5880c132063
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesSerializeEnsemble.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesSerializeEnsemble"
+  endpoint {
+    name: "estimator.BoostedTreesSerializeEnsemble"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesSparseAggregateStats.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesSparseAggregateStats.pbtxt
new file mode 100644
index 00000000000..109f3bae4e2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesSparseAggregateStats.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesSparseAggregateStats"
+  endpoint {
+    name: "estimator.BoostedTreesSparseAggregateStats"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesSparseCalculateBestFeatureSplit.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesSparseCalculateBestFeatureSplit.pbtxt
new file mode 100644
index 00000000000..aae4c225f7e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesSparseCalculateBestFeatureSplit.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesSparseCalculateBestFeatureSplit"
+  endpoint {
+    name: "estimator.BoostedTreesSparseCalculateBestFeatureSplit"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesTrainingPredict.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesTrainingPredict.pbtxt
new file mode 100644
index 00000000000..d4696dc6182
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesTrainingPredict.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesTrainingPredict"
+  endpoint {
+    name: "estimator.BoostedTreesTrainingPredict"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesUpdateEnsemble.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesUpdateEnsemble.pbtxt
new file mode 100644
index 00000000000..77f30bc409f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesUpdateEnsemble.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesUpdateEnsemble"
+  endpoint {
+    name: "estimator.BoostedTreesUpdateEnsemble"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesUpdateEnsembleV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesUpdateEnsembleV2.pbtxt
new file mode 100644
index 00000000000..df4e978b422
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BoostedTreesUpdateEnsembleV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "BoostedTreesUpdateEnsembleV2"
+  endpoint {
+    name: "estimator.BoostedTreesUpdateEnsembleV2"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BroadcastArgs.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BroadcastArgs.pbtxt
new file mode 100644
index 00000000000..ebc44eacd85
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BroadcastArgs.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BroadcastArgs"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BroadcastGradientArgs.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BroadcastGradientArgs.pbtxt
new file mode 100644
index 00000000000..6e6f0d1b9b7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BroadcastGradientArgs.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BroadcastGradientArgs"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BroadcastTo.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BroadcastTo.pbtxt
new file mode 100644
index 00000000000..c5b07af0a18
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BroadcastTo.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "BroadcastTo"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Bucketize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Bucketize.pbtxt
new file mode 100644
index 00000000000..a600ac3634d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Bucketize.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Bucketize"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_BytesProducedStatsDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_BytesProducedStatsDataset.pbtxt
new file mode 100644
index 00000000000..b9d81b54105
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_BytesProducedStatsDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "BytesProducedStatsDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.BytesProducedStatsDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CSRSparseMatrixComponents.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CSRSparseMatrixComponents.pbtxt
new file mode 100644
index 00000000000..24b7e34e16b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CSRSparseMatrixComponents.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CSRSparseMatrixComponents"
+  endpoint {
+    name: "linalg.sparse.CSRSparseMatrixComponents"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CSRSparseMatrixToDense.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CSRSparseMatrixToDense.pbtxt
new file mode 100644
index 00000000000..62baeff7b47
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CSRSparseMatrixToDense.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CSRSparseMatrixToDense"
+  endpoint {
+    name: "linalg.sparse.CSRSparseMatrixToDense"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CSRSparseMatrixToSparseTensor.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CSRSparseMatrixToSparseTensor.pbtxt
new file mode 100644
index 00000000000..6be3fd9219b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CSRSparseMatrixToSparseTensor.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CSRSparseMatrixToSparseTensor"
+  endpoint {
+    name: "linalg.sparse.CSRSparseMatrixToSparseTensor"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CSVDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CSVDataset.pbtxt
new file mode 100644
index 00000000000..b4637f34b40
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CSVDataset.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "CSVDataset"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CSVDatasetV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CSVDatasetV2.pbtxt
new file mode 100644
index 00000000000..2c2848e9a74
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CSVDatasetV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "CSVDatasetV2"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.CSVDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CTCBeamSearchDecoder.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CTCBeamSearchDecoder.pbtxt
new file mode 100644
index 00000000000..113d683f6be
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CTCBeamSearchDecoder.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CTCBeamSearchDecoder"
+  endpoint {
+    name: "nn.CtcBeamSearchDecoder"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CTCGreedyDecoder.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CTCGreedyDecoder.pbtxt
new file mode 100644
index 00000000000..f82f1789f23
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CTCGreedyDecoder.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CTCGreedyDecoder"
+  endpoint {
+    name: "nn.CtcGreedyDecoder"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CTCLoss.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CTCLoss.pbtxt
new file mode 100644
index 00000000000..0c4d2f7843a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CTCLoss.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CTCLoss"
+  endpoint {
+    name: "nn.CtcLoss"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CTCLossV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CTCLossV2.pbtxt
new file mode 100644
index 00000000000..4ea107e1445
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CTCLossV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CTCLossV2"
+  endpoint {
+    name: "nn.CTCLossV2"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CacheDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CacheDataset.pbtxt
new file mode 100644
index 00000000000..4b4b9bb3b53
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CacheDataset.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "CacheDataset"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CacheDatasetV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CacheDatasetV2.pbtxt
new file mode 100644
index 00000000000..8c5b58383c3
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CacheDatasetV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "CacheDatasetV2"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.CacheDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Case.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Case.pbtxt
new file mode 100644
index 00000000000..eb371486f04
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Case.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Case"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Cast.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Cast.pbtxt
new file mode 100644
index 00000000000..bd6b1b27204
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Cast.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Cast"
+  endpoint {
+    name: "dtypes.Cast"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Ceil.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Ceil.pbtxt
new file mode 100644
index 00000000000..41c23c44712
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Ceil.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Ceil"
+  endpoint {
+    name: "math.Ceil"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CheckNumerics.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CheckNumerics.pbtxt
new file mode 100644
index 00000000000..7bf14dcba10
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CheckNumerics.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "CheckNumerics"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CheckNumericsV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CheckNumericsV2.pbtxt
new file mode 100644
index 00000000000..3085f985715
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CheckNumericsV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CheckNumericsV2"
+  endpoint {
+    name: "debugging.CheckNumerics"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CheckPinned.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CheckPinned.pbtxt
new file mode 100644
index 00000000000..fff873c9bbf
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CheckPinned.pbtxt
@@ -0,0 +1,6 @@
+op {
+  graph_op_name: "CheckPinned"
+  endpoint {
+    name: "CheckPinned"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Cholesky.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Cholesky.pbtxt
new file mode 100644
index 00000000000..0c1f48317d1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Cholesky.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Cholesky"
+  endpoint {
+    name: "linalg.Cholesky"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CholeskyGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CholeskyGrad.pbtxt
new file mode 100644
index 00000000000..22e4aa89a6f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CholeskyGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CholeskyGrad"
+  endpoint {
+    name: "linalg.CholeskyGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ChooseFastestBranchDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ChooseFastestBranchDataset.pbtxt
new file mode 100644
index 00000000000..b3be1a9cd3b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ChooseFastestBranchDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "ChooseFastestBranchDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.ChooseFastestBranchDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ChooseFastestDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ChooseFastestDataset.pbtxt
new file mode 100644
index 00000000000..a25508efebc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ChooseFastestDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "ChooseFastestDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.ChooseFastestDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ClipByValue.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ClipByValue.pbtxt
new file mode 100644
index 00000000000..b6c8fae964f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ClipByValue.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ClipByValue"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CloseSummaryWriter.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CloseSummaryWriter.pbtxt
new file mode 100644
index 00000000000..2d1ca9631d3
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CloseSummaryWriter.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CloseSummaryWriter"
+  endpoint {
+    name: "summary.CloseSummaryWriter"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CollateTPUEmbeddingMemory.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollateTPUEmbeddingMemory.pbtxt
new file mode 100644
index 00000000000..7e2b1aef93b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollateTPUEmbeddingMemory.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CollateTPUEmbeddingMemory"
+  endpoint {
+    name: "tpu.CollateTPUEmbeddingMemory"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveAllToAllV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveAllToAllV2.pbtxt
new file mode 100644
index 00000000000..6460f0455c0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveAllToAllV2.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "CollectiveAllToAllV2"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveAllToAllV3.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveAllToAllV3.pbtxt
new file mode 100644
index 00000000000..b2356ee5b36
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveAllToAllV3.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CollectiveAllToAllV3"
+  endpoint {
+    name: "collective.CollectiveAllToAll"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveAssignGroupV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveAssignGroupV2.pbtxt
new file mode 100644
index 00000000000..d414cd66079
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveAssignGroupV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CollectiveAssignGroupV2"
+  endpoint {
+    name: "collective.CollectiveAssignGroup"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveBcastRecv.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveBcastRecv.pbtxt
new file mode 100644
index 00000000000..48feac2efa0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveBcastRecv.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "CollectiveBcastRecv"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveBcastRecvV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveBcastRecvV2.pbtxt
new file mode 100644
index 00000000000..be74a35b7f9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveBcastRecvV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CollectiveBcastRecvV2"
+  endpoint {
+    name: "collective.CollectiveBcastRecv"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveBcastSend.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveBcastSend.pbtxt
new file mode 100644
index 00000000000..3d444c00bf2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveBcastSend.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "CollectiveBcastSend"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveBcastSendV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveBcastSendV2.pbtxt
new file mode 100644
index 00000000000..1fb22afed54
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveBcastSendV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CollectiveBcastSendV2"
+  endpoint {
+    name: "collective.CollectiveBcastSend"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveGather.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveGather.pbtxt
new file mode 100644
index 00000000000..8479efea1a8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveGather.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "CollectiveGather"
+  visibility: SKIP
+}
\ No newline at end of file
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveGatherV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveGatherV2.pbtxt
new file mode 100644
index 00000000000..d220f2ab11f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveGatherV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CollectiveGatherV2"
+  endpoint: {
+    name: "collective.CollectiveGather"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveInitializeCommunicator.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveInitializeCommunicator.pbtxt
new file mode 100644
index 00000000000..fba9e620843
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveInitializeCommunicator.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CollectiveInitializeCommunicator"
+  endpoint {
+    name: "collective.CollectiveInitializeCommunicator"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectivePermute.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectivePermute.pbtxt
new file mode 100644
index 00000000000..5fa5a659df4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectivePermute.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CollectivePermute"
+  endpoint {
+    name: "collective.CollectivePermute"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveReduce.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveReduce.pbtxt
new file mode 100644
index 00000000000..e810cfb06da
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveReduce.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "CollectiveReduce"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveReduceScatterV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveReduceScatterV2.pbtxt
new file mode 100644
index 00000000000..b36c3830ca1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveReduceScatterV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CollectiveReduceScatterV2"
+  endpoint {
+    name: "collective.CollectiveReduceScatter"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveReduceV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveReduceV2.pbtxt
new file mode 100644
index 00000000000..4fe3c35b51e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveReduceV2.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "CollectiveReduceV2"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveReduceV3.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveReduceV3.pbtxt
new file mode 100644
index 00000000000..3a2779461d2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CollectiveReduceV3.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CollectiveReduceV3"
+  endpoint {
+    name: "collective.CollectiveReduce"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CombinedNonMaxSuppression.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CombinedNonMaxSuppression.pbtxt
new file mode 100644
index 00000000000..836a46a42b2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CombinedNonMaxSuppression.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CombinedNonMaxSuppression"
+  endpoint {
+    name: "image.CombinedNonMaxSuppression"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_CompareAndBitpack.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CompareAndBitpack.pbtxt
similarity index 81%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_CompareAndBitpack.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_CompareAndBitpack.pbtxt
index d744fbbc90f..4e5a5e1a2af 100644
--- a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_CompareAndBitpack.pbtxt
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CompareAndBitpack.pbtxt
@@ -1,4 +1,5 @@
 op {
+  visibility: VISIBLE
   graph_op_name: "CompareAndBitpack"
   endpoint {
     name: "math.CompareAndBitpack"
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Complex.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Complex.pbtxt
new file mode 100644
index 00000000000..f649707afb8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Complex.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Complex"
+  endpoint {
+    name: "dtypes.Complex"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ComplexAbs.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ComplexAbs.pbtxt
new file mode 100644
index 00000000000..be6aa59c92e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ComplexAbs.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ComplexAbs"
+  endpoint {
+    name: "math.ComplexAbs"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CompositeTensorVariantFromComponents.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CompositeTensorVariantFromComponents.pbtxt
new file mode 100644
index 00000000000..adb638940d8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CompositeTensorVariantFromComponents.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CompositeTensorVariantFromComponents"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CompositeTensorVariantToComponents.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CompositeTensorVariantToComponents.pbtxt
new file mode 100644
index 00000000000..b34054ead77
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CompositeTensorVariantToComponents.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CompositeTensorVariantToComponents"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CompressElement.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CompressElement.pbtxt
new file mode 100644
index 00000000000..09a543581d2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CompressElement.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CompressElement"
+  endpoint {
+    name: "data.CompressElement"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ComputeAccidentalHits.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ComputeAccidentalHits.pbtxt
new file mode 100644
index 00000000000..8c4d834016b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ComputeAccidentalHits.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ComputeAccidentalHits"
+  endpoint {
+    name: "nn.ComputeAccidentalHits"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ComputeBatchSize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ComputeBatchSize.pbtxt
new file mode 100644
index 00000000000..826f51ac87d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ComputeBatchSize.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ComputeBatchSize"
+  endpoint {
+    name: "train.ComputeBatchSize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ComputeDedupDataSize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ComputeDedupDataSize.pbtxt
new file mode 100644
index 00000000000..3bedfe49d78
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ComputeDedupDataSize.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "ComputeDedupDataSize"
+  visibility: SKIP
+  endpoint {
+    name: "tpu.ComputeDedupDataSize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ComputeDedupDataSizeV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ComputeDedupDataSizeV2.pbtxt
new file mode 100644
index 00000000000..af5bdc31f13
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ComputeDedupDataSizeV2.pbtxt
@@ -0,0 +1,6 @@
+op {
+  graph_op_name: "ComputeDedupDataSizeV2"
+  endpoint {
+    name: "tpu.ComputeDedupDataSize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ComputeDedupDataTupleMask.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ComputeDedupDataTupleMask.pbtxt
new file mode 100644
index 00000000000..cb0cd71c3f3
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ComputeDedupDataTupleMask.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "ComputeDedupDataTupleMask"
+  endpoint {
+    name: "tpu.ComputeDedupDataTupleMask"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ComputeDedupDataTupleMaskV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ComputeDedupDataTupleMaskV2.pbtxt
new file mode 100644
index 00000000000..75e34703b13
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ComputeDedupDataTupleMaskV2.pbtxt
@@ -0,0 +1,6 @@
+op {
+  graph_op_name: "ComputeDedupDataTupleMaskV2"
+  endpoint {
+    name: "tpu.ComputeDedupDataTupleMask"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Concat.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Concat.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Concat.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_Concat.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ConcatOffset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConcatOffset.pbtxt
new file mode 100644
index 00000000000..876db502770
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConcatOffset.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ConcatOffset"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ConcatV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConcatV2.pbtxt
new file mode 100644
index 00000000000..9bf9a9b8648
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConcatV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ConcatV2"
+  endpoint {
+    name: "Concat"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ConcatenateDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConcatenateDataset.pbtxt
new file mode 100644
index 00000000000..d4878f5925b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConcatenateDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "ConcatenateDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.ConcatenateDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ConditionalAccumulator.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConditionalAccumulator.pbtxt
new file mode 100644
index 00000000000..3e8dd5299a1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConditionalAccumulator.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ConditionalAccumulator"
+  endpoint {
+    name: "train.ConditionalAccumulator"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ConfigureAndInitializeGlobalTPU.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConfigureAndInitializeGlobalTPU.pbtxt
new file mode 100644
index 00000000000..5ee6c848dee
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConfigureAndInitializeGlobalTPU.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ConfigureAndInitializeGlobalTPU"
+  endpoint {
+    name: "tpu.ConfigureAndInitializeGlobalTPU"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ConfigureDistributedTPU.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConfigureDistributedTPU.pbtxt
new file mode 100644
index 00000000000..1dc468d8666
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConfigureDistributedTPU.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ConfigureDistributedTPU"
+  endpoint {
+    name: "tpu.ConfigureDistributedTPU"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ConfigureTPUEmbedding.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConfigureTPUEmbedding.pbtxt
new file mode 100644
index 00000000000..1cd8caf6d34
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConfigureTPUEmbedding.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ConfigureTPUEmbedding"
+  endpoint {
+    name: "tpu.ConfigureTPUEmbedding"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ConfigureTPUEmbeddingHost.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConfigureTPUEmbeddingHost.pbtxt
new file mode 100644
index 00000000000..aa4265b80ba
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConfigureTPUEmbeddingHost.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ConfigureTPUEmbeddingHost"
+  endpoint {
+    name: "tpu.ConfigureTPUEmbeddingHost"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ConfigureTPUEmbeddingMemory.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConfigureTPUEmbeddingMemory.pbtxt
new file mode 100644
index 00000000000..51b142d5c15
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConfigureTPUEmbeddingMemory.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ConfigureTPUEmbeddingMemory"
+  endpoint {
+    name: "tpu.ConfigureTPUEmbeddingMemory"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Conj.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conj.pbtxt
new file mode 100644
index 00000000000..0fb1ddc5788
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conj.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Conj"
+  endpoint {
+    name: "math.Conj"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ConjugateTranspose.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConjugateTranspose.pbtxt
new file mode 100644
index 00000000000..42fad3b7ee6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConjugateTranspose.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ConjugateTranspose"
+  endpoint {
+    name: "linalg.ConjugateTranspose"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ConnectTPUEmbeddingHosts.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConnectTPUEmbeddingHosts.pbtxt
new file mode 100644
index 00000000000..030cd71468e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConnectTPUEmbeddingHosts.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ConnectTPUEmbeddingHosts"
+  endpoint {
+    name: "tpu.ConnectTPUEmbeddingHosts"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Const.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Const.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Const.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_Const.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ConsumeMutexLock.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConsumeMutexLock.pbtxt
new file mode 100644
index 00000000000..78c8099b9ac
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConsumeMutexLock.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ConsumeMutexLock"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ControlTrigger.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ControlTrigger.pbtxt
new file mode 100644
index 00000000000..8dc64a98773
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ControlTrigger.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ControlTrigger"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv.pbtxt
new file mode 100644
index 00000000000..cdc59f52e68
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Conv"
+  endpoint {
+    name: "nn.Conv"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv2D.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv2D.pbtxt
new file mode 100644
index 00000000000..1752f424f38
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv2D.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Conv2D"
+  endpoint {
+    name: "nn.Conv2d"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv2DBackpropFilter.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv2DBackpropFilter.pbtxt
new file mode 100644
index 00000000000..30b696c51d1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv2DBackpropFilter.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "Conv2DBackpropFilter"
+  visibility: VISIBLE
+  endpoint {
+    name: "nn.Conv2dBackpropFilter"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv2DBackpropFilterV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv2DBackpropFilterV2.pbtxt
new file mode 100644
index 00000000000..83c1d10a28f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv2DBackpropFilterV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "Conv2DBackpropFilterV2"
+  visibility: HIDDEN
+  endpoint {
+    name: "nn.Conv2dBackpropFilterV2"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv2DBackpropInput.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv2DBackpropInput.pbtxt
new file mode 100644
index 00000000000..9c7eb533cca
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv2DBackpropInput.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "Conv2DBackpropInput"
+  visibility: VISIBLE
+  endpoint {
+    name: "nn.Conv2dBackpropInput"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv2DBackpropInputV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv2DBackpropInputV2.pbtxt
new file mode 100644
index 00000000000..821f284ad44
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv2DBackpropInputV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "Conv2DBackpropInputV2"
+  visibility: HIDDEN
+  endpoint {
+    name: "nn.Conv2dBackpropInputV2"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv3D.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv3D.pbtxt
new file mode 100644
index 00000000000..abafc5a703d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv3D.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Conv3D"
+  endpoint {
+    name: "nn.Conv3d"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Conv3DBackpropFilter.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv3DBackpropFilter.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Conv3DBackpropFilter.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_Conv3DBackpropFilter.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv3DBackpropFilterV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv3DBackpropFilterV2.pbtxt
new file mode 100644
index 00000000000..257a0e6f7fe
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv3DBackpropFilterV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Conv3DBackpropFilterV2"
+  endpoint {
+    name: "nn.Conv3dBackpropFilter"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Conv3DBackpropInput.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv3DBackpropInput.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Conv3DBackpropInput.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_Conv3DBackpropInput.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv3DBackpropInputV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv3DBackpropInputV2.pbtxt
new file mode 100644
index 00000000000..e192e5feedc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Conv3DBackpropInputV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Conv3DBackpropInputV2"
+  endpoint {
+    name: "nn.Conv3dBackpropInput"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ConvertToCooTensor.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConvertToCooTensor.pbtxt
new file mode 100644
index 00000000000..3047ada98b7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConvertToCooTensor.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "ConvertToCooTensor"
+  visibility: VISIBLE
+  endpoint {
+    name: "tpu.ConvertToCooTensor"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ConvertToListOfSparseCoreCooTensors.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConvertToListOfSparseCoreCooTensors.pbtxt
new file mode 100644
index 00000000000..99d2ebea438
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConvertToListOfSparseCoreCooTensors.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "ConvertToListOfSparseCoreCooTensors"
+  visibility: VISIBLE
+  endpoint {
+    name: "sparse.ConvertToListOfSparseCoreCooTensors"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ConvertToSparseCoreCsrWrappedCooTensor.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConvertToSparseCoreCsrWrappedCooTensor.pbtxt
new file mode 100644
index 00000000000..6b78c0b216c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ConvertToSparseCoreCsrWrappedCooTensor.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "ConvertToSparseCoreCsrWrappedCooTensor"
+  visibility: VISIBLE
+  endpoint {
+    name: "sparse.ConvertToSparseCoreCsrWrappedCooTensor"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Copy.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Copy.pbtxt
new file mode 100644
index 00000000000..3a822291794
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Copy.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "Copy"
+  visibility: HIDDEN
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CopyHost.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CopyHost.pbtxt
new file mode 100644
index 00000000000..2429cee5899
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CopyHost.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "CopyHost"
+  visibility: HIDDEN
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CopyToMesh.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CopyToMesh.pbtxt
new file mode 100644
index 00000000000..e70bf4ade58
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CopyToMesh.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CopyToMesh"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CopyToMeshGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CopyToMeshGrad.pbtxt
new file mode 100644
index 00000000000..5e3d38dd349
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CopyToMeshGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CopyToMeshGrad"
+  endpoint {
+    name: "CopyToMeshGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Cos.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Cos.pbtxt
new file mode 100644
index 00000000000..a8006cadd6b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Cos.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Cos"
+  endpoint {
+    name: "math.Cos"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Cosh.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Cosh.pbtxt
new file mode 100644
index 00000000000..6f08a1b1862
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Cosh.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Cosh"
+  endpoint {
+    name: "math.Cosh"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CountUpTo.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CountUpTo.pbtxt
new file mode 100644
index 00000000000..bdc63ba1e04
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CountUpTo.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CountUpTo"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CreateSummaryDbWriter.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CreateSummaryDbWriter.pbtxt
new file mode 100644
index 00000000000..0c9840034b5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CreateSummaryDbWriter.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CreateSummaryDbWriter"
+  endpoint {
+    name: "summary.CreateSummaryDbWriter"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CreateSummaryFileWriter.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CreateSummaryFileWriter.pbtxt
new file mode 100644
index 00000000000..b85f13b6de4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CreateSummaryFileWriter.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CreateSummaryFileWriter"
+  endpoint {
+    name: "summary.CreateSummaryFileWriter"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CropAndResize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CropAndResize.pbtxt
new file mode 100644
index 00000000000..b41932cf5ab
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CropAndResize.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CropAndResize"
+  endpoint {
+    name: "image.CropAndResize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CropAndResizeGradBoxes.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CropAndResizeGradBoxes.pbtxt
new file mode 100644
index 00000000000..8b29c975468
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CropAndResizeGradBoxes.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CropAndResizeGradBoxes"
+  endpoint {
+    name: "image.CropAndResizeGradBoxes"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CropAndResizeGradImage.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CropAndResizeGradImage.pbtxt
new file mode 100644
index 00000000000..85607c39878
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CropAndResizeGradImage.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CropAndResizeGradImage"
+  endpoint {
+    name: "image.CropAndResizeGradImage"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Cross.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Cross.pbtxt
new file mode 100644
index 00000000000..a9717d3bc7d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Cross.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Cross"
+  endpoint {
+    name: "linalg.Cross"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CrossReplicaSum.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CrossReplicaSum.pbtxt
new file mode 100644
index 00000000000..f83642ef04a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CrossReplicaSum.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CrossReplicaSum"
+  endpoint {
+    name: "tpu.CrossReplicaSum"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_CudnnRNN.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNN.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_CudnnRNN.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNN.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_CudnnRNNBackprop.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNBackprop.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_CudnnRNNBackprop.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNBackprop.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNBackpropV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNBackpropV2.pbtxt
new file mode 100644
index 00000000000..2e544a47286
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNBackpropV2.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "CudnnRNNBackpropV2"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNBackpropV3.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNBackpropV3.pbtxt
new file mode 100644
index 00000000000..eb7800c71df
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNBackpropV3.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CudnnRNNBackpropV3"
+  endpoint {
+    name: "nn.CudnnRNNBackprop"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNCanonicalToParams.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNCanonicalToParams.pbtxt
new file mode 100644
index 00000000000..41572ac391d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNCanonicalToParams.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "CudnnRNNCanonicalToParams"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNCanonicalToParamsV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNCanonicalToParamsV2.pbtxt
new file mode 100644
index 00000000000..99b144ed11c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNCanonicalToParamsV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CudnnRNNCanonicalToParamsV2"
+  endpoint {
+    name: "nn.CudnnRNNCanonicalToParams"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNParamsSize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNParamsSize.pbtxt
new file mode 100644
index 00000000000..e0b34db1680
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNParamsSize.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CudnnRNNParamsSize"
+  endpoint {
+    name: "nn.CudnnRnnParamsSize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNParamsToCanonical.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNParamsToCanonical.pbtxt
new file mode 100644
index 00000000000..7862f38a144
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNParamsToCanonical.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "CudnnRNNParamsToCanonical"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNParamsToCanonicalV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNParamsToCanonicalV2.pbtxt
new file mode 100644
index 00000000000..4542b63afcc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNParamsToCanonicalV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CudnnRNNParamsToCanonicalV2"
+  endpoint {
+    name: "nn.CudnnRNNParamsToCanonical"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNV2.pbtxt
new file mode 100644
index 00000000000..b9d693be62a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNV2.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "CudnnRNNV2"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNV3.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNV3.pbtxt
new file mode 100644
index 00000000000..0e07477c874
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CudnnRNNV3.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CudnnRNNV3"
+  endpoint {
+    name: "nn.CudnnRNN"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Cumprod.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Cumprod.pbtxt
new file mode 100644
index 00000000000..b49217a6d13
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Cumprod.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Cumprod"
+  endpoint {
+    name: "math.Cumprod"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Cumsum.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Cumsum.pbtxt
new file mode 100644
index 00000000000..30db71c3b58
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Cumsum.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Cumsum"
+  endpoint {
+    name: "math.Cumsum"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_CumulativeLogsumexp.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_CumulativeLogsumexp.pbtxt
new file mode 100644
index 00000000000..5e815bd9dab
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_CumulativeLogsumexp.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "CumulativeLogsumexp"
+  endpoint {
+    name: "math.CumulativeLogsumexp"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DTensorRestoreV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DTensorRestoreV2.pbtxt
new file mode 100644
index 00000000000..c494af28b78
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DTensorRestoreV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DTensorRestoreV2"
+  endpoint {
+    name: "tpu.DTensorRestore"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DTensorSetGlobalTPUArray.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DTensorSetGlobalTPUArray.pbtxt
new file mode 100644
index 00000000000..9eb54c892bb
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DTensorSetGlobalTPUArray.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DTensorSetGlobalTPUArray"
+  endpoint {
+    name: "tpu.ExecuteTPUEmbeddingPartitioner"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DTensorShardedPrefix.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DTensorShardedPrefix.pbtxt
new file mode 100644
index 00000000000..28a477a0351
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DTensorShardedPrefix.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DTensorShardedPrefix"
+  endpoint {
+    name: "tpu.DTensorShardedPrefix"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DataFormatDimMap.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DataFormatDimMap.pbtxt
new file mode 100644
index 00000000000..8d1015ddf8a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DataFormatDimMap.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DataFormatDimMap"
+  endpoint {
+    name: "nn.DataFormatDimMap"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DataFormatVecPermute.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DataFormatVecPermute.pbtxt
new file mode 100644
index 00000000000..61766b93905
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DataFormatVecPermute.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DataFormatVecPermute"
+  endpoint {
+    name: "nn.DataFormatVecPermute"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DataServiceDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DataServiceDataset.pbtxt
new file mode 100644
index 00000000000..cfe0fc978fc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DataServiceDataset.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "DataServiceDataset"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DataServiceDatasetV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DataServiceDatasetV2.pbtxt
new file mode 100644
index 00000000000..63f9d0c5aae
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DataServiceDatasetV2.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "DataServiceDatasetV2"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DataServiceDatasetV3.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DataServiceDatasetV3.pbtxt
new file mode 100644
index 00000000000..67371f27cbf
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DataServiceDatasetV3.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "DataServiceDatasetV3"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DataServiceDatasetV4.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DataServiceDatasetV4.pbtxt
new file mode 100644
index 00000000000..4798e5bd703
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DataServiceDatasetV4.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "DataServiceDatasetV4"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.DataServiceDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DatasetCardinality.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DatasetCardinality.pbtxt
new file mode 100644
index 00000000000..6a699fc214e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DatasetCardinality.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "DatasetCardinality"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.DatasetCardinality"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DatasetFingerprint.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DatasetFingerprint.pbtxt
new file mode 100644
index 00000000000..61e0086729b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DatasetFingerprint.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "DatasetFingerprint"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.DatasetFingerprint"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DatasetFromGraph.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DatasetFromGraph.pbtxt
new file mode 100644
index 00000000000..80ea2a57196
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DatasetFromGraph.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "DatasetFromGraph"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.DatasetFromGraph"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DatasetToGraph.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DatasetToGraph.pbtxt
new file mode 100644
index 00000000000..88e1ce351e4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DatasetToGraph.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "DatasetToGraph"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DatasetToGraphV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DatasetToGraphV2.pbtxt
new file mode 100644
index 00000000000..99be66c5e54
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DatasetToGraphV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "DatasetToGraphV2"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.DatasetToGraph"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DatasetToSingleElement.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DatasetToSingleElement.pbtxt
new file mode 100644
index 00000000000..0f0407914d4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DatasetToSingleElement.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "DatasetToSingleElement"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.DatasetToSingleElement"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DatasetToTFRecord.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DatasetToTFRecord.pbtxt
new file mode 100644
index 00000000000..c4d256969f7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DatasetToTFRecord.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "DatasetToTFRecord"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.DatasetToTfRecord"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Dawsn.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Dawsn.pbtxt
new file mode 100644
index 00000000000..8cd2717a601
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Dawsn.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Dawsn"
+  endpoint {
+    name: "math.special.Dawsn"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugGradientIdentity.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugGradientIdentity.pbtxt
new file mode 100644
index 00000000000..1729c4a1508
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugGradientIdentity.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "DebugGradientIdentity"
+  endpoint {
+    name: "debugging.DebugGradientIdentity"
+  }
+  visibility: HIDDEN
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugGradientRefIdentity.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugGradientRefIdentity.pbtxt
new file mode 100644
index 00000000000..e892bcefc17
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugGradientRefIdentity.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "DebugGradientRefIdentity"
+  endpoint {
+    name: "debugging.DebugGradientRefIdentity"
+  }
+  visibility: HIDDEN
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugIdentity.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugIdentity.pbtxt
new file mode 100644
index 00000000000..e1d6b305f0f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugIdentity.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "DebugIdentity"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugIdentityV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugIdentityV2.pbtxt
new file mode 100644
index 00000000000..e9c29efad27
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugIdentityV2.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "DebugIdentityV2"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugIdentityV3.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugIdentityV3.pbtxt
new file mode 100644
index 00000000000..ec79f482e44
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugIdentityV3.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "DebugIdentityV3"
+  visibility: HIDDEN
+  endpoint {
+    name: "debugging.DebugIdentity"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugNanCount.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugNanCount.pbtxt
new file mode 100644
index 00000000000..5012ee1e355
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugNanCount.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "DebugNanCount"
+  endpoint {
+    name: "debugging.DebugNanCount"
+  }
+  visibility: HIDDEN
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugNumericSummary.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugNumericSummary.pbtxt
new file mode 100644
index 00000000000..8a5c173e170
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugNumericSummary.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "DebugNumericSummary"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugNumericSummaryV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugNumericSummaryV2.pbtxt
new file mode 100644
index 00000000000..dd70cac6e61
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DebugNumericSummaryV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "DebugNumericSummaryV2"
+  endpoint {
+    name: "debugging.DebugNumericsSummary"
+  }
+  visibility: HIDDEN
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeAndCropJpeg.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeAndCropJpeg.pbtxt
new file mode 100644
index 00000000000..13ffab4d225
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeAndCropJpeg.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DecodeAndCropJpeg"
+  endpoint {
+    name: "image.DecodeAndCropJpeg"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeBase64.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeBase64.pbtxt
new file mode 100644
index 00000000000..6d091e3a52e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeBase64.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DecodeBase64"
+  endpoint {
+    name: "io.DecodeBase64"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeBmp.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeBmp.pbtxt
new file mode 100644
index 00000000000..03f5e2d7aa0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeBmp.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DecodeBmp"
+  endpoint {
+    name: "image.DecodeBmp"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeCSV.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeCSV.pbtxt
new file mode 100644
index 00000000000..f8c881d807f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeCSV.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DecodeCSV"
+  endpoint {
+    name: "io.DecodeCsv"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeCompressed.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeCompressed.pbtxt
new file mode 100644
index 00000000000..e688002e944
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeCompressed.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DecodeCompressed"
+  endpoint {
+    name: "io.DecodeCompressed"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeGif.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeGif.pbtxt
new file mode 100644
index 00000000000..ac36d9bc1f2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeGif.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DecodeGif"
+  endpoint {
+    name: "image.DecodeGif"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeImage.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeImage.pbtxt
new file mode 100644
index 00000000000..80516c0e1b1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeImage.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DecodeImage"
+  endpoint {
+    name: "image.DecodeImage"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeJSONExample.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeJSONExample.pbtxt
new file mode 100644
index 00000000000..d78f8891a22
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeJSONExample.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DecodeJSONExample"
+  endpoint {
+    name: "io.DecodeJsonExample"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeJpeg.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeJpeg.pbtxt
new file mode 100644
index 00000000000..f1d5b1238d9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeJpeg.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DecodeJpeg"
+  endpoint {
+    name: "image.DecodeJpeg"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodePaddedRaw.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodePaddedRaw.pbtxt
new file mode 100644
index 00000000000..daaabcd76c4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodePaddedRaw.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DecodePaddedRaw"
+  endpoint {
+    name: "io.DecodePaddedRaw"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodePng.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodePng.pbtxt
new file mode 100644
index 00000000000..aed9c898a29
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodePng.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DecodePng"
+  endpoint {
+    name: "image.DecodePng"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeProtoV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeProtoV2.pbtxt
new file mode 100644
index 00000000000..b831161f690
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeProtoV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DecodeProtoV2"
+  endpoint {
+    name: "DecodeProto"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeRaw.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeRaw.pbtxt
new file mode 100644
index 00000000000..d91490cc854
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeRaw.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DecodeRaw"
+  endpoint {
+    name: "io.DecodeRaw"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeWav.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeWav.pbtxt
new file mode 100644
index 00000000000..f63a147de11
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeWav.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DecodeWav"
+  endpoint {
+    name: "audio.DecodeWav"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeWebP.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeWebP.pbtxt
new file mode 100644
index 00000000000..5bd8c3f5508
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DecodeWebP.pbtxt
@@ -0,0 +1,6 @@
+op {
+  graph_op_name: "DecodeWebP"
+  endpoint {
+    name: "image.DecodeWebP"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DeepCopy.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeepCopy.pbtxt
new file mode 100644
index 00000000000..e55a4c21ffe
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeepCopy.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DeepCopy"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DeleteIterator.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeleteIterator.pbtxt
new file mode 100644
index 00000000000..9a612e9ad6c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeleteIterator.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "DeleteIterator"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.DeleteIterator"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DeleteMemoryCache.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeleteMemoryCache.pbtxt
new file mode 100644
index 00000000000..e9ddbda3ed9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeleteMemoryCache.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DeleteMemoryCache"
+  endpoint {
+    name: "data.DeleteMemoryCache"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DeleteMultiDeviceIterator.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeleteMultiDeviceIterator.pbtxt
new file mode 100644
index 00000000000..b93b8c3541e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeleteMultiDeviceIterator.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DeleteMultiDeviceIterator"
+  endpoint {
+    name: "data.DeleteMultiDeviceIterator"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DeleteRandomSeedGenerator.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeleteRandomSeedGenerator.pbtxt
new file mode 100644
index 00000000000..f1d06eccdbb
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeleteRandomSeedGenerator.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DeleteRandomSeedGenerator"
+  endpoint {
+    name: "random.DeleteRandomSeedGenerator"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DeleteSeedGenerator.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeleteSeedGenerator.pbtxt
new file mode 100644
index 00000000000..24e5394bf3f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeleteSeedGenerator.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DeleteSeedGenerator"
+  endpoint {
+    name: "random.DeleteSeedGenerator"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DeleteSessionTensor.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeleteSessionTensor.pbtxt
new file mode 100644
index 00000000000..a7e2ca5bfed
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeleteSessionTensor.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DeleteSessionTensor"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DenseBincount.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DenseBincount.pbtxt
new file mode 100644
index 00000000000..38af1580e36
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DenseBincount.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DenseBincount"
+  endpoint {
+    name: "math.DenseBincount"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DenseCountSparseOutput.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DenseCountSparseOutput.pbtxt
new file mode 100644
index 00000000000..6496cb1c446
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DenseCountSparseOutput.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DenseCountSparseOutput"
+  endpoint {
+    name: "sparse.DenseCountSparseOutput"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DenseToCSRSparseMatrix.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DenseToCSRSparseMatrix.pbtxt
new file mode 100644
index 00000000000..dc7ecd1a204
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DenseToCSRSparseMatrix.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DenseToCSRSparseMatrix"
+  endpoint {
+    name: "linalg.sparse.DenseToCSRSparseMatrix"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DenseToDenseSetOperation.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DenseToDenseSetOperation.pbtxt
new file mode 100644
index 00000000000..8772c2c0e3a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DenseToDenseSetOperation.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DenseToDenseSetOperation"
+  endpoint {
+    name: "sparse.DenseToDenseSetOperation"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DenseToSparseBatchDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DenseToSparseBatchDataset.pbtxt
new file mode 100644
index 00000000000..106059e48f0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DenseToSparseBatchDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "DenseToSparseBatchDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.DenseToSparseBatchDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DenseToSparseSetOperation.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DenseToSparseSetOperation.pbtxt
new file mode 100644
index 00000000000..80455026338
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DenseToSparseSetOperation.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DenseToSparseSetOperation"
+  endpoint {
+    name: "sparse.DenseToSparseSetOperation"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DepthToSpace.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DepthToSpace.pbtxt
new file mode 100644
index 00000000000..da338027869
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DepthToSpace.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DepthToSpace"
+  endpoint {
+    name: "nn.DepthToSpace"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DepthwiseConv2dNative.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DepthwiseConv2dNative.pbtxt
new file mode 100644
index 00000000000..eb20bbab725
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DepthwiseConv2dNative.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DepthwiseConv2dNative"
+  endpoint {
+    name: "nn.DepthwiseConv2dNative"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DepthwiseConv2dNativeBackpropFilter.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DepthwiseConv2dNativeBackpropFilter.pbtxt
new file mode 100644
index 00000000000..e534f662ea2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DepthwiseConv2dNativeBackpropFilter.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DepthwiseConv2dNativeBackpropFilter"
+  endpoint {
+    name: "nn.DepthwiseConv2dNativeBackpropFilter"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DepthwiseConv2dNativeBackpropInput.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DepthwiseConv2dNativeBackpropInput.pbtxt
new file mode 100644
index 00000000000..892160034cd
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DepthwiseConv2dNativeBackpropInput.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DepthwiseConv2dNativeBackpropInput"
+  endpoint {
+    name: "nn.DepthwiseConv2dNativeBackpropInput"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Dequantize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Dequantize.pbtxt
new file mode 100644
index 00000000000..7b32cd14882
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Dequantize.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Dequantize"
+  endpoint {
+    name: "quantization.Dequantize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DeserializeIterator.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeserializeIterator.pbtxt
new file mode 100644
index 00000000000..cb296d27127
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeserializeIterator.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DeserializeIterator"
+  endpoint {
+    name: "data.DeserializeIterator"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DeserializeManySparse.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeserializeManySparse.pbtxt
new file mode 100644
index 00000000000..b57141ed844
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeserializeManySparse.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DeserializeManySparse"
+  endpoint {
+    name: "io.DeserializeManySparse"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DeserializeSparse.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeserializeSparse.pbtxt
new file mode 100644
index 00000000000..8b46d1060b8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeserializeSparse.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DeserializeSparse"
+  endpoint {
+    name: "sparse.DeserializeSparse"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DestroyResourceOp.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DestroyResourceOp.pbtxt
new file mode 100644
index 00000000000..dbdcf2f0cea
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DestroyResourceOp.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DestroyResourceOp"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DestroyTemporaryVariable.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DestroyTemporaryVariable.pbtxt
new file mode 100644
index 00000000000..e9f167bd1fc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DestroyTemporaryVariable.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DestroyTemporaryVariable"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DeviceIndex.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeviceIndex.pbtxt
new file mode 100644
index 00000000000..de7b5bc2b58
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DeviceIndex.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DeviceIndex"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Diag.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Diag.pbtxt
new file mode 100644
index 00000000000..de116a55651
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Diag.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Diag"
+  endpoint {
+    name: "linalg.TensorDiag"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DiagPart.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DiagPart.pbtxt
new file mode 100644
index 00000000000..b9ef4010d99
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DiagPart.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DiagPart"
+  endpoint {
+    name: "linalg.TensorDiagPart"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Digamma.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Digamma.pbtxt
new file mode 100644
index 00000000000..fafcf4cc8bc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Digamma.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Digamma"
+  endpoint {
+    name: "math.Digamma"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Dilation2D.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Dilation2D.pbtxt
new file mode 100644
index 00000000000..523cf20b08d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Dilation2D.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Dilation2D"
+  endpoint {
+    name: "nn.Dilation2d"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Dilation2DBackpropFilter.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Dilation2DBackpropFilter.pbtxt
new file mode 100644
index 00000000000..0b7b84c8b5d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Dilation2DBackpropFilter.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Dilation2DBackpropFilter"
+  endpoint {
+    name: "nn.Dilation2dBackpropFilter"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Dilation2DBackpropInput.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Dilation2DBackpropInput.pbtxt
new file mode 100644
index 00000000000..c8d15a56c8b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Dilation2DBackpropInput.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Dilation2DBackpropInput"
+  endpoint {
+    name: "nn.Dilation2dBackpropInput"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DirectedInterleaveDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DirectedInterleaveDataset.pbtxt
new file mode 100644
index 00000000000..60c9729704e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DirectedInterleaveDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "DirectedInterleaveDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.DirectedInterleaveDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DisableCopyOnRead.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DisableCopyOnRead.pbtxt
new file mode 100644
index 00000000000..4e6dae43607
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DisableCopyOnRead.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DisableCopyOnRead"
+  endpoint {
+    name: "io.DisableCopyOnRead"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DistributedSave.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DistributedSave.pbtxt
new file mode 100644
index 00000000000..74a8b4ddfc1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DistributedSave.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DistributedSave"
+  endpoint {
+    name: "train.DistributedSave"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Div.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Div.pbtxt
new file mode 100644
index 00000000000..70007de3ae0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Div.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Div"
+  endpoint {
+    name: "math.Div"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DivNoNan.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DivNoNan.pbtxt
new file mode 100644
index 00000000000..c8dcc9f80aa
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DivNoNan.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DivNoNan"
+  endpoint {
+    name: "math.DivNoNan"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DrawBoundingBoxes.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DrawBoundingBoxes.pbtxt
new file mode 100644
index 00000000000..5929f6ff960
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DrawBoundingBoxes.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "DrawBoundingBoxes"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DrawBoundingBoxesV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DrawBoundingBoxesV2.pbtxt
new file mode 100644
index 00000000000..1a1bcc3c284
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DrawBoundingBoxesV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DrawBoundingBoxesV2"
+  endpoint {
+    name: "image.DrawBoundingBoxes"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DummyIterationCounter.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DummyIterationCounter.pbtxt
new file mode 100644
index 00000000000..837647279de
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DummyIterationCounter.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DummyIterationCounter"
+  endpoint {
+    name: "data.DummyIterationCounter"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DummyMemoryCache.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DummyMemoryCache.pbtxt
new file mode 100644
index 00000000000..ac86013215f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DummyMemoryCache.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DummyMemoryCache"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DummySeedGenerator.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DummySeedGenerator.pbtxt
new file mode 100644
index 00000000000..3d2cf2618ff
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DummySeedGenerator.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DummySeedGenerator"
+  endpoint {
+    name: "random.DummySeedGenerator"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DynamicEnqueueTPUEmbeddingArbitraryTensorBatch.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DynamicEnqueueTPUEmbeddingArbitraryTensorBatch.pbtxt
new file mode 100644
index 00000000000..935786de8fa
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DynamicEnqueueTPUEmbeddingArbitraryTensorBatch.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DynamicEnqueueTPUEmbeddingArbitraryTensorBatch"
+  endpoint {
+    name: "tpu.DynamicEnqueueTPUEmbeddingArbitraryTensorBatch"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DynamicEnqueueTPUEmbeddingRaggedTensorBatch.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DynamicEnqueueTPUEmbeddingRaggedTensorBatch.pbtxt
new file mode 100644
index 00000000000..2f59cca069b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DynamicEnqueueTPUEmbeddingRaggedTensorBatch.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DynamicEnqueueTPUEmbeddingRaggedTensorBatch"
+  endpoint {
+    name: "tpu.DynamicEnqueueTPUEmbeddingRaggedTensorBatch"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DynamicPartition.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DynamicPartition.pbtxt
new file mode 100644
index 00000000000..4550ff6fbbc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DynamicPartition.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DynamicPartition"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_DynamicStitch.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_DynamicStitch.pbtxt
new file mode 100644
index 00000000000..609515974a7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_DynamicStitch.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "DynamicStitch"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_EagerPyFunc.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_EagerPyFunc.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_EagerPyFunc.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_EagerPyFunc.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_EditDistance.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_EditDistance.pbtxt
new file mode 100644
index 00000000000..8e6dabb659f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_EditDistance.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "EditDistance"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Eig.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Eig.pbtxt
new file mode 100644
index 00000000000..fb0d5c4b045
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Eig.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Eig"
+  endpoint {
+    name: "linalg.Eig"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Einsum.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Einsum.pbtxt
new file mode 100644
index 00000000000..fbfc95e1380
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Einsum.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Einsum"
+  endpoint {
+    name: "linalg.Einsum"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Elu.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Elu.pbtxt
new file mode 100644
index 00000000000..432d2a70692
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Elu.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Elu"
+  endpoint {
+    name: "nn.Elu"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_EluGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_EluGrad.pbtxt
new file mode 100644
index 00000000000..e8722cc7d24
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_EluGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "EluGrad"
+  endpoint {
+    name: "nn.EluGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Empty.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Empty.pbtxt
new file mode 100644
index 00000000000..e2dfb53ab7b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Empty.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Empty"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_EmptyTensorList.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_EmptyTensorList.pbtxt
new file mode 100644
index 00000000000..df92f263af1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_EmptyTensorList.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "EmptyTensorList"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_EmptyTensorMap.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_EmptyTensorMap.pbtxt
new file mode 100644
index 00000000000..a2141d3fbd3
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_EmptyTensorMap.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "EmptyTensorMap"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_EncodeBase64.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_EncodeBase64.pbtxt
new file mode 100644
index 00000000000..a060a92104d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_EncodeBase64.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "EncodeBase64"
+  endpoint {
+    name: "io.EncodeBase64"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_EncodeJpeg.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_EncodeJpeg.pbtxt
new file mode 100644
index 00000000000..af995121608
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_EncodeJpeg.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "EncodeJpeg"
+  endpoint {
+    name: "image.EncodeJpeg"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_EncodeJpegVariableQuality.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_EncodeJpegVariableQuality.pbtxt
new file mode 100644
index 00000000000..bb8eeba21b3
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_EncodeJpegVariableQuality.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "EncodeJpegVariableQuality"
+  endpoint {
+    name: "image.EncodeJpegVariableQuality"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_EncodePng.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_EncodePng.pbtxt
new file mode 100644
index 00000000000..b806e4917ff
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_EncodePng.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "EncodePng"
+  endpoint {
+    name: "image.EncodePng"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_EncodeProto.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_EncodeProto.pbtxt
new file mode 100644
index 00000000000..87b2c6ac4bc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_EncodeProto.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "EncodeProto"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_EncodeWav.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_EncodeWav.pbtxt
new file mode 100644
index 00000000000..96ed73270da
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_EncodeWav.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "EncodeWav"
+  endpoint {
+    name: "audio.EncodeWav"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_EnqueueInQueueDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_EnqueueInQueueDataset.pbtxt
similarity index 82%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_EnqueueInQueueDataset.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_EnqueueInQueueDataset.pbtxt
index 26051ab446f..804c2fc317e 100644
--- a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_EnqueueInQueueDataset.pbtxt
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_EnqueueInQueueDataset.pbtxt
@@ -1,5 +1,6 @@
 op {
   graph_op_name: "EnqueueInQueueDataset"
+  visibility: VISIBLE
   endpoint {
     name: "data.EnqueueInQueueDataset"
   }
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_EnqueueTPUEmbeddingArbitraryTensorBatch.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_EnqueueTPUEmbeddingArbitraryTensorBatch.pbtxt
new file mode 100644
index 00000000000..7335cf4e1cc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_EnqueueTPUEmbeddingArbitraryTensorBatch.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "EnqueueTPUEmbeddingArbitraryTensorBatch"
+  endpoint {
+    name: "tpu.EnqueueTPUEmbeddingArbitraryTensorBatch"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_EnqueueTPUEmbeddingBatch.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_EnqueueTPUEmbeddingBatch.pbtxt
new file mode 100644
index 00000000000..a14d72b4a72
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_EnqueueTPUEmbeddingBatch.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "EnqueueTPUEmbeddingBatch"
+  endpoint {
+    name: "tpu.EnqueueTPUEmbeddingBatch"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_EnqueueTPUEmbeddingIntegerBatch.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_EnqueueTPUEmbeddingIntegerBatch.pbtxt
new file mode 100644
index 00000000000..97b471f0ddd
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_EnqueueTPUEmbeddingIntegerBatch.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "EnqueueTPUEmbeddingIntegerBatch"
+  endpoint {
+    name: "tpu.EnqueueTPUEmbeddingIntegerBatch"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_EnqueueTPUEmbeddingRaggedTensorBatch.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_EnqueueTPUEmbeddingRaggedTensorBatch.pbtxt
new file mode 100644
index 00000000000..d1d250dd27a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_EnqueueTPUEmbeddingRaggedTensorBatch.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "EnqueueTPUEmbeddingRaggedTensorBatch"
+  endpoint {
+    name: "tpu.EnqueueTPUEmbeddingRaggedTensorBatch"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_EnqueueTPUEmbeddingSparseBatch.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_EnqueueTPUEmbeddingSparseBatch.pbtxt
new file mode 100644
index 00000000000..b346dd636a9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_EnqueueTPUEmbeddingSparseBatch.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "EnqueueTPUEmbeddingSparseBatch"
+  endpoint {
+    name: "tpu.EnqueueTPUEmbeddingSparseBatch"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_EnqueueTPUEmbeddingSparseTensorBatch.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_EnqueueTPUEmbeddingSparseTensorBatch.pbtxt
new file mode 100644
index 00000000000..56864f899be
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_EnqueueTPUEmbeddingSparseTensorBatch.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "EnqueueTPUEmbeddingSparseTensorBatch"
+  endpoint {
+    name: "tpu.EnqueueTPUEmbeddingSparseTensorBatch"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_EnsureShape.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_EnsureShape.pbtxt
new file mode 100644
index 00000000000..4e7d8ac0a55
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_EnsureShape.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "EnsureShape"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Enter.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Enter.pbtxt
new file mode 100644
index 00000000000..07abdf23784
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Enter.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Enter"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Equal.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Equal.pbtxt
new file mode 100644
index 00000000000..afd1c9fcf85
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Equal.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Equal"
+  endpoint {
+    name: "math.Equal"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Erf.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Erf.pbtxt
new file mode 100644
index 00000000000..0f3d2e6dc03
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Erf.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Erf"
+  endpoint {
+    name: "math.Erf"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Erfc.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Erfc.pbtxt
new file mode 100644
index 00000000000..b1da0c02862
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Erfc.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Erfc"
+  endpoint {
+    name: "math.Erfc"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Erfinv.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Erfinv.pbtxt
new file mode 100644
index 00000000000..68358ebb137
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Erfinv.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Erfinv"
+  endpoint {
+    name: "math.erfinv"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_EuclideanNorm.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_EuclideanNorm.pbtxt
new file mode 100644
index 00000000000..f4afae29cd7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_EuclideanNorm.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "EuclideanNorm"
+  endpoint {
+    name: "linalg.EuclideanNorm"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExecuteTPUEmbeddingPartitioner.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExecuteTPUEmbeddingPartitioner.pbtxt
new file mode 100644
index 00000000000..125aeb61d93
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExecuteTPUEmbeddingPartitioner.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExecuteTPUEmbeddingPartitioner"
+  endpoint {
+    name: "tpu.ExecuteTPUEmbeddingPartitioner"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Exit.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Exit.pbtxt
new file mode 100644
index 00000000000..0ca26a5aa7d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Exit.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Exit"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Exp.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Exp.pbtxt
new file mode 100644
index 00000000000..7947019a666
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Exp.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Exp"
+  endpoint {
+    name: "math.Exp"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExpandDims.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExpandDims.pbtxt
new file mode 100644
index 00000000000..01c82186792
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExpandDims.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExpandDims"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalAssertNextDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalAssertNextDataset.pbtxt
new file mode 100644
index 00000000000..28e46dce87d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalAssertNextDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalAssertNextDataset"
+  endpoint {
+    name: "data.experimental.AssertNextDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalAutoShardDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalAutoShardDataset.pbtxt
new file mode 100644
index 00000000000..df08aef09b3
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalAutoShardDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalAutoShardDataset"
+  endpoint {
+    name: "data.experimental.AutoShardDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalBytesProducedStatsDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalBytesProducedStatsDataset.pbtxt
new file mode 100644
index 00000000000..272f9e1eaae
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalBytesProducedStatsDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalBytesProducedStatsDataset"
+  endpoint {
+    name: "data.experimental.BytesProducedStatsDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalCSVDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalCSVDataset.pbtxt
new file mode 100644
index 00000000000..d548e72a07a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalCSVDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalCSVDataset"
+  endpoint {
+    name:  "data.experimental.CSVDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalChooseFastestDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalChooseFastestDataset.pbtxt
new file mode 100644
index 00000000000..d818de9d33e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalChooseFastestDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalChooseFastestDataset"
+  endpoint {
+    name: "data.experimental.ChooseFastestDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalDatasetCardinality.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalDatasetCardinality.pbtxt
new file mode 100644
index 00000000000..743bc536a0f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalDatasetCardinality.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalDatasetCardinality"
+  endpoint {
+    name: "data.experimental.DatasetCardinality"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalDatasetToTFRecord.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalDatasetToTFRecord.pbtxt
new file mode 100644
index 00000000000..45ca0a09034
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalDatasetToTFRecord.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalDatasetToTFRecord"
+  endpoint {
+    name: "data.experimental.DatasetToTFRecord"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalDenseToSparseBatchDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalDenseToSparseBatchDataset.pbtxt
new file mode 100644
index 00000000000..492eeee03a2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalDenseToSparseBatchDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalDenseToSparseBatchDataset"
+  endpoint {
+    name: "data.experimental.DenseToSparseBatchDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalDirectedInterleaveDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalDirectedInterleaveDataset.pbtxt
new file mode 100644
index 00000000000..d0acd7ea288
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalDirectedInterleaveDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalDirectedInterleaveDataset"
+  endpoint {
+    name: "data.experimental.DirectedInterleaveDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalFunctionBufferingResource.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalFunctionBufferingResource.pbtxt
new file mode 100644
index 00000000000..f35eca43ca4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalFunctionBufferingResource.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalFunctionBufferingResource"
+  endpoint {
+    name: "data.experimental.FunctionBufferingResource"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalFunctionBufferingResourceGetNext.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalFunctionBufferingResourceGetNext.pbtxt
new file mode 100644
index 00000000000..e1b5ae6fac6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalFunctionBufferingResourceGetNext.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalFunctionBufferingResourceGetNext"
+  endpoint {
+    name: "data.experimental.FunctionBufferingResourceGetNext"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalFunctionBufferingResourceReset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalFunctionBufferingResourceReset.pbtxt
new file mode 100644
index 00000000000..8c9bdb4de26
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalFunctionBufferingResourceReset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalFunctionBufferingResourceReset"
+  endpoint {
+    name: "data.experimental.FunctionBufferingResourceReset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalGroupByReducerDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalGroupByReducerDataset.pbtxt
new file mode 100644
index 00000000000..8cf62d85942
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalGroupByReducerDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalGroupByReducerDataset"
+  endpoint {
+    name: "data.experimental.GroupByReducerDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalGroupByWindowDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalGroupByWindowDataset.pbtxt
new file mode 100644
index 00000000000..875aaa78dd8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalGroupByWindowDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalGroupByWindowDataset"
+  endpoint {
+    name: "data.experimental.GroupByWindowDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalIgnoreErrorsDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalIgnoreErrorsDataset.pbtxt
new file mode 100644
index 00000000000..ad31e9738d7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalIgnoreErrorsDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalIgnoreErrorsDataset"
+  endpoint {
+    name: "data.experimental.IgnoreErrorsDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalIteratorGetDevice.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalIteratorGetDevice.pbtxt
new file mode 100644
index 00000000000..b1f2dfcf5c9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalIteratorGetDevice.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalIteratorGetDevice"
+  endpoint {
+    name: "data.experimental.IteratorGetDevice"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalLMDBDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalLMDBDataset.pbtxt
new file mode 100644
index 00000000000..a427a85e631
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalLMDBDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalLMDBDataset"
+  endpoint {
+    name: "data.experimental.LmdbDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalLatencyStatsDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalLatencyStatsDataset.pbtxt
new file mode 100644
index 00000000000..21ed0bfde64
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalLatencyStatsDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalLatencyStatsDataset"
+  endpoint {
+    name: "data.experimental.LatencyStatsDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalMapAndBatchDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalMapAndBatchDataset.pbtxt
new file mode 100644
index 00000000000..fa88e18887b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalMapAndBatchDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalMapAndBatchDataset"
+  endpoint {
+    name: "data.experimental.MapAndBatchDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalMapDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalMapDataset.pbtxt
new file mode 100644
index 00000000000..cdfa66a022e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalMapDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalMapDataset"
+  endpoint {
+    name: "data.experimental.MapDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalMatchingFilesDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalMatchingFilesDataset.pbtxt
new file mode 100644
index 00000000000..ae0210b3f3e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalMatchingFilesDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalMatchingFilesDataset"
+  endpoint {
+    name: "data.experimental.MatchingFilesDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalMaxIntraOpParallelismDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalMaxIntraOpParallelismDataset.pbtxt
new file mode 100644
index 00000000000..afe63cd09fe
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalMaxIntraOpParallelismDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalMaxIntraOpParallelismDataset"
+  endpoint {
+    name: "data.experimental.MaxIntraOpParallelismDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalNonSerializableDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalNonSerializableDataset.pbtxt
new file mode 100644
index 00000000000..5e3386e8483
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalNonSerializableDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalNonSerializableDataset"
+  endpoint {
+    name: "data.experimental.NonSerializableDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalParallelInterleaveDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalParallelInterleaveDataset.pbtxt
new file mode 100644
index 00000000000..ad33fe82aa8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalParallelInterleaveDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalParallelInterleaveDataset"
+  endpoint {
+    name: "data.experimental.ParallelInterleaveDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalParseExampleDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalParseExampleDataset.pbtxt
new file mode 100644
index 00000000000..741b6b1a96a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalParseExampleDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalParseExampleDataset"
+  endpoint {
+    name: "data.experimental.ParseExampleDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalPrivateThreadPoolDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalPrivateThreadPoolDataset.pbtxt
new file mode 100644
index 00000000000..667d9f53047
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalPrivateThreadPoolDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalPrivateThreadPoolDataset"
+  endpoint {
+    name: "data.experimental.PrivateThreadPoolDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalRandomDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalRandomDataset.pbtxt
new file mode 100644
index 00000000000..687e7c2782a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalRandomDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalRandomDataset"
+  endpoint {
+    name: "data.experimental.RandomDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalRebatchDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalRebatchDataset.pbtxt
new file mode 100644
index 00000000000..8012dbae620
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalRebatchDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalRebatchDataset"
+  endpoint {
+    name: "data.experimental.RebatchDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalScanDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalScanDataset.pbtxt
new file mode 100644
index 00000000000..910fb561988
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalScanDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalScanDataset"
+  endpoint {
+    name: "data.experimental.ScanDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalSetStatsAggregatorDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalSetStatsAggregatorDataset.pbtxt
new file mode 100644
index 00000000000..d3039499942
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalSetStatsAggregatorDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalSetStatsAggregatorDataset"
+  endpoint {
+    name: "data.experimental.SetStatsAggregatorDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalSleepDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalSleepDataset.pbtxt
new file mode 100644
index 00000000000..7c160528fcc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalSleepDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalSleepDataset"
+  endpoint {
+    name: "data.experimental.SleepDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalSlidingWindowDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalSlidingWindowDataset.pbtxt
new file mode 100644
index 00000000000..aa0fe454722
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalSlidingWindowDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalSlidingWindowDataset"
+  endpoint {
+    name: "data.experimental.SlidingWindowDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalSqlDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalSqlDataset.pbtxt
new file mode 100644
index 00000000000..f827b21b8b7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalSqlDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalSqlDataset"
+  endpoint {
+    name: "data.experimental.SqlDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalStatsAggregatorHandle.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalStatsAggregatorHandle.pbtxt
new file mode 100644
index 00000000000..ec2f2aff7ca
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalStatsAggregatorHandle.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalStatsAggregatorHandle"
+  endpoint {
+    name: "data.experimental.StatsAggregatorHandle"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalStatsAggregatorSummary.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalStatsAggregatorSummary.pbtxt
new file mode 100644
index 00000000000..6f9b79ac777
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalStatsAggregatorSummary.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalStatsAggregatorSummary"
+  endpoint {
+    name: "data.experimental.StatsAggregatorSummary"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalTakeWhileDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalTakeWhileDataset.pbtxt
new file mode 100644
index 00000000000..2b494bd04c4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalTakeWhileDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalTakeWhileDataset"
+  endpoint {
+    name: "data.experimental.TakeWhileDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalThreadPoolDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalThreadPoolDataset.pbtxt
new file mode 100644
index 00000000000..55fc4665fd9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalThreadPoolDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalThreadPoolDataset"
+  endpoint {
+    name: "data.experimental.ThreadPoolDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalThreadPoolHandle.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalThreadPoolHandle.pbtxt
new file mode 100644
index 00000000000..ecaa0ceb2c9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalThreadPoolHandle.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalThreadPoolHandle"
+  endpoint {
+    name: "data.experimental.ThreadPoolHandle"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalUnbatchDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalUnbatchDataset.pbtxt
new file mode 100644
index 00000000000..c08a60749be
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalUnbatchDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalUnbatchDataset"
+  endpoint {
+    name: "data.experimental.UnbatchDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalUniqueDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalUniqueDataset.pbtxt
new file mode 100644
index 00000000000..d644078b402
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExperimentalUniqueDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExperimentalUniqueDataset"
+  endpoint {
+    name: "data.experimental.UniqueDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Expint.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Expint.pbtxt
new file mode 100644
index 00000000000..64b09ca6ab7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Expint.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Expint"
+  endpoint {
+    name: "math.special.Expint"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Expm1.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Expm1.pbtxt
new file mode 100644
index 00000000000..df2ece3b9e8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Expm1.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Expm1"
+  endpoint {
+    name: "math.Expm1"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExtractGlimpse.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExtractGlimpse.pbtxt
new file mode 100644
index 00000000000..b44183c1178
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExtractGlimpse.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "ExtractGlimpse"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExtractGlimpseV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExtractGlimpseV2.pbtxt
new file mode 100644
index 00000000000..e0491472fc4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExtractGlimpseV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExtractGlimpseV2"
+  endpoint {
+    name: "image.ExtractGlimpse"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExtractImagePatches.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExtractImagePatches.pbtxt
new file mode 100644
index 00000000000..ab6177b5247
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExtractImagePatches.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExtractImagePatches"
+  endpoint {
+    name: "image.ExtractImagePatches"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExtractJpegShape.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExtractJpegShape.pbtxt
new file mode 100644
index 00000000000..da8258cc5b2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExtractJpegShape.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExtractJpegShape"
+  endpoint {
+    name: "image.ExtractJpegShape"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ExtractVolumePatches.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExtractVolumePatches.pbtxt
new file mode 100644
index 00000000000..5d5d80ce08f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ExtractVolumePatches.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ExtractVolumePatches"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FFT.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FFT.pbtxt
new file mode 100644
index 00000000000..a50549a383e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FFT.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FFT"
+  endpoint {
+    name: "signal.Fft"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FFT2D.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FFT2D.pbtxt
new file mode 100644
index 00000000000..ffbf0a00050
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FFT2D.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FFT2D"
+  endpoint {
+    name: "signal.Fft2d"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FFT3D.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FFT3D.pbtxt
new file mode 100644
index 00000000000..a7415cc5d03
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FFT3D.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FFT3D"
+  endpoint {
+    name: "signal.Fft3d"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FFTND.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FFTND.pbtxt
new file mode 100644
index 00000000000..753cdcb1997
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FFTND.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FFTND"
+  endpoint {
+    name: "signal.FftNd"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_FIFOQueue.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FIFOQueue.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_FIFOQueue.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_FIFOQueue.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FIFOQueueV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FIFOQueueV2.pbtxt
new file mode 100644
index 00000000000..797fe75a0b5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FIFOQueueV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FIFOQueueV2"
+  endpoint {
+    name: "io.FifoQueue"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Fact.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Fact.pbtxt
new file mode 100644
index 00000000000..f60455d31a5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Fact.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Fact"
+  endpoint {
+    name: "math.Fact"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeParam.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeParam.pbtxt
new file mode 100644
index 00000000000..3310fb8af02
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeParam.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FakeParam"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeQuantWithMinMaxArgs.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeQuantWithMinMaxArgs.pbtxt
new file mode 100644
index 00000000000..61723a6b616
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeQuantWithMinMaxArgs.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FakeQuantWithMinMaxArgs"
+  endpoint {
+    name: "quantization.FakeQuantWithMinMaxArgs"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeQuantWithMinMaxArgsGradient.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeQuantWithMinMaxArgsGradient.pbtxt
new file mode 100644
index 00000000000..a995fff37e4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeQuantWithMinMaxArgsGradient.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FakeQuantWithMinMaxArgsGradient"
+  endpoint {
+    name: "quantization.FakeQuantWithMinMaxArgsGradient"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeQuantWithMinMaxVars.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeQuantWithMinMaxVars.pbtxt
new file mode 100644
index 00000000000..7318899ee3f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeQuantWithMinMaxVars.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FakeQuantWithMinMaxVars"
+  endpoint {
+    name: "quantization.FakeQuantWithMinMaxVars"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeQuantWithMinMaxVarsGradient.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeQuantWithMinMaxVarsGradient.pbtxt
new file mode 100644
index 00000000000..7738b510c20
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeQuantWithMinMaxVarsGradient.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FakeQuantWithMinMaxVarsGradient"
+  endpoint {
+    name: "quantization.FakeQuantWithMinMaxVarsGradient"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeQuantWithMinMaxVarsPerChannel.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeQuantWithMinMaxVarsPerChannel.pbtxt
new file mode 100644
index 00000000000..270c2644610
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeQuantWithMinMaxVarsPerChannel.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FakeQuantWithMinMaxVarsPerChannel"
+  endpoint {
+    name: "quantization.FakeQuantWithMinMaxVarsPerChannel"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeQuantWithMinMaxVarsPerChannelGradient.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeQuantWithMinMaxVarsPerChannelGradient.pbtxt
new file mode 100644
index 00000000000..0cd372b0162
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeQuantWithMinMaxVarsPerChannelGradient.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FakeQuantWithMinMaxVarsPerChannelGradient"
+  endpoint {
+    name: "quantization.FakeQuantWithMinMaxVarsPerChannelGradient"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeQueue.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeQueue.pbtxt
new file mode 100644
index 00000000000..b49719e8142
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FakeQueue.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FakeQueue"
+  endpoint {
+    name: "io.FakeQueue"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FileSystemSetConfiguration.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FileSystemSetConfiguration.pbtxt
new file mode 100644
index 00000000000..48a9f01c087
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FileSystemSetConfiguration.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FileSystemSetConfiguration"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Fill.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Fill.pbtxt
new file mode 100644
index 00000000000..b0883b54e03
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Fill.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Fill"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FilterByLastComponentDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FilterByLastComponentDataset.pbtxt
new file mode 100644
index 00000000000..4ad74385bce
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FilterByLastComponentDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "FilterByLastComponentDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.FilterByLastComponentDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FilterDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FilterDataset.pbtxt
new file mode 100644
index 00000000000..c8e587eeedd
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FilterDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "FilterDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.FilterDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FinalizeDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FinalizeDataset.pbtxt
new file mode 100644
index 00000000000..78b37455e28
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FinalizeDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "FinalizeDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.FinalizeDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FinalizeTPUEmbedding.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FinalizeTPUEmbedding.pbtxt
new file mode 100644
index 00000000000..5a5262fbe5a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FinalizeTPUEmbedding.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "FinalizeTPUEmbedding"
+  endpoint {
+    name: "tpu.FinalizeTPUEmbedding"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FinalizeTPUEmbeddingV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FinalizeTPUEmbeddingV2.pbtxt
new file mode 100644
index 00000000000..7a8840309e4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FinalizeTPUEmbeddingV2.pbtxt
@@ -0,0 +1,6 @@
+op {
+  graph_op_name: "FinalizeTPUEmbeddingV2"
+  endpoint {
+    name: "tpu.FinalizeTPUEmbedding"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Fingerprint.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Fingerprint.pbtxt
new file mode 100644
index 00000000000..42f780314bb
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Fingerprint.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Fingerprint"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_FixedLengthRecordDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FixedLengthRecordDataset.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_FixedLengthRecordDataset.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_FixedLengthRecordDataset.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FixedLengthRecordDatasetV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FixedLengthRecordDatasetV2.pbtxt
new file mode 100644
index 00000000000..b0f66ca1642
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FixedLengthRecordDatasetV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "FixedLengthRecordDatasetV2"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.FixedLengthRecordDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_FixedLengthRecordReader.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FixedLengthRecordReader.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_FixedLengthRecordReader.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_FixedLengthRecordReader.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FixedLengthRecordReaderV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FixedLengthRecordReaderV2.pbtxt
new file mode 100644
index 00000000000..c6acb018dc2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FixedLengthRecordReaderV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FixedLengthRecordReaderV2"
+  endpoint {
+    name: "io.FixedLengthRecordReader"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FixedUnigramCandidateSampler.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FixedUnigramCandidateSampler.pbtxt
new file mode 100644
index 00000000000..b4e26238201
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FixedUnigramCandidateSampler.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FixedUnigramCandidateSampler"
+  endpoint {
+    name: "nn.FixedUnigramCandidateSampler"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FlatMapDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FlatMapDataset.pbtxt
new file mode 100644
index 00000000000..54b443d247c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FlatMapDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "FlatMapDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.FlatMapDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Floor.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Floor.pbtxt
new file mode 100644
index 00000000000..9cbf0eb0e4e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Floor.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Floor"
+  endpoint {
+    name: "math.Floor"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FloorDiv.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FloorDiv.pbtxt
new file mode 100644
index 00000000000..693eed27e08
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FloorDiv.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FloorDiv"
+  endpoint {
+    name: "math.FloorDiv"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FloorMod.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FloorMod.pbtxt
new file mode 100644
index 00000000000..c6c7ea42659
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FloorMod.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FloorMod"
+  endpoint {
+    name: "math.FloorMod"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FlushSummaryWriter.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FlushSummaryWriter.pbtxt
new file mode 100644
index 00000000000..5731ce679d7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FlushSummaryWriter.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FlushSummaryWriter"
+  endpoint {
+    name: "summary.FlushSummaryWriter"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_For.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_For.pbtxt
new file mode 100644
index 00000000000..4d01b94bd26
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_For.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "For"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FractionalAvgPool.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FractionalAvgPool.pbtxt
new file mode 100644
index 00000000000..1e2afb0ca3b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FractionalAvgPool.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FractionalAvgPool"
+  endpoint {
+    name: "nn.FractionalAvgPool"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FractionalAvgPoolGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FractionalAvgPoolGrad.pbtxt
new file mode 100644
index 00000000000..f51859f903e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FractionalAvgPoolGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FractionalAvgPoolGrad"
+  endpoint {
+    name: "nn.FractionalAvgPoolGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FractionalMaxPool.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FractionalMaxPool.pbtxt
new file mode 100644
index 00000000000..ad0fddc2bc6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FractionalMaxPool.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FractionalMaxPool"
+  endpoint {
+    name: "nn.FractionalMaxPool"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FractionalMaxPoolGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FractionalMaxPoolGrad.pbtxt
new file mode 100644
index 00000000000..00bf30c2b68
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FractionalMaxPoolGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FractionalMaxPoolGrad"
+  endpoint {
+    name: "nn.FractionalMaxPoolGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FresnelCos.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FresnelCos.pbtxt
new file mode 100644
index 00000000000..239ea452c59
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FresnelCos.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FresnelCos"
+  endpoint {
+    name: "math.special.FresnelCos"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FresnelSin.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FresnelSin.pbtxt
new file mode 100644
index 00000000000..01e64aa2368
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FresnelSin.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FresnelSin"
+  endpoint {
+    name: "math.special.FresnelSin"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_FusedBatchNorm.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FusedBatchNorm.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_FusedBatchNorm.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_FusedBatchNorm.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_FusedBatchNormGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FusedBatchNormGrad.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_FusedBatchNormGrad.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_FusedBatchNormGrad.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FusedBatchNormGradV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FusedBatchNormGradV2.pbtxt
new file mode 100644
index 00000000000..6cbbd1cf862
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FusedBatchNormGradV2.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "FusedBatchNormGradV2"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FusedBatchNormGradV3.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FusedBatchNormGradV3.pbtxt
new file mode 100644
index 00000000000..bf2ae00fd7f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FusedBatchNormGradV3.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FusedBatchNormGradV3"
+  endpoint {
+    name: "nn.FusedBatchNormGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FusedBatchNormV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FusedBatchNormV2.pbtxt
new file mode 100644
index 00000000000..4428a94d582
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FusedBatchNormV2.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "FusedBatchNormV2"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FusedBatchNormV3.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FusedBatchNormV3.pbtxt
new file mode 100644
index 00000000000..e3cc882ca7d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FusedBatchNormV3.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FusedBatchNormV3"
+  endpoint {
+    name: "nn.FusedBatchNorm"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FusedPadConv2D.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FusedPadConv2D.pbtxt
new file mode 100644
index 00000000000..7e0d6eb913d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FusedPadConv2D.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FusedPadConv2D"
+  endpoint {
+    name: "nn.FusedPadConv2d"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_FusedResizeAndPadConv2D.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_FusedResizeAndPadConv2D.pbtxt
new file mode 100644
index 00000000000..fc92f057104
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_FusedResizeAndPadConv2D.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "FusedResizeAndPadConv2D"
+  endpoint {
+    name: "nn.FusedResizeAndPadConv2d"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GRUBlockCell.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GRUBlockCell.pbtxt
new file mode 100644
index 00000000000..0b5ab9c8b0b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GRUBlockCell.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "GRUBlockCell"
+  endpoint {
+    name: "nn.GRUBlockCell"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GRUBlockCellGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GRUBlockCellGrad.pbtxt
new file mode 100644
index 00000000000..642a35b7945
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GRUBlockCellGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "GRUBlockCellGrad"
+  endpoint {
+    name: "nn.GRUBlockCellGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Gather.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Gather.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Gather.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_Gather.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GatherNd.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GatherNd.pbtxt
new file mode 100644
index 00000000000..80ed9a514c5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GatherNd.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "GatherNd"
+  endpoint {
+    name: "GatherNd"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GatherV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GatherV2.pbtxt
new file mode 100644
index 00000000000..d27fd30efa0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GatherV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "GatherV2"
+  endpoint {
+    name: "Gather"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GcsConfigureBlockCache.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GcsConfigureBlockCache.pbtxt
new file mode 100644
index 00000000000..0878563c93b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GcsConfigureBlockCache.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "GcsConfigureBlockCache"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GcsConfigureCredentials.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GcsConfigureCredentials.pbtxt
new file mode 100644
index 00000000000..1653b16c4ee
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GcsConfigureCredentials.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "GcsConfigureCredentials"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GenerateBigQueryReaderPartitions.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GenerateBigQueryReaderPartitions.pbtxt
new file mode 100644
index 00000000000..3b037ef31c6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GenerateBigQueryReaderPartitions.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "GenerateBigQueryReaderPartitions"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GenerateBoundingBoxProposals.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GenerateBoundingBoxProposals.pbtxt
new file mode 100644
index 00000000000..069e9b74fff
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GenerateBoundingBoxProposals.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "GenerateBoundingBoxProposals"
+  endpoint {
+    name: "image.GenerateBoundingBoxProposals"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GenerateVocabRemapping.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GenerateVocabRemapping.pbtxt
new file mode 100644
index 00000000000..02c132223ec
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GenerateVocabRemapping.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "GenerateVocabRemapping"
+  endpoint {
+    name: "train.GenerateVocabRemapping"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GeneratorDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GeneratorDataset.pbtxt
new file mode 100644
index 00000000000..9ff9c28330a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GeneratorDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "GeneratorDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.GeneratorDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GetElementAtIndex.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GetElementAtIndex.pbtxt
new file mode 100644
index 00000000000..9fac3335954
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GetElementAtIndex.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "GetElementAtIndex"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GetMinibatchSplitsWithPhysicalReplica.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GetMinibatchSplitsWithPhysicalReplica.pbtxt
new file mode 100644
index 00000000000..a9a8710fdb5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GetMinibatchSplitsWithPhysicalReplica.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "GetMinibatchSplitsWithPhysicalReplica"
+  visibility: VISIBLE
+  endpoint {
+    name: "tpu.GetMinibatchSplitsWithPhysicalReplica"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GetMinibatchesInCsrWithPhysicalReplica.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GetMinibatchesInCsrWithPhysicalReplica.pbtxt
new file mode 100644
index 00000000000..9ee5d7e2e5b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GetMinibatchesInCsrWithPhysicalReplica.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "GetMinibatchesInCsrWithPhysicalReplica"
+  visibility: VISIBLE
+  endpoint {
+    name: "tpu.GetMinibatchesInCsrWithPhysicalReplica"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GetOptions.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GetOptions.pbtxt
new file mode 100644
index 00000000000..eeb6d4c91d8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GetOptions.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "GetOptions"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_GetSessionHandle.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GetSessionHandle.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_GetSessionHandle.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_GetSessionHandle.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GetSessionHandleV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GetSessionHandleV2.pbtxt
new file mode 100644
index 00000000000..3484fbcd5d7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GetSessionHandleV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "GetSessionHandleV2"
+  endpoint {
+    name: "GetSessionHandle"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GetSessionTensor.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GetSessionTensor.pbtxt
new file mode 100644
index 00000000000..496b31c6ef0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GetSessionTensor.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "GetSessionTensor"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GetStatsFromListOfSparseCoreCooTensors.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GetStatsFromListOfSparseCoreCooTensors.pbtxt
new file mode 100644
index 00000000000..11a2b9eccba
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GetStatsFromListOfSparseCoreCooTensors.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "GetStatsFromListOfSparseCoreCooTensors"
+  visibility: VISIBLE
+  endpoint {
+    name: "sparse.GetStatsFromListOfSparseCoreCooTensors"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GetTpuTaskId.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GetTpuTaskId.pbtxt
new file mode 100644
index 00000000000..1072689506c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GetTpuTaskId.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "GetTpuTaskId"
+  visibility: VISIBLE
+  endpoint {
+    name: "tpu.GetTpuTaskId"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GlobalIterId.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GlobalIterId.pbtxt
new file mode 100644
index 00000000000..8a795a8ef23
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GlobalIterId.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "GlobalIterId"
+  visibility: VISIBLE
+  endpoint {
+    name: "tpu.GlobalIterId"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GlobalShuffleDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GlobalShuffleDataset.pbtxt
new file mode 100644
index 00000000000..ed286d3ae31
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GlobalShuffleDataset.pbtxt
@@ -0,0 +1,6 @@
+op {
+  graph_op_name: "GlobalShuffleDataset"
+  endpoint {
+    name: "data.GlobalShuffleDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Greater.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Greater.pbtxt
new file mode 100644
index 00000000000..a84b4c9bc6b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Greater.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Greater"
+  endpoint {
+    name: "math.Greater"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GreaterEqual.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GreaterEqual.pbtxt
new file mode 100644
index 00000000000..57f8c014728
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GreaterEqual.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "GreaterEqual"
+  endpoint {
+    name: "math.GreaterEqual"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GroupByReducerDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GroupByReducerDataset.pbtxt
new file mode 100644
index 00000000000..57b781c5a0a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GroupByReducerDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "GroupByReducerDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.GroupByReducerDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GroupByWindowDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GroupByWindowDataset.pbtxt
new file mode 100644
index 00000000000..529ca47d86e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GroupByWindowDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "GroupByWindowDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.GroupByWindowDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_GuaranteeConst.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_GuaranteeConst.pbtxt
new file mode 100644
index 00000000000..56a115a0603
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_GuaranteeConst.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "GuaranteeConst"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_HSVToRGB.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_HSVToRGB.pbtxt
new file mode 100644
index 00000000000..5689d054353
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_HSVToRGB.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "HSVToRGB"
+  endpoint {
+    name: "image.HsvToRgb"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_HashTable.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_HashTable.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_HashTable.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_HashTable.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_HashTableV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_HashTableV2.pbtxt
new file mode 100644
index 00000000000..4cde617757a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_HashTableV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "HashTableV2"
+  endpoint {
+    name: "HashTable"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_HistogramFixedWidth.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_HistogramFixedWidth.pbtxt
new file mode 100644
index 00000000000..f3d2065032f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_HistogramFixedWidth.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "HistogramFixedWidth"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_HistogramSummary.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_HistogramSummary.pbtxt
new file mode 100644
index 00000000000..6c2c3b8254a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_HistogramSummary.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "HistogramSummary"
+  endpoint {
+    name: "summary.HistogramSummary"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_HostConst.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_HostConst.pbtxt
new file mode 100644
index 00000000000..f2a7160eccd
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_HostConst.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "HostConst"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IFFT.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IFFT.pbtxt
new file mode 100644
index 00000000000..a84e2d6dd57
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IFFT.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IFFT"
+  endpoint {
+    name: "signal.Ifft"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IFFT2D.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IFFT2D.pbtxt
new file mode 100644
index 00000000000..3380f459463
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IFFT2D.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IFFT2D"
+  endpoint {
+    name: "signal.Ifft2d"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IFFT3D.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IFFT3D.pbtxt
new file mode 100644
index 00000000000..02db3a66379
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IFFT3D.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IFFT3D"
+  endpoint {
+    name: "signal.Ifft3d"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IFFTND.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IFFTND.pbtxt
new file mode 100644
index 00000000000..214a8bfc0b8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IFFTND.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IFFTND"
+  endpoint {
+    name: "signal.IfftNd"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IRFFT.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IRFFT.pbtxt
new file mode 100644
index 00000000000..ebd31423283
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IRFFT.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IRFFT"
+  endpoint {
+    name: "signal.Irfft"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IRFFT2D.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IRFFT2D.pbtxt
new file mode 100644
index 00000000000..e73397a832f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IRFFT2D.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IRFFT2D"
+  endpoint {
+    name: "signal.Irfft2d"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IRFFT3D.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IRFFT3D.pbtxt
new file mode 100644
index 00000000000..e6a064cfa6c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IRFFT3D.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IRFFT3D"
+  endpoint {
+    name: "signal.Irfft3d"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IRFFTND.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IRFFTND.pbtxt
new file mode 100644
index 00000000000..848e444c33e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IRFFTND.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IRFFTND"
+  endpoint {
+    name: "signal.IrfftNd"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Identity.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Identity.pbtxt
new file mode 100644
index 00000000000..f90a3e1b0f9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Identity.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Identity"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IdentityN.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IdentityN.pbtxt
new file mode 100644
index 00000000000..a39e00d4106
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IdentityN.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IdentityN"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_IdentityReader.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IdentityReader.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_IdentityReader.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_IdentityReader.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IdentityReaderV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IdentityReaderV2.pbtxt
new file mode 100644
index 00000000000..92bc4a10279
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IdentityReaderV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IdentityReaderV2"
+  endpoint {
+    name: "io.IdentityReader"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_If.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_If.pbtxt
new file mode 100644
index 00000000000..292c093587e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_If.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "If"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Igamma.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Igamma.pbtxt
new file mode 100644
index 00000000000..e0134f5acc4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Igamma.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Igamma"
+  endpoint {
+    name: "math.Igamma"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IgammaGradA.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IgammaGradA.pbtxt
new file mode 100644
index 00000000000..46eaba97345
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IgammaGradA.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IgammaGradA"
+  endpoint {
+    name: "math.IgammaGradA"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Igammac.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Igammac.pbtxt
new file mode 100644
index 00000000000..3114d90fd61
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Igammac.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Igammac"
+  endpoint {
+    name: "math.Igammac"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IgnoreErrorsDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IgnoreErrorsDataset.pbtxt
new file mode 100644
index 00000000000..a8812f70e1a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IgnoreErrorsDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "IgnoreErrorsDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.IgnoreErrorsDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Imag.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Imag.pbtxt
new file mode 100644
index 00000000000..66427ed58bd
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Imag.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Imag"
+  endpoint {
+    name: "math.Imag"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ImageProjectiveTransformV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ImageProjectiveTransformV2.pbtxt
new file mode 100644
index 00000000000..ae6bb8507be
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ImageProjectiveTransformV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ImageProjectiveTransformV2"
+  endpoint {
+    name: "image.ImageProjectiveTransformV2"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ImageProjectiveTransformV3.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ImageProjectiveTransformV3.pbtxt
new file mode 100644
index 00000000000..2f477c6d695
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ImageProjectiveTransformV3.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ImageProjectiveTransformV3"
+  endpoint {
+    name: "image.ImageProjectiveTransformV3"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ImageSummary.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ImageSummary.pbtxt
new file mode 100644
index 00000000000..5c3bd5f5047
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ImageSummary.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ImageSummary"
+  endpoint {
+    name: "summary.ImageSummary"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ImmutableConst.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ImmutableConst.pbtxt
new file mode 100644
index 00000000000..6f7a34c5a69
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ImmutableConst.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ImmutableConst"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ImportEvent.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ImportEvent.pbtxt
new file mode 100644
index 00000000000..630a8894724
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ImportEvent.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ImportEvent"
+  endpoint {
+    name: "summary.ImportEvent"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_InTopK.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_InTopK.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_InTopK.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_InTopK.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_InTopKV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_InTopKV2.pbtxt
new file mode 100644
index 00000000000..0fc46096895
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_InTopKV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "InTopKV2"
+  endpoint {
+    name: "nn.InTopK"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IndexFlatMapDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IndexFlatMapDataset.pbtxt
new file mode 100644
index 00000000000..682904a7504
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IndexFlatMapDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "IndexFlatMapDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.IndexFlatMapDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_InfeedDequeue.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_InfeedDequeue.pbtxt
new file mode 100644
index 00000000000..0d57c36ce27
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_InfeedDequeue.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "InfeedDequeue"
+  endpoint {
+    name: "tpu.InfeedDequeue"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_InfeedDequeueTuple.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_InfeedDequeueTuple.pbtxt
new file mode 100644
index 00000000000..3655572e592
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_InfeedDequeueTuple.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "InfeedDequeueTuple"
+  endpoint {
+    name: "tpu.InfeedDequeueTuple"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_InfeedEnqueue.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_InfeedEnqueue.pbtxt
new file mode 100644
index 00000000000..889c70cbfb1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_InfeedEnqueue.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "InfeedEnqueue"
+  endpoint {
+    name: "tpu.InfeedEnqueue"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_InfeedEnqueuePrelinearizedBuffer.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_InfeedEnqueuePrelinearizedBuffer.pbtxt
new file mode 100644
index 00000000000..e37e5ed26cf
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_InfeedEnqueuePrelinearizedBuffer.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "InfeedEnqueuePrelinearizedBuffer"
+  endpoint {
+    name: "tpu.InfeedEnqueuePrelinearizedBuffer"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_InfeedEnqueueTuple.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_InfeedEnqueueTuple.pbtxt
new file mode 100644
index 00000000000..99c1cc4f0a1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_InfeedEnqueueTuple.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "InfeedEnqueueTuple"
+  endpoint {
+    name: "tpu.InfeedEnqueueTuple"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_InitializeTable.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_InitializeTable.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_InitializeTable.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_InitializeTable.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_InitializeTableFromDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_InitializeTableFromDataset.pbtxt
new file mode 100644
index 00000000000..bfd98dd2d1c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_InitializeTableFromDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "InitializeTableFromDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.InitializeTableFromDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_InitializeTableFromTextFile.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_InitializeTableFromTextFile.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_InitializeTableFromTextFile.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_InitializeTableFromTextFile.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_InitializeTableFromTextFileV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_InitializeTableFromTextFileV2.pbtxt
new file mode 100644
index 00000000000..34712e89316
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_InitializeTableFromTextFileV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "InitializeTableFromTextFileV2"
+  endpoint {
+    name: "InitializeTableFromTextFile"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_InitializeTableV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_InitializeTableV2.pbtxt
new file mode 100644
index 00000000000..efb93c75341
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_InitializeTableV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "InitializeTableV2"
+  endpoint {
+    name: "InitializeTable"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_InplaceAdd.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_InplaceAdd.pbtxt
new file mode 100644
index 00000000000..c5b62051abe
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_InplaceAdd.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "InplaceAdd"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_InplaceSub.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_InplaceSub.pbtxt
new file mode 100644
index 00000000000..2b6359ab957
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_InplaceSub.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "InplaceSub"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_InplaceUpdate.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_InplaceUpdate.pbtxt
new file mode 100644
index 00000000000..8d3a0f9d699
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_InplaceUpdate.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "InplaceUpdate"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_InterleaveDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_InterleaveDataset.pbtxt
new file mode 100644
index 00000000000..dcc02c855ed
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_InterleaveDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "InterleaveDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.InterleaveDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Inv.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Inv.pbtxt
new file mode 100644
index 00000000000..543e2c9bbe8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Inv.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Inv"
+  endpoint {
+    name: "linalg.Inv"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_InvGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_InvGrad.pbtxt
new file mode 100644
index 00000000000..560855ffcf2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_InvGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "InvGrad"
+  endpoint {
+    name: "nn.InvGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Invert.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Invert.pbtxt
new file mode 100644
index 00000000000..6119fb19629
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Invert.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Invert"
+  endpoint {
+    name: "bitwise.Invert"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_InvertPermutation.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_InvertPermutation.pbtxt
new file mode 100644
index 00000000000..3fa442de299
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_InvertPermutation.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "InvertPermutation"
+  endpoint {
+    name: "math.InvertPermutation"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IsBoostedTreesEnsembleInitialized.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IsBoostedTreesEnsembleInitialized.pbtxt
new file mode 100644
index 00000000000..9efd7cd8357
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IsBoostedTreesEnsembleInitialized.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "IsBoostedTreesEnsembleInitialized"
+  endpoint {
+    name: "estimator.IsBoostedTreesEnsembleInitialized"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IsBoostedTreesQuantileStreamResourceInitialized.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IsBoostedTreesQuantileStreamResourceInitialized.pbtxt
new file mode 100644
index 00000000000..630406cc2f0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IsBoostedTreesQuantileStreamResourceInitialized.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "IsBoostedTreesQuantileStreamResourceInitialized"
+  endpoint {
+    name: "estimator.IsBoostedTreesQuantileStreamResourceInitialized"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IsFinite.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IsFinite.pbtxt
new file mode 100644
index 00000000000..1c33eae3169
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IsFinite.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IsFinite"
+  endpoint {
+    name: "math.IsFinite"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IsInf.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IsInf.pbtxt
new file mode 100644
index 00000000000..dbe157edb81
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IsInf.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IsInf"
+  endpoint {
+    name: "math.IsInf"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IsNan.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IsNan.pbtxt
new file mode 100644
index 00000000000..a5575098082
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IsNan.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IsNan"
+  endpoint {
+    name: "math.IsNan"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IsTPUEmbeddingInitialized.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IsTPUEmbeddingInitialized.pbtxt
new file mode 100644
index 00000000000..8f99e9b3e71
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IsTPUEmbeddingInitialized.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IsTPUEmbeddingInitialized"
+  endpoint {
+    name: "tpu.IsTPUEmbeddingInitialized"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IsVariableInitialized.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IsVariableInitialized.pbtxt
new file mode 100644
index 00000000000..b5f0f182125
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IsVariableInitialized.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IsVariableInitialized"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IsotonicRegression.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IsotonicRegression.pbtxt
new file mode 100644
index 00000000000..e0d1edb67aa
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IsotonicRegression.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IsotonicRegression"
+  endpoint {
+    name: "nn.IsotonicRegression"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Iterator.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Iterator.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Iterator.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_Iterator.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_IteratorFromStringHandle.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorFromStringHandle.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_IteratorFromStringHandle.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorFromStringHandle.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorFromStringHandleV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorFromStringHandleV2.pbtxt
new file mode 100644
index 00000000000..214318f4aea
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorFromStringHandleV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IteratorFromStringHandleV2"
+  endpoint {
+    name: "data.IteratorFromStringHandle"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorGetDevice.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorGetDevice.pbtxt
new file mode 100644
index 00000000000..9da26e5af9f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorGetDevice.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IteratorGetDevice"
+  endpoint {
+    name: "data.IteratorGetDevice"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorGetModelProto.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorGetModelProto.pbtxt
new file mode 100644
index 00000000000..588803255e0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorGetModelProto.pbtxt
@@ -0,0 +1,6 @@
+op {
+  graph_op_name: "IteratorGetModelProto"
+  endpoint {
+    name: "data.IteratorGetModelProto"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorGetNext.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorGetNext.pbtxt
new file mode 100644
index 00000000000..b0c4c39a0f9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorGetNext.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "IteratorGetNext"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.IteratorGetNext"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorGetNextAsOptional.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorGetNextAsOptional.pbtxt
new file mode 100644
index 00000000000..95ea8dc4224
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorGetNextAsOptional.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IteratorGetNextAsOptional"
+  endpoint {
+    name: "data.IteratorGetNextAsOptional"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorGetNextSync.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorGetNextSync.pbtxt
new file mode 100644
index 00000000000..5f74f24e12f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorGetNextSync.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IteratorGetNextSync"
+  endpoint {
+    name: "data.IteratorGetNextSync"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorToStringHandle.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorToStringHandle.pbtxt
new file mode 100644
index 00000000000..0a7723ac676
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorToStringHandle.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "IteratorToStringHandle"
+  endpoint {
+    name: "data.IteratorToStringHandle"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorV2.pbtxt
new file mode 100644
index 00000000000..841bbba687f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_IteratorV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "IteratorV2"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.Iterator"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_KMC2ChainInitialization.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_KMC2ChainInitialization.pbtxt
new file mode 100644
index 00000000000..5c2ed95566d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_KMC2ChainInitialization.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "KMC2ChainInitialization"
+  endpoint {
+    name: "cluster.KMC2ChainInitialization"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_KafkaDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_KafkaDataset.pbtxt
similarity index 79%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_KafkaDataset.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_KafkaDataset.pbtxt
index 5f0da216cbb..6055a53c894 100644
--- a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_KafkaDataset.pbtxt
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_KafkaDataset.pbtxt
@@ -1,5 +1,6 @@
 op {
   graph_op_name: "KafkaDataset"
+  visibility: VISIBLE
   endpoint {
     name: "data.KafkaDataset"
   }
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_KmeansPlusPlusInitialization.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_KmeansPlusPlusInitialization.pbtxt
new file mode 100644
index 00000000000..b4cb77a981b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_KmeansPlusPlusInitialization.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "KmeansPlusPlusInitialization"
+  endpoint {
+    name: "cluster.KmeansPlusPlusInitialization"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_KthOrderStatistic.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_KthOrderStatistic.pbtxt
new file mode 100644
index 00000000000..98c602c5ebe
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_KthOrderStatistic.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "KthOrderStatistic"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_L2Loss.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_L2Loss.pbtxt
new file mode 100644
index 00000000000..e00de2d3643
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_L2Loss.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "L2Loss"
+  endpoint {
+    name: "nn.L2Loss"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LMDBDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LMDBDataset.pbtxt
new file mode 100644
index 00000000000..68de33fde0b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LMDBDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "LMDBDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.LMDBDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LMDBReader.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LMDBReader.pbtxt
new file mode 100644
index 00000000000..cff04abb5f5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LMDBReader.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LMDBReader"
+  endpoint {
+    name: "io.LmdbReader"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LRN.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LRN.pbtxt
new file mode 100644
index 00000000000..5990d283ee7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LRN.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LRN"
+  endpoint {
+    name: "nn.LocalResponseNormalization"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LRNGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LRNGrad.pbtxt
new file mode 100644
index 00000000000..f6c64ca6d04
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LRNGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LRNGrad"
+  endpoint {
+    name: "nn.LocalResponseNormalizationGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LSTMBlockCell.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LSTMBlockCell.pbtxt
new file mode 100644
index 00000000000..dd8baae2a1e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LSTMBlockCell.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LSTMBlockCell"
+  endpoint {
+    name: "nn.LSTMBlockCell"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LSTMBlockCellGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LSTMBlockCellGrad.pbtxt
new file mode 100644
index 00000000000..518a29ef8b1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LSTMBlockCellGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LSTMBlockCellGrad"
+  endpoint {
+    name: "nn.LSTMBlockCellGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LatencyStatsDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LatencyStatsDataset.pbtxt
new file mode 100644
index 00000000000..8447fb7e287
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LatencyStatsDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "LatencyStatsDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.LatencyStatsDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LeakyRelu.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LeakyRelu.pbtxt
new file mode 100644
index 00000000000..3573bff4fa8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LeakyRelu.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "LeakyRelu"
+  visibility: VISIBLE
+  endpoint {
+    name: "nn.LeakyRelu"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LeakyReluGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LeakyReluGrad.pbtxt
new file mode 100644
index 00000000000..0b6ab5953da
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LeakyReluGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LeakyReluGrad"
+  endpoint {
+    name: "data.LeakyReluGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LearnedUnigramCandidateSampler.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LearnedUnigramCandidateSampler.pbtxt
new file mode 100644
index 00000000000..bc4ab82cdc2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LearnedUnigramCandidateSampler.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LearnedUnigramCandidateSampler"
+  endpoint {
+    name: "nn.LearnedUnigramCandidateSampler"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LeftShift.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LeftShift.pbtxt
new file mode 100644
index 00000000000..e00c50f0d68
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LeftShift.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LeftShift"
+  endpoint {
+    name: "bitwise.LeftShift"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LegacyParallelInterleaveDatasetV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LegacyParallelInterleaveDatasetV2.pbtxt
new file mode 100644
index 00000000000..4046256a580
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LegacyParallelInterleaveDatasetV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "LegacyParallelInterleaveDatasetV2"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.LegacyParallelInterleaveDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Less.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Less.pbtxt
new file mode 100644
index 00000000000..0fa328a0f94
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Less.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Less"
+  endpoint {
+    name: "math.Less"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LessEqual.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LessEqual.pbtxt
new file mode 100644
index 00000000000..7faf528185e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LessEqual.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LessEqual"
+  endpoint {
+    name: "math.LessEqual"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Lgamma.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Lgamma.pbtxt
new file mode 100644
index 00000000000..b6e817d9d69
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Lgamma.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Lgamma"
+  endpoint {
+    name: "math.Lgamma"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LinSpace.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LinSpace.pbtxt
new file mode 100644
index 00000000000..09eb5212385
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LinSpace.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LinSpace"
+  endpoint {
+    name: "LinSpace"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ListDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ListDataset.pbtxt
new file mode 100644
index 00000000000..434f9b2c332
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ListDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ListDataset"
+  endpoint {
+    name: "data.ListDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ListDiff.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ListDiff.pbtxt
new file mode 100644
index 00000000000..4cac575906b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ListDiff.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ListDiff"
+  endpoint {
+    name: "SetDiff1d"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ListSnapshotChunksDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ListSnapshotChunksDataset.pbtxt
new file mode 100644
index 00000000000..e48c7bf0a11
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ListSnapshotChunksDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "ListSnapshotChunksDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.ListSnapshotChunksDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadAllTPUEmbeddingParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadAllTPUEmbeddingParameters.pbtxt
new file mode 100644
index 00000000000..1c5cf1f526e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadAllTPUEmbeddingParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadAllTPUEmbeddingParameters"
+  endpoint {
+    name: "tpu.LoadAllTPUEmbeddingParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadAndRemapMatrix.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadAndRemapMatrix.pbtxt
new file mode 100644
index 00000000000..3c8984a6cb6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadAndRemapMatrix.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadAndRemapMatrix"
+  endpoint {
+    name: "linalg.LoadAndRemapMatrix"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadDataset.pbtxt
new file mode 100644
index 00000000000..7bbd800c889
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "LoadDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.LoadDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingADAMParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingADAMParameters.pbtxt
new file mode 100644
index 00000000000..a591533cf42
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingADAMParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingADAMParameters"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingADAMParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingADAMParametersGradAccumDebug.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingADAMParametersGradAccumDebug.pbtxt
new file mode 100644
index 00000000000..cd5c2cf8a4d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingADAMParametersGradAccumDebug.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingADAMParametersGradAccumDebug"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingADAMParametersGradAccumDebug"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingAdadeltaParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingAdadeltaParameters.pbtxt
new file mode 100644
index 00000000000..4b4466b3ebe
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingAdadeltaParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingAdadeltaParameters"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingAdadeltaParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingAdadeltaParametersGradAccumDebug.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingAdadeltaParametersGradAccumDebug.pbtxt
new file mode 100644
index 00000000000..3e6fbd0cda8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingAdadeltaParametersGradAccumDebug.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingAdadeltaParametersGradAccumDebug"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingAdadeltaParametersGradAccumDebug"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingAdagradMomentumParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingAdagradMomentumParameters.pbtxt
new file mode 100644
index 00000000000..4ab6b43fb23
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingAdagradMomentumParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingAdagradMomentumParameters"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingAdagradMomentumParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingAdagradParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingAdagradParameters.pbtxt
new file mode 100644
index 00000000000..53dc92a921c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingAdagradParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingAdagradParameters"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingAdagradParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingAdagradParametersGradAccumDebug.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingAdagradParametersGradAccumDebug.pbtxt
new file mode 100644
index 00000000000..fa8a345407c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingAdagradParametersGradAccumDebug.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingAdagradParametersGradAccumDebug"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingAdagradParametersGradAccumDebug"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingCenteredRMSPropParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingCenteredRMSPropParameters.pbtxt
new file mode 100644
index 00000000000..f1781c96808
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingCenteredRMSPropParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingCenteredRMSPropParameters"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingCenteredRMSPropParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingFTRLParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingFTRLParameters.pbtxt
new file mode 100644
index 00000000000..6b3377f0d72
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingFTRLParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingFTRLParameters"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingFTRLParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingFTRLParametersGradAccumDebug.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingFTRLParametersGradAccumDebug.pbtxt
new file mode 100644
index 00000000000..f17d8fcc776
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingFTRLParametersGradAccumDebug.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingFTRLParametersGradAccumDebug"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingFTRLParametersGradAccumDebug"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingFrequencyEstimatorParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingFrequencyEstimatorParameters.pbtxt
new file mode 100644
index 00000000000..33baa18848c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingFrequencyEstimatorParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingFrequencyEstimatorParameters"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingFrequencyEstimatorParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingFrequencyEstimatorParametersGradAccumDebug.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingFrequencyEstimatorParametersGradAccumDebug.pbtxt
new file mode 100644
index 00000000000..fba39f852dc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingFrequencyEstimatorParametersGradAccumDebug.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingFrequencyEstimatorParametersGradAccumDebug"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingFrequencyEstimatorParametersGradAccumDebug"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingMDLAdagradLightParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingMDLAdagradLightParameters.pbtxt
new file mode 100644
index 00000000000..d03ed8796c1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingMDLAdagradLightParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingMDLAdagradLightParameters"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingMDLAdagradLightParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingMomentumParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingMomentumParameters.pbtxt
new file mode 100644
index 00000000000..2ea9c9cfc8c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingMomentumParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingMomentumParameters"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingMomentumParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingMomentumParametersGradAccumDebug.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingMomentumParametersGradAccumDebug.pbtxt
new file mode 100644
index 00000000000..fccbff595f9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingMomentumParametersGradAccumDebug.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingMomentumParametersGradAccumDebug"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingMomentumParametersGradAccumDebug"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingProximalAdagradParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingProximalAdagradParameters.pbtxt
new file mode 100644
index 00000000000..1b6f3afd838
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingProximalAdagradParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingProximalAdagradParameters"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingProximalAdagradParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug.pbtxt
new file mode 100644
index 00000000000..65fe6e27afe
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingProximalYogiParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingProximalYogiParameters.pbtxt
new file mode 100644
index 00000000000..f416308b609
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingProximalYogiParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingProximalYogiParameters"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingProximalYogiParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingProximalYogiParametersGradAccumDebug.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingProximalYogiParametersGradAccumDebug.pbtxt
new file mode 100644
index 00000000000..2656c561bbb
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingProximalYogiParametersGradAccumDebug.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingProximalYogiParametersGradAccumDebug"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingProximalYogiParametersGradAccumDebug"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingRMSPropParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingRMSPropParameters.pbtxt
new file mode 100644
index 00000000000..bee7db0753b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingRMSPropParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingRMSPropParameters"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingRMSPropParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingRMSPropParametersGradAccumDebug.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingRMSPropParametersGradAccumDebug.pbtxt
new file mode 100644
index 00000000000..3becf4df5d3
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingRMSPropParametersGradAccumDebug.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingRMSPropParametersGradAccumDebug"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingRMSPropParametersGradAccumDebug"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingStochasticGradientDescentParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingStochasticGradientDescentParameters.pbtxt
new file mode 100644
index 00000000000..57102d66657
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingStochasticGradientDescentParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingStochasticGradientDescentParameters"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingStochasticGradientDescentParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebug.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebug.pbtxt
new file mode 100644
index 00000000000..e6dae92e1f2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebug.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebug"
+  endpoint {
+    name: "tpu.LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebug"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Log.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Log.pbtxt
new file mode 100644
index 00000000000..79d5b27a477
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Log.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Log"
+  endpoint {
+    name: "math.Log"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Log1p.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Log1p.pbtxt
new file mode 100644
index 00000000000..f91d9ec6a09
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Log1p.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Log1p"
+  endpoint {
+    name: "math.Log1p"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LogMatrixDeterminant.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LogMatrixDeterminant.pbtxt
new file mode 100644
index 00000000000..3828143fa9b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LogMatrixDeterminant.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LogMatrixDeterminant"
+  endpoint {
+    name: "linalg.LogMatrixDeterminant"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LogSoftmax.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LogSoftmax.pbtxt
new file mode 100644
index 00000000000..94186851ee9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LogSoftmax.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LogSoftmax"
+  endpoint {
+    name: "nn.LogSoftmax"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LogUniformCandidateSampler.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LogUniformCandidateSampler.pbtxt
new file mode 100644
index 00000000000..c1f7c67d6e5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LogUniformCandidateSampler.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LogUniformCandidateSampler"
+  endpoint {
+    name: "random.LogUniformCandidateSampler"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LogicalAnd.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LogicalAnd.pbtxt
new file mode 100644
index 00000000000..ebd2c0f5d60
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LogicalAnd.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LogicalAnd"
+  endpoint {
+    name: "math.LogicalAnd"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LogicalNot.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LogicalNot.pbtxt
new file mode 100644
index 00000000000..3665727828c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LogicalNot.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LogicalNot"
+  endpoint {
+    name: "math.LogicalNot"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LogicalOr.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LogicalOr.pbtxt
new file mode 100644
index 00000000000..e4a567d034e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LogicalOr.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LogicalOr"
+  endpoint {
+    name: "math.LogicalOr"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_LookupTableExport.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableExport.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_LookupTableExport.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableExport.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableExportV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableExportV2.pbtxt
new file mode 100644
index 00000000000..0e0c4a4fac3
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableExportV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LookupTableExportV2"
+  endpoint {
+    name: "LookupTableExport"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_LookupTableFind.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableFind.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_LookupTableFind.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableFind.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableFindV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableFindV2.pbtxt
new file mode 100644
index 00000000000..936dd7afecf
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableFindV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LookupTableFindV2"
+  endpoint {
+    name: "LookupTableFind"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_LookupTableImport.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableImport.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_LookupTableImport.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableImport.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableImportV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableImportV2.pbtxt
new file mode 100644
index 00000000000..9e7925797da
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableImportV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LookupTableImportV2"
+  endpoint {
+    name: "LookupTableImport"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_LookupTableInsert.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableInsert.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_LookupTableInsert.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableInsert.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableInsertV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableInsertV2.pbtxt
new file mode 100644
index 00000000000..d5db4b3b535
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableInsertV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LookupTableInsertV2"
+  endpoint {
+    name: "LookupTableInsert"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableRemoveV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableRemoveV2.pbtxt
new file mode 100644
index 00000000000..911df9ae719
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableRemoveV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LookupTableRemoveV2"
+  endpoint {
+    name: "LookupTableRemove"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_LookupTableSize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableSize.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_LookupTableSize.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableSize.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableSizeV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableSizeV2.pbtxt
new file mode 100644
index 00000000000..fafc1f8c910
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LookupTableSizeV2.pbtxt
@@ -0,0 +1,11 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LookupTableSizeV2"
+  endpoint {
+    name: "LookupTableSize"
+  }
+  out_arg {
+    name: "size"
+    rename_to: "output"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LoopCond.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoopCond.pbtxt
new file mode 100644
index 00000000000..88907751f5e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LoopCond.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LoopCond"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_LowerBound.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_LowerBound.pbtxt
new file mode 100644
index 00000000000..3e92dbec886
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_LowerBound.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "LowerBound"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Lu.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Lu.pbtxt
new file mode 100644
index 00000000000..269a5fbb7d5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Lu.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Lu"
+  endpoint {
+    name: "linalg.Lu"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MakeIterator.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MakeIterator.pbtxt
new file mode 100644
index 00000000000..cdcae8e5f69
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MakeIterator.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "MakeIterator"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.MakeIterator"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MakeUnique.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MakeUnique.pbtxt
new file mode 100644
index 00000000000..3c61d469fd4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MakeUnique.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MakeUnique"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MapAndBatchDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MapAndBatchDataset.pbtxt
new file mode 100644
index 00000000000..bbf61d0f31e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MapAndBatchDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "MapAndBatchDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.MapAndBatchDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MapClear.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MapClear.pbtxt
new file mode 100644
index 00000000000..b5bba0a4941
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MapClear.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MapClear"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MapDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MapDataset.pbtxt
new file mode 100644
index 00000000000..11cba7c2c0e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MapDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "MapDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.MapDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MapDefun.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MapDefun.pbtxt
new file mode 100644
index 00000000000..0e069d080fe
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MapDefun.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MapDefun"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MapIncompleteSize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MapIncompleteSize.pbtxt
new file mode 100644
index 00000000000..cd28e3f8a28
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MapIncompleteSize.pbtxt
@@ -0,0 +1,8 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MapIncompleteSize"
+  out_arg {
+    name: "size"
+    rename_to: "output"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MapPeek.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MapPeek.pbtxt
new file mode 100644
index 00000000000..3541cc96d63
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MapPeek.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MapPeek"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MapSize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MapSize.pbtxt
new file mode 100644
index 00000000000..30bad2d2ccb
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MapSize.pbtxt
@@ -0,0 +1,8 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MapSize"
+  out_arg {
+    name: "size"
+    rename_to: "output"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MapStage.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MapStage.pbtxt
new file mode 100644
index 00000000000..fab2cf93595
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MapStage.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MapStage"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MapUnstage.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MapUnstage.pbtxt
new file mode 100644
index 00000000000..82be22f5dc8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MapUnstage.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MapUnstage"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MapUnstageNoKey.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MapUnstageNoKey.pbtxt
new file mode 100644
index 00000000000..dac737d2486
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MapUnstageNoKey.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MapUnstageNoKey"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MatMul.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatMul.pbtxt
new file mode 100644
index 00000000000..bc7b2833b00
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatMul.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MatMul"
+  endpoint {
+    name: "linalg.MatMul"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MatchingFiles.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatchingFiles.pbtxt
new file mode 100644
index 00000000000..fea6f70d5cf
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatchingFiles.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MatchingFiles"
+  endpoint {
+    name: "io.MatchingFiles"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MatchingFilesDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatchingFilesDataset.pbtxt
new file mode 100644
index 00000000000..2bee85539f8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatchingFilesDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "MatchingFilesDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.MatchingFilesDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixBandPart.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixBandPart.pbtxt
new file mode 100644
index 00000000000..24f955501f7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixBandPart.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MatrixBandPart"
+  endpoint {
+    name: "linalg.BandPart"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixDeterminant.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixDeterminant.pbtxt
new file mode 100644
index 00000000000..933a41dddc0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixDeterminant.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MatrixDeterminant"
+  endpoint {
+    name: "linalg.Det"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixDiag.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixDiag.pbtxt
new file mode 100644
index 00000000000..36497b863db
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixDiag.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "MatrixDiag"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixDiagPart.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixDiagPart.pbtxt
new file mode 100644
index 00000000000..9c5506e8fa1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixDiagPart.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "MatrixDiagPart"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixDiagPartV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixDiagPartV2.pbtxt
new file mode 100644
index 00000000000..c40b2c16745
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixDiagPartV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MatrixDiagPartV2"
+  endpoint {
+    name: "linalg.MatrixDiagPart"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixDiagPartV3.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixDiagPartV3.pbtxt
new file mode 100644
index 00000000000..05fadef2d8a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixDiagPartV3.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MatrixDiagPartV3"
+  endpoint {
+    name: "linalg.MatrixDiagPartV3"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixDiagV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixDiagV2.pbtxt
new file mode 100644
index 00000000000..b25ce946738
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixDiagV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MatrixDiagV2"
+  endpoint {
+    name: "linalg.MatrixDiag"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixDiagV3.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixDiagV3.pbtxt
new file mode 100644
index 00000000000..fdb19d77f1b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixDiagV3.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MatrixDiagV3"
+  endpoint {
+    name: "linalg.MatrixDiagV3"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixExponential.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixExponential.pbtxt
new file mode 100644
index 00000000000..9db500e926a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixExponential.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MatrixExponential"
+  endpoint {
+    name: "linalg.MatrixExponential"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixInverse.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixInverse.pbtxt
new file mode 100644
index 00000000000..1792f6deef7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixInverse.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MatrixInverse"
+  endpoint {
+    name: "linalg.Inv"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixLogarithm.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixLogarithm.pbtxt
new file mode 100644
index 00000000000..9fcb9badeb5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixLogarithm.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MatrixLogarithm"
+  endpoint {
+    name: "linalg.MatrixLogarithm"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixSetDiag.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixSetDiag.pbtxt
new file mode 100644
index 00000000000..82f0441f2a0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixSetDiag.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "MatrixSetDiag"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixSetDiagV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixSetDiagV2.pbtxt
new file mode 100644
index 00000000000..c6fbcfc235d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixSetDiagV2.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "MatrixSetDiagV2"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixSetDiagV3.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixSetDiagV3.pbtxt
new file mode 100644
index 00000000000..28a0fb5b934
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixSetDiagV3.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MatrixSetDiagV3"
+  endpoint {
+    name: "linalg.MatrixSetDiag"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixSolve.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixSolve.pbtxt
new file mode 100644
index 00000000000..cf4bc9b04a6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixSolve.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MatrixSolve"
+  endpoint {
+    name: "linalg.Solve"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixSolveLs.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixSolveLs.pbtxt
new file mode 100644
index 00000000000..c7fc10c5447
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixSolveLs.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MatrixSolveLs"
+  endpoint {
+    name: "linalg.MatrixSolveLs"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixSquareRoot.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixSquareRoot.pbtxt
new file mode 100644
index 00000000000..42d3518b6e5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixSquareRoot.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MatrixSquareRoot"
+  endpoint {
+    name: "linalg.Sqrtm"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixTriangularSolve.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixTriangularSolve.pbtxt
new file mode 100644
index 00000000000..0e20889c3ae
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MatrixTriangularSolve.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MatrixTriangularSolve"
+  endpoint {
+    name: "linalg.TriangularSolve"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Max.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Max.pbtxt
new file mode 100644
index 00000000000..112ab3af60a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Max.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Max"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxIntraOpParallelismDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxIntraOpParallelismDataset.pbtxt
new file mode 100644
index 00000000000..20a2e55ba80
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxIntraOpParallelismDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "MaxIntraOpParallelismDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.MaxIntraOpParallelismDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_MaxPool.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPool.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_MaxPool.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPool.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPool3D.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPool3D.pbtxt
new file mode 100644
index 00000000000..77232e6020a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPool3D.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MaxPool3D"
+  endpoint {
+    name: "nn.MaxPool3d"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPool3DGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPool3DGrad.pbtxt
new file mode 100644
index 00000000000..bbdc2058f46
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPool3DGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MaxPool3DGrad"
+  endpoint {
+    name: "nn.MaxPool3dGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPool3DGradGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPool3DGradGrad.pbtxt
new file mode 100644
index 00000000000..cd2d4d76817
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPool3DGradGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MaxPool3DGradGrad"
+  endpoint {
+    name: "nn.MaxPool3dGradGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_MaxPoolGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolGrad.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_MaxPoolGrad.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolGrad.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_MaxPoolGradGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolGradGrad.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_MaxPoolGradGrad.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolGradGrad.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolGradGradV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolGradGradV2.pbtxt
new file mode 100644
index 00000000000..68a36bb8b63
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolGradGradV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MaxPoolGradGradV2"
+  endpoint {
+    name: "nn.MaxPoolGradGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolGradGradWithArgmax.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolGradGradWithArgmax.pbtxt
new file mode 100644
index 00000000000..84f92c16fd9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolGradGradWithArgmax.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MaxPoolGradGradWithArgmax"
+  endpoint {
+    name: "nn.MaxPoolGradGradWithArgmax"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolGradV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolGradV2.pbtxt
new file mode 100644
index 00000000000..78c26e0d20a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolGradV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MaxPoolGradV2"
+  endpoint {
+    name: "nn.MaxPoolGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolGradWithArgmax.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolGradWithArgmax.pbtxt
new file mode 100644
index 00000000000..82d58e00566
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolGradWithArgmax.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MaxPoolGradWithArgmax"
+  endpoint {
+    name: "nn.MaxPoolGradWithArgmax"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolV2.pbtxt
new file mode 100644
index 00000000000..a8ebcfea908
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MaxPoolV2"
+  endpoint {
+    name: "nn.MaxPool"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolWithArgmax.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolWithArgmax.pbtxt
new file mode 100644
index 00000000000..c0e9bb2aa29
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MaxPoolWithArgmax.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MaxPoolWithArgmax"
+  endpoint {
+    name: "nn.MaxPoolWithArgmax"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Maximum.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Maximum.pbtxt
new file mode 100644
index 00000000000..0a510be5947
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Maximum.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Maximum"
+  endpoint {
+    name: "math.Maximum"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Mean.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Mean.pbtxt
new file mode 100644
index 00000000000..707b1eddb86
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Mean.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Mean"
+  endpoint {
+    name: "math.Mean"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Merge.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Merge.pbtxt
new file mode 100644
index 00000000000..e04a5e7670d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Merge.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Merge"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MergeDedupData.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MergeDedupData.pbtxt
new file mode 100644
index 00000000000..c62ad85f44d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MergeDedupData.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MergeDedupData"
+  endpoint {
+    name: "tpu.MergeDedupData"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MergeSummary.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MergeSummary.pbtxt
new file mode 100644
index 00000000000..528399aaec1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MergeSummary.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MergeSummary"
+  endpoint {
+    name: "summary.MergeSummary"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MergeV2Checkpoints.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MergeV2Checkpoints.pbtxt
new file mode 100644
index 00000000000..671ae3f9917
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MergeV2Checkpoints.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MergeV2Checkpoints"
+  endpoint {
+    name: "train.MergeV2Checkpoints"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Mfcc.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Mfcc.pbtxt
new file mode 100644
index 00000000000..018361798cc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Mfcc.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Mfcc"
+  endpoint {
+    name: "audio.Mfcc"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Min.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Min.pbtxt
new file mode 100644
index 00000000000..3355adfbdde
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Min.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Min"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Minimum.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Minimum.pbtxt
new file mode 100644
index 00000000000..cb33aa21fb4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Minimum.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Minimum"
+  endpoint {
+    name: "math.Minimum"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MirrorPad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MirrorPad.pbtxt
new file mode 100644
index 00000000000..5bc1ebdacbc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MirrorPad.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MirrorPad"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MirrorPadGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MirrorPadGrad.pbtxt
new file mode 100644
index 00000000000..0a9c168e261
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MirrorPadGrad.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MirrorPadGrad"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MlirPassthroughOp.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MlirPassthroughOp.pbtxt
new file mode 100644
index 00000000000..bf4453b8f2d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MlirPassthroughOp.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MlirPassthroughOp"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Mod.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Mod.pbtxt
new file mode 100644
index 00000000000..e4003385089
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Mod.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Mod"
+  endpoint {
+    name: "math.Mod"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ModelDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ModelDataset.pbtxt
new file mode 100644
index 00000000000..8549b4582cc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ModelDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "ModelDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.ModelDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Mul.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Mul.pbtxt
new file mode 100644
index 00000000000..8d1f243721d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Mul.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Mul"
+  endpoint {
+    name: "math.Mul"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MulNoNan.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MulNoNan.pbtxt
new file mode 100644
index 00000000000..e5af10eb9b4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MulNoNan.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MulNoNan"
+  endpoint {
+    name: "math.MulNoNan"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MultiDeviceIterator.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MultiDeviceIterator.pbtxt
new file mode 100644
index 00000000000..b51de3ab1e5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MultiDeviceIterator.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MultiDeviceIterator"
+  endpoint {
+    name: "data.MultiDeviceIterator"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MultiDeviceIteratorFromStringHandle.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MultiDeviceIteratorFromStringHandle.pbtxt
new file mode 100644
index 00000000000..59f8a287dad
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MultiDeviceIteratorFromStringHandle.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MultiDeviceIteratorFromStringHandle"
+  endpoint {
+    name: "data.MultiDeviceIteratorFromStringHandle"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MultiDeviceIteratorGetNextFromShard.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MultiDeviceIteratorGetNextFromShard.pbtxt
new file mode 100644
index 00000000000..f36e12598c4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MultiDeviceIteratorGetNextFromShard.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MultiDeviceIteratorGetNextFromShard"
+  endpoint {
+    name: "data.MultiDeviceIteratorGetNextFromShard"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MultiDeviceIteratorInit.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MultiDeviceIteratorInit.pbtxt
new file mode 100644
index 00000000000..3b477b5b21f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MultiDeviceIteratorInit.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MultiDeviceIteratorInit"
+  endpoint {
+    name: "data.MultiDeviceIteratorInit"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MultiDeviceIteratorToStringHandle.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MultiDeviceIteratorToStringHandle.pbtxt
new file mode 100644
index 00000000000..3d4958f4495
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MultiDeviceIteratorToStringHandle.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MultiDeviceIteratorToStringHandle"
+  endpoint {
+    name: "data.MultiDeviceIteratorToStringHandle"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Multinomial.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Multinomial.pbtxt
new file mode 100644
index 00000000000..2b693f02801
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Multinomial.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Multinomial"
+  endpoint {
+    name: "random.Multinomial"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_MutableDenseHashTable.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MutableDenseHashTable.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_MutableDenseHashTable.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_MutableDenseHashTable.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MutableDenseHashTableV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MutableDenseHashTableV2.pbtxt
new file mode 100644
index 00000000000..8f20cfd93f5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MutableDenseHashTableV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MutableDenseHashTableV2"
+  endpoint {
+    name: "MutableDenseHashTable"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_MutableHashTable.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MutableHashTable.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_MutableHashTable.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_MutableHashTable.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_MutableHashTableOfTensors.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MutableHashTableOfTensors.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_MutableHashTableOfTensors.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_MutableHashTableOfTensors.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MutableHashTableOfTensorsV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MutableHashTableOfTensorsV2.pbtxt
new file mode 100644
index 00000000000..d9c26fde9dc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MutableHashTableOfTensorsV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MutableHashTableOfTensorsV2"
+  endpoint {
+    name: "MutableHashTableOfTensors"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MutableHashTableV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MutableHashTableV2.pbtxt
new file mode 100644
index 00000000000..0cfaa1a226b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MutableHashTableV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MutableHashTableV2"
+  endpoint {
+    name: "MutableHashTable"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MutexLock.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MutexLock.pbtxt
new file mode 100644
index 00000000000..99bf40ba1ed
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MutexLock.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MutexLock"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_MutexV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_MutexV2.pbtxt
new file mode 100644
index 00000000000..17198f4f38c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_MutexV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "MutexV2"
+  endpoint {
+    name: "Mutex"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_NcclAllReduce.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_NcclAllReduce.pbtxt
new file mode 100644
index 00000000000..cd7390fa15e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_NcclAllReduce.pbtxt
@@ -0,0 +1,11 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "NcclAllReduce"
+  endpoint: {
+    name: "distribute.NcclAllReduce"
+  }
+  endpoint: {
+    name: "NcclAllReduce"
+    deprecated: true
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_NcclBroadcast.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_NcclBroadcast.pbtxt
new file mode 100644
index 00000000000..74abc5b82d0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_NcclBroadcast.pbtxt
@@ -0,0 +1,11 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "NcclBroadcast"
+  endpoint: {
+    name: "distribute.NcclBroadcast"
+  }
+  endpoint: {
+    name: "NcclBroadcast"
+    deprecated: true
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_NcclReduce.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_NcclReduce.pbtxt
new file mode 100644
index 00000000000..a0ee5487b3e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_NcclReduce.pbtxt
@@ -0,0 +1,11 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "NcclReduce"
+  endpoint: {
+    name: "distribute.NcclReduce"
+  }
+  endpoint: {
+    name: "NcclReduce"
+    deprecated: true
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Ndtri.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Ndtri.pbtxt
new file mode 100644
index 00000000000..9394ba422af
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Ndtri.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Ndtri"
+  endpoint {
+    name: "math.Ndtri"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_NearestNeighbors.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_NearestNeighbors.pbtxt
new file mode 100644
index 00000000000..d50362c31fd
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_NearestNeighbors.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "NearestNeighbors"
+  endpoint {
+    name: "image.NearestNeighbors"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Neg.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Neg.pbtxt
new file mode 100644
index 00000000000..440db9e6414
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Neg.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Neg"
+  endpoint {
+    name: "math.Neg"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_NegTrain.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_NegTrain.pbtxt
new file mode 100644
index 00000000000..5f381b6e034
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_NegTrain.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "NegTrain"
+  endpoint {
+    name: "train.NegTrain"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_NextAfter.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_NextAfter.pbtxt
new file mode 100644
index 00000000000..c1c88706cb2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_NextAfter.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "NextAfter"
+  endpoint {
+    name: "math.NextAfter"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_NextIteration.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_NextIteration.pbtxt
new file mode 100644
index 00000000000..63b551aad19
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_NextIteration.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "NextIteration"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_NoOp.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_NoOp.pbtxt
new file mode 100644
index 00000000000..f3d89127156
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_NoOp.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "NoOp"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_NonDeterministicInts.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_NonDeterministicInts.pbtxt
new file mode 100644
index 00000000000..aa8cc027cd6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_NonDeterministicInts.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "NonDeterministicInts"
+  endpoint {
+    name: "random.NonDeterministicInts"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_NonMaxSuppression.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_NonMaxSuppression.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_NonMaxSuppression.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_NonMaxSuppression.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_NonMaxSuppressionV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_NonMaxSuppressionV2.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_NonMaxSuppressionV2.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_NonMaxSuppressionV2.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_NonMaxSuppressionV3.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_NonMaxSuppressionV3.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_NonMaxSuppressionV3.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_NonMaxSuppressionV3.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_NonMaxSuppressionV4.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_NonMaxSuppressionV4.pbtxt
new file mode 100644
index 00000000000..e817e8d18ba
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_NonMaxSuppressionV4.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "NonMaxSuppressionV4"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_NonMaxSuppressionV5.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_NonMaxSuppressionV5.pbtxt
new file mode 100644
index 00000000000..7821a13912d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_NonMaxSuppressionV5.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "NonMaxSuppressionV5"
+  endpoint {
+    name: "image.NonMaxSuppression"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_NonMaxSuppressionWithOverlaps.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_NonMaxSuppressionWithOverlaps.pbtxt
new file mode 100644
index 00000000000..de5488bb255
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_NonMaxSuppressionWithOverlaps.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "NonMaxSuppressionWithOverlaps"
+  endpoint {
+    name: "image.NonMaxSuppressionWithOverlaps"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_NonSerializableDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_NonSerializableDataset.pbtxt
new file mode 100644
index 00000000000..4efa2ec9978
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_NonSerializableDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "NonSerializableDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.NonSerializableDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_NotEqual.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_NotEqual.pbtxt
new file mode 100644
index 00000000000..5b587960e14
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_NotEqual.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "NotEqual"
+  endpoint {
+    name: "math.NotEqual"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_NthElement.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_NthElement.pbtxt
new file mode 100644
index 00000000000..7930c041ad3
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_NthElement.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "NthElement"
+  endpoint {
+    name: "nn.NthElement"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OneHot.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OneHot.pbtxt
new file mode 100644
index 00000000000..116d0272f16
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OneHot.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "OneHot"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OneShotIterator.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OneShotIterator.pbtxt
new file mode 100644
index 00000000000..18ee5a8cff8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OneShotIterator.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "OneShotIterator"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.OneShotIterator"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OnesLike.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OnesLike.pbtxt
new file mode 100644
index 00000000000..06bdeacbd0e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OnesLike.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "OnesLike"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OptimizeDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OptimizeDataset.pbtxt
new file mode 100644
index 00000000000..4220b306071
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OptimizeDataset.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "OptimizeDataset"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OptimizeDatasetV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OptimizeDatasetV2.pbtxt
new file mode 100644
index 00000000000..4b0214740a9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OptimizeDatasetV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "OptimizeDatasetV2"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.OptimizeDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OptionalFromValue.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OptionalFromValue.pbtxt
new file mode 100644
index 00000000000..282d866f180
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OptionalFromValue.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "OptionalFromValue"
+  endpoint {
+    name: "data.OptionalFromValue"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OptionalGetValue.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OptionalGetValue.pbtxt
new file mode 100644
index 00000000000..b0be584ec90
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OptionalGetValue.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "OptionalGetValue"
+  endpoint {
+    name: "data.OptionalGetValue"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OptionalHasValue.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OptionalHasValue.pbtxt
new file mode 100644
index 00000000000..f2778d04bb8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OptionalHasValue.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "OptionalHasValue"
+  endpoint {
+    name: "data.OptionalHasValue"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OptionalNone.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OptionalNone.pbtxt
new file mode 100644
index 00000000000..77ec49c964c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OptionalNone.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "OptionalNone"
+  endpoint {
+    name: "data.OptionalNone"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OptionsDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OptionsDataset.pbtxt
new file mode 100644
index 00000000000..0ccf9d12546
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OptionsDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "OptionsDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.OptionsDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OrderedMapClear.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OrderedMapClear.pbtxt
new file mode 100644
index 00000000000..30c9cc626d0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OrderedMapClear.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "OrderedMapClear"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OrderedMapIncompleteSize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OrderedMapIncompleteSize.pbtxt
new file mode 100644
index 00000000000..ef2e4e4f272
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OrderedMapIncompleteSize.pbtxt
@@ -0,0 +1,8 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "OrderedMapIncompleteSize"
+  out_arg {
+    name: "size"
+    rename_to: "output"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OrderedMapPeek.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OrderedMapPeek.pbtxt
new file mode 100644
index 00000000000..2ac8b71d2fb
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OrderedMapPeek.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "OrderedMapPeek"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OrderedMapSize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OrderedMapSize.pbtxt
new file mode 100644
index 00000000000..47e4f6188ce
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OrderedMapSize.pbtxt
@@ -0,0 +1,8 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "OrderedMapSize"
+  out_arg {
+    name: "size"
+    rename_to: "output"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OrderedMapStage.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OrderedMapStage.pbtxt
new file mode 100644
index 00000000000..22a96eaccb0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OrderedMapStage.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "OrderedMapStage"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OrderedMapUnstage.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OrderedMapUnstage.pbtxt
new file mode 100644
index 00000000000..b617e0ad11e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OrderedMapUnstage.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "OrderedMapUnstage"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OrderedMapUnstageNoKey.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OrderedMapUnstageNoKey.pbtxt
new file mode 100644
index 00000000000..e5beaff8915
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OrderedMapUnstageNoKey.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "OrderedMapUnstageNoKey"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OutfeedDequeue.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OutfeedDequeue.pbtxt
new file mode 100644
index 00000000000..6a8b5d5f562
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OutfeedDequeue.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "OutfeedDequeue"
+  endpoint {
+    name: "tpu.OutfeedDequeue"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OutfeedDequeueTuple.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OutfeedDequeueTuple.pbtxt
new file mode 100644
index 00000000000..9b8a9b7bebd
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OutfeedDequeueTuple.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "OutfeedDequeueTuple"
+  endpoint {
+    name: "tpu.OutfeedDequeueTuple"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OutfeedDequeueTupleV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OutfeedDequeueTupleV2.pbtxt
new file mode 100644
index 00000000000..7fef814d5b3
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OutfeedDequeueTupleV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "OutfeedDequeueTupleV2"
+  endpoint {
+    name: "tpu.OutfeedDequeueTupleV2"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OutfeedDequeueV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OutfeedDequeueV2.pbtxt
new file mode 100644
index 00000000000..02c947f23f8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OutfeedDequeueV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "OutfeedDequeueV2"
+  endpoint {
+    name: "tpu.OutfeedDequeueV2"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OutfeedEnqueue.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OutfeedEnqueue.pbtxt
new file mode 100644
index 00000000000..18694993470
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OutfeedEnqueue.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "OutfeedEnqueue"
+  endpoint {
+    name: "tpu.OutfeedEnqueue"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_OutfeedEnqueueTuple.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_OutfeedEnqueueTuple.pbtxt
new file mode 100644
index 00000000000..e4347fe0bcd
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_OutfeedEnqueueTuple.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "OutfeedEnqueueTuple"
+  endpoint {
+    name: "tpu.OutfeedEnqueueTuple"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Pack.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Pack.pbtxt
new file mode 100644
index 00000000000..2be5e46f791
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Pack.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Pack"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Pad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Pad.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Pad.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_Pad.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_PadV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_PadV2.pbtxt
new file mode 100644
index 00000000000..2462c556cf3
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_PadV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "PadV2"
+  endpoint {
+    name: "Pad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_PaddedBatchDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_PaddedBatchDataset.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_PaddedBatchDataset.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_PaddedBatchDataset.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_PaddedBatchDatasetV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_PaddedBatchDatasetV2.pbtxt
new file mode 100644
index 00000000000..0999120d361
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_PaddedBatchDatasetV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "PaddedBatchDatasetV2"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.PaddedBatchDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_PaddingFIFOQueue.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_PaddingFIFOQueue.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_PaddingFIFOQueue.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_PaddingFIFOQueue.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_PaddingFIFOQueueV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_PaddingFIFOQueueV2.pbtxt
new file mode 100644
index 00000000000..d0b4a712ff8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_PaddingFIFOQueueV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "PaddingFIFOQueueV2"
+  endpoint {
+    name: "io.PaddingFifoQueue"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelBatchDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelBatchDataset.pbtxt
new file mode 100644
index 00000000000..3fd9b1a423b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelBatchDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "ParallelBatchDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.ParallelBatchDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelConcat.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelConcat.pbtxt
new file mode 100644
index 00000000000..cead44173d7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelConcat.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ParallelConcat"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelDynamicStitch.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelDynamicStitch.pbtxt
new file mode 100644
index 00000000000..a8bebe9f4f5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelDynamicStitch.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ParallelDynamicStitch"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelFilterDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelFilterDataset.pbtxt
new file mode 100644
index 00000000000..32e189b0963
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelFilterDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ParallelFilterDataset"
+  endpoint {
+    name: "data.ParallelFilterDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ParallelInterleaveDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelInterleaveDataset.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ParallelInterleaveDataset.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelInterleaveDataset.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelInterleaveDatasetV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelInterleaveDatasetV2.pbtxt
new file mode 100644
index 00000000000..349769a43cf
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelInterleaveDatasetV2.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "ParallelInterleaveDatasetV2"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelInterleaveDatasetV3.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelInterleaveDatasetV3.pbtxt
new file mode 100644
index 00000000000..b0f3e0f0f62
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelInterleaveDatasetV3.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "ParallelInterleaveDatasetV3"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelInterleaveDatasetV4.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelInterleaveDatasetV4.pbtxt
new file mode 100644
index 00000000000..7dddfc15a66
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelInterleaveDatasetV4.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "ParallelInterleaveDatasetV4"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.ParallelInterleaveDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelMapDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelMapDataset.pbtxt
new file mode 100644
index 00000000000..64f25b9e5e9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelMapDataset.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "ParallelMapDataset"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelMapDatasetV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelMapDatasetV2.pbtxt
new file mode 100644
index 00000000000..9135d8f5c99
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParallelMapDatasetV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "ParallelMapDatasetV2"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.ParallelMapDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ParameterizedTruncatedNormal.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParameterizedTruncatedNormal.pbtxt
new file mode 100644
index 00000000000..e271245d703
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParameterizedTruncatedNormal.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ParameterizedTruncatedNormal"
+  endpoint {
+    name: "random.ParameterizedTruncatedNormal"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseExample.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseExample.pbtxt
new file mode 100644
index 00000000000..9b531803889
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseExample.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "ParseExample"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseExampleDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseExampleDataset.pbtxt
new file mode 100644
index 00000000000..d293e296b74
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseExampleDataset.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "ParseExampleDataset"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseExampleDatasetV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseExampleDatasetV2.pbtxt
new file mode 100644
index 00000000000..4ce175177f6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseExampleDatasetV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "ParseExampleDatasetV2"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.ParseExampleDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseExampleV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseExampleV2.pbtxt
new file mode 100644
index 00000000000..c78eb77249c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseExampleV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ParseExampleV2"
+  endpoint {
+    name: "io.ParseExample"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseSequenceExample.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseSequenceExample.pbtxt
new file mode 100644
index 00000000000..83dc91d9644
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseSequenceExample.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "ParseSequenceExample"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseSequenceExampleV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseSequenceExampleV2.pbtxt
new file mode 100644
index 00000000000..3ce6e01560f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseSequenceExampleV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ParseSequenceExampleV2"
+  endpoint {
+    name: "io.ParseSequenceExample"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseSingleExample.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseSingleExample.pbtxt
new file mode 100644
index 00000000000..d2dfdc20ea2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseSingleExample.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ParseSingleExample"
+  endpoint {
+    name: "io.ParseSingleExample"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseSingleSequenceExample.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseSingleSequenceExample.pbtxt
new file mode 100644
index 00000000000..2a83b9105e0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseSingleSequenceExample.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ParseSingleSequenceExample"
+  endpoint {
+    name: "io.ParseSingleSequenceExample"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseTensor.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseTensor.pbtxt
new file mode 100644
index 00000000000..e8e5db934af
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ParseTensor.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ParseTensor"
+  endpoint {
+    name: "io.ParseTensor"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_PartitionedCall.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_PartitionedCall.pbtxt
new file mode 100644
index 00000000000..268c519a8a7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_PartitionedCall.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "PartitionedCall"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Placeholder.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Placeholder.pbtxt
new file mode 100644
index 00000000000..2e83fe4d8f8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Placeholder.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Placeholder"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_PlaceholderV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_PlaceholderV2.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_PlaceholderV2.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_PlaceholderV2.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_PlaceholderWithDefault.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_PlaceholderWithDefault.pbtxt
new file mode 100644
index 00000000000..d20aff9cb92
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_PlaceholderWithDefault.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "PlaceholderWithDefault"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Polygamma.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Polygamma.pbtxt
new file mode 100644
index 00000000000..f81d95924f1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Polygamma.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Polygamma"
+  endpoint {
+    name: "math.Polygamma"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_PopulationCount.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_PopulationCount.pbtxt
new file mode 100644
index 00000000000..840404a23d0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_PopulationCount.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "PopulationCount"
+  endpoint {
+    name: "math.PopulationCount"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Pow.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Pow.pbtxt
new file mode 100644
index 00000000000..8657e4afb98
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Pow.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Pow"
+  endpoint {
+    name: "math.Pow"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_PrefetchDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_PrefetchDataset.pbtxt
new file mode 100644
index 00000000000..a8a3423123d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_PrefetchDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "PrefetchDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.PrefetchDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Prelinearize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Prelinearize.pbtxt
new file mode 100644
index 00000000000..71d98c0868f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Prelinearize.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Prelinearize"
+  endpoint {
+    name: "tpu.Prelinearize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_PrelinearizeTuple.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_PrelinearizeTuple.pbtxt
new file mode 100644
index 00000000000..59751130dfc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_PrelinearizeTuple.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "PrelinearizeTuple"
+  endpoint {
+    name: "tpu.PrelinearizeTuple"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_PrependFromQueueAndPaddedBatchDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_PrependFromQueueAndPaddedBatchDataset.pbtxt
similarity index 86%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_PrependFromQueueAndPaddedBatchDataset.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_PrependFromQueueAndPaddedBatchDataset.pbtxt
index 7c9d509b163..a5e8f99de23 100644
--- a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_PrependFromQueueAndPaddedBatchDataset.pbtxt
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_PrependFromQueueAndPaddedBatchDataset.pbtxt
@@ -1,5 +1,6 @@
 op {
   graph_op_name: "PrependFromQueueAndPaddedBatchDataset"
+  visibility: VISIBLE
   endpoint {
     name: "data.PrependFromQueueAndPaddedBatchDataset"
   }
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_PreventGradient.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_PreventGradient.pbtxt
new file mode 100644
index 00000000000..bafa0a5a739
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_PreventGradient.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "PreventGradient"
+  endpoint {
+    name: "train.PreventGradient"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Print.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Print.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Print.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_Print.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_PrintV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_PrintV2.pbtxt
new file mode 100644
index 00000000000..573751c55b8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_PrintV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "PrintV2"
+  endpoint {
+    name: "Print"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_PriorityQueue.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_PriorityQueue.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_PriorityQueue.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_PriorityQueue.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_PriorityQueueV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_PriorityQueueV2.pbtxt
new file mode 100644
index 00000000000..8bd3b0a04dc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_PriorityQueueV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "PriorityQueueV2"
+  endpoint {
+    name: "io.PriorityQueue"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_PrivateThreadPoolDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_PrivateThreadPoolDataset.pbtxt
new file mode 100644
index 00000000000..4c0cfbe6698
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_PrivateThreadPoolDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "PrivateThreadPoolDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.PrivateThreadPoolDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Prod.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Prod.pbtxt
new file mode 100644
index 00000000000..d1c62ee4c7d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Prod.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Prod"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_PyFunc.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_PyFunc.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_PyFunc.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_PyFunc.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_PyFuncStateless.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_PyFuncStateless.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_PyFuncStateless.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_PyFuncStateless.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Qr.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Qr.pbtxt
new file mode 100644
index 00000000000..13b372131af
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Qr.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Qr"
+  endpoint {
+    name: "linalg.Qr"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_QuantizeAndDequantize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizeAndDequantize.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_QuantizeAndDequantize.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizeAndDequantize.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_QuantizeAndDequantizeV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizeAndDequantizeV2.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_QuantizeAndDequantizeV2.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizeAndDequantizeV2.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizeAndDequantizeV3.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizeAndDequantizeV3.pbtxt
new file mode 100644
index 00000000000..49b0b0d4878
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizeAndDequantizeV3.pbtxt
@@ -0,0 +1,10 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizeAndDequantizeV3"
+  endpoint {
+    name: "quantization.QuantizeAndDequantizeV3"
+  }
+  endpoint {
+    name: "quantization.QuantizeAndDequantize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizeAndDequantizeV4.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizeAndDequantizeV4.pbtxt
new file mode 100644
index 00000000000..4e9780f470c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizeAndDequantizeV4.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizeAndDequantizeV4"
+  endpoint {
+    name: "quantization.QuantizeAndDequantizeV4"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizeAndDequantizeV4Grad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizeAndDequantizeV4Grad.pbtxt
new file mode 100644
index 00000000000..3c86a135f58
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizeAndDequantizeV4Grad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizeAndDequantizeV4Grad"
+  endpoint {
+    name: "quantization.QuantizeAndDequantizeV4Grad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizeDownAndShrinkRange.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizeDownAndShrinkRange.pbtxt
new file mode 100644
index 00000000000..ac2dc64b29b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizeDownAndShrinkRange.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizeDownAndShrinkRange"
+  endpoint {
+    name: "quantization.QuantizeDownAndShrinkRange"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizeV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizeV2.pbtxt
new file mode 100644
index 00000000000..8dd0155b0cc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizeV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizeV2"
+  endpoint {
+    name: "quantization.Quantize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedAdd.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedAdd.pbtxt
new file mode 100644
index 00000000000..409160600a2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedAdd.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedAdd"
+  endpoint {
+    name: "math.QuantizedAdd"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedAvgPool.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedAvgPool.pbtxt
new file mode 100644
index 00000000000..4f6112fd2d6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedAvgPool.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedAvgPool"
+  endpoint {
+    name: "nn.QuantizedAvgPool"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedBatchNormWithGlobalNormalization.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedBatchNormWithGlobalNormalization.pbtxt
new file mode 100644
index 00000000000..f83d5c2433a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedBatchNormWithGlobalNormalization.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedBatchNormWithGlobalNormalization"
+  endpoint {
+    name: "nn.QuantizedBatchNormWithGlobalNormalization"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedBiasAdd.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedBiasAdd.pbtxt
new file mode 100644
index 00000000000..42af03225d9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedBiasAdd.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedBiasAdd"
+  endpoint {
+    name: "nn.QuantizedBiasAdd"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConcat.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConcat.pbtxt
new file mode 100644
index 00000000000..6f494b440b1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConcat.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedConcat"
+  endpoint {
+    name: "quantization.QuantizedConcat"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConcatV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConcatV2.pbtxt
new file mode 100644
index 00000000000..b88e8e1a96f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConcatV2.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "QuantizedConcatV2"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2D.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2D.pbtxt
new file mode 100644
index 00000000000..a6e20f4585d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2D.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedConv2D"
+  endpoint {
+    name: "nn.QuantizedConv2d"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DAndRelu.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DAndRelu.pbtxt
new file mode 100644
index 00000000000..11babc82e64
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DAndRelu.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedConv2DAndRelu"
+  endpoint {
+    name: "nn.QuantizedConv2DAndRelu"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DAndReluAndRequantize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DAndReluAndRequantize.pbtxt
new file mode 100644
index 00000000000..69598eb29e7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DAndReluAndRequantize.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedConv2DAndReluAndRequantize"
+  endpoint {
+    name: "nn.QuantizedConv2DAndReluAndRequantize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DAndRequantize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DAndRequantize.pbtxt
new file mode 100644
index 00000000000..074c8bb81dc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DAndRequantize.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedConv2DAndRequantize"
+  endpoint {
+    name: "nn.QuantizedConv2DAndRequantize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DPerChannel.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DPerChannel.pbtxt
new file mode 100644
index 00000000000..8e0ad23bd42
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DPerChannel.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedConv2DPerChannel"
+  endpoint {
+    name: "nn.QuantizedConv2DPerChannel"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DWithBias.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DWithBias.pbtxt
new file mode 100644
index 00000000000..bfb35fd99ee
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DWithBias.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedConv2DWithBias"
+  endpoint {
+    name: "nn.QuantizedConv2DWithBias"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DWithBiasAndRelu.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DWithBiasAndRelu.pbtxt
new file mode 100644
index 00000000000..094b5484db9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DWithBiasAndRelu.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedConv2DWithBiasAndRelu"
+  endpoint {
+    name: "nn.QuantizedConv2DWithBiasAndRelu"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DWithBiasAndReluAndRequantize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DWithBiasAndReluAndRequantize.pbtxt
new file mode 100644
index 00000000000..45a9ae59f11
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DWithBiasAndReluAndRequantize.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedConv2DWithBiasAndReluAndRequantize"
+  endpoint {
+    name: "nn.QuantizedConv2DWithBiasAndReluAndRequantize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DWithBiasAndRequantize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DWithBiasAndRequantize.pbtxt
new file mode 100644
index 00000000000..e2360686b4a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DWithBiasAndRequantize.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedConv2DWithBiasAndRequantize"
+  endpoint {
+    name: "nn.QuantizedConv2DWithBiasAndRequantize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DWithBiasSignedSumAndReluAndRequantize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DWithBiasSignedSumAndReluAndRequantize.pbtxt
new file mode 100644
index 00000000000..16c15d1bcbb
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DWithBiasSignedSumAndReluAndRequantize.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedConv2DWithBiasSignedSumAndReluAndRequantize"
+  endpoint {
+    name: "nn.QuantizedConv2DWithBiasSignedSumAndReluAndRequantize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DWithBiasSumAndRelu.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DWithBiasSumAndRelu.pbtxt
new file mode 100644
index 00000000000..210d5287924
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DWithBiasSumAndRelu.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedConv2DWithBiasSumAndRelu"
+  endpoint {
+    name: "nn.QuantizedConv2DWithBiasSumAndRelu"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DWithBiasSumAndReluAndRequantize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DWithBiasSumAndReluAndRequantize.pbtxt
new file mode 100644
index 00000000000..910800ac4f0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedConv2DWithBiasSumAndReluAndRequantize.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedConv2DWithBiasSumAndReluAndRequantize"
+  endpoint {
+    name: "nn.QuantizedConv2DWithBiasSumAndReluAndRequantize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedDepthwiseConv2D.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedDepthwiseConv2D.pbtxt
new file mode 100644
index 00000000000..cfcc863566b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedDepthwiseConv2D.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedDepthwiseConv2D"
+  endpoint {
+    name: "nn.QuantizedDepthwiseConv2D"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedDepthwiseConv2DWithBias.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedDepthwiseConv2DWithBias.pbtxt
new file mode 100644
index 00000000000..961de7a11f7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedDepthwiseConv2DWithBias.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedDepthwiseConv2DWithBias"
+  endpoint {
+    name: "nn.QuantizedDepthwiseConv2DWithBias"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedDepthwiseConv2DWithBiasAndRelu.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedDepthwiseConv2DWithBiasAndRelu.pbtxt
new file mode 100644
index 00000000000..4470675b660
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedDepthwiseConv2DWithBiasAndRelu.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedDepthwiseConv2DWithBiasAndRelu"
+  endpoint {
+    name: "nn.QuantizedDepthwiseConv2DWithBiasAndRelu"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize.pbtxt
new file mode 100644
index 00000000000..e2673935a16
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize"
+  endpoint {
+    name: "nn.QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedInstanceNorm.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedInstanceNorm.pbtxt
new file mode 100644
index 00000000000..52620d0f998
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedInstanceNorm.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedInstanceNorm"
+  endpoint {
+    name: "nn.QuantizedInstanceNorm"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMatMul.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMatMul.pbtxt
new file mode 100644
index 00000000000..40f0a5e788c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMatMul.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedMatMul"
+  endpoint {
+    name: "linalg.QuantizedMatMul"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMatMulWithBias.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMatMulWithBias.pbtxt
new file mode 100644
index 00000000000..65cd7780258
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMatMulWithBias.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedMatMulWithBias"
+  endpoint {
+    name: "linalg.QuantizedMatMulWithBias"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMatMulWithBiasAndDequantize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMatMulWithBiasAndDequantize.pbtxt
new file mode 100644
index 00000000000..2c47dfba1b0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMatMulWithBiasAndDequantize.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedMatMulWithBiasAndDequantize"
+  endpoint {
+    name: "quantization.QuantizedMatMulWithBiasAndDequantize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMatMulWithBiasAndRelu.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMatMulWithBiasAndRelu.pbtxt
new file mode 100644
index 00000000000..9f7d19c4203
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMatMulWithBiasAndRelu.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedMatMulWithBiasAndRelu"
+  endpoint {
+    name: "linalg.QuantizedMatMulWithBiasAndRelu"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMatMulWithBiasAndReluAndRequantize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMatMulWithBiasAndReluAndRequantize.pbtxt
new file mode 100644
index 00000000000..548eeb7b9ef
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMatMulWithBiasAndReluAndRequantize.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedMatMulWithBiasAndReluAndRequantize"
+  endpoint {
+    name: "linalg.QuantizedMatMulWithBiasAndReluAndRequantize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMatMulWithBiasAndRequantize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMatMulWithBiasAndRequantize.pbtxt
new file mode 100644
index 00000000000..24994b5662f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMatMulWithBiasAndRequantize.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedMatMulWithBiasAndRequantize"
+  endpoint {
+    name: "quantization.QuantizedMatMulWithBiasAndRequantize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMaxPool.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMaxPool.pbtxt
new file mode 100644
index 00000000000..40f6f65c9b1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMaxPool.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedMaxPool"
+  endpoint {
+    name: "nn.QuantizedMaxPool"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMul.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMul.pbtxt
new file mode 100644
index 00000000000..6b14b69beb5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedMul.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedMul"
+  endpoint {
+    name: "math.QuantizedMul"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedRelu.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedRelu.pbtxt
new file mode 100644
index 00000000000..8e1b314e688
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedRelu.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedRelu"
+  endpoint {
+    name: "nn.QuantizedRelu"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedRelu6.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedRelu6.pbtxt
new file mode 100644
index 00000000000..f5230201707
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedRelu6.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedRelu6"
+  endpoint {
+    name: "nn.QuantizedRelu6"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedReluX.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedReluX.pbtxt
new file mode 100644
index 00000000000..a52915868d7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedReluX.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedReluX"
+  endpoint {
+    name: "nn.QuantizedReluX"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedReshape.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedReshape.pbtxt
new file mode 100644
index 00000000000..f2049b9f380
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedReshape.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedReshape"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedResizeBilinear.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedResizeBilinear.pbtxt
new file mode 100644
index 00000000000..28191a12de9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QuantizedResizeBilinear.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QuantizedResizeBilinear"
+  endpoint {
+    name: "image.QuantizedResizeBilinear"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_QueueClose.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueClose.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_QueueClose.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_QueueClose.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueCloseV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueCloseV2.pbtxt
new file mode 100644
index 00000000000..08c2af13ab5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueCloseV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QueueCloseV2"
+  endpoint {
+    name: "io.QueueClose"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_QueueDequeue.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueDequeue.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_QueueDequeue.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_QueueDequeue.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_QueueDequeueMany.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueDequeueMany.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_QueueDequeueMany.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_QueueDequeueMany.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueDequeueManyV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueDequeueManyV2.pbtxt
new file mode 100644
index 00000000000..e0cdf5ce764
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueDequeueManyV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QueueDequeueManyV2"
+  endpoint {
+    name: "io.QueueDequeueMany"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_QueueDequeueUpTo.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueDequeueUpTo.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_QueueDequeueUpTo.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_QueueDequeueUpTo.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueDequeueUpToV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueDequeueUpToV2.pbtxt
new file mode 100644
index 00000000000..715b614ccda
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueDequeueUpToV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QueueDequeueUpToV2"
+  endpoint {
+    name: "io.QueueDequeueUpTo"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueDequeueV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueDequeueV2.pbtxt
new file mode 100644
index 00000000000..670a81b09c6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueDequeueV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QueueDequeueV2"
+  endpoint {
+    name: "io.QueueDequeue"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_QueueEnqueue.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueEnqueue.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_QueueEnqueue.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_QueueEnqueue.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_QueueEnqueueMany.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueEnqueueMany.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_QueueEnqueueMany.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_QueueEnqueueMany.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueEnqueueManyV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueEnqueueManyV2.pbtxt
new file mode 100644
index 00000000000..8f08727b990
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueEnqueueManyV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QueueEnqueueManyV2"
+  endpoint {
+    name: "io.QueueEnqueueMany"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueEnqueueV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueEnqueueV2.pbtxt
new file mode 100644
index 00000000000..56700dbe62d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueEnqueueV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QueueEnqueueV2"
+  endpoint {
+    name: "io.QueueEnqueue"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_QueueIsClosed.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueIsClosed.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_QueueIsClosed.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_QueueIsClosed.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueIsClosedV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueIsClosedV2.pbtxt
new file mode 100644
index 00000000000..e3c27b82fe8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueIsClosedV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QueueIsClosedV2"
+  endpoint {
+    name: "io.QueueIsClosed"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_QueueSize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueSize.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_QueueSize.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_QueueSize.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueSizeV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueSizeV2.pbtxt
new file mode 100644
index 00000000000..f352e15e0c7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_QueueSizeV2.pbtxt
@@ -0,0 +1,11 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "QueueSizeV2"
+  endpoint {
+    name: "io.QueueSize"
+  }
+  out_arg {
+    name: "size"
+    rename_to: "output"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RFFT.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RFFT.pbtxt
new file mode 100644
index 00000000000..708de1951ae
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RFFT.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RFFT"
+  endpoint {
+    name: "signal.Rfft"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RFFT2D.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RFFT2D.pbtxt
new file mode 100644
index 00000000000..8488c65b5d0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RFFT2D.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RFFT2D"
+  endpoint {
+    name: "signal.Rfft2d"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RFFT3D.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RFFT3D.pbtxt
new file mode 100644
index 00000000000..09218cd6296
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RFFT3D.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RFFT3D"
+  endpoint {
+    name: "signal.Rfft3d"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RFFTND.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RFFTND.pbtxt
new file mode 100644
index 00000000000..4b46e0f0d31
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RFFTND.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RFFTND"
+  endpoint {
+    name: "signal.RfftNd"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RGBToHSV.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RGBToHSV.pbtxt
new file mode 100644
index 00000000000..2172f52405b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RGBToHSV.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RGBToHSV"
+  endpoint {
+    name: "image.RgbToHsv"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedBincount.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedBincount.pbtxt
new file mode 100644
index 00000000000..632be33d30d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedBincount.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RaggedBincount"
+  endpoint {
+    name: "ragged.RaggedBincount"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedCountSparseOutput.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedCountSparseOutput.pbtxt
new file mode 100644
index 00000000000..e74b9bd9d0a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedCountSparseOutput.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RaggedCountSparseOutput"
+  endpoint {
+    name: "ragged.RaggedCountSparseOutput"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedCross.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedCross.pbtxt
new file mode 100644
index 00000000000..7da3096c7ef
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedCross.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RaggedCross"
+  endpoint {
+    name: "ragged.RaggedCross"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedFillEmptyRows.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedFillEmptyRows.pbtxt
new file mode 100644
index 00000000000..5f135f87e74
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedFillEmptyRows.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RaggedFillEmptyRows"
+  endpoint {
+    name: "ragged.RaggedFillEmptyRows"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedFillEmptyRowsGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedFillEmptyRowsGrad.pbtxt
new file mode 100644
index 00000000000..5f8f1790f32
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedFillEmptyRowsGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RaggedFillEmptyRowsGrad"
+  endpoint {
+    name: "ragged.RaggedFillEmptyRowsGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedGather.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedGather.pbtxt
new file mode 100644
index 00000000000..10da3a31954
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedGather.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RaggedGather"
+  endpoint {
+    name: "ragged.RaggedGather"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedRange.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedRange.pbtxt
new file mode 100644
index 00000000000..6ec658b61fe
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedRange.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RaggedRange"
+  endpoint {
+    name: "ragged.RaggedRange"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedTensorFromVariant.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedTensorFromVariant.pbtxt
new file mode 100644
index 00000000000..2067148bde1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedTensorFromVariant.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RaggedTensorFromVariant"
+  endpoint {
+    name: "ragged.RaggedTensorFromVariant"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedTensorToSparse.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedTensorToSparse.pbtxt
new file mode 100644
index 00000000000..c6d61a22606
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedTensorToSparse.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RaggedTensorToSparse"
+  endpoint {
+    name: "ragged.RaggedTensorToSparse"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedTensorToTensor.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedTensorToTensor.pbtxt
new file mode 100644
index 00000000000..2bae8ad3de2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedTensorToTensor.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RaggedTensorToTensor"
+  endpoint {
+    name: "ragged.RaggedTensorToTensor"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedTensorToVariant.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedTensorToVariant.pbtxt
new file mode 100644
index 00000000000..3e4b2029a1b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedTensorToVariant.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RaggedTensorToVariant"
+  endpoint {
+    name: "ragged.RaggedTensorToVariant"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedTensorToVariantGradient.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedTensorToVariantGradient.pbtxt
new file mode 100644
index 00000000000..a09acd4debd
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RaggedTensorToVariantGradient.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RaggedTensorToVariantGradient"
+  endpoint {
+    name: "ragged.RaggedTensorToVariantGradient"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomCrop.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomCrop.pbtxt
new file mode 100644
index 00000000000..be299f2ed38
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomCrop.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RandomCrop"
+  endpoint {
+    name: "image.RandomCrop"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomDataset.pbtxt
new file mode 100644
index 00000000000..6c64c2b8818
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomDataset.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "RandomDataset"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomDatasetV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomDatasetV2.pbtxt
new file mode 100644
index 00000000000..77231322675
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomDatasetV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "RandomDatasetV2"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.RandomDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomGamma.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomGamma.pbtxt
new file mode 100644
index 00000000000..c8fbfbf0134
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomGamma.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RandomGamma"
+  endpoint {
+    name: "random.RandomGamma"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomGammaGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomGammaGrad.pbtxt
new file mode 100644
index 00000000000..6d0b3466690
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomGammaGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RandomGammaGrad"
+  endpoint {
+    name: "random.RandomGammaGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomIndexShuffle.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomIndexShuffle.pbtxt
new file mode 100644
index 00000000000..0af6f3e5b1e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomIndexShuffle.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RandomIndexShuffle"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_RandomPoisson.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomPoisson.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_RandomPoisson.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_RandomPoisson.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomPoissonV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomPoissonV2.pbtxt
new file mode 100644
index 00000000000..09bdecdaa10
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomPoissonV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RandomPoissonV2"
+  endpoint {
+    name: "random.RandomPoisson"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomShuffle.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomShuffle.pbtxt
new file mode 100644
index 00000000000..5d0d7a3b680
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomShuffle.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RandomShuffle"
+  endpoint {
+    name: "random.RandomShuffle"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_RandomShuffleQueue.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomShuffleQueue.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_RandomShuffleQueue.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_RandomShuffleQueue.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomShuffleQueueV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomShuffleQueueV2.pbtxt
new file mode 100644
index 00000000000..4dd84fac74d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomShuffleQueueV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RandomShuffleQueueV2"
+  endpoint {
+    name: "io.RandomShuffleQueue"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomStandardNormal.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomStandardNormal.pbtxt
new file mode 100644
index 00000000000..5ac99b9005b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomStandardNormal.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RandomStandardNormal"
+  endpoint {
+    name: "random.RandomStandardNormal"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomUniform.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomUniform.pbtxt
new file mode 100644
index 00000000000..bdec5ac99d7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomUniform.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RandomUniform"
+  endpoint {
+    name: "random.RandomUniform"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomUniformInt.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomUniformInt.pbtxt
new file mode 100644
index 00000000000..4102517f3de
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RandomUniformInt.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RandomUniformInt"
+  endpoint {
+    name: "random.RandomUniformInt"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Range.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Range.pbtxt
new file mode 100644
index 00000000000..dbda35b7374
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Range.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Range"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RangeDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RangeDataset.pbtxt
new file mode 100644
index 00000000000..e4a9af7ea97
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RangeDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "RangeDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.RangeDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Rank.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Rank.pbtxt
new file mode 100644
index 00000000000..dc306a7ae56
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Rank.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Rank"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ReadFile.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReadFile.pbtxt
new file mode 100644
index 00000000000..8d2c022f428
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReadFile.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ReadFile"
+  endpoint {
+    name: "io.ReadFile"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ReadVariableOp.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReadVariableOp.pbtxt
new file mode 100644
index 00000000000..7f053e301a6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReadVariableOp.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ReadVariableOp"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ReadVariableXlaSplitND.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReadVariableXlaSplitND.pbtxt
new file mode 100644
index 00000000000..5d6bfb45373
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReadVariableXlaSplitND.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ReadVariableXlaSplitND"
+  endpoint {
+    name: "xla.ReadVariableSplitND"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ReaderNumRecordsProduced.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderNumRecordsProduced.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ReaderNumRecordsProduced.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderNumRecordsProduced.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderNumRecordsProducedV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderNumRecordsProducedV2.pbtxt
new file mode 100644
index 00000000000..13578bcba83
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderNumRecordsProducedV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ReaderNumRecordsProducedV2"
+  endpoint {
+    name: "io.ReaderNumRecordsProduced"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ReaderNumWorkUnitsCompleted.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderNumWorkUnitsCompleted.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ReaderNumWorkUnitsCompleted.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderNumWorkUnitsCompleted.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderNumWorkUnitsCompletedV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderNumWorkUnitsCompletedV2.pbtxt
new file mode 100644
index 00000000000..1a72c3be10a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderNumWorkUnitsCompletedV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ReaderNumWorkUnitsCompletedV2"
+  endpoint {
+    name: "io.ReaderNumWorkUnitsCompleted"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ReaderRead.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderRead.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ReaderRead.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderRead.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ReaderReadUpTo.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderReadUpTo.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ReaderReadUpTo.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderReadUpTo.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderReadUpToV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderReadUpToV2.pbtxt
new file mode 100644
index 00000000000..06a316fbb70
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderReadUpToV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ReaderReadUpToV2"
+  endpoint {
+    name: "io.ReaderReadUpTo"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderReadV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderReadV2.pbtxt
new file mode 100644
index 00000000000..64bd40cdde8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderReadV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ReaderReadV2"
+  endpoint {
+    name: "io.ReaderRead"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ReaderReset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderReset.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ReaderReset.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderReset.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderResetV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderResetV2.pbtxt
new file mode 100644
index 00000000000..05bd5c48bc3
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderResetV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ReaderResetV2"
+  endpoint {
+    name: "io.ReaderReset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ReaderRestoreState.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderRestoreState.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ReaderRestoreState.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderRestoreState.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderRestoreStateV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderRestoreStateV2.pbtxt
new file mode 100644
index 00000000000..c53c47ff372
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderRestoreStateV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ReaderRestoreStateV2"
+  endpoint {
+    name: "io.ReaderRestoreState"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ReaderSerializeState.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderSerializeState.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ReaderSerializeState.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderSerializeState.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderSerializeStateV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderSerializeStateV2.pbtxt
new file mode 100644
index 00000000000..ec18d3c71b6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReaderSerializeStateV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ReaderSerializeStateV2"
+  endpoint {
+    name: "io.ReaderSerializeState"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Real.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Real.pbtxt
new file mode 100644
index 00000000000..3ddd3bc902a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Real.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Real"
+  endpoint {
+    name: "math.Real"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RealDiv.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RealDiv.pbtxt
new file mode 100644
index 00000000000..366c95f2566
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RealDiv.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RealDiv"
+  endpoint {
+    name: "math.RealDiv"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RebatchDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RebatchDataset.pbtxt
new file mode 100644
index 00000000000..61d010ff033
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RebatchDataset.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "RebatchDataset"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RebatchDatasetV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RebatchDatasetV2.pbtxt
new file mode 100644
index 00000000000..42ab3bc1a6e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RebatchDatasetV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "RebatchDatasetV2"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.RebatchDatasetV2"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Reciprocal.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Reciprocal.pbtxt
new file mode 100644
index 00000000000..bb6956bbe3c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Reciprocal.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Reciprocal"
+  endpoint {
+    name: "math.Reciprocal"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ReciprocalGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReciprocalGrad.pbtxt
new file mode 100644
index 00000000000..57cc8c630e1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReciprocalGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ReciprocalGrad"
+  endpoint {
+    name: "math.ReciprocalGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RecordInput.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RecordInput.pbtxt
new file mode 100644
index 00000000000..bf8836b3d81
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RecordInput.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RecordInput"
+  endpoint {
+    name: "random.RecordInput"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Recv.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Recv.pbtxt
new file mode 100644
index 00000000000..6ba56fa3392
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Recv.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Recv"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RecvTPUEmbeddingActivations.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RecvTPUEmbeddingActivations.pbtxt
new file mode 100644
index 00000000000..05ce63f87aa
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RecvTPUEmbeddingActivations.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RecvTPUEmbeddingActivations"
+  endpoint {
+    name: "tpu.RecvTPUEmbeddingActivations"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ReduceDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReduceDataset.pbtxt
new file mode 100644
index 00000000000..4493b8a20ac
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReduceDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "ReduceDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.ReduceDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ReduceJoin.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReduceJoin.pbtxt
new file mode 100644
index 00000000000..bb2b90169a1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReduceJoin.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ReduceJoin"
+  endpoint {
+    name: "strings.ReduceJoin"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RefEnter.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RefEnter.pbtxt
new file mode 100644
index 00000000000..886f9cc3436
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RefEnter.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RefEnter"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RefExit.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RefExit.pbtxt
new file mode 100644
index 00000000000..1495c957912
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RefExit.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RefExit"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RefIdentity.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RefIdentity.pbtxt
new file mode 100644
index 00000000000..013b3bcce61
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RefIdentity.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RefIdentity"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RefMerge.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RefMerge.pbtxt
new file mode 100644
index 00000000000..97599f361be
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RefMerge.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RefMerge"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RefNextIteration.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RefNextIteration.pbtxt
new file mode 100644
index 00000000000..0b94ec2d5d0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RefNextIteration.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RefNextIteration"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RefSelect.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RefSelect.pbtxt
new file mode 100644
index 00000000000..dc135b3cc98
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RefSelect.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RefSelect"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RefSwitch.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RefSwitch.pbtxt
new file mode 100644
index 00000000000..abccabbf444
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RefSwitch.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RefSwitch"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RegexFullMatch.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RegexFullMatch.pbtxt
new file mode 100644
index 00000000000..ed0a0765b5c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RegexFullMatch.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RegexFullMatch"
+  endpoint {
+    name: "strings.RegexFullMatch"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RegexReplace.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RegexReplace.pbtxt
new file mode 100644
index 00000000000..a2987dba302
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RegexReplace.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RegexReplace"
+  endpoint {
+    name: "strings.RegexReplace"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RegisterDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RegisterDataset.pbtxt
new file mode 100644
index 00000000000..03947c43e92
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RegisterDataset.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "RegisterDataset"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RegisterDatasetV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RegisterDatasetV2.pbtxt
new file mode 100644
index 00000000000..b44314327a5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RegisterDatasetV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "RegisterDatasetV2"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.RegisterDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Relayout.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Relayout.pbtxt
new file mode 100644
index 00000000000..50f3036cc78
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Relayout.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Relayout"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RelayoutLike.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RelayoutLike.pbtxt
new file mode 100644
index 00000000000..b83aaf0cf61
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RelayoutLike.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RelayoutLike"
+  endpoint {
+    name: "RelayoutLike"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Relu.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Relu.pbtxt
new file mode 100644
index 00000000000..87e110a0739
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Relu.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Relu"
+  endpoint {
+    name: "nn.Relu"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Relu6.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Relu6.pbtxt
new file mode 100644
index 00000000000..c1dc6c6d205
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Relu6.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Relu6"
+  endpoint {
+    name: "nn.Relu6"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Relu6Grad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Relu6Grad.pbtxt
new file mode 100644
index 00000000000..bb4621ffb5b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Relu6Grad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Relu6Grad"
+  endpoint {
+    name: "nn.Relu6Grad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ReluGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReluGrad.pbtxt
new file mode 100644
index 00000000000..7830ad371d6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReluGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ReluGrad"
+  endpoint {
+    name: "nn.ReluGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RemoteCall.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RemoteCall.pbtxt
new file mode 100644
index 00000000000..b2f13cc48b9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RemoteCall.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RemoteCall"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RemoteFusedGraphExecute.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RemoteFusedGraphExecute.pbtxt
new file mode 100644
index 00000000000..c30673aa76e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RemoteFusedGraphExecute.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RemoteFusedGraphExecute"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RepeatDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RepeatDataset.pbtxt
new file mode 100644
index 00000000000..b64988dd378
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RepeatDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "RepeatDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.RepeatDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RequantizationRange.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RequantizationRange.pbtxt
new file mode 100644
index 00000000000..81e17cf420d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RequantizationRange.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RequantizationRange"
+  endpoint {
+    name: "quantization.RequantizationRange"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RequantizationRangePerChannel.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RequantizationRangePerChannel.pbtxt
new file mode 100644
index 00000000000..2073052bfe9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RequantizationRangePerChannel.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RequantizationRangePerChannel"
+  endpoint {
+    name: "math.RequantizationRangePerChannel"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Requantize.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Requantize.pbtxt
new file mode 100644
index 00000000000..c771cef0746
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Requantize.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Requantize"
+  endpoint {
+    name: "quantization.Requantize"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RequantizePerChannel.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RequantizePerChannel.pbtxt
new file mode 100644
index 00000000000..2539fbe9528
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RequantizePerChannel.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RequantizePerChannel"
+  endpoint {
+    name: "math.RequantizePerChannel"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Reshape.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Reshape.pbtxt
new file mode 100644
index 00000000000..bd628df6d68
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Reshape.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Reshape"
+  endpoint {
+    name: "Reshape"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResizeArea.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResizeArea.pbtxt
new file mode 100644
index 00000000000..2514478bc1e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResizeArea.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResizeArea"
+  endpoint {
+    name: "image.ResizeArea"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResizeBicubic.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResizeBicubic.pbtxt
new file mode 100644
index 00000000000..669b0889911
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResizeBicubic.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResizeBicubic"
+  endpoint {
+    name: "image.ResizeBicubic"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResizeBicubicGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResizeBicubicGrad.pbtxt
new file mode 100644
index 00000000000..63478567394
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResizeBicubicGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResizeBicubicGrad"
+  endpoint {
+    name: "image.ResizeBicubicGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResizeBilinear.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResizeBilinear.pbtxt
new file mode 100644
index 00000000000..42bc9578c0b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResizeBilinear.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResizeBilinear"
+  endpoint {
+    name: "image.ResizeBilinear"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResizeBilinearGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResizeBilinearGrad.pbtxt
new file mode 100644
index 00000000000..88bccdf83ca
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResizeBilinearGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResizeBilinearGrad"
+  endpoint {
+    name: "image.ResizeBilinearGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResizeNearestNeighbor.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResizeNearestNeighbor.pbtxt
new file mode 100644
index 00000000000..84f8e26218d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResizeNearestNeighbor.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResizeNearestNeighbor"
+  endpoint {
+    name: "image.ResizeNearestNeighbor"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResizeNearestNeighborGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResizeNearestNeighborGrad.pbtxt
new file mode 100644
index 00000000000..2b5ce61b1cf
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResizeNearestNeighborGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResizeNearestNeighborGrad"
+  endpoint {
+    name: "image.ResizeNearestNeighborGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceAccumulatorApplyGradient.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceAccumulatorApplyGradient.pbtxt
new file mode 100644
index 00000000000..2463e311f36
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceAccumulatorApplyGradient.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceAccumulatorApplyGradient"
+  endpoint {
+    name: "train.ResourceAccumulatorApplyGradient"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceAccumulatorNumAccumulated.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceAccumulatorNumAccumulated.pbtxt
new file mode 100644
index 00000000000..414247dc55b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceAccumulatorNumAccumulated.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceAccumulatorNumAccumulated"
+  endpoint {
+    name: "train.ResourceAccumulatorNumAccumulated"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceAccumulatorSetGlobalStep.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceAccumulatorSetGlobalStep.pbtxt
new file mode 100644
index 00000000000..02083395b15
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceAccumulatorSetGlobalStep.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceAccumulatorSetGlobalStep"
+  endpoint {
+    name: "train.ResourceAccumulatorSetGlobalStep"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceAccumulatorTakeGradient.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceAccumulatorTakeGradient.pbtxt
new file mode 100644
index 00000000000..7d7fbd9c9ba
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceAccumulatorTakeGradient.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceAccumulatorTakeGradient"
+  endpoint {
+    name: "train.ResourceAccumulatorTakeGradient"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAdaMax.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAdaMax.pbtxt
new file mode 100644
index 00000000000..cbe0abd7fd2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAdaMax.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceApplyAdaMax"
+  endpoint {
+    name: "train.ResourceApplyAdaMax"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAdadelta.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAdadelta.pbtxt
new file mode 100644
index 00000000000..11ea32f0474
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAdadelta.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceApplyAdadelta"
+  endpoint {
+    name: "train.ResourceApplyAdadelta"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAdagrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAdagrad.pbtxt
new file mode 100644
index 00000000000..f6b5cb0fd04
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAdagrad.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "ResourceApplyAdagrad"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAdagradDA.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAdagradDA.pbtxt
new file mode 100644
index 00000000000..7de1a78a3e7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAdagradDA.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceApplyAdagradDA"
+  endpoint {
+    name: "train.ResourceApplyAdagradDa"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAdagradV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAdagradV2.pbtxt
new file mode 100644
index 00000000000..4b2cdf69a9b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAdagradV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceApplyAdagradV2"
+  endpoint {
+    name: "train.ResourceApplyAdagrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAdam.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAdam.pbtxt
new file mode 100644
index 00000000000..13b9b145b78
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAdam.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceApplyAdam"
+  endpoint {
+    name: "train.ResourceApplyAdam"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAdamWithAmsgrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAdamWithAmsgrad.pbtxt
new file mode 100644
index 00000000000..3afb7a28c5c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAdamWithAmsgrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceApplyAdamWithAmsgrad"
+  endpoint {
+    name: "train.ResourceApplyAdamWithAmsgrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAddSign.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAddSign.pbtxt
new file mode 100644
index 00000000000..8e57cf8d4c9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyAddSign.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceApplyAddSign"
+  endpoint {
+    name: "train.ResourceApplyAddSign"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyCenteredRMSProp.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyCenteredRMSProp.pbtxt
new file mode 100644
index 00000000000..5bc55386fb3
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyCenteredRMSProp.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceApplyCenteredRMSProp"
+  endpoint {
+    name: "train.ResourceApplyCenteredRmsProp"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ResourceApplyFtrl.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyFtrl.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ResourceApplyFtrl.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyFtrl.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyFtrlV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyFtrlV2.pbtxt
new file mode 100644
index 00000000000..db4e93ed80e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyFtrlV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceApplyFtrlV2"
+  endpoint {
+    name: "train.ResourceApplyFtrl"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyGradientDescent.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyGradientDescent.pbtxt
new file mode 100644
index 00000000000..48a55a96cc1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyGradientDescent.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceApplyGradientDescent"
+  endpoint {
+    name: "train.ResourceApplyGradientDescent"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyKerasMomentum.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyKerasMomentum.pbtxt
new file mode 100644
index 00000000000..35b88fc8869
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyKerasMomentum.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceApplyKerasMomentum"
+  endpoint {
+    name: "train.ResourceApplyKerasMomentum"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyMomentum.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyMomentum.pbtxt
new file mode 100644
index 00000000000..ea88f416f0f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyMomentum.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceApplyMomentum"
+  endpoint {
+    name: "train.ResourceApplyMomentum"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyPowerSign.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyPowerSign.pbtxt
new file mode 100644
index 00000000000..c2a67f1fee3
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyPowerSign.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceApplyPowerSign"
+  endpoint {
+    name: "train.ResourceApplyPowerSign"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyProximalAdagrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyProximalAdagrad.pbtxt
new file mode 100644
index 00000000000..c022658a317
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyProximalAdagrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceApplyProximalAdagrad"
+  endpoint {
+    name: "train.ResourceApplyProximalAdagrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyProximalGradientDescent.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyProximalGradientDescent.pbtxt
new file mode 100644
index 00000000000..a209ab6a065
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyProximalGradientDescent.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceApplyProximalGradientDescent"
+  endpoint {
+    name: "train.ResourceApplyProximalGradientDescent"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyRMSProp.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyRMSProp.pbtxt
new file mode 100644
index 00000000000..7e5a287fbdf
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceApplyRMSProp.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceApplyRMSProp"
+  endpoint {
+    name: "train.ResourceApplyRmsProp"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceConditionalAccumulator.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceConditionalAccumulator.pbtxt
new file mode 100644
index 00000000000..9b23eb1891c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceConditionalAccumulator.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceConditionalAccumulator"
+  endpoint {
+    name: "train.ResourceConditionalAccumulator"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceCountUpTo.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceCountUpTo.pbtxt
new file mode 100644
index 00000000000..4c1309f160d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceCountUpTo.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceCountUpTo"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceGather.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceGather.pbtxt
new file mode 100644
index 00000000000..a9b829ebd04
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceGather.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceGather"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceGatherNd.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceGatherNd.pbtxt
new file mode 100644
index 00000000000..ec282febc2b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceGatherNd.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceGatherNd"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterAdd.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterAdd.pbtxt
new file mode 100644
index 00000000000..33b6d9c67d6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterAdd.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceScatterAdd"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterDiv.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterDiv.pbtxt
new file mode 100644
index 00000000000..b32181fde11
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterDiv.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceScatterDiv"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterMax.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterMax.pbtxt
new file mode 100644
index 00000000000..e758222d6ed
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterMax.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceScatterMax"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterMin.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterMin.pbtxt
new file mode 100644
index 00000000000..bce335396b4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterMin.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceScatterMin"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterMul.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterMul.pbtxt
new file mode 100644
index 00000000000..4740ed6669c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterMul.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceScatterMul"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterNdAdd.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterNdAdd.pbtxt
new file mode 100644
index 00000000000..29e9541aac8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterNdAdd.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceScatterNdAdd"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterNdMax.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterNdMax.pbtxt
new file mode 100644
index 00000000000..2b2382e88b7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterNdMax.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceScatterNdMax"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterNdMin.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterNdMin.pbtxt
new file mode 100644
index 00000000000..bad7c7741b5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterNdMin.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceScatterNdMin"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterNdSub.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterNdSub.pbtxt
new file mode 100644
index 00000000000..5dad023a56a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterNdSub.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceScatterNdSub"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterNdUpdate.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterNdUpdate.pbtxt
new file mode 100644
index 00000000000..72d079bef41
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterNdUpdate.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceScatterNdUpdate"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterSub.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterSub.pbtxt
new file mode 100644
index 00000000000..ca9e5fa6a25
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterSub.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceScatterSub"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterUpdate.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterUpdate.pbtxt
new file mode 100644
index 00000000000..bd850c7bcd2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceScatterUpdate.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceScatterUpdate"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyAdadelta.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyAdadelta.pbtxt
new file mode 100644
index 00000000000..7614ee61566
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyAdadelta.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceSparseApplyAdadelta"
+  endpoint {
+    name: "train.ResourceSparseApplyAdadelta"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyAdagrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyAdagrad.pbtxt
new file mode 100644
index 00000000000..3acd27409f1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyAdagrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceSparseApplyAdagrad"
+  endpoint {
+    name: "train.ResourceSparseApplyAdagrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyAdagradDA.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyAdagradDA.pbtxt
new file mode 100644
index 00000000000..dff8e161d04
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyAdagradDA.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceSparseApplyAdagradDA"
+  endpoint {
+    name: "train.ResourceSparseApplyAdagradDa"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyAdagradV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyAdagradV2.pbtxt
new file mode 100644
index 00000000000..f86922242c7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyAdagradV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceSparseApplyAdagradV2"
+  endpoint {
+    name: "train.ResourceSparseApplyAdagradV2"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyCenteredRMSProp.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyCenteredRMSProp.pbtxt
new file mode 100644
index 00000000000..0f402d6bb96
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyCenteredRMSProp.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceSparseApplyCenteredRMSProp"
+  endpoint {
+    name: "train.ResourceSparseApplyCenteredRmsProp"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ResourceSparseApplyFtrl.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyFtrl.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_ResourceSparseApplyFtrl.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyFtrl.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyFtrlV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyFtrlV2.pbtxt
new file mode 100644
index 00000000000..553da2bcb6f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyFtrlV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceSparseApplyFtrlV2"
+  endpoint {
+    name: "train.ResourceSparseApplyFtrl"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyKerasMomentum.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyKerasMomentum.pbtxt
new file mode 100644
index 00000000000..8c39775ba83
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyKerasMomentum.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceSparseApplyKerasMomentum"
+  endpoint {
+    name: "train.ResourceSparseApplyKerasMomentum"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyMomentum.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyMomentum.pbtxt
new file mode 100644
index 00000000000..d165cf2f94e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyMomentum.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceSparseApplyMomentum"
+  endpoint {
+    name: "train.ResourceSparseApplyMomentum"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyProximalAdagrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyProximalAdagrad.pbtxt
new file mode 100644
index 00000000000..a97d3c5d608
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyProximalAdagrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceSparseApplyProximalAdagrad"
+  endpoint {
+    name: "train.ResourceSparseApplyProximalAdagrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyProximalGradientDescent.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyProximalGradientDescent.pbtxt
new file mode 100644
index 00000000000..69db57fbc14
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyProximalGradientDescent.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceSparseApplyProximalGradientDescent"
+  endpoint {
+    name: "train.ResourceSparseApplyProximalGradientDescent"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyRMSProp.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyRMSProp.pbtxt
new file mode 100644
index 00000000000..3cac8411190
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceSparseApplyRMSProp.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceSparseApplyRMSProp"
+  endpoint {
+    name: "train.ResourceSparseApplyRmsProp"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceStridedSliceAssign.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceStridedSliceAssign.pbtxt
new file mode 100644
index 00000000000..bf142658402
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ResourceStridedSliceAssign.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ResourceStridedSliceAssign"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Restore.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Restore.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Restore.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_Restore.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RestoreSlice.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RestoreSlice.pbtxt
new file mode 100644
index 00000000000..d49abdc2abf
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RestoreSlice.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RestoreSlice"
+  endpoint {
+    name: "train.RestoreSlice"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RestoreV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RestoreV2.pbtxt
new file mode 100644
index 00000000000..f73221177e7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RestoreV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RestoreV2"
+  endpoint {
+    name: "train.Restore"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveAllTPUEmbeddingParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveAllTPUEmbeddingParameters.pbtxt
new file mode 100644
index 00000000000..0918a4bbd71
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveAllTPUEmbeddingParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveAllTPUEmbeddingParameters"
+  endpoint {
+    name: "tpu.RetrieveAllTPUEmbeddingParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingADAMParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingADAMParameters.pbtxt
new file mode 100644
index 00000000000..6fa45ac4709
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingADAMParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingADAMParameters"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingADAMParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingADAMParametersGradAccumDebug.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingADAMParametersGradAccumDebug.pbtxt
new file mode 100644
index 00000000000..19024de237a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingADAMParametersGradAccumDebug.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingADAMParametersGradAccumDebug"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingADAMParametersGradAccumDebug"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingAdadeltaParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingAdadeltaParameters.pbtxt
new file mode 100644
index 00000000000..608071b458b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingAdadeltaParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingAdadeltaParameters"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingAdadeltaParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug.pbtxt
new file mode 100644
index 00000000000..ce7f843c0d3
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingAdagradMomentumParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingAdagradMomentumParameters.pbtxt
new file mode 100644
index 00000000000..c086360d4fb
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingAdagradMomentumParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingAdagradMomentumParameters"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingAdagradMomentumParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingAdagradParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingAdagradParameters.pbtxt
new file mode 100644
index 00000000000..2829ab63f30
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingAdagradParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingAdagradParameters"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingAdagradParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingAdagradParametersGradAccumDebug.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingAdagradParametersGradAccumDebug.pbtxt
new file mode 100644
index 00000000000..08a26da1fc2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingAdagradParametersGradAccumDebug.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingAdagradParametersGradAccumDebug"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingAdagradParametersGradAccumDebug"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingCenteredRMSPropParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingCenteredRMSPropParameters.pbtxt
new file mode 100644
index 00000000000..b339631e163
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingCenteredRMSPropParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingCenteredRMSPropParameters"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingCenteredRMSPropParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingFTRLParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingFTRLParameters.pbtxt
new file mode 100644
index 00000000000..de9f9931616
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingFTRLParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingFTRLParameters"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingFTRLParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingFTRLParametersGradAccumDebug.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingFTRLParametersGradAccumDebug.pbtxt
new file mode 100644
index 00000000000..57b3e0e2e28
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingFTRLParametersGradAccumDebug.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingFTRLParametersGradAccumDebug"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingFTRLParametersGradAccumDebug"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingFrequencyEstimatorParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingFrequencyEstimatorParameters.pbtxt
new file mode 100644
index 00000000000..a30b2e979d9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingFrequencyEstimatorParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingFrequencyEstimatorParameters"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingFrequencyEstimatorParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingFrequencyEstimatorParametersGradAccumDebug.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingFrequencyEstimatorParametersGradAccumDebug.pbtxt
new file mode 100644
index 00000000000..eff5462872f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingFrequencyEstimatorParametersGradAccumDebug.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingFrequencyEstimatorParametersGradAccumDebug"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingFrequencyEstimatorParametersGradAccumDebug"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingMDLAdagradLightParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingMDLAdagradLightParameters.pbtxt
new file mode 100644
index 00000000000..c4320af9050
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingMDLAdagradLightParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingMDLAdagradLightParameters"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingMDLAdagradLightParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingMomentumParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingMomentumParameters.pbtxt
new file mode 100644
index 00000000000..cae7612c2b2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingMomentumParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingMomentumParameters"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingMomentumParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingMomentumParametersGradAccumDebug.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingMomentumParametersGradAccumDebug.pbtxt
new file mode 100644
index 00000000000..c3d1eea0d1d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingMomentumParametersGradAccumDebug.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingMomentumParametersGradAccumDebug"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingMomentumParametersGradAccumDebug"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingProximalAdagradParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingProximalAdagradParameters.pbtxt
new file mode 100644
index 00000000000..a6a7b7d8582
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingProximalAdagradParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingProximalAdagradParameters"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingProximalAdagradParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug.pbtxt
new file mode 100644
index 00000000000..8f0cba646fd
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingProximalYogiParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingProximalYogiParameters.pbtxt
new file mode 100644
index 00000000000..3e516888ec3
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingProximalYogiParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingProximalYogiParameters"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingProximalYogiParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebug.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebug.pbtxt
new file mode 100644
index 00000000000..26a810e8794
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebug.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebug"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebug"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingRMSPropParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingRMSPropParameters.pbtxt
new file mode 100644
index 00000000000..03b991ee6b4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingRMSPropParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingRMSPropParameters"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingRMSPropParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug.pbtxt
new file mode 100644
index 00000000000..2a873e27fc3
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingStochasticGradientDescentParameters.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingStochasticGradientDescentParameters.pbtxt
new file mode 100644
index 00000000000..a0377103d49
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingStochasticGradientDescentParameters.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingStochasticGradientDescentParameters"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingStochasticGradientDescentParameters"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebug.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebug.pbtxt
new file mode 100644
index 00000000000..71758e43589
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebug.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebug"
+  endpoint {
+    name: "tpu.RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebug"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Reverse.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Reverse.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Reverse.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_Reverse.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ReverseSequence.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReverseSequence.pbtxt
new file mode 100644
index 00000000000..f0e6bd4a1cc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReverseSequence.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ReverseSequence"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ReverseV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReverseV2.pbtxt
new file mode 100644
index 00000000000..c286316354f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ReverseV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ReverseV2"
+  endpoint {
+    name: "Reverse"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RewriteDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RewriteDataset.pbtxt
new file mode 100644
index 00000000000..cd73223372b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RewriteDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RewriteDataset"
+  endpoint {
+    name: "data.RewriteDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RightShift.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RightShift.pbtxt
new file mode 100644
index 00000000000..8f6889fd4d5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RightShift.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RightShift"
+  endpoint {
+    name: "bitwise.RightShift"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Rint.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Rint.pbtxt
new file mode 100644
index 00000000000..0bf2aa48f28
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Rint.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Rint"
+  endpoint {
+    name: "math.Rint"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscAbs.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscAbs.pbtxt
new file mode 100644
index 00000000000..16a02df71a8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscAbs.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscAbs"
+  endpoint {
+    name: "risc.RiscAbs"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscAdd.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscAdd.pbtxt
new file mode 100644
index 00000000000..db1cafd86b1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscAdd.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscAdd"
+  endpoint {
+    name: "risc.RiscAdd"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscBinaryArithmetic.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscBinaryArithmetic.pbtxt
new file mode 100644
index 00000000000..a6b0d3849d9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscBinaryArithmetic.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscBinaryArithmetic"
+  endpoint {
+    name: "risc.RiscBinaryArithmetic"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscBinaryComparison.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscBinaryComparison.pbtxt
new file mode 100644
index 00000000000..b278cdb19b5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscBinaryComparison.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscBinaryComparison"
+  endpoint {
+    name: "risc.RiscBinaryComparison"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscBitcast.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscBitcast.pbtxt
new file mode 100644
index 00000000000..3576ea43316
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscBitcast.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscBitcast"
+  endpoint {
+    name: "risc.RiscBitcast"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscBroadcast.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscBroadcast.pbtxt
new file mode 100644
index 00000000000..70f651c5595
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscBroadcast.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscBroadcast"
+  endpoint {
+    name: "risc.RiscBroadcast"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscCast.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscCast.pbtxt
new file mode 100644
index 00000000000..03d2dddb2a7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscCast.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscCast"
+  endpoint {
+    name: "risc.RiscCast"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscCeil.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscCeil.pbtxt
new file mode 100644
index 00000000000..7cc1796e649
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscCeil.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscCeil"
+  endpoint {
+    name: "risc.RiscCeil"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscCholesky.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscCholesky.pbtxt
new file mode 100644
index 00000000000..f58e0969b02
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscCholesky.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscCholesky"
+  endpoint {
+    name: "risc.RiscCholesky"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscConcat.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscConcat.pbtxt
new file mode 100644
index 00000000000..e5aad1d665c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscConcat.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscConcat"
+  endpoint {
+    name: "risc.RiscConcat"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscCondition.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscCondition.pbtxt
new file mode 100644
index 00000000000..20b4043192e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscCondition.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscCondition"
+  endpoint {
+    name: "risc.RiscCondition"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscConv.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscConv.pbtxt
new file mode 100644
index 00000000000..3b85466aad8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscConv.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscConv"
+  endpoint {
+    name: "risc.RiscConv"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscCos.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscCos.pbtxt
new file mode 100644
index 00000000000..bd0bd4faa20
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscCos.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscCos"
+  endpoint {
+    name: "risc.RiscCos"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscDiv.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscDiv.pbtxt
new file mode 100644
index 00000000000..62752229c2b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscDiv.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscDiv"
+  endpoint {
+    name: "risc.RiscDiv"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscDot.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscDot.pbtxt
new file mode 100644
index 00000000000..884d0093f49
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscDot.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscDot"
+  endpoint {
+    name: "risc.RiscDot"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscExp.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscExp.pbtxt
new file mode 100644
index 00000000000..a0f735e9812
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscExp.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscExp"
+  endpoint {
+    name: "risc.RiscExp"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscFft.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscFft.pbtxt
new file mode 100644
index 00000000000..7939ade66d4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscFft.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscFft"
+  endpoint {
+    name: "risc.RiscFft"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscFloor.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscFloor.pbtxt
new file mode 100644
index 00000000000..4bbf58f30be
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscFloor.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscFloor"
+  endpoint {
+    name: "risc.RiscFloor"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscGather.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscGather.pbtxt
new file mode 100644
index 00000000000..65e03eabd05
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscGather.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscGather"
+  endpoint {
+    name: "risc.RiscGather"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscImag.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscImag.pbtxt
new file mode 100644
index 00000000000..c8473b54de1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscImag.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscImag"
+  endpoint {
+    name: "risc.RiscImag"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscIsFinite.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscIsFinite.pbtxt
new file mode 100644
index 00000000000..9155259eba0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscIsFinite.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscIsFinite"
+  endpoint {
+    name: "risc.RiscIsFinite"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscLog.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscLog.pbtxt
new file mode 100644
index 00000000000..c8e1afe2a75
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscLog.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscLog"
+  endpoint {
+    name: "risc.RiscLog"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscLogicalAnd.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscLogicalAnd.pbtxt
new file mode 100644
index 00000000000..bc2d5b1f9eb
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscLogicalAnd.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscLogicalAnd"
+  endpoint {
+    name: "risc.RiscLogicalAnd"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscLogicalNot.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscLogicalNot.pbtxt
new file mode 100644
index 00000000000..c4743d410b3
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscLogicalNot.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscLogicalNot"
+  endpoint {
+    name: "risc.RiscLogicalNot"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscLogicalOr.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscLogicalOr.pbtxt
new file mode 100644
index 00000000000..f23f059b514
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscLogicalOr.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscLogicalOr"
+  endpoint {
+    name: "risc.RiscLogicalOr"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscMax.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscMax.pbtxt
new file mode 100644
index 00000000000..06d25cbc86a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscMax.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscMax"
+  endpoint {
+    name: "risc.RiscMax"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscMin.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscMin.pbtxt
new file mode 100644
index 00000000000..309d515d6fd
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscMin.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscMin"
+  endpoint {
+    name: "risc.RiscMin"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscMul.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscMul.pbtxt
new file mode 100644
index 00000000000..51927d3a135
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscMul.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscMul"
+  endpoint {
+    name: "risc.RiscMul"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscNeg.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscNeg.pbtxt
new file mode 100644
index 00000000000..0e0dd0ea4b0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscNeg.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscNeg"
+  endpoint {
+    name: "risc.RiscNeg"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscPad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscPad.pbtxt
new file mode 100644
index 00000000000..0e3d478d02b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscPad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscPad"
+  endpoint {
+    name: "risc.RiscPad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscPool.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscPool.pbtxt
new file mode 100644
index 00000000000..74cd28a15fd
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscPool.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscPool"
+  endpoint {
+    name: "risc.RiscPool"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscPow.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscPow.pbtxt
new file mode 100644
index 00000000000..2565bd11555
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscPow.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscPow"
+  endpoint {
+    name: "risc.RiscPow"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscRandomUniform.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscRandomUniform.pbtxt
new file mode 100644
index 00000000000..942c4bec622
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscRandomUniform.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscRandomUniform"
+  endpoint {
+    name: "risc.RiscRandomUniform"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscReal.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscReal.pbtxt
new file mode 100644
index 00000000000..5d24d2ad837
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscReal.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscReal"
+  endpoint {
+    name: "risc.RiscReal"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscReduce.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscReduce.pbtxt
new file mode 100644
index 00000000000..bc9b20496e5
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscReduce.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscReduce"
+  endpoint {
+    name: "risc.RiscReduce"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscRem.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscRem.pbtxt
new file mode 100644
index 00000000000..22de8c713ea
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscRem.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscRem"
+  endpoint {
+    name: "risc.RiscRem"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscReshape.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscReshape.pbtxt
new file mode 100644
index 00000000000..fd3bacbd2d6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscReshape.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscReshape"
+  endpoint {
+    name: "risc.RiscReshape"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscReverse.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscReverse.pbtxt
new file mode 100644
index 00000000000..ee8e646e4b9
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscReverse.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscReverse"
+  endpoint {
+    name: "risc.RiscReverse"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscScatter.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscScatter.pbtxt
new file mode 100644
index 00000000000..dabe270375d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscScatter.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscScatter"
+  endpoint {
+    name: "risc.RiscScatter"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscShape.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscShape.pbtxt
new file mode 100644
index 00000000000..83666efcdf6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscShape.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscShape"
+  endpoint {
+    name: "risc.RiscShape"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscSign.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscSign.pbtxt
new file mode 100644
index 00000000000..2cc5dfc378c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscSign.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscSign"
+  endpoint {
+    name: "risc.RiscSign"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscSlice.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscSlice.pbtxt
new file mode 100644
index 00000000000..ecb7b991196
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscSlice.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscSlice"
+  endpoint {
+    name: "risc.RiscSlice"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscSort.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscSort.pbtxt
new file mode 100644
index 00000000000..3361401d336
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscSort.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscSort"
+  endpoint {
+    name: "risc.RiscSort"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscSqueeze.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscSqueeze.pbtxt
new file mode 100644
index 00000000000..5b9b50d209e
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscSqueeze.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscSqueeze"
+  endpoint {
+    name: "risc.RiscSqueeze"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscSub.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscSub.pbtxt
new file mode 100644
index 00000000000..ea48b182d22
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscSub.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscSub"
+  endpoint {
+    name: "risc.RiscSub"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscTranspose.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscTranspose.pbtxt
new file mode 100644
index 00000000000..f2d3e739b50
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscTranspose.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscTranspose"
+  endpoint {
+    name: "risc.RiscTranspose"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscTriangularSolve.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscTriangularSolve.pbtxt
new file mode 100644
index 00000000000..70b4fbdeed4
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscTriangularSolve.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscTriangularSolve"
+  endpoint {
+    name: "risc.RiscTriangularSolve"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscUnary.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscUnary.pbtxt
new file mode 100644
index 00000000000..d1d03367c05
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscUnary.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscUnary"
+  endpoint {
+    name: "risc.RiscUnary"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscWhile.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscWhile.pbtxt
new file mode 100644
index 00000000000..745b47cdfab
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RiscWhile.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: SKIP
+  graph_op_name: "RiscWhile"
+  endpoint {
+    name: "risc.RiscWhile"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RngReadAndSkip.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RngReadAndSkip.pbtxt
new file mode 100644
index 00000000000..8603fa95988
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RngReadAndSkip.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RngReadAndSkip"
+  endpoint {
+    name: "random.RngReadAndSkip"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RngSkip.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RngSkip.pbtxt
new file mode 100644
index 00000000000..9074f38c5da
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RngSkip.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RngSkip"
+  endpoint {
+    name: "random.RngSkip"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Roll.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Roll.pbtxt
new file mode 100644
index 00000000000..fe4eed9ab13
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Roll.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Roll"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Round.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Round.pbtxt
new file mode 100644
index 00000000000..960ffba508f
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Round.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Round"
+  endpoint {
+    name: "math.Round"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Rpc.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Rpc.pbtxt
new file mode 100644
index 00000000000..528afe26709
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Rpc.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Rpc"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_Rsqrt.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Rsqrt.pbtxt
new file mode 100644
index 00000000000..97165e2d758
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_Rsqrt.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "Rsqrt"
+  endpoint {
+    name: "math.Rsqrt"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_RsqrtGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_RsqrtGrad.pbtxt
new file mode 100644
index 00000000000..8aa9f02b9bc
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_RsqrtGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "RsqrtGrad"
+  endpoint {
+    name: "math.RsqrtGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_SampleDistortedBoundingBox.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_SampleDistortedBoundingBox.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_SampleDistortedBoundingBox.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_SampleDistortedBoundingBox.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_SampleDistortedBoundingBoxV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_SampleDistortedBoundingBoxV2.pbtxt
new file mode 100644
index 00000000000..0aef133b9e6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_SampleDistortedBoundingBoxV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "SampleDistortedBoundingBoxV2"
+  endpoint {
+    name: "image.SampleDistortedBoundingBox"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_SamplingDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_SamplingDataset.pbtxt
new file mode 100644
index 00000000000..6b33a96d9e8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_SamplingDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "SamplingDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.SamplingDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Save.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_Save.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_Save.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_Save.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_SaveDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_SaveDataset.pbtxt
new file mode 100644
index 00000000000..8c4d87ac61c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_SaveDataset.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "SaveDataset"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_SaveDatasetV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_SaveDatasetV2.pbtxt
new file mode 100644
index 00000000000..a0723dc3d7b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_SaveDatasetV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "SaveDatasetV2"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.SaveDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_SaveSlices.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_SaveSlices.pbtxt
new file mode 100644
index 00000000000..33af2108dd0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_SaveSlices.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "SaveSlices"
+  endpoint {
+    name: "train.SaveSlices"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_SaveV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_SaveV2.pbtxt
new file mode 100644
index 00000000000..0fc943f3540
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_SaveV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "SaveV2"
+  endpoint {
+    name: "train.Save"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ScalarSummary.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScalarSummary.pbtxt
new file mode 100644
index 00000000000..7b6f6129353
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScalarSummary.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ScalarSummary"
+  endpoint {
+    name: "summary.ScalarSummary"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ScaleAndTranslate.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScaleAndTranslate.pbtxt
new file mode 100644
index 00000000000..25364907a30
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScaleAndTranslate.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ScaleAndTranslate"
+  endpoint {
+    name: "image.ScaleAndTranslate"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ScaleAndTranslateGrad.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScaleAndTranslateGrad.pbtxt
new file mode 100644
index 00000000000..e3256e0f704
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScaleAndTranslateGrad.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ScaleAndTranslateGrad"
+  endpoint {
+    name: "image.ScaleAndTranslateGrad"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ScanDataset.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScanDataset.pbtxt
new file mode 100644
index 00000000000..838de863044
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScanDataset.pbtxt
@@ -0,0 +1,7 @@
+op {
+  graph_op_name: "ScanDataset"
+  visibility: VISIBLE
+  endpoint {
+    name: "data.ScanDataset"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterAdd.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterAdd.pbtxt
new file mode 100644
index 00000000000..74492ab813b
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterAdd.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ScatterAdd"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterDiv.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterDiv.pbtxt
new file mode 100644
index 00000000000..97252d64db3
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterDiv.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ScatterDiv"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterMax.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterMax.pbtxt
new file mode 100644
index 00000000000..5217cb1f668
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterMax.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ScatterMax"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterMin.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterMin.pbtxt
new file mode 100644
index 00000000000..c082832265c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterMin.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ScatterMin"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterMul.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterMul.pbtxt
new file mode 100644
index 00000000000..4d284a527c2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterMul.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ScatterMul"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterNd.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterNd.pbtxt
new file mode 100644
index 00000000000..5d5308a7444
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterNd.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ScatterNd"
+  endpoint {
+    name: "ScatterNd"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterNdAdd.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterNdAdd.pbtxt
new file mode 100644
index 00000000000..61d9acdd48c
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterNdAdd.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ScatterNdAdd"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterNdMax.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterNdMax.pbtxt
new file mode 100644
index 00000000000..617c639add6
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterNdMax.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ScatterNdMax"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterNdMin.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterNdMin.pbtxt
new file mode 100644
index 00000000000..53d6754e0e3
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterNdMin.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ScatterNdMin"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterNdNonAliasingAdd.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterNdNonAliasingAdd.pbtxt
new file mode 100644
index 00000000000..98baca56e19
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterNdNonAliasingAdd.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ScatterNdNonAliasingAdd"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterNdSub.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterNdSub.pbtxt
new file mode 100644
index 00000000000..867227b1507
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterNdSub.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ScatterNdSub"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterNdUpdate.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterNdUpdate.pbtxt
new file mode 100644
index 00000000000..2c4432c9ed0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterNdUpdate.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ScatterNdUpdate"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterSub.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterSub.pbtxt
new file mode 100644
index 00000000000..25a2e9519fa
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterSub.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ScatterSub"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterUpdate.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterUpdate.pbtxt
new file mode 100644
index 00000000000..cfcff646652
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_ScatterUpdate.pbtxt
@@ -0,0 +1,4 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "ScatterUpdate"
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_SdcaFprint.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_SdcaFprint.pbtxt
new file mode 100644
index 00000000000..19725ee76d2
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_SdcaFprint.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "SdcaFprint"
+  endpoint {
+    name: "train.SdcaFprint"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_SdcaOptimizer.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_SdcaOptimizer.pbtxt
similarity index 100%
rename from tensorflow-core/tensorflow-core-api/src/bazel/api_def/api_def_SdcaOptimizer.pbtxt
rename to tensorflow-core/tensorflow-core-api/src/api/api_def_SdcaOptimizer.pbtxt
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_SdcaOptimizerV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_SdcaOptimizerV2.pbtxt
new file mode 100644
index 00000000000..b67c06a7069
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_SdcaOptimizerV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "SdcaOptimizerV2"
+  endpoint {
+    name: "train.SdcaOptimizer"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_SdcaShrinkL1.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_SdcaShrinkL1.pbtxt
new file mode 100644
index 00000000000..b65cd2a92c0
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_SdcaShrinkL1.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "SdcaShrinkL1"
+  endpoint {
+    name: "train.SdcaShrinkL1"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentMax.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentMax.pbtxt
new file mode 100644
index 00000000000..b3ba099ebef
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentMax.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "SegmentMax"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentMaxV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentMaxV2.pbtxt
new file mode 100644
index 00000000000..58d1cce4a47
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentMaxV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "SegmentMaxV2"
+  endpoint {
+    name: "math.SegmentMax"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentMean.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentMean.pbtxt
new file mode 100644
index 00000000000..78a64153e26
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentMean.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "SegmentMean"
+  endpoint {
+    name: "math.SegmentMean"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentMin.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentMin.pbtxt
new file mode 100644
index 00000000000..33dafd9c445
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentMin.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "SegmentMin"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentMinV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentMinV2.pbtxt
new file mode 100644
index 00000000000..8d3c1ea4bdd
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentMinV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "SegmentMinV2"
+  endpoint {
+    name: "math.SegmentMin"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentProd.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentProd.pbtxt
new file mode 100644
index 00000000000..c813c7c1457
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentProd.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "SegmentProd"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentProdV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentProdV2.pbtxt
new file mode 100644
index 00000000000..6ed9d2bf402
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentProdV2.pbtxt
@@ -0,0 +1,7 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "SegmentProdV2"
+  endpoint {
+    name: "math.SegmentProd"
+  }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentSum.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentSum.pbtxt
new file mode 100644
index 00000000000..091d5892796
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentSum.pbtxt
@@ -0,0 +1,4 @@
+op {
+  graph_op_name: "SegmentSum"
+  visibility: SKIP
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentSumV2.pbtxt b/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentSumV2.pbtxt
new file mode 100644
index 00000000000..4478e3a5fb8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/api/api_def_SegmentSumV2.pbtxt
@@ -0,0 +1,21 @@
+op {
+  visibility: VISIBLE
+  graph_op_name: "SegmentSumV2"
+  endpoint {
+    name: "math.SegmentSum"
+  }
+  description: <
+ *

Graphically the output tensors are: + *

+   *  output_tensor[0] = shape = [2, 4]
+   *  [    a  ]
+   *  [b c    ]
    *
-   * @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
+   *  output_tensor[1] = shape = [2, 3]
+   *  [ d e  ]
+   *  [      ]
+   *  
+ * + * @param splitDim 0-D. The dimension along which to split. Must be in the range + * {@code [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. + * @param data type for {@code SparseSplit} output and operands + * @return a new instance of SparseSplit */ - public SparseCross sparseCross( - Iterable> indices, Iterable> values, - Iterable> shapes, Iterable> denseInputs, Boolean hashedOutput, - Long numBuckets, Long hashKey, DataType outType, DataType internalType) { - return SparseCross.create(scope, indices, values, shapes, denseInputs, hashedOutput, numBuckets, hashKey, outType, internalType); + 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 SparseSegmentSqrtNWithNumSegments} operation + * Adds up a {@code SparseTensor} and a dense {@code Tensor}, producing a dense {@code Tensor}. + * This Op does not require {@code a_indices} be sorted in standard lexicographic order. * - * @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 + * @param aIndices 2-D. The {@code indices} of the {@code SparseTensor}, with shape {@code [nnz, ndims]}. + * @param aValues 1-D. The {@code values} of the {@code SparseTensor}, with shape {@code [nnz]}. + * @param aShape 1-D. The {@code shape} of the {@code SparseTensor}, with shape {@code [ndims]}. + * @param b {@code ndims}-D Tensor. With shape {@code a_shape}. + * @param data type for {@code SparseTensorDenseAdd} output and operands + * @param data type for {@code SparseTensorDenseAdd} output and operands + * @return a new instance of SparseTensorDenseAdd */ - public SparseSegmentSqrtNWithNumSegments sparseSegmentSqrtNWithNumSegments( - Operand data, Operand indices, Operand segmentIds, Operand numSegments) { - return SparseSegmentSqrtNWithNumSegments.create(scope, data, indices, segmentIds, numSegments); + public SparseTensorDenseAdd sparseTensorDenseAdd( + Operand aIndices, Operand aValues, Operand aShape, Operand b) { + return SparseTensorDenseAdd.create(scope, aIndices, aValues, aShape, b); } /** - * Builds an {@link SparseAccumulatorTakeGradient} operation + * 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 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 + * @param aIndices 2-D. The {@code indices} of the {@code SparseTensor}, size {@code [nnz, 2]} Matrix. + * @param aValues 1-D. The {@code values} of the {@code SparseTensor}, size {@code [nnz]} Vector. + * @param aShape 1-D. The {@code shape} of the {@code SparseTensor}, size {@code [2]} Vector. + * @param b 2-D. A dense Matrix. + * @param options carries optional attribute values + * @param data type for {@code SparseTensorDenseMatMul} output and operands + * @return a new instance of SparseTensorDenseMatMul */ - public SparseAccumulatorTakeGradient sparseAccumulatorTakeGradient( - Operand handle, Operand numRequired, DataType dtype) { - return SparseAccumulatorTakeGradient.create(scope, handle, numRequired, dtype); + 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 SparseMatMul} operation + * Converts a sparse representation into a dense tensor. + * Builds an array {@code dense} with shape {@code output_shape} such that + *

+   *  # If sparse_indices is scalar
+   *  dense[i] = (i == sparse_indices ? sparse_values : default_value)
    *
-   * @param a 
-   * @param b 
-   * @param options carries optional attributes values
-   * @return a new instance of SparseMatMul
-   * @see org.tensorflow.op.sparse.SparseMatMul
+   *  # 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 {@code dense} are set to {@code default_value}. If {@code 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 {@code validate_indices} is true, these properties + * are checked during execution. + * + * @param sparseIndices 0-D, 1-D, or 2-D. {@code sparse_indices[i]} contains the complete + * index where {@code 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 {@code sparse_indices}, + * or a scalar value to be used for all sparse indices. + * @param defaultValue Scalar value to set for indices not specified in + * {@code sparse_indices}. + * @param options carries optional attribute values + * @param data type for {@code SparseToDense} output and operands + * @param data type for {@code SparseToDense} output and operands + * @return a new instance of SparseToDense */ - public SparseMatMul sparseMatMul(Operand a, - Operand b, SparseMatMul.Options... options) { - return SparseMatMul.create(scope, a, b, options); + 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 DenseToDenseSetOperation} operation + * Applies set operation along last dimension of 2 {@code SparseTensor} inputs. + * See SetOperationOp::SetOperationFromContext for values of {@code set_operation}. + *

If {@code validate_indices} is {@code True}, {@code sparse.SparseToSparseSetOperation} validates the + * order and range of {@code set1} and {@code set2} indices. + *

Input {@code set1} is a {@code SparseTensor} represented by {@code set1_indices}, {@code set1_values}, + * and {@code set1_shape}. For {@code set1} ranked {@code n}, 1st {@code n-1} dimensions must be the same + * as {@code set2}. Dimension {@code n} contains values in a set, duplicates are allowed but + * ignored. + *

Input {@code set2} is a {@code SparseTensor} represented by {@code set2_indices}, {@code set2_values}, + * and {@code set2_shape}. For {@code set2} ranked {@code n}, 1st {@code n-1} dimensions must be the same + * as {@code set1}. Dimension {@code n} contains values in a set, duplicates are allowed but + * ignored. + *

If {@code validate_indices} is {@code True}, this op validates the order and range of {@code set1} + * and {@code set2} indices. + *

Output {@code result} is a {@code SparseTensor} represented by {@code result_indices}, + * {@code result_values}, and {@code result_shape}. For {@code set1} and {@code set2} ranked {@code n}, this + * has rank {@code n} and the same 1st {@code n-1} dimensions as {@code set1} and {@code set2}. The {@code nth} + * dimension contains the result of {@code set_operation} applied to the corresponding + * {@code [0...n-1]} dimension of {@code set}. * - * @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 + * @param set1Indices 2D {@code Tensor}, indices of a {@code SparseTensor}. Must be in row-major + * order. + * @param set1Values 1D {@code Tensor}, values of a {@code SparseTensor}. Must be in row-major + * order. + * @param set1Shape 1D {@code Tensor}, shape of a {@code SparseTensor}. {@code set1_shape[0...n-1]} must + * be the same as {@code set2_shape[0...n-1]}, {@code set1_shape[n]} is the + * max set size across {@code 0...n-1} dimensions. + * @param set2Indices 2D {@code Tensor}, indices of a {@code SparseTensor}. Must be in row-major + * order. + * @param set2Values 1D {@code Tensor}, values of a {@code SparseTensor}. Must be in row-major + * order. + * @param set2Shape 1D {@code Tensor}, shape of a {@code SparseTensor}. {@code set2_shape[0...n-1]} must + * be the same as {@code set1_shape[0...n-1]}, {@code set2_shape[n]} is the + * max set size across {@code 0...n-1} dimensions. + * @param setOperation The value of the setOperation attribute + * @param options carries optional attribute values + * @param data type for {@code SparseToSparseSetOperation} output and operands + * @return a new instance of SparseToSparseSetOperation */ - public DenseToDenseSetOperation denseToDenseSetOperation(Operand set1, - Operand set2, String setOperation, DenseToDenseSetOperation.Options... options) { - return DenseToDenseSetOperation.create(scope, set1, set2, setOperation, options); + 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 SparseSegmentSqrtN} operation + * Read {@code SparseTensors} from a {@code SparseTensorsMap} and concatenate them. + * The input {@code sparse_handles} must be an {@code int64} matrix of shape {@code [N, 1]} where + * {@code N} is the minibatch size and the rows correspond to the output handles of + * {@code AddSparseToTensorsMap} or {@code AddManySparseToTensorsMap}. The ranks of the + * original {@code SparseTensor} objects that went into the given input ops must all + * match. When the final {@code SparseTensor} is created, it has rank one + * higher than the ranks of the incoming {@code SparseTensor} objects + * (they have been concatenated along a new row dimension on the left). + *

The output {@code SparseTensor} object's shape values for all dimensions but the + * first are the max across the input {@code SparseTensor} objects' shape values + * for the corresponding dimensions. Its first shape value is {@code N}, the minibatch + * size. + *

The input {@code SparseTensor} objects' indices are assumed ordered in + * standard lexicographic order. If this is not the case, after this + * step run {@code SparseReorder} to restore index ordering. + *

For example, if the handles represent an input, which is a {@code [2, 3]} matrix + * representing two original {@code SparseTensor} objects: + *

+   *      index = [ 0]
+   *              [10]
+   *              [20]
+   *      values = [1, 2, 3]
+   *      shape = [50]
+   *  
+ *

and + *

+   *      index = [ 2]
+   *              [10]
+   *      values = [4, 5]
+   *      shape = [30]
+   *  
+ *

then the final {@code 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 - * @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 + * @param sparseHandles 1-D, The {@code N} serialized {@code SparseTensor} objects. + * Shape: {@code [N]}. + * @param dtype The {@code dtype} of the {@code SparseTensor} objects stored in the + * {@code SparseTensorsMap}. + * @param options carries optional attribute values + * @param data type for {@code TakeManySparseFromTensorsMap} output and operands + * @return a new instance of TakeManySparseFromTensorsMap */ - public SparseSegmentSqrtN sparseSegmentSqrtN( - Operand data, Operand indices, Operand segmentIds) { - return SparseSegmentSqrtN.create(scope, data, indices, segmentIds); + public TakeManySparseFromTensorsMap takeManySparseFromTensorsMap( + Operand sparseHandles, Class dtype, + TakeManySparseFromTensorsMap.Options... options) { + return TakeManySparseFromTensorsMap.create(scope, sparseHandles, dtype, options); } /** - * 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 + * Get the parent {@link Ops} object. */ - public SparseTensorDenseAdd sparseTensorDenseAdd( - Operand aIndices, Operand aValues, Operand aShape, Operand b) { - return SparseTensorDenseAdd.create(scope, aIndices, aValues, aShape, b); + public final Ops ops() { + return ops; } } 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 index 58fce0ef005..2b49dd474a3 100644 --- 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 @@ -1,14 +1,34 @@ +// Copyright 2020-2022 The TensorFlow Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ============================================================================== +// +// This class has been generated, DO NOT EDIT! +// package org.tensorflow.op; import java.util.List; -import org.tensorflow.DataType; import org.tensorflow.Operand; import org.tensorflow.op.strings.Join; +import org.tensorflow.op.strings.Lower; import org.tensorflow.op.strings.ReduceJoin; import org.tensorflow.op.strings.RegexFullMatch; import org.tensorflow.op.strings.RegexReplace; +import org.tensorflow.op.strings.StaticRegexFullMatch; +import org.tensorflow.op.strings.StaticRegexReplace; import org.tensorflow.op.strings.StringFormat; import org.tensorflow.op.strings.StringLength; +import org.tensorflow.op.strings.StringNGrams; import org.tensorflow.op.strings.StringSplit; import org.tensorflow.op.strings.Strip; import org.tensorflow.op.strings.Substr; @@ -16,160 +36,281 @@ import org.tensorflow.op.strings.ToHashBucketFast; import org.tensorflow.op.strings.ToHashBucketStrong; import org.tensorflow.op.strings.ToNumber; +import org.tensorflow.op.strings.UnicodeDecode; +import org.tensorflow.op.strings.UnicodeDecodeWithOffsets; +import org.tensorflow.op.strings.UnicodeEncode; import org.tensorflow.op.strings.UnicodeScript; import org.tensorflow.op.strings.UnicodeTranscode; -import org.tensorflow.types.TFloat; +import org.tensorflow.op.strings.UnsortedSegmentJoin; +import org.tensorflow.op.strings.Upper; +import org.tensorflow.types.TFloat32; import org.tensorflow.types.TInt32; +import org.tensorflow.types.TInt64; import org.tensorflow.types.TString; import org.tensorflow.types.family.TNumber; /** * An API for building {@code strings} operations as {@link Op Op}s * - * @see {@link Ops} + * @see Ops */ public final class StringsOps { private final Scope scope; - StringsOps(Scope scope) { - this.scope = scope; - } + private final Ops ops; - /** - * 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); + StringsOps(Ops ops) { + this.scope = ops.scope(); + this.ops = ops; } /** - * Builds an {@link Join} operation + * Joins the strings in the given list of string tensors into one tensor; + * with the given separator (default is an empty separator). + *

Examples: + *

+ *
+ *
+ *

s = ["hello", "world", "tensorflow"] + * tf.strings.join(s, " ") + * <tf.Tensor: shape=(), dtype=string, numpy=b'hello world tensorflow'> + *

+ *
+ *
* * @param inputs A list of string tensors. The tensors must all have the same shape, - * @param options carries optional attributes values + * or be scalars. Scalars may be mixed in; these will be broadcast to the shape + * of non-scalar inputs. + * @param options carries optional attribute 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 StringFormat} operation + * Converts all uppercase characters into their respective lowercase replacements. + * Example: + *
+ *
+ *
+ *

tf.strings.lower("CamelCase string and ALL CAPS") + * <tf.Tensor: shape=(), dtype=string, numpy=b'camelcase string and all caps'> + *

+ *
+ *
* - * @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 + * @param input The input to be lower-cased. + * @param options carries optional attribute values + * @return a new instance of Lower */ - public StringFormat stringFormat(Iterable> inputs, StringFormat.Options... options) { - return StringFormat.create(scope, inputs, options); + public Lower lower(Operand input, Lower.Options... options) { + return Lower.create(scope, input, options); } /** - * Builds an {@link ToHashBucketFast} operation + * Joins a string Tensor across the given dimensions. + * Computes the string join across dimensions in the given string Tensor of shape + * {@code [\\(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 {@code -1} being equivalent to {@code n - 1}. If + * indices are not specified, joins across all dimensions beginning from {@code n - 1} + * through {@code 0}. + *

For example: + *

+   *  # 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"
+   *  
* - * @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 Strip} operation - * - * @param input A string `Tensor` of any shape. - * @return a new instance of Strip - * @see org.tensorflow.op.strings.Strip + * @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 {@code reduction_indices} is equivalent to passing + * {@code [n-1, n-2, ..., 0]}. Negative indices from {@code -n} to {@code -1} are supported. + * @param options carries optional attribute values + * @return a new instance of ReduceJoin */ - public Strip strip(Operand input) { - return Strip.create(scope, input); + public ReduceJoin reduceJoin(Operand inputs, Operand reductionIndices, + ReduceJoin.Options... options) { + return ReduceJoin.create(scope, inputs, reductionIndices, options); } /** - * Builds an {@link RegexFullMatch} operation + * 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) + *

Examples: + *

+ *
+ *
+ *

tf.strings.regex_full_match(["TF lib", "lib TF"], ".*lib$") + * <tf.Tensor: shape=(2,), dtype=bool, numpy=array([ True, False])> + * tf.strings.regex_full_match(["TF lib", "lib TF"], ".*TF$") + * <tf.Tensor: shape=(2,), dtype=bool, numpy=array([False, True])> + *

+ *
+ *
* * @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 ToNumber} operation + * Replaces matches of the {@code pattern} regular expression in {@code input} with the + * replacement string provided in {@code rewrite}. + * It follows the re2 syntax (https://github.com/google/re2/wiki/Syntax) * - * @param stringTensor - * @return a new instance of ToNumber - * @see org.tensorflow.op.strings.ToNumber + * @param input The text to be processed. + * @param pattern The regular expression to be matched in the {@code input} strings. + * @param rewrite The rewrite string to be substituted for the {@code pattern} expression where it is + * matched in the {@code input} strings. + * @param options carries optional attribute values + * @return a new instance of RegexReplace */ - public ToNumber toNumber(Operand stringTensor) { - return ToNumber.create(scope, stringTensor); + public RegexReplace regexReplace(Operand input, Operand pattern, + Operand rewrite, RegexReplace.Options... options) { + return RegexReplace.create(scope, input, pattern, rewrite, options); } /** - * Builds an {@link UnicodeTranscode} operation + * 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) * - * @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 + * @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 UnicodeTranscode unicodeTranscode(Operand input, String inputEncoding, - String outputEncoding, UnicodeTranscode.Options... options) { - return UnicodeTranscode.create(scope, input, inputEncoding, outputEncoding, options); + public StaticRegexFullMatch staticRegexFullMatch(Operand input, String pattern) { + return StaticRegexFullMatch.create(scope, input, pattern); } /** - * Builds an {@link RegexReplace} operation + * Replaces the match of pattern in input with rewrite. + * It follows the re2 syntax (https://github.com/google/re2/wiki/Syntax) * * @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 + * @param pattern The regular expression to match the input. + * @param rewrite The rewrite to be applied to the matched expression. + * @param options carries optional attribute values + * @return a new instance of StaticRegexReplace */ - public RegexReplace regexReplace(Operand input, Operand pattern, - Operand rewrite, RegexReplace.Options... options) { - return RegexReplace.create(scope, input, pattern, rewrite, options); + public StaticRegexReplace staticRegexReplace(Operand input, String pattern, + String rewrite, StaticRegexReplace.Options... options) { + return StaticRegexReplace.create(scope, input, pattern, rewrite, options); } /** - * Builds an {@link ToHashBucket} operation + * Formats a string template using a list of tensors. + * Formats a string template using a list of tensors, pretty-printing tensor summaries. * - * @param stringTensor - * @param numBuckets The number of buckets. - * @return a new instance of ToHashBucket - * @see org.tensorflow.op.strings.ToHashBucket + * @param inputs The list of tensors to format into the placeholder string. + * @param options carries optional attribute values + * @return a new instance of StringFormat */ - public ToHashBucket toHashBucket(Operand stringTensor, Long numBuckets) { - return ToHashBucket.create(scope, stringTensor, numBuckets); + public StringFormat stringFormat(Iterable> inputs, StringFormat.Options... options) { + return StringFormat.create(scope, inputs, options); + } + + /** + * String lengths of {@code input}. + * Computes the length of each string given in the input tensor. + *

+ *
+ *
+ *

strings = tf.constant(['Hello','TensorFlow', '\U0001F642']) + * tf.strings.length(strings).numpy() # default counts bytes + * array([ 5, 10, 4], dtype=int32) + * tf.strings.length(strings, unit="UTF8_CHAR").numpy() + * array([ 5, 10, 1], dtype=int32) + *

+ *
+ *
+ * + * @param input The strings for which to compute the length for each element. + * @param options carries optional attribute values + * @return a new instance of StringLength + */ + public StringLength stringLength(Operand input, StringLength.Options... options) { + return StringLength.create(scope, input, options); + } + + /** + * 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 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 {@code pad_width=-1}, then add {@code max(ngram_widths)-1} + * elements. + * @param preserveShortSequences The value of the preserveShortSequences attribute + * @param data type for {@code StringNGrams} output and operands + * @return a new instance of 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 StringSplit} operation + * Split elements of {@code source} based on {@code sep} into a {@code SparseTensor}. + * Let N be the size of source (typically N will be the batch size). Split each + * element of {@code source} based on {@code sep} and return a {@code 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 + *

+   *  st.indices = [0, 0;
+   *                0, 1;
+   *                1, 0;
+   *                1, 1;
+   *                1, 2]
+   *  st.shape = [2, 3]
+   *  st.values = ['hello', 'world', 'a', 'b', 'c']
+   *  
+ *

If {@code sep} is given, consecutive delimiters are not grouped together and are + * deemed to delimit empty strings. For example, source of {@code "1<>2<><>3"} and + * sep of {@code "<>"} returns {@code ["1", "2", "", "3"]}. If {@code 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. * - * @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 + * @param input {@code 1-D} string {@code Tensor}, the strings to split. + * @param sep {@code 0-D} string {@code Tensor}, the delimiter character. + * @param options carries optional attribute values * @return a new instance of StringSplit - * @see org.tensorflow.op.strings.StringSplit */ public StringSplit stringSplit(Operand input, Operand sep, StringSplit.Options... options) { @@ -177,24 +318,176 @@ public StringSplit stringSplit(Operand input, Operand sep, } /** - * Builds an {@link UnicodeScript} operation + * Strip leading and trailing whitespaces from the Tensor. + * Examples: + *

+ *
+ *
+ *

tf.strings.strip(["\nTensorFlow", " The python library "]).numpy() + * array([b'TensorFlow', b'The python library'], dtype=object) + *

+ *
+ *
* - * @param input A Tensor of int32 Unicode code points. - * @return a new instance of UnicodeScript - * @see org.tensorflow.op.strings.UnicodeScript + * @param input A string {@code Tensor} of any shape. + * @return a new instance of Strip */ - public UnicodeScript unicodeScript(Operand input) { - return UnicodeScript.create(scope, input); + public Strip strip(Operand input) { + return Strip.create(scope, input); + } + + /** + * Return substrings from {@code Tensor} of strings. + * For each string in the input {@code Tensor}, creates a substring starting at index + * {@code pos} with a total length of {@code len}. + *

If {@code len} defines a substring that would extend beyond the length of the input + * string, or if {@code len} is negative, then as many characters as possible are used. + *

A negative {@code pos} indicates distance within the string backwards from the end. + *

If {@code pos} specifies an index which is out of range for any of the input strings, + * then an {@code InvalidArgumentError} is thrown. + *

{@code pos} and {@code len} must have the same shape, otherwise a {@code ValueError} is thrown on + * Op creation. + *

NOTE: {@code strings.Substr} supports broadcasting up to two dimensions. More about + * broadcasting + * here + *


+ *

Examples + *

Using scalar {@code pos} and {@code len}: + *

+   *  input = [b'Hello', b'World']
+   *  position = 1
+   *  length = 3
+   *
+   *  output = [b'ell', b'orl']
+   *  
+ *

Using {@code pos} and {@code len} with same shape as {@code input}: + *

+   *  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 {@code pos} and {@code len} onto {@code input}: + *

+   *  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 {@code input} onto {@code pos} and {@code len}: + *

+   *  input = b'thirteen'
+   *  position = [1, 5, 7]
+   *  length =   [3, 2, 1]
+   *
+   *  output = [b'hir', b'ee', b'n']
+   *  
+ *

Raises: + *

    + *
  • {@code ValueError}: If the first argument cannot be converted to a + * Tensor of {@code dtype string}.
  • + *
  • {@code InvalidArgumentError}: If indices are out of range.
  • + *
  • {@code ValueError}: If {@code pos} and {@code len} are not the same shape.
  • + *
+ * + * @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 attribute values + * @param data type for {@code Substr} output and operands + * @return a new instance of Substr + */ + public Substr substr(Operand input, Operand pos, Operand len, + Substr.Options... options) { + return Substr.create(scope, input, pos, len, options); + } + + /** + * 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 + * {@code tf.string_to_hash_bucket_fast()} or {@code tf.string_to_hash_bucket_strong()}. + * + * @param stringTensor The stringTensor value + * @param numBuckets The number of buckets. + * @return a new instance of ToHashBucket + */ + public ToHashBucket toHashBucket(Operand stringTensor, Long numBuckets) { + return ToHashBucket.create(scope, stringTensor, numBuckets); + } + + /** + * 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 + * {@code tf.string_to_hash_bucket_strong}. + *

Examples: + *

+ *
+ *
+ *

tf.strings.to_hash_bucket_fast(["Hello", "TensorFlow", "2.x"], 3).numpy() + * array([0, 2, 2]) + *

+ *
+ *
+ * + * @param input The strings to assign a hash bucket. + * @param numBuckets The number of buckets. + * @return a new instance of ToHashBucketFast + */ + public ToHashBucketFast toHashBucketFast(Operand input, Long numBuckets) { + return ToHashBucketFast.create(scope, input, numBuckets); } /** - * Builds an {@link ToHashBucketStrong} operation + * 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 {@code key} + * defines the key of the hash function. {@code 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 {@code tf.string_to_hash_bucket_fast}. + *

Examples: + *

+ *
+ *
+ *

tf.strings.to_hash_bucket_strong(["Hello", "TF"], 3, [1, 2]).numpy() + * array([2, 0]) + *

+ *
+ *
* * @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 - * @see org.tensorflow.op.strings.ToHashBucketStrong */ public ToHashBucketStrong toHashBucketStrong(Operand input, Long numBuckets, List key) { @@ -202,41 +495,324 @@ public ToHashBucketStrong toHashBucketStrong(Operand input, Long numBuc } /** - * Builds an {@link ToNumber} operation + * 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.) + *

Example: + *

+ *
+ *
+ *

strings = ["5.0", "3.0", "7.0"] + * tf.strings.to_number(strings) + * <tf.Tensor: shape=(3,), dtype=float32, numpy=array([5., 3., 7.], dtype=float32)> + *

+ *
+ *
* - * @param stringTensor - * @param outType The numeric type to interpret each string in `string_tensor` as. + * @param stringTensor The stringTensor value + * @return a new instance of ToNumber, with default output types + */ + public ToNumber toNumber(Operand stringTensor) { + return ToNumber.create(scope, stringTensor); + } + + /** + * 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.) + *

Example: + *

+ *
+ *
+ *

strings = ["5.0", "3.0", "7.0"] + * tf.strings.to_number(strings) + * <tf.Tensor: shape=(3,), dtype=float32, numpy=array([5., 3., 7.], dtype=float32)> + *

+ *
+ *
+ * + * @param stringTensor The stringTensor value + * @param outType The numeric type to interpret each string in {@code string_tensor} as. + * @param data type for {@code StringToNumber} output and operands * @return a new instance of ToNumber - * @see org.tensorflow.op.strings.ToNumber */ - public ToNumber toNumber(Operand stringTensor, - DataType outType) { + public ToNumber toNumber(Operand stringTensor, Class outType) { return ToNumber.create(scope, stringTensor, outType); } /** - * Builds an {@link ReduceJoin} operation + * Decodes each string in {@code input} into a sequence of Unicode code points. + * The character codepoints for all strings are returned using a single vector + * {@code char_values}, with strings expanded to characters in row-major order. + *

The {@code row_splits} tensor indicates where the codepoints for + * each input string begin and end within the {@code char_values} tensor. + * In particular, the values for the {@code i}th + * string (in row-major order) are stored in the slice + * {@code [row_splits[i]:row_splits[i+1]]}. Thus: + *

    + *
  • {@code char_values[row_splits[i]+j]} is the Unicode codepoint for the {@code j}th + * character in the {@code i}th string (in row-major order).
  • + *
  • {@code row_splits[i+1] - row_splits[i]} is the number of characters in the {@code i}th + * string (in row-major order).
  • + *
* - * @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 + * @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: {@code "UTF-16", "US ASCII", "UTF-8"}. + * @param options carries optional attribute values + * @return a new instance of UnicodeDecode, with default output types */ - public ReduceJoin reduceJoin(Operand inputs, Operand reductionIndices, - ReduceJoin.Options... options) { - return ReduceJoin.create(scope, inputs, reductionIndices, options); + public UnicodeDecode unicodeDecode(Operand input, String inputEncoding, + UnicodeDecode.Options... options) { + return UnicodeDecode.create(scope, input, inputEncoding, options); } /** - * Builds an {@link StringLength} operation + * Decodes each string in {@code input} into a sequence of Unicode code points. + * The character codepoints for all strings are returned using a single vector + * {@code char_values}, with strings expanded to characters in row-major order. + *

The {@code row_splits} tensor indicates where the codepoints for + * each input string begin and end within the {@code char_values} tensor. + * In particular, the values for the {@code i}th + * string (in row-major order) are stored in the slice + * {@code [row_splits[i]:row_splits[i+1]]}. Thus: + *

    + *
  • {@code char_values[row_splits[i]+j]} is the Unicode codepoint for the {@code j}th + * character in the {@code i}th string (in row-major order).
  • + *
  • {@code row_splits[i+1] - row_splits[i]} is the number of characters in the {@code i}th + * string (in row-major order).
  • + *
* - * @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 + * @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: {@code "UTF-16", "US ASCII", "UTF-8"}. + * @param Tsplits The value of the Tsplits attribute + * @param options carries optional attribute values + * @param data type for {@code UnicodeDecode} output and operands + * @return a new instance of UnicodeDecode */ - public StringLength stringLength(Operand input, StringLength.Options... options) { - return StringLength.create(scope, input, options); + public UnicodeDecode unicodeDecode(Operand input, + String inputEncoding, Class Tsplits, UnicodeDecode.Options... options) { + return UnicodeDecode.create(scope, input, inputEncoding, Tsplits, options); + } + + /** + * Decodes each string in {@code input} into a sequence of Unicode code points. + * The character codepoints for all strings are returned using a single vector + * {@code char_values}, with strings expanded to characters in row-major order. + * Similarly, the character start byte offsets are returned using a single vector + * {@code char_to_byte_starts}, with strings expanded in row-major order. + *

The {@code row_splits} tensor indicates where the codepoints and start offsets for + * each input string begin and end within the {@code char_values} and + * {@code char_to_byte_starts} tensors. In particular, the values for the {@code i}th + * string (in row-major order) are stored in the slice + * {@code [row_splits[i]:row_splits[i+1]]}. Thus: + *

    + *
  • {@code char_values[row_splits[i]+j]} is the Unicode codepoint for the {@code j}th + * character in the {@code i}th string (in row-major order).
  • + *
  • {@code char_to_bytes_starts[row_splits[i]+j]} is the start byte offset for the {@code j}th + * character in the {@code i}th string (in row-major order).
  • + *
  • {@code row_splits[i+1] - row_splits[i]} is the number of characters in the {@code i}th + * string (in row-major order).
  • + *
+ * + * @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: {@code "UTF-16", "US ASCII", "UTF-8"}. + * @param options carries optional attribute values + * @return a new instance of UnicodeDecodeWithOffsets, with default output types + */ + public UnicodeDecodeWithOffsets unicodeDecodeWithOffsets(Operand input, + String inputEncoding, UnicodeDecodeWithOffsets.Options... options) { + return UnicodeDecodeWithOffsets.create(scope, input, inputEncoding, options); + } + + /** + * Decodes each string in {@code input} into a sequence of Unicode code points. + * The character codepoints for all strings are returned using a single vector + * {@code char_values}, with strings expanded to characters in row-major order. + * Similarly, the character start byte offsets are returned using a single vector + * {@code char_to_byte_starts}, with strings expanded in row-major order. + *

The {@code row_splits} tensor indicates where the codepoints and start offsets for + * each input string begin and end within the {@code char_values} and + * {@code char_to_byte_starts} tensors. In particular, the values for the {@code i}th + * string (in row-major order) are stored in the slice + * {@code [row_splits[i]:row_splits[i+1]]}. Thus: + *

    + *
  • {@code char_values[row_splits[i]+j]} is the Unicode codepoint for the {@code j}th + * character in the {@code i}th string (in row-major order).
  • + *
  • {@code char_to_bytes_starts[row_splits[i]+j]} is the start byte offset for the {@code j}th + * character in the {@code i}th string (in row-major order).
  • + *
  • {@code row_splits[i+1] - row_splits[i]} is the number of characters in the {@code i}th + * string (in row-major order).
  • + *
+ * + * @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: {@code "UTF-16", "US ASCII", "UTF-8"}. + * @param Tsplits The value of the Tsplits attribute + * @param options carries optional attribute values + * @param data type for {@code UnicodeDecodeWithOffsets} output and operands + * @return a new instance of UnicodeDecodeWithOffsets + */ + public UnicodeDecodeWithOffsets unicodeDecodeWithOffsets( + Operand input, String inputEncoding, Class Tsplits, + UnicodeDecodeWithOffsets.Options... options) { + return UnicodeDecodeWithOffsets.create(scope, input, inputEncoding, Tsplits, options); + } + + /** + * Encode a tensor of ints into unicode strings. + * Returns a vector of strings, where {@code output[i]} is constructed by encoding the + * Unicode codepoints in {@code input_values[input_splits[i]:input_splits[i+1]]} + * using {@code output_encoding}. + *
+ *

Example: + *

+   *  input_values = [72, 101, 108, 108, 111, 87, 111, 114, 108, 100]
+   *  input_splits = [0, 5, 10]
+   *  output_encoding = 'UTF-8'
+   *
+   *  output = ['Hello', 'World']
+   *  
+ * + * @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, {@code output[i]} is constructed by encoding the codepoints in the + * slice {@code input_values[input_splits[i]:input_splits[i+1]]}. + * @param outputEncoding Unicode encoding of the output strings. Valid encodings are: {@code "UTF-8", "UTF-16-BE", and "UTF-32-BE"}. + * @param options carries optional attribute values + * @return a new instance of UnicodeEncode + */ + public UnicodeEncode unicodeEncode(Operand inputValues, + Operand inputSplits, String outputEncoding, + UnicodeEncode.Options... options) { + return UnicodeEncode.create(scope, inputValues, inputSplits, outputEncoding, options); + } + + /** + * 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 + * ICU project docs + * for more details on script codes. + *

For an example, see the unicode strings guide on [unicode scripts] + * (https://www.tensorflow.org/tutorials/load_data/unicode#representing_unicode). + *

Returns -1 (USCRIPT_INVALID_CODE) for invalid codepoints. Output shape will + * match input shape. + *

Examples: + *

+ *
+ *
+ *

tf.strings.unicode_script([1, 31, 38]) + * <tf.Tensor: shape=(3,), dtype=int32, numpy=array([0, 0, 0], dtype=int32)> + *

+ *
+ *
+ * + * @param input A Tensor of int32 Unicode code points. + * @return a new instance of UnicodeScript + */ + public UnicodeScript unicodeScript(Operand input) { + return UnicodeScript.create(scope, input); + } + + /** + * 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 + * {@code 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 {@code replacement_char}. If the errors policy is to {@code ignore}, any + * invalid encoding positions in the input are skipped and not included in the + * output. If it set to {@code strict} then any invalid formatting will result in an + * InvalidArgument error. + *

This operation can be used with {@code 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. + *

Examples: + *

+ *
+ *
+ *

tf.strings.unicode_transcode(["Hello", "TensorFlow", "2.x"], "UTF-8", "UTF-16-BE") + * <tf.Tensor: shape=(3,), dtype=string, numpy= + * array([b'\x00H\x00e\x00l\x00l\x00o', + * b'\x00T\x00e\x00n\x00s\x00o\x00r\x00F\x00l\x00o\x00w', + * b'\x002\x00.\x00x'], dtype=object)> + * tf.strings.unicode_transcode(["A", "B", "C"], "US ASCII", "UTF-8").numpy() + * array([b'A', b'B', b'C'], dtype=object) + *

+ *
+ *
+ * + * @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: {@code "UTF-16", "US ASCII", "UTF-8"}. + * @param outputEncoding The unicode encoding to use in the output. Must be one of + * {@code "UTF-8", "UTF-16-BE", "UTF-32-BE"}. Multi-byte encodings will be big-endian. + * @param options carries optional attribute values + * @return a new instance of UnicodeTranscode + */ + public UnicodeTranscode unicodeTranscode(Operand input, String inputEncoding, + String outputEncoding, UnicodeTranscode.Options... options) { + return UnicodeTranscode.create(scope, input, inputEncoding, outputEncoding, options); + } + + /** + * The UnsortedSegmentJoin operation + * + * @param inputs The inputs value + * @param segmentIds The segmentIds value + * @param numSegments The numSegments value + * @param options carries optional attribute values + * @return a new instance of UnsortedSegmentJoin + */ + public UnsortedSegmentJoin unsortedSegmentJoin(Operand inputs, + Operand segmentIds, Operand numSegments, + UnsortedSegmentJoin.Options... options) { + return UnsortedSegmentJoin.create(scope, inputs, segmentIds, numSegments, options); + } + + /** + * Converts all lowercase characters into their respective uppercase replacements. + * Example: + *
+ *
+ *
+ *

tf.strings.upper("CamelCase string and ALL CAPS") + * <tf.Tensor: shape=(), dtype=string, numpy=b'CAMELCASE STRING AND ALL CAPS'> + *

+ *
+ *
+ * + * @param input The input to be upper-cased. + * @param options carries optional attribute values + * @return a new instance of Upper + */ + public Upper upper(Operand input, Upper.Options... options) { + return Upper.create(scope, input, options); + } + + /** + * Get the parent {@link Ops} object. + */ + public final Ops ops() { + return ops; } } 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 index 3d93ab59453..d7690d11d71 100644 --- 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 @@ -1,105 +1,398 @@ +// Copyright 2020-2022 The TensorFlow Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ============================================================================== +// +// This class has been generated, DO NOT EDIT! +// package org.tensorflow.op; import org.tensorflow.Operand; import org.tensorflow.op.summary.AudioSummary; +import org.tensorflow.op.summary.CloseSummaryWriter; +import org.tensorflow.op.summary.CreateSummaryDbWriter; +import org.tensorflow.op.summary.CreateSummaryFileWriter; +import org.tensorflow.op.summary.FlushSummaryWriter; import org.tensorflow.op.summary.HistogramSummary; import org.tensorflow.op.summary.ImageSummary; +import org.tensorflow.op.summary.ImportEvent; import org.tensorflow.op.summary.MergeSummary; import org.tensorflow.op.summary.ScalarSummary; +import org.tensorflow.op.summary.StatsAggregatorSummary; +import org.tensorflow.op.summary.SummaryWriter; import org.tensorflow.op.summary.TensorSummary; -import org.tensorflow.types.TFloat; +import org.tensorflow.op.summary.WriteAudioSummary; +import org.tensorflow.op.summary.WriteGraphSummary; +import org.tensorflow.op.summary.WriteHistogramSummary; +import org.tensorflow.op.summary.WriteImageSummary; +import org.tensorflow.op.summary.WriteRawProtoSummary; +import org.tensorflow.op.summary.WriteScalarSummary; +import org.tensorflow.op.summary.WriteSummary; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.TInt64; import org.tensorflow.types.TString; +import org.tensorflow.types.TUint8; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * An API for building {@code summary} operations as {@link Op Op}s * - * @see {@link Ops} + * @see Ops */ public final class SummaryOps { private final Scope scope; - SummaryOps(Scope scope) { - this.scope = scope; + private final Ops ops; + + SummaryOps(Ops ops) { + this.scope = ops.scope(); + this.ops = ops; } /** - * Builds an {@link AudioSummary} operation + * Outputs a {@code Summary} protocol buffer with audio. + * The summary has up to {@code max_outputs} summary values containing audio. The + * audio is built from {@code tensor} which must be 3-D with shape {@code [batch_size, frames, channels]} or 2-D with shape {@code [batch_size, frames]}. The values are + * assumed to be in the range of {@code [-1.0, 1.0]} with a sample rate of {@code sample_rate}. + *

The {@code tag} argument is a scalar {@code Tensor} of type {@code string}. It is used to + * build the {@code tag} of the summary values: + *

    + *
  • If {@code max_outputs} is 1, the summary value tag is 'tag/audio'.
  • + *
  • If {@code max_outputs} is greater than 1, the summary value tags are + * generated sequentially as 'tag/audio/0', 'tag/audio/1', etc.
  • + *
* - * @param tag Scalar. Used to build the `tag` attribute of the summary values. - * @param tensor 2-D of shape `[batch_size, frames]`. + * @param tag Scalar. Used to build the {@code tag} attribute of the summary values. + * @param tensor 2-D of shape {@code [batch_size, frames]}. * @param sampleRate The sample rate of the signal in hertz. - * @param options carries optional attributes values + * @param options carries optional attribute 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) { + public AudioSummary audioSummary(Operand tag, Operand tensor, + Operand sampleRate, AudioSummary.Options... options) { return AudioSummary.create(scope, tag, tensor, sampleRate, options); } /** - * Builds an {@link TensorSummary} operation + * The CloseSummaryWriter 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 + * @param writer The writer value + * @return a new instance of CloseSummaryWriter */ - public TensorSummary tensorSummary(Operand tag, Operand tensor, - Operand serializedSummaryMetadata) { - return TensorSummary.create(scope, tag, tensor, serializedSummaryMetadata); + public CloseSummaryWriter closeSummaryWriter(Operand writer) { + return CloseSummaryWriter.create(scope, writer); } /** - * Builds an {@link ImageSummary} operation + * The CreateSummaryDbWriter 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 + * @param writer The writer value + * @param dbUri The dbUri value + * @param experimentName The experimentName value + * @param runName The runName value + * @param userName The userName value + * @return a new instance of CreateSummaryDbWriter */ - public ImageSummary imageSummary(Operand tag, Operand tensor, - ImageSummary.Options... options) { - return ImageSummary.create(scope, tag, tensor, options); + public CreateSummaryDbWriter createSummaryDbWriter(Operand writer, + Operand dbUri, Operand experimentName, Operand runName, + Operand userName) { + return CreateSummaryDbWriter.create(scope, writer, dbUri, experimentName, runName, userName); } /** - * Builds an {@link HistogramSummary} operation + * The CreateSummaryFileWriter operation * - * @param tag Scalar. Tag to use for the `Summary.Value`. + * @param writer The writer value + * @param logdir The logdir value + * @param maxQueue The maxQueue value + * @param flushMillis The flushMillis value + * @param filenameSuffix The filenameSuffix value + * @return a new instance of CreateSummaryFileWriter + */ + public CreateSummaryFileWriter createSummaryFileWriter(Operand writer, + Operand logdir, Operand maxQueue, Operand flushMillis, + Operand filenameSuffix) { + return CreateSummaryFileWriter.create(scope, writer, logdir, maxQueue, flushMillis, filenameSuffix); + } + + /** + * The FlushSummaryWriter operation + * + * @param writer The writer value + * @return a new instance of FlushSummaryWriter + */ + public FlushSummaryWriter flushSummaryWriter(Operand writer) { + return FlushSummaryWriter.create(scope, writer); + } + + /** + * Outputs a {@code Summary} protocol buffer with a histogram. + * The generated + * {@code Summary} + * has one summary value containing a histogram for {@code values}. + *

This op reports an {@code InvalidArgument} error if any value is not finite. + * + * @param tag Scalar. Tag to use for the {@code 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) { + public HistogramSummary histogramSummary(Operand tag, + Operand values) { return HistogramSummary.create(scope, tag, values); } /** - * Builds an {@link ScalarSummary} operation + * Outputs a {@code Summary} protocol buffer with images. + * The summary has up to {@code max_images} summary values containing images. The + * images are built from {@code tensor} which must be 4-D with shape {@code [batch_size, height, width, channels]} and where {@code channels} can be: + *

    + *
  • 1: {@code tensor} is interpreted as Grayscale.
  • + *
  • 3: {@code tensor} is interpreted as RGB.
  • + *
  • 4: {@code 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 + * {@code [0, 255]}. {@code 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 {@code tag} argument is a scalar {@code Tensor} of type {@code string}. It is used to + * build the {@code tag} of the summary values: + *

    + *
  • If {@code max_images} is 1, the summary value tag is 'tag/image'.
  • + *
  • If {@code max_images} is greater than 1, the summary value tags are + * generated sequentially as 'tag/image/0', 'tag/image/1', etc.
  • + *
+ *

The {@code bad_color} argument is the color to use in the generated images for + * non-finite input values. It is a {@code uint8} 1-D tensor of length {@code channels}. + * Each element must be in the range {@code [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. + * + * @param tag Scalar. Used to build the {@code tag} attribute of the summary values. + * @param tensor 4-D of shape {@code [batch_size, height, width, channels]} where + * {@code channels} is 1, 3, or 4. + * @param options carries optional attribute values + * @return a new instance of ImageSummary + */ + public ImageSummary imageSummary(Operand tag, Operand tensor, + ImageSummary.Options... options) { + return ImageSummary.create(scope, tag, tensor, options); + } + + /** + * The ImportEvent operation + * + * @param writer The writer value + * @param event The event value + * @return a new instance of ImportEvent + */ + public ImportEvent importEvent(Operand writer, Operand event) { + return ImportEvent.create(scope, writer, event); + } + + /** + * Merges summaries. + * This op creates a + * {@code Summary} + * protocol buffer that contains the union of all the values in the input + * summaries. + *

When the Op is run, it reports an {@code InvalidArgument} error if multiple values + * in the summaries to merge use the same tag. + * + * @param inputs Can be of any shape. Each must contain serialized {@code Summary} protocol + * buffers. + * @return a new instance of MergeSummary + */ + public MergeSummary mergeSummary(Iterable> inputs) { + return MergeSummary.create(scope, inputs); + } + + /** + * Outputs a {@code Summary} protocol buffer with scalar values. + * The input {@code tags} and {@code values} must have the same shape. The generated summary + * has a summary value for each tag-value pair in {@code tags} and {@code values}. * * @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) { + public ScalarSummary scalarSummary(Operand tags, Operand values) { return ScalarSummary.create(scope, tags, values); } /** - * Builds an {@link MergeSummary} operation + * Produces a summary of any statistics recorded by the given statistics manager. * - * @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 + * @param iterator The iterator value + * @return a new instance of StatsAggregatorSummary */ - public MergeSummary mergeSummary(Iterable> inputs) { - return MergeSummary.create(scope, inputs); + public StatsAggregatorSummary statsAggregatorSummary(Operand iterator) { + return StatsAggregatorSummary.create(scope, iterator); + } + + /** + * The SummaryWriter operation + * + * @param options carries optional attribute values + * @return a new instance of SummaryWriter + */ + public SummaryWriter summaryWriter(SummaryWriter.Options... options) { + return SummaryWriter.create(scope, options); + } + + /** + * Outputs a {@code Summary} protocol buffer with a tensor and per-plugin data. + * + * @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 TensorSummary tensorSummary(Operand tag, Operand tensor, + Operand serializedSummaryMetadata) { + return TensorSummary.create(scope, tag, tensor, serializedSummaryMetadata); + } + + /** + * Writes an audio summary. + * Writes encoded audio summary {@code tensor} at {@code step} with {@code tag} using summary {@code writer}. + * {@code sample_rate} is the audio sample rate is Hz. + * + * @param writer The writer value + * @param step The step value + * @param tag The tag value + * @param tensor The tensor value + * @param sampleRate The sampleRate value + * @param options carries optional attribute values + * @return a new instance of WriteAudioSummary + */ + public WriteAudioSummary writeAudioSummary(Operand writer, Operand step, + Operand tag, Operand tensor, Operand sampleRate, + WriteAudioSummary.Options... options) { + return WriteAudioSummary.create(scope, writer, step, tag, tensor, sampleRate, options); + } + + /** + * Writes a graph summary. + * Writes TensorFlow graph {@code tensor} at {@code step} using summary {@code writer}. + * + * @param writer The writer value + * @param step The step value + * @param tensor The tensor value + * @return a new instance of WriteGraphSummary + */ + public WriteGraphSummary writeGraphSummary(Operand writer, Operand step, + Operand tensor) { + return WriteGraphSummary.create(scope, writer, step, tensor); + } + + /** + * Writes a histogram summary. + * Writes histogram {@code values} at {@code step} with {@code tag} using summary {@code writer}. + * + * @param writer The writer value + * @param step The step value + * @param tag The tag value + * @param values The values value + * @return a new instance of WriteHistogramSummary + */ + public WriteHistogramSummary writeHistogramSummary(Operand writer, + Operand step, Operand tag, Operand values) { + return WriteHistogramSummary.create(scope, writer, step, tag, values); + } + + /** + * Writes an image summary. + * Writes image {@code tensor} at {@code step} with {@code tag} using summary {@code writer}. + * {@code tensor} is image with shape [height, width, channels]. + * + * @param writer The writer value + * @param step The step value + * @param tag The tag value + * @param tensor The tensor value + * @param badColor The badColor value + * @param options carries optional attribute values + * @return a new instance of WriteImageSummary + */ + public WriteImageSummary writeImageSummary(Operand writer, Operand step, + Operand tag, Operand tensor, Operand badColor, + WriteImageSummary.Options... options) { + return WriteImageSummary.create(scope, writer, step, tag, tensor, badColor, options); + } + + /** + * Writes a serialized proto summary. + * Writes {@code tensor}, a serialized proto at {@code step} using summary {@code writer}. + * + * @param writer The writer value + * @param step The step value + * @param tensor The tensor value + * @return a new instance of WriteRawProtoSummary + */ + public WriteRawProtoSummary writeRawProtoSummary(Operand writer, + Operand step, Operand tensor) { + return WriteRawProtoSummary.create(scope, writer, step, tensor); + } + + /** + * Writes a scalar summary. + * Writes scalar {@code value} at {@code step} with {@code tag} using summary {@code writer}. + * + * @param writer The writer value + * @param step The step value + * @param tag The tag value + * @param value The value value + * @return a new instance of WriteScalarSummary + */ + public WriteScalarSummary writeScalarSummary(Operand writer, + Operand step, Operand tag, Operand value) { + return WriteScalarSummary.create(scope, writer, step, tag, value); + } + + /** + * Writes a tensor summary. + * Writes {@code tensor} at {@code step} with {@code tag} using summary {@code writer}. + * + * @param writer The writer value + * @param step The step value + * @param tensor The tensor value + * @param tag The tag value + * @param summaryMetadata The summaryMetadata value + * @return a new instance of WriteSummary + */ + public WriteSummary writeSummary(Operand writer, Operand step, + Operand tensor, Operand tag, Operand summaryMetadata) { + return WriteSummary.create(scope, writer, step, tensor, tag, summaryMetadata); + } + + /** + * Get the parent {@link Ops} object. + */ + public final Ops ops() { + return ops; } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/TpuOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/TpuOps.java new file mode 100644 index 00000000000..f6ea8e12178 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/TpuOps.java @@ -0,0 +1,1989 @@ +// Copyright 2020-2022 The TensorFlow Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ============================================================================== +// +// This class has been generated, DO NOT EDIT! +// +package org.tensorflow.op; + +import java.util.List; +import org.tensorflow.ConcreteFunction; +import org.tensorflow.Operand; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.tpu.AllToAll; +import org.tensorflow.op.tpu.CollateTPUEmbeddingMemory; +import org.tensorflow.op.tpu.CompilationResult; +import org.tensorflow.op.tpu.Compile; +import org.tensorflow.op.tpu.CompileSucceededAssert; +import org.tensorflow.op.tpu.ConfigureAndInitializeGlobalTPU; +import org.tensorflow.op.tpu.ConfigureDistributedTPU; +import org.tensorflow.op.tpu.ConfigureTPUEmbedding; +import org.tensorflow.op.tpu.ConfigureTPUEmbeddingHost; +import org.tensorflow.op.tpu.ConfigureTPUEmbeddingMemory; +import org.tensorflow.op.tpu.ConnectTPUEmbeddingHosts; +import org.tensorflow.op.tpu.ConvertToCooTensor; +import org.tensorflow.op.tpu.CrossReplicaSum; +import org.tensorflow.op.tpu.DTensorRestore; +import org.tensorflow.op.tpu.DynamicEnqueueTPUEmbeddingArbitraryTensorBatch; +import org.tensorflow.op.tpu.DynamicEnqueueTPUEmbeddingRaggedTensorBatch; +import org.tensorflow.op.tpu.EmbeddingActivations; +import org.tensorflow.op.tpu.EnqueueTPUEmbeddingArbitraryTensorBatch; +import org.tensorflow.op.tpu.EnqueueTPUEmbeddingBatch; +import org.tensorflow.op.tpu.EnqueueTPUEmbeddingIntegerBatch; +import org.tensorflow.op.tpu.EnqueueTPUEmbeddingRaggedTensorBatch; +import org.tensorflow.op.tpu.EnqueueTPUEmbeddingSparseBatch; +import org.tensorflow.op.tpu.EnqueueTPUEmbeddingSparseTensorBatch; +import org.tensorflow.op.tpu.Execute; +import org.tensorflow.op.tpu.ExecuteAndUpdateVariables; +import org.tensorflow.op.tpu.ExecuteTPUEmbeddingPartitioner; +import org.tensorflow.op.tpu.FinalizeTPUEmbedding; +import org.tensorflow.op.tpu.GetMinibatchSplitsWithPhysicalReplica; +import org.tensorflow.op.tpu.GetMinibatchesInCsrWithPhysicalReplica; +import org.tensorflow.op.tpu.GetTpuTaskId; +import org.tensorflow.op.tpu.GlobalIterId; +import org.tensorflow.op.tpu.InfeedDequeue; +import org.tensorflow.op.tpu.InfeedDequeueTuple; +import org.tensorflow.op.tpu.InfeedEnqueue; +import org.tensorflow.op.tpu.InfeedEnqueuePrelinearizedBuffer; +import org.tensorflow.op.tpu.InfeedEnqueueTuple; +import org.tensorflow.op.tpu.IsTPUEmbeddingInitialized; +import org.tensorflow.op.tpu.LoadAllTPUEmbeddingParameters; +import org.tensorflow.op.tpu.LoadTPUEmbeddingADAMParameters; +import org.tensorflow.op.tpu.LoadTPUEmbeddingAdadeltaParameters; +import org.tensorflow.op.tpu.LoadTPUEmbeddingAdagradMomentumParameters; +import org.tensorflow.op.tpu.LoadTPUEmbeddingAdagradParameters; +import org.tensorflow.op.tpu.LoadTPUEmbeddingCenteredRMSPropParameters; +import org.tensorflow.op.tpu.LoadTPUEmbeddingFTRLParameters; +import org.tensorflow.op.tpu.LoadTPUEmbeddingFrequencyEstimatorParameters; +import org.tensorflow.op.tpu.LoadTPUEmbeddingMDLAdagradLightParameters; +import org.tensorflow.op.tpu.LoadTPUEmbeddingMomentumParameters; +import org.tensorflow.op.tpu.LoadTPUEmbeddingProximalAdagradParameters; +import org.tensorflow.op.tpu.LoadTPUEmbeddingProximalYogiParameters; +import org.tensorflow.op.tpu.LoadTPUEmbeddingRMSPropParameters; +import org.tensorflow.op.tpu.LoadTPUEmbeddingStochasticGradientDescentParameters; +import org.tensorflow.op.tpu.MergeDedupData; +import org.tensorflow.op.tpu.OrdinalSelector; +import org.tensorflow.op.tpu.OutfeedDequeue; +import org.tensorflow.op.tpu.OutfeedDequeueTuple; +import org.tensorflow.op.tpu.OutfeedDequeueTupleV2; +import org.tensorflow.op.tpu.OutfeedDequeueV2; +import org.tensorflow.op.tpu.OutfeedEnqueue; +import org.tensorflow.op.tpu.OutfeedEnqueueTuple; +import org.tensorflow.op.tpu.PartitionedCall; +import org.tensorflow.op.tpu.PartitionedInput; +import org.tensorflow.op.tpu.PartitionedOutput; +import org.tensorflow.op.tpu.Prelinearize; +import org.tensorflow.op.tpu.PrelinearizeTuple; +import org.tensorflow.op.tpu.RecvTPUEmbeddingActivations; +import org.tensorflow.op.tpu.ReplicateMetadata; +import org.tensorflow.op.tpu.ReplicatedInput; +import org.tensorflow.op.tpu.ReplicatedOutput; +import org.tensorflow.op.tpu.RetrieveAllTPUEmbeddingParameters; +import org.tensorflow.op.tpu.RetrieveTPUEmbeddingADAMParameters; +import org.tensorflow.op.tpu.RetrieveTPUEmbeddingAdadeltaParameters; +import org.tensorflow.op.tpu.RetrieveTPUEmbeddingAdagradMomentumParameters; +import org.tensorflow.op.tpu.RetrieveTPUEmbeddingAdagradParameters; +import org.tensorflow.op.tpu.RetrieveTPUEmbeddingCenteredRMSPropParameters; +import org.tensorflow.op.tpu.RetrieveTPUEmbeddingFTRLParameters; +import org.tensorflow.op.tpu.RetrieveTPUEmbeddingFrequencyEstimatorParameters; +import org.tensorflow.op.tpu.RetrieveTPUEmbeddingMDLAdagradLightParameters; +import org.tensorflow.op.tpu.RetrieveTPUEmbeddingMomentumParameters; +import org.tensorflow.op.tpu.RetrieveTPUEmbeddingProximalAdagradParameters; +import org.tensorflow.op.tpu.RetrieveTPUEmbeddingProximalYogiParameters; +import org.tensorflow.op.tpu.RetrieveTPUEmbeddingRMSPropParameters; +import org.tensorflow.op.tpu.RetrieveTPUEmbeddingStochasticGradientDescentParameters; +import org.tensorflow.op.tpu.SendTPUEmbeddingGradients; +import org.tensorflow.op.tpu.ShutdownDistributedTPU; +import org.tensorflow.op.tpu.ShutdownTPUSystem; +import org.tensorflow.op.tpu.SplitDedupData; +import org.tensorflow.op.tpu.StoreMinibatchStatisticsInFdo; +import org.tensorflow.op.tpu.TPUAnnotateTensorsWithDynamicShape; +import org.tensorflow.op.tpu.TPUCompilationResult; +import org.tensorflow.op.tpu.TPUCopyWithDynamicShape; +import org.tensorflow.op.tpu.TPUEmbeddingActivations; +import org.tensorflow.op.tpu.TPUReplicateMetadata; +import org.tensorflow.op.tpu.TPUReplicatedInput; +import org.tensorflow.op.tpu.TPUReplicatedOutput; +import org.tensorflow.op.tpu.TPUReshardVariables; +import org.tensorflow.op.tpu.TPURoundRobin; +import org.tensorflow.op.tpu.TpuHandleToProtoKey; +import org.tensorflow.op.tpu.WorkerHeartbeat; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.TInt64; +import org.tensorflow.types.TString; +import org.tensorflow.types.family.TNumber; +import org.tensorflow.types.family.TType; + +/** + * An API for building {@code tpu} operations as {@link Op Op}s + * + * @see Ops + */ +public final class TpuOps { + private final Scope scope; + + private final Ops ops; + + TpuOps(Ops ops) { + this.scope = ops.scope(); + this.ops = ops; + } + + /** + * An Op to exchange data across TPU replicas. + * On each replica, the input is split into {@code split_count} blocks along + * {@code split_dimension} and send to the other replicas given group_assignment. After + * receiving {@code split_count} - 1 blocks from other replicas, we concatenate the + * blocks along {@code concat_dimension} as the output. + *

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

group_assignment={@code [[0, 1]]} + * concat_dimension=0 + * split_dimension=1 + * split_count=2 + *

replica 0's output: {@code [[A], [C]]} + * replica 1's output: {@code [[B], [D]]} + * + * @param input The local input to the sum. + * @param groupAssignment An int32 tensor with shape + * [num_groups, num_replicas_per_group]. {@code 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]) + * @param data type for {@code AllToAll} output and operands + * @return a new instance of AllToAll + */ + public AllToAll allToAll(Operand input, Operand groupAssignment, + Long concatDimension, Long splitDimension, Long splitCount) { + return AllToAll.create(scope, input, groupAssignment, concatDimension, splitDimension, splitCount); + } + + /** + * An op that merges the string-encoded memory config protos from all hosts. + * + * @param memoryConfigs String-encoded memory config protos containing metadata about + * the memory allocations reserved for TPUEmbedding across all hosts. + * @return a new instance of CollateTPUEmbeddingMemory + */ + public CollateTPUEmbeddingMemory collateTPUEmbeddingMemory( + Iterable> memoryConfigs) { + return CollateTPUEmbeddingMemory.create(scope, memoryConfigs); + } + + /** + * Returns the result of a TPU compilation. + * This operation returns the result of a TPU compilation as a serialized + * CompilationResultProto, which holds a status and an error message if an error + * occurred during compilation. + * + * @return a new instance of CompilationResult + */ + public CompilationResult compilationResult() { + return CompilationResult.create(scope); + } + + /** + * Compiles a computations for execution on one or more TPU devices. + * For the internal use of the distributed TPU compiler. + *

'num_computations' is the number of computations to be compiled. + * 'function' is a function containing the computation to compile. + * 'dynamic_shapes' contains dynamic shapes of arguments whose shapes were not + * known statically at TPUReplication rewrite time. + * 'guaranteed_constants' is a list of tensors which have been guaranteed to not + * change their values during the session lifetime. These contain tensors marked as + * constant using the GuaranteeConstOp. + * 'metadata' is a serialized TPUCompileMetadataProto describing + * the shapes and types of the inputs to the computation, as well as a mapping onto + * the TPU pod topology. + * Each 'program' output is a string key that is passed to the _TPUExecute op and + * used to look up the program in the compilation cache. + * 'may_modify_variables' indicates whether variables may be modified. + * + * @param dynamicShapes The dynamicShapes value + * @param guaranteedConstants The guaranteedConstants value + * @param numComputations The value of the numComputations attribute + * @param function The value of the function attribute + * @param metadata The value of the metadata attribute + * @return a new instance of Compile + */ + public Compile compile(Iterable> dynamicShapes, + Iterable> guaranteedConstants, Long numComputations, ConcreteFunction function, + String metadata) { + return Compile.create(scope, dynamicShapes, guaranteedConstants, numComputations, function, metadata); + } + + /** + * Asserts that compilation succeeded. + * This op produces no output and closes the device during failure to ensure all + * pending device interactions fail. + *

'compilation_status' is a serialized CompilationResultProto. + * + * @param compilationStatus The compilationStatus value + * @return a new instance of CompileSucceededAssert + */ + public CompileSucceededAssert compileSucceededAssert(Operand compilationStatus) { + return CompileSucceededAssert.create(scope, compilationStatus); + } + + /** + * An op that sets up the centralized structures for a distributed TPU system. + * + * @param options carries optional attribute values + * @return a new instance of ConfigureAndInitializeGlobalTPU + */ + public ConfigureAndInitializeGlobalTPU configureAndInitializeGlobalTPU( + ConfigureAndInitializeGlobalTPU.Options... options) { + return ConfigureAndInitializeGlobalTPU.create(scope, options); + } + + /** + * Sets up the centralized structures for a distributed TPU system. + * + * @param options carries optional attribute values + * @return a new instance of ConfigureDistributedTPU + */ + public ConfigureDistributedTPU configureDistributedTPU( + ConfigureDistributedTPU.Options... options) { + return ConfigureDistributedTPU.create(scope, options); + } + + /** + * Sets up TPUEmbedding in a distributed TPU system. + * + * @param config Serialized tensorflow.tpu.TPUEmbeddingConfiguration that + * describes the embedding lookups of the program. + * @return a new instance of ConfigureTPUEmbedding + */ + public ConfigureTPUEmbedding configureTPUEmbedding(String config) { + return ConfigureTPUEmbedding.create(scope, config); + } + + /** + * An op that configures the TPUEmbedding software on a host. + * + * @param commonConfig A string-encoded common configuration proto containing metadata + * about the TPUEmbedding partitioner output. + * @param memoryConfig A string-encoded memory config proto containing metadata about + * the memory allocations reserved for TPUEmbedding. + * @param config An TPUEmbeddingConfiguration proto serialized to a string, + * describing the desired TPUEmbedding configuration. + * @return a new instance of ConfigureTPUEmbeddingHost + */ + public ConfigureTPUEmbeddingHost configureTPUEmbeddingHost(Operand commonConfig, + Operand memoryConfig, String config) { + return ConfigureTPUEmbeddingHost.create(scope, commonConfig, memoryConfig, config); + } + + /** + * An op that configures the TPUEmbedding software on a host. + * + * @param commonConfig A string-encoded CommonConfiguration proto containing metadata + * about the TPUEmbedding partitioner output and the HBM size (in bytes) required + * for operation. + * @return a new instance of ConfigureTPUEmbeddingMemory + */ + public ConfigureTPUEmbeddingMemory configureTPUEmbeddingMemory(Operand commonConfig) { + return ConfigureTPUEmbeddingMemory.create(scope, commonConfig); + } + + /** + * An op that sets up communication between TPUEmbedding host software instances + * after ConfigureTPUEmbeddingHost has been called on each host. + * + * @param networkConfigs Strings containing metadata about the hostname and RPC port + * used for communication with all hosts. + * @return a new instance of ConnectTPUEmbeddingHosts + */ + public ConnectTPUEmbeddingHosts connectTPUEmbeddingHosts( + Iterable> networkConfigs) { + return ConnectTPUEmbeddingHosts.create(scope, networkConfigs); + } + + /** + * The ConvertToCooTensor operation + * + * @param indicesOrRowSplits The indicesOrRowSplits value + * @param values The values value + * @param weights The weights value + * @param sampleCount The value of the sampleCount attribute + * @param combiner The value of the combiner attribute + * @return a new instance of ConvertToCooTensor + */ + public ConvertToCooTensor convertToCooTensor(Operand indicesOrRowSplits, + Operand values, Operand weights, Long sampleCount, String combiner) { + return ConvertToCooTensor.create(scope, indicesOrRowSplits, values, weights, sampleCount, combiner); + } + + /** + * An Op to sum inputs across replicated TPU instances. + * Each instance supplies its own input. + *

For example, suppose there are 8 TPU instances: {@code [A, B, C, D, E, F, G, H]}. + * Passing group_assignment={@code [[0,2,4,6],[1,3,5,7]]} sets {@code A, C, E, G} as group 0, + * and {@code B, D, F, H} as group 1. Thus we get the outputs: + * {@code [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 input The local input to the sum. + * @param groupAssignment An int32 tensor with shape + * [num_groups, num_replicas_per_group]. {@code group_assignment[i]} represents the + * replica ids in the ith subgroup. + * @param data type for {@code CrossReplicaSum} output and operands + * @return a new instance of CrossReplicaSum + */ + public CrossReplicaSum crossReplicaSum(Operand input, + Operand groupAssignment) { + return CrossReplicaSum.create(scope, input, groupAssignment); + } + + /** + * The DTensorRestoreV2 operation + * + * @param prefix The prefix value + * @param tensorNames The tensorNames value + * @param shapeAndSlices The shapeAndSlices value + * @param inputShapes The value of the inputShapes attribute + * @param inputLayouts The value of the inputLayouts attribute + * @param dtypes The value of the dtypes attribute + * @return a new instance of DTensorRestore + */ + public DTensorRestore dTensorRestore(Operand prefix, Operand tensorNames, + Operand shapeAndSlices, List inputShapes, List inputLayouts, + List> dtypes) { + return DTensorRestore.create(scope, prefix, tensorNames, shapeAndSlices, inputShapes, inputLayouts, dtypes); + } + + /** + * Eases the porting of code that uses tf.nn.embedding_lookup_sparse(). + * embedding_indices[i] and aggregation_weights[i] correspond + * to the 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. + * + * @param sampleIndicesOrRowSplits A list of rank 2 Tensors specifying the training example to which the + * corresponding embedding_indices and aggregation_weights values belong. + * If the size of its first dimension is 0, we assume each embedding_indices + * belongs to a different sample. Both int32 and int64 are allowed and will + * be converted to int32 internally. + *

Or a list of rank 1 Tensors specifying the row splits for splitting + * embedding_indices and aggregation_weights into rows. It corresponds to + * ids.row_splits in embedding_lookup(), when ids is a RaggedTensor. When + * enqueuing N-D ragged tensor, only the last dimension is allowed to be ragged. + * the row splits is 1-D dense tensor. When empty, we assume a dense tensor is + * passed to the op Both int32 and int64 are allowed and will be converted to + * int32 internally. + * @param embeddingIndices A list of rank 1 Tensors, indices into the embedding + * tables. Both int32 and int64 are allowed and will be converted to + * int32 internally. + * @param aggregationWeights A list of rank 1 Tensors containing per training + * example aggregation weights. Both float32 and float64 are allowed and will + * be converted to float32 internally. + * @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 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. + * @param options carries optional attribute values + * @return a new instance of DynamicEnqueueTPUEmbeddingArbitraryTensorBatch + */ + public DynamicEnqueueTPUEmbeddingArbitraryTensorBatch dynamicEnqueueTPUEmbeddingArbitraryTensorBatch( + Iterable> sampleIndicesOrRowSplits, + Iterable> embeddingIndices, + Iterable> aggregationWeights, Operand modeOverride, + Operand deviceOrdinal, + DynamicEnqueueTPUEmbeddingArbitraryTensorBatch.Options... options) { + return DynamicEnqueueTPUEmbeddingArbitraryTensorBatch.create(scope, sampleIndicesOrRowSplits, embeddingIndices, aggregationWeights, modeOverride, deviceOrdinal, options); + } + + /** + * The DynamicEnqueueTPUEmbeddingRaggedTensorBatch operation + * + * @param sampleSplits The sampleSplits value + * @param embeddingIndices The embeddingIndices value + * @param aggregationWeights The aggregationWeights value + * @param modeOverride The modeOverride value + * @param deviceOrdinal The deviceOrdinal value + * @param tableIds The value of the tableIds attribute + * @param options carries optional attribute values + * @return a new instance of DynamicEnqueueTPUEmbeddingRaggedTensorBatch + */ + public DynamicEnqueueTPUEmbeddingRaggedTensorBatch dynamicEnqueueTPUEmbeddingRaggedTensorBatch( + Iterable> sampleSplits, + Iterable> embeddingIndices, + Iterable> aggregationWeights, Operand modeOverride, + Operand deviceOrdinal, List tableIds, + DynamicEnqueueTPUEmbeddingRaggedTensorBatch.Options... options) { + return DynamicEnqueueTPUEmbeddingRaggedTensorBatch.create(scope, sampleSplits, embeddingIndices, aggregationWeights, modeOverride, deviceOrdinal, tableIds, options); + } + + /** + * 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. + * + * @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 EmbeddingActivations + */ + public EmbeddingActivations embeddingActivations(Operand embeddingVariable, + Operand slicedActivations, Long tableId, Long lookupId) { + return EmbeddingActivations.create(scope, embeddingVariable, slicedActivations, tableId, lookupId); + } + + /** + * Eases the porting of code that uses tf.nn.embedding_lookup_sparse(). + * embedding_indices[i] and aggregation_weights[i] correspond + * to the 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. + * + * @param sampleIndicesOrRowSplits A list of rank 2 Tensors specifying the training example to which the + * corresponding embedding_indices and aggregation_weights values belong. + * If the size of its first dimension is 0, we assume each embedding_indices + * belongs to a different sample. Both int32 and int64 are allowed and will + * be converted to int32 internally. + *

Or a list of rank 1 Tensors specifying the row splits for splitting + * embedding_indices and aggregation_weights into rows. It corresponds to + * ids.row_splits in embedding_lookup(), when ids is a RaggedTensor. When + * enqueuing N-D ragged tensor, only the last dimension is allowed to be ragged. + * the row splits is 1-D dense tensor. When empty, we assume a dense tensor is + * passed to the op Both int32 and int64 are allowed and will be converted to + * int32 internally. + * @param embeddingIndices A list of rank 1 Tensors, indices into the embedding + * tables. Both int32 and int64 are allowed and will be converted to + * int32 internally. + * @param aggregationWeights A list of rank 1 Tensors containing per training + * example aggregation weights. Both float32 and float64 are allowed and will + * be converted to float32 internally. + * @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 attribute values + * @return a new instance of EnqueueTPUEmbeddingArbitraryTensorBatch + */ + public EnqueueTPUEmbeddingArbitraryTensorBatch enqueueTPUEmbeddingArbitraryTensorBatch( + Iterable> sampleIndicesOrRowSplits, + Iterable> embeddingIndices, + Iterable> aggregationWeights, Operand modeOverride, + EnqueueTPUEmbeddingArbitraryTensorBatch.Options... options) { + return EnqueueTPUEmbeddingArbitraryTensorBatch.create(scope, sampleIndicesOrRowSplits, embeddingIndices, aggregationWeights, modeOverride, options); + } + + /** + * An op that enqueues a list of input batch tensors to TPUEmbedding. + * An op that enqueues a list of input batch tensors to TPUEmbedding. + * + * @param batch A list of 1D tensors, one for each embedding table, containing the + * batch inputs encoded as dist_belief.SparseFeatures protos. If the weight + * field in the SparseFeatures proto is not populated for an ID, a weight of + * 1.0 is assumed. + * @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 attribute values + * @return a new instance of EnqueueTPUEmbeddingBatch + */ + public EnqueueTPUEmbeddingBatch enqueueTPUEmbeddingBatch(Iterable> batch, + Operand modeOverride, EnqueueTPUEmbeddingBatch.Options... options) { + return EnqueueTPUEmbeddingBatch.create(scope, batch, modeOverride, options); + } + + /** + * An op that enqueues a list of input batch tensors to TPUEmbedding. + * + * @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 attribute values + * @return a new instance of EnqueueTPUEmbeddingIntegerBatch + */ + public EnqueueTPUEmbeddingIntegerBatch enqueueTPUEmbeddingIntegerBatch( + Iterable> batch, Operand modeOverride, + EnqueueTPUEmbeddingIntegerBatch.Options... options) { + return EnqueueTPUEmbeddingIntegerBatch.create(scope, batch, modeOverride, options); + } + + /** + * Eases the porting of code that uses tf.nn.embedding_lookup(). + * sample_splits[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 two of the input lists, + * 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. + * + * @param sampleSplits A list of rank 1 Tensors specifying the break points for splitting + * embedding_indices and aggregation_weights into rows. + * It corresponds to ids.row_splits in embedding_lookup(), when ids is a + * RaggedTensor. + * @param embeddingIndices A list of rank 1 Tensors, indices into the embedding tables. + * It corresponds to ids.values in embedding_lookup(), when ids is a RaggedTensor. + * @param aggregationWeights A list of rank 1 Tensors containing per training example + * aggregation weights. It corresponds to the values field of a RaggedTensor + * with the same row_splits as ids in embedding_lookup(), when ids is a + * RaggedTensor. + * @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 attribute values + * @return a new instance of EnqueueTPUEmbeddingRaggedTensorBatch + */ + public EnqueueTPUEmbeddingRaggedTensorBatch enqueueTPUEmbeddingRaggedTensorBatch( + Iterable> sampleSplits, + Iterable> embeddingIndices, + Iterable> aggregationWeights, Operand modeOverride, + List tableIds, EnqueueTPUEmbeddingRaggedTensorBatch.Options... options) { + return EnqueueTPUEmbeddingRaggedTensorBatch.create(scope, sampleSplits, embeddingIndices, aggregationWeights, modeOverride, tableIds, options); + } + + /** + * 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. + * + * @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 attribute values + * @return a new instance of EnqueueTPUEmbeddingSparseBatch + */ + public EnqueueTPUEmbeddingSparseBatch enqueueTPUEmbeddingSparseBatch( + Iterable> sampleIndices, + Iterable> embeddingIndices, + Iterable> aggregationWeights, Operand modeOverride, + EnqueueTPUEmbeddingSparseBatch.Options... options) { + return EnqueueTPUEmbeddingSparseBatch.create(scope, sampleIndices, embeddingIndices, aggregationWeights, modeOverride, options); + } + + /** + * 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. + * + * @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 attribute values + * @return a new instance of EnqueueTPUEmbeddingSparseTensorBatch + */ + public EnqueueTPUEmbeddingSparseTensorBatch enqueueTPUEmbeddingSparseTensorBatch( + Iterable> sampleIndices, + Iterable> embeddingIndices, + Iterable> aggregationWeights, Operand modeOverride, + List tableIds, EnqueueTPUEmbeddingSparseTensorBatch.Options... options) { + return EnqueueTPUEmbeddingSparseTensorBatch.create(scope, sampleIndices, embeddingIndices, aggregationWeights, modeOverride, tableIds, options); + } + + /** + * Op that loads and executes a TPU program on a TPU device. + * For the internal use of the distributed TPU compiler. + * + * @param args The args value + * @param key The key value + * @param Tresults The value of the Tresults attribute + * @return a new instance of Execute + */ + public Execute execute(Iterable> args, Operand key, + List> Tresults) { + return Execute.create(scope, args, key, Tresults); + } + + /** + * Op that executes a program with optional in-place variable updates. + * It (optionally) reads device variables, loads and executes a TPU program on a + * TPU device, and then (optionally) in-place updates variables using the program + * outputs, as specified in attributes device_var_reads_indices (program input + * indices from directly reading variables) and device_var_updates_indices (program + * output indices used to update variables, -1 means no-update/read-only). Such + * program outputs are consumed by these variables will not appear in the op + * output. For the internal use of the distributed TPU compiler. + * + * @param args The args value + * @param key The key value + * @param Tresults The value of the Tresults attribute + * @param deviceVarReadsIndices The value of the deviceVarReadsIndices attribute + * @param deviceVarUpdatesIndices The value of the deviceVarUpdatesIndices attribute + * @return a new instance of ExecuteAndUpdateVariables + */ + public ExecuteAndUpdateVariables executeAndUpdateVariables(Iterable> args, + Operand key, List> Tresults, List deviceVarReadsIndices, + List deviceVarUpdatesIndices) { + return ExecuteAndUpdateVariables.create(scope, args, key, Tresults, deviceVarReadsIndices, deviceVarUpdatesIndices); + } + + /** + * An op that executes the TPUEmbedding partitioner on the central configuration + * device and computes the HBM size (in bytes) required for TPUEmbedding operation. + * + * @param config An TPUEmbeddingConfiguration proto serialized to a string, + * describing the desired TPUEmbedding configuration. + * @return a new instance of ExecuteTPUEmbeddingPartitioner + */ + public ExecuteTPUEmbeddingPartitioner executeTPUEmbeddingPartitioner(String config) { + return ExecuteTPUEmbeddingPartitioner.create(scope, config); + } + + /** + * An op that finalizes the TPUEmbedding configuration. + * + * @param commonConfig A string-encoded common configuration proto containing metadata + * about the TPUEmbedding partitioner output and the HBM size (in bytes) required + * for operation. + * @param memoryConfig A string-encoded memory config proto containing metadata about + * the memory allocations reserved for TPUEmbedding. + * @return a new instance of FinalizeTPUEmbedding + */ + public FinalizeTPUEmbedding finalizeTPUEmbedding(Operand commonConfig, + Operand memoryConfig) { + return FinalizeTPUEmbedding.create(scope, commonConfig, memoryConfig); + } + + /** + * The GetMinibatchSplitsWithPhysicalReplica operation + * + * @param programKey The programKey value + * @param rowIds The rowIds value + * @param colIds The colIds value + * @param gains The gains value + * @param sampleCount The value of the sampleCount attribute + * @param numReplica The value of the numReplica attribute + * @param tableVocabSize The value of the tableVocabSize attribute + * @param featureWidth The value of the featureWidth attribute + * @param numScPerChip The value of the numScPerChip attribute + * @param tableName The value of the tableName attribute + * @param miniBatchSplits The value of the miniBatchSplits attribute + * @return a new instance of GetMinibatchSplitsWithPhysicalReplica + */ + public GetMinibatchSplitsWithPhysicalReplica getMinibatchSplitsWithPhysicalReplica( + Operand programKey, Operand rowIds, Operand colIds, + Operand gains, Long sampleCount, Long numReplica, Long tableVocabSize, + Long featureWidth, Long numScPerChip, String tableName, String miniBatchSplits) { + return GetMinibatchSplitsWithPhysicalReplica.create(scope, programKey, rowIds, colIds, gains, sampleCount, numReplica, tableVocabSize, featureWidth, numScPerChip, tableName, miniBatchSplits); + } + + /** + * The GetMinibatchesInCsrWithPhysicalReplica operation + * + * @param programKey The programKey value + * @param rowIds The rowIds value + * @param colIds The colIds value + * @param gains The gains value + * @param splits The splits value + * @param idCounts The idCounts value + * @param sampleCount The value of the sampleCount attribute + * @param numReplica The value of the numReplica attribute + * @param maxMinibatchesPerSc The value of the maxMinibatchesPerSc attribute + * @param maxIdsPerChipPerSample The value of the maxIdsPerChipPerSample attribute + * @param tableVocabSize The value of the tableVocabSize attribute + * @param featureWidth The value of the featureWidth attribute + * @param numScPerChip The value of the numScPerChip attribute + * @param tableName The value of the tableName attribute + * @param miniBatchInCsr The value of the miniBatchInCsr attribute + * @return a new instance of GetMinibatchesInCsrWithPhysicalReplica + */ + public GetMinibatchesInCsrWithPhysicalReplica getMinibatchesInCsrWithPhysicalReplica( + Operand programKey, Operand rowIds, Operand colIds, + Operand gains, Operand splits, Operand idCounts, Long sampleCount, + Long numReplica, Long maxMinibatchesPerSc, Long maxIdsPerChipPerSample, Long tableVocabSize, + Long featureWidth, Long numScPerChip, String tableName, String miniBatchInCsr) { + return GetMinibatchesInCsrWithPhysicalReplica.create(scope, programKey, rowIds, colIds, gains, splits, idCounts, sampleCount, numReplica, maxMinibatchesPerSc, maxIdsPerChipPerSample, tableVocabSize, featureWidth, numScPerChip, tableName, miniBatchInCsr); + } + + /** + * An op returns the TPU task ID from TPU topology. + * This op is to return the TPU task ID from TPU topology. + * + * @return a new instance of GetTpuTaskId + */ + public GetTpuTaskId getTpuTaskId() { + return GetTpuTaskId.create(scope); + } + + /** + * The GlobalIterId operation + * + * @return a new instance of GlobalIterId + */ + public GlobalIterId globalIterId() { + return GlobalIterId.create(scope); + } + + /** + * A placeholder op for a value that will be fed into the computation. + * + * @param dtype The type of elements in the tensor. + * @param shape The shape of the tensor. + * @param data type for {@code InfeedDequeue} output and operands + * @return a new instance of InfeedDequeue + */ + public InfeedDequeue infeedDequeue(Class dtype, Shape shape) { + return InfeedDequeue.create(scope, dtype, shape); + } + + /** + * Fetches multiple values from infeed as an XLA tuple. + * + * @param dtypes The element types of each element in {@code outputs}. + * @param shapes The shapes of each tensor in {@code outputs}. + * @return a new instance of InfeedDequeueTuple + */ + public InfeedDequeueTuple infeedDequeueTuple(List> dtypes, + List shapes) { + return InfeedDequeueTuple.create(scope, dtypes, shapes); + } + + /** + * An op which feeds a single Tensor value into the computation. + * + * @param input A tensor that will be provided using the infeed mechanism. + * @param options carries optional attribute values + * @return a new instance of InfeedEnqueue + */ + public InfeedEnqueue infeedEnqueue(Operand input, + InfeedEnqueue.Options... options) { + return InfeedEnqueue.create(scope, input, options); + } + + /** + * An op which enqueues prelinearized buffer into TPU infeed. + * + * @param input A variant tensor representing linearized output. + * @param options carries optional attribute values + * @return a new instance of InfeedEnqueuePrelinearizedBuffer + */ + public InfeedEnqueuePrelinearizedBuffer infeedEnqueuePrelinearizedBuffer( + Operand input, InfeedEnqueuePrelinearizedBuffer.Options... options) { + return InfeedEnqueuePrelinearizedBuffer.create(scope, input, options); + } + + /** + * Feeds multiple Tensor values into the computation as an XLA tuple. + * + * @param inputs A list of tensors that will be provided using the infeed mechanism. + * @param shapes The shapes of each tensor in {@code inputs}. + * @param options carries optional attribute values + * @return a new instance of InfeedEnqueueTuple + */ + public InfeedEnqueueTuple infeedEnqueueTuple(Iterable> inputs, List shapes, + InfeedEnqueueTuple.Options... options) { + return InfeedEnqueueTuple.create(scope, inputs, shapes, options); + } + + /** + * Whether TPU Embedding is initialized in a distributed TPU system. + * + * @param options carries optional attribute values + * @return a new instance of IsTPUEmbeddingInitialized + */ + public IsTPUEmbeddingInitialized isTPUEmbeddingInitialized( + IsTPUEmbeddingInitialized.Options... options) { + return IsTPUEmbeddingInitialized.create(scope, options); + } + + /** + * An op that loads optimization parameters into embedding memory. + * An op that loads optimization parameters into embedding memory. 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. For Adagrad, + * auxiliary1 should be the accumulators. For SGD, all of the auxiliary* values + * should be empty. For FTRL, auxiliary1 should be the accumulators and auxiliary2 + * should be the linear terms. For ADAM, auxiliary1 should be the momenta and + * auxiliary2 should be the velocities. + * + * @param parameters A list of tensors, one for each embedding table, + * containing the initial embedding table parameters to use in embedding + * lookups. + * @param auxiliary1 A list of tensors, one for each embedding table, containing the + * initial values of the first auxiliary optimization parameter to use in embedding + * training loop updates. The shape of each entry is ignored (and thus can be + * empty) for those tables whose optimization algorithms do not have at least one + * auxiliary parameter. + * @param auxiliary2 A list of tensors, one for each embedding table, containing the + * initial values of the second auxiliary optimization parameter to use in + * embedding training loop updates. The shape of each entry is ignored (and thus + * can be empty) for those tables whose optimization algorithms do not have at + * least two auxiliary + * @param auxiliary3 A list of tensors, one for each embedding table, containing the + * initial values of the third auxiliary optimization parameter to use in embedding + * training loop updates. The shape of each entry is ignored (and thus can be + * empty) for those tables whose optimization algorithms do not have three + * auxiliary parameters. + * @param auxiliary4 A list of tensors, one for each embedding table, containing the + * initial values of the second auxiliary optimization parameter to use in + * embedding training loop updates. The shape of each entry is ignored (and thus + * can be empty) for those tables whose optimization algorithms do not have at + * least four auxiliary + * @param auxiliary5 A list of tensors, one for each embedding table, containing the + * initial values of the third auxiliary optimization parameter to use in embedding + * training loop updates. The shape of each entry is ignored (and thus can be + * empty) for those tables whose optimization algorithms do not have five + * auxiliary parameters. + * @param auxiliary6 A list of tensors, one for each embedding table, containing the + * initial values of the second auxiliary optimization parameter to use in + * embedding training loop updates. The shape of each entry is ignored (and thus + * can be empty) for those tables whose optimization algorithms do not have at + * least six auxiliary + * @param auxiliary7 A list of tensors, one for each embedding table, containing the + * initial values of the third auxiliary optimization parameter to use in embedding + * training loop updates. The shape of each entry is ignored (and thus can be + * empty) for those tables whose optimization algorithms do not have sevan + * auxiliary parameters. + * @param config An TPUEmbeddingConfiguration proto describing the + * table parameters being loaded, serialized to a string. + * @param numShards Number of shards into which the embedding tables are divided. + * @param shardId Identifier of shard for this operation. + * @return a new instance of LoadAllTPUEmbeddingParameters + */ + public LoadAllTPUEmbeddingParameters loadAllTPUEmbeddingParameters( + Iterable> parameters, Iterable> auxiliary1, + Iterable> auxiliary2, Iterable> auxiliary3, + Iterable> auxiliary4, Iterable> auxiliary5, + Iterable> auxiliary6, Iterable> auxiliary7, String config, + Long numShards, Long shardId) { + return LoadAllTPUEmbeddingParameters.create(scope, parameters, auxiliary1, auxiliary2, auxiliary3, auxiliary4, auxiliary5, auxiliary6, auxiliary7, config, numShards, shardId); + } + + /** + * 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. + * + * @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 The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of LoadTPUEmbeddingADAMParameters + */ + public LoadTPUEmbeddingADAMParameters loadTPUEmbeddingADAMParameters(Operand parameters, + Operand momenta, Operand velocities, Long numShards, Long shardId, + LoadTPUEmbeddingADAMParameters.Options... options) { + return LoadTPUEmbeddingADAMParameters.create(scope, parameters, momenta, velocities, numShards, shardId, options); + } + + /** + * 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. + * + * @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 The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of LoadTPUEmbeddingAdadeltaParameters + */ + public LoadTPUEmbeddingAdadeltaParameters loadTPUEmbeddingAdadeltaParameters( + Operand parameters, Operand accumulators, Operand updates, + Long numShards, Long shardId, LoadTPUEmbeddingAdadeltaParameters.Options... options) { + return LoadTPUEmbeddingAdadeltaParameters.create(scope, parameters, accumulators, updates, numShards, shardId, options); + } + + /** + * Load Adagrad 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. + * + * @param parameters Value of parameters used in the Adagrad Momentum optimization algorithm. + * @param accumulators Value of accumulators used in the Adagrad Momentum optimization algorithm. + * @param momenta Value of momenta used in the Adagrad Momentum optimization algorithm. + * @param numShards The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of LoadTPUEmbeddingAdagradMomentumParameters + */ + public LoadTPUEmbeddingAdagradMomentumParameters loadTPUEmbeddingAdagradMomentumParameters( + Operand parameters, Operand accumulators, Operand momenta, + Long numShards, Long shardId, LoadTPUEmbeddingAdagradMomentumParameters.Options... options) { + return LoadTPUEmbeddingAdagradMomentumParameters.create(scope, parameters, accumulators, momenta, numShards, shardId, options); + } + + /** + * 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. + * + * @param parameters Value of parameters used in the Adagrad optimization algorithm. + * @param accumulators Value of accumulators used in the Adagrad optimization algorithm. + * @param numShards The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of LoadTPUEmbeddingAdagradParameters + */ + public LoadTPUEmbeddingAdagradParameters loadTPUEmbeddingAdagradParameters( + Operand parameters, Operand accumulators, Long numShards, Long shardId, + LoadTPUEmbeddingAdagradParameters.Options... options) { + return LoadTPUEmbeddingAdagradParameters.create(scope, parameters, accumulators, numShards, shardId, options); + } + + /** + * 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. + * + * @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 The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of LoadTPUEmbeddingCenteredRMSPropParameters + */ + public LoadTPUEmbeddingCenteredRMSPropParameters loadTPUEmbeddingCenteredRMSPropParameters( + Operand parameters, Operand ms, Operand mom, + Operand mg, Long numShards, Long shardId, + LoadTPUEmbeddingCenteredRMSPropParameters.Options... options) { + return LoadTPUEmbeddingCenteredRMSPropParameters.create(scope, parameters, ms, mom, mg, numShards, shardId, options); + } + + /** + * 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. + * + * @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 The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of LoadTPUEmbeddingFTRLParameters + */ + public LoadTPUEmbeddingFTRLParameters loadTPUEmbeddingFTRLParameters(Operand parameters, + Operand accumulators, Operand linears, Long numShards, Long shardId, + LoadTPUEmbeddingFTRLParameters.Options... options) { + return LoadTPUEmbeddingFTRLParameters.create(scope, parameters, accumulators, linears, numShards, shardId, options); + } + + /** + * Load frequency estimator 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. + * + * @param parameters Value of parameters used in the frequency estimator optimization algorithm. + * @param lastHitStep Value of last_hit_step used in the frequency estimator optimization algorithm. + * @param numShards The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of LoadTPUEmbeddingFrequencyEstimatorParameters + */ + public LoadTPUEmbeddingFrequencyEstimatorParameters loadTPUEmbeddingFrequencyEstimatorParameters( + Operand parameters, Operand lastHitStep, Long numShards, Long shardId, + LoadTPUEmbeddingFrequencyEstimatorParameters.Options... options) { + return LoadTPUEmbeddingFrequencyEstimatorParameters.create(scope, parameters, lastHitStep, numShards, shardId, options); + } + + /** + * 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. + * + * @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 The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of LoadTPUEmbeddingMDLAdagradLightParameters + */ + public LoadTPUEmbeddingMDLAdagradLightParameters loadTPUEmbeddingMDLAdagradLightParameters( + Operand parameters, Operand accumulators, Operand weights, + Operand benefits, Long numShards, Long shardId, + LoadTPUEmbeddingMDLAdagradLightParameters.Options... options) { + return LoadTPUEmbeddingMDLAdagradLightParameters.create(scope, parameters, accumulators, weights, benefits, numShards, shardId, options); + } + + /** + * 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. + * + * @param parameters Value of parameters used in the Momentum optimization algorithm. + * @param momenta Value of momenta used in the Momentum optimization algorithm. + * @param numShards The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of LoadTPUEmbeddingMomentumParameters + */ + public LoadTPUEmbeddingMomentumParameters loadTPUEmbeddingMomentumParameters( + Operand parameters, Operand momenta, Long numShards, Long shardId, + LoadTPUEmbeddingMomentumParameters.Options... options) { + return LoadTPUEmbeddingMomentumParameters.create(scope, parameters, momenta, numShards, shardId, options); + } + + /** + * 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. + * + * @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 The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of LoadTPUEmbeddingProximalAdagradParameters + */ + public LoadTPUEmbeddingProximalAdagradParameters loadTPUEmbeddingProximalAdagradParameters( + Operand parameters, Operand accumulators, Long numShards, Long shardId, + LoadTPUEmbeddingProximalAdagradParameters.Options... options) { + return LoadTPUEmbeddingProximalAdagradParameters.create(scope, parameters, accumulators, numShards, shardId, options); + } + + /** + * The LoadTPUEmbeddingProximalYogiParameters operation + * + * @param parameters The parameters value + * @param v The v value + * @param m The m value + * @param numShards The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of LoadTPUEmbeddingProximalYogiParameters + */ + public LoadTPUEmbeddingProximalYogiParameters loadTPUEmbeddingProximalYogiParameters( + Operand parameters, Operand v, Operand m, Long numShards, + Long shardId, LoadTPUEmbeddingProximalYogiParameters.Options... options) { + return LoadTPUEmbeddingProximalYogiParameters.create(scope, parameters, v, m, numShards, shardId, options); + } + + /** + * 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. + * + * @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 The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of LoadTPUEmbeddingRMSPropParameters + */ + public LoadTPUEmbeddingRMSPropParameters loadTPUEmbeddingRMSPropParameters( + Operand parameters, Operand ms, Operand mom, Long numShards, + Long shardId, LoadTPUEmbeddingRMSPropParameters.Options... options) { + return LoadTPUEmbeddingRMSPropParameters.create(scope, parameters, ms, mom, numShards, shardId, options); + } + + /** + * 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. + * + * @param parameters Value of parameters used in the stochastic gradient descent optimization algorithm. + * @param numShards The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of LoadTPUEmbeddingStochasticGradientDescentParameters + */ + public LoadTPUEmbeddingStochasticGradientDescentParameters loadTPUEmbeddingStochasticGradientDescentParameters( + Operand parameters, Long numShards, Long shardId, + LoadTPUEmbeddingStochasticGradientDescentParameters.Options... options) { + return LoadTPUEmbeddingStochasticGradientDescentParameters.create(scope, parameters, numShards, shardId, options); + } + + /** + * An op merges elements of integer and float tensors into deduplication data as + * XLA tuple. + * This op merges outputs of SplitDedupDataOp, which gives two 1-D tensors, integer + * and floating point. With respect to tuple_mask, this op merges values of these + * two tensors into an XLA tuple, which should be as same as input to + * SplitDedupDataOp. + * + * @param integerTensor A 1-D integer tensor, includes integer elements of deduplication data tuple. + * @param floatTensor A 1-D float tensor, includes float elements of deduplication data tuple. + * @param tupleMask A serialized TensorProto string of output tuple mask. This mask is a 2-D tensor, + * with first column as tuple element type, and second column as span of this type. + * For example, an output tuple of (1, 2, 0.1, 3), its mask is [[0, 2], [1, 1], [0, + * 1]]. We expect only two types of elements: integer(0) and float(1). + * @param options carries optional attribute values + * @return a new instance of MergeDedupData + */ + public MergeDedupData mergeDedupData(Operand integerTensor, + Operand floatTensor, String tupleMask, MergeDedupData.Options... options) { + return MergeDedupData.create(scope, integerTensor, floatTensor, tupleMask, options); + } + + /** + * 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. + * + * @return a new instance of OrdinalSelector + */ + public OrdinalSelector ordinalSelector() { + return OrdinalSelector.create(scope); + } + + /** + * Retrieves a single tensor from the computation outfeed. + * This operation will block indefinitely until data is available. + * + * @param dtype The type of elements in the tensor. + * @param shape The shape of the tensor. + * @param options carries optional attribute values + * @param data type for {@code OutfeedDequeue} output and operands + * @return a new instance of OutfeedDequeue + */ + public OutfeedDequeue outfeedDequeue(Class dtype, Shape shape, + OutfeedDequeue.Options... options) { + return OutfeedDequeue.create(scope, dtype, shape, options); + } + + /** + * Retrieve multiple values from the computation outfeed. + * This operation will block indefinitely until data is available. Output {@code i} + * corresponds to XLA tuple element {@code i}. + * + * @param dtypes The element types of each element in {@code outputs}. + * @param shapes The shapes of each tensor in {@code outputs}. + * @param options carries optional attribute values + * @return a new instance of OutfeedDequeueTuple + */ + public OutfeedDequeueTuple outfeedDequeueTuple(List> dtypes, + List shapes, OutfeedDequeueTuple.Options... options) { + return OutfeedDequeueTuple.create(scope, dtypes, shapes, options); + } + + /** + * Retrieve multiple values from the computation outfeed. Device ordinal is a + * tensor allowing dynamic outfeed. + * This operation will block indefinitely until data is available. Output {@code i} + * corresponds to XLA tuple element {@code i}. + * + * @param deviceOrdinal An int scalar tensor, representing 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. + * @param dtypes The element types of each element in {@code outputs}. + * @param shapes The shapes of each tensor in {@code outputs}. + * @return a new instance of OutfeedDequeueTupleV2 + */ + public OutfeedDequeueTupleV2 outfeedDequeueTupleV2(Operand deviceOrdinal, + List> dtypes, List shapes) { + return OutfeedDequeueTupleV2.create(scope, deviceOrdinal, dtypes, shapes); + } + + /** + * Retrieves a single tensor from the computation outfeed. Device ordinal is a + * tensor allowing dynamic outfeed. + * This operation will block indefinitely until data is available. + * + * @param deviceOrdinal An int scalar tensor, representing 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. + * @param dtype The type of elements in the tensor. + * @param shape The shape of the tensor. + * @param data type for {@code OutfeedDequeueV2} output and operands + * @return a new instance of OutfeedDequeueV2 + */ + public OutfeedDequeueV2 outfeedDequeueV2(Operand deviceOrdinal, + Class dtype, Shape shape) { + return OutfeedDequeueV2.create(scope, deviceOrdinal, dtype, shape); + } + + /** + * Enqueue a Tensor on the computation outfeed. + * + * @param input A tensor that will be inserted into the outfeed queue. + * @return a new instance of OutfeedEnqueue + */ + public OutfeedEnqueue outfeedEnqueue(Operand input) { + return OutfeedEnqueue.create(scope, input); + } + + /** + * Enqueue multiple Tensor values on the computation outfeed. + * + * @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 OutfeedEnqueueTuple outfeedEnqueueTuple(Iterable> inputs) { + return OutfeedEnqueueTuple.create(scope, inputs); + } + + /** + * Calls a function placed on a specified TPU device. + * + * @param args The arguments to the function. + * @param deviceOrdinal The TPU device ordinal to run the function on. + * @param Tout The types of the outputs of the function. + * @param f The function to call. + * @param options carries optional attribute values + * @return a new instance of PartitionedCall + */ + public PartitionedCall partitionedCall(Iterable> args, Operand deviceOrdinal, + List> Tout, ConcreteFunction f, PartitionedCall.Options... options) { + return PartitionedCall.create(scope, args, deviceOrdinal, Tout, f, options); + } + + /** + * An op that groups a list of partitioned inputs together. Supports ND sharding. + * + * @param inputs A list of partitioned inputs which must have the same shape. + * @param partitionDims A list of integers describing how each dimension is partitioned. Emptiness + * indicates the inputs are replicated. + * @param options carries optional attribute values + * @param data type for {@code TPUPartitionedInputV2} output and operands + * @return a new instance of PartitionedInput + */ + public PartitionedInput partitionedInput(Iterable> inputs, + List partitionDims, PartitionedInput.Options... options) { + return PartitionedInput.create(scope, inputs, partitionDims, options); + } + + /** + * An op that demultiplexes a tensor to be sharded by XLA to a list of partitioned + * outputs outside the XLA computation. Supports ND sharding. + * + * @param inputs A tensor which represents the full shape of partitioned tensors. + * @param numSplits The value of the numSplits attribute + * @param partitionDims A list of integers describing how each dimension is partitioned. Emptiness + * indicates the inputs are replicated. + * @param data type for {@code TPUPartitionedOutputV2} output and operands + * @return a new instance of PartitionedOutput + */ + public PartitionedOutput partitionedOutput(Operand inputs, Long numSplits, + List partitionDims) { + return PartitionedOutput.create(scope, inputs, numSplits, partitionDims); + } + + /** + * An op which linearizes one Tensor value to an opaque variant tensor. + * + * @param input A tensor that will be linearized. + * @param options carries optional attribute values + * @return a new instance of Prelinearize + */ + public Prelinearize prelinearize(Operand input, + Prelinearize.Options... options) { + return Prelinearize.create(scope, input, options); + } + + /** + * An op which linearizes multiple Tensor values to an opaque variant tensor. + * + * @param inputs A list of tensors that will be provided using the infeed mechanism. + * @param shapes The shapes of each tensor in {@code inputs}. + * @param options carries optional attribute values + * @return a new instance of PrelinearizeTuple + */ + public PrelinearizeTuple prelinearizeTuple(Iterable> inputs, List shapes, + PrelinearizeTuple.Options... options) { + return PrelinearizeTuple.create(scope, inputs, shapes, options); + } + + /** + * 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. + * + * @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 RecvTPUEmbeddingActivations recvTPUEmbeddingActivations(Long numOutputs, String config) { + return RecvTPUEmbeddingActivations.create(scope, numOutputs, config); + } + + /** + * Metadata indicating how the TPU computation should be replicated. + * This operation holds the metadata common to operations of a {@code tpu.replicate()} computation subgraph. + * + * @param numReplicas Number of replicas of the computation + * @param options carries optional attribute values + * @return a new instance of ReplicateMetadata + */ + public ReplicateMetadata replicateMetadata(Long numReplicas, + ReplicateMetadata.Options... options) { + return ReplicateMetadata.create(scope, numReplicas, options); + } + + /** + * Connects N inputs to an N-way replicated TPU computation. + * This operation holds a replicated input to a {@code tpu.replicate()} computation subgraph. + * Each replicated input has the same shape and type alongside the output. + *

For example: + *

+   *  %a = "tf.opA"()
+   *  %b = "tf.opB"()
+   *  %replicated_input = "tf.TPUReplicatedInput"(%a, %b)
+   *  %computation = "tf.Computation"(%replicated_input)
+   *  
+ *

The above computation has a replicated input of two replicas. + * + * @param inputs The inputs value + * @param options carries optional attribute values + * @param data type for {@code TPUReplicatedInput} output and operands + * @return a new instance of ReplicatedInput + */ + public ReplicatedInput replicatedInput(Iterable> inputs, + ReplicatedInput.Options... options) { + return ReplicatedInput.create(scope, inputs, options); + } + + /** + * Connects N outputs from an N-way replicated TPU computation. + * This operation holds a replicated output from a {@code tpu.replicate()} computation subgraph. + * Each replicated output has the same shape and type alongside the input. + *

For example: + *

+   *  %computation = "tf.Computation"()
+   *  %replicated_output:2 = "tf.TPUReplicatedOutput"(%computation)
+   *  
+ *

The above computation has a replicated output of two replicas. + * + * @param input The input value + * @param numReplicas The value of the numReplicas attribute + * @param data type for {@code TPUReplicatedOutput} output and operands + * @return a new instance of ReplicatedOutput + */ + public ReplicatedOutput replicatedOutput(Operand input, + Long numReplicas) { + return ReplicatedOutput.create(scope, input, numReplicas); + } + + /** + * An op that retrieves optimization parameters from embedding to host memory. + * 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. For Adagrad, auxiliary1 will contain the + * accumulators after running this op. For SGD, all of the auxiliary* values will + * be empty (0x0 tensors for that table). For FTRL, auxiliary1 will contain the + * accumulators and auxiliary2 will contain the linear terms. For ADAM, auxiliary1 + * will contain the momenta and auxiliary2 will contain the velocities. + * + * @param NumTables The number of embedding tables. + * @param config An TPUEmbeddingConfiguration proto describing the + * table parameters being loaded, serialized to a string. + * @param numShards Number of shards into which the embedding tables are divided. + * @param shardId Identifier of shard for this operation. + * @return a new instance of RetrieveAllTPUEmbeddingParameters + */ + public RetrieveAllTPUEmbeddingParameters retrieveAllTPUEmbeddingParameters(Long NumTables, + String config, Long numShards, Long shardId) { + return RetrieveAllTPUEmbeddingParameters.create(scope, NumTables, config, numShards, shardId); + } + + /** + * 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. + * + * @param numShards The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of RetrieveTPUEmbeddingADAMParameters + */ + public RetrieveTPUEmbeddingADAMParameters retrieveTPUEmbeddingADAMParameters(Long numShards, + Long shardId, RetrieveTPUEmbeddingADAMParameters.Options... options) { + return RetrieveTPUEmbeddingADAMParameters.create(scope, numShards, shardId, options); + } + + /** + * 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. + * + * @param numShards The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of RetrieveTPUEmbeddingAdadeltaParameters + */ + public RetrieveTPUEmbeddingAdadeltaParameters retrieveTPUEmbeddingAdadeltaParameters( + Long numShards, Long shardId, RetrieveTPUEmbeddingAdadeltaParameters.Options... options) { + return RetrieveTPUEmbeddingAdadeltaParameters.create(scope, numShards, shardId, options); + } + + /** + * Retrieve Adagrad 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. + * + * @param numShards The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of RetrieveTPUEmbeddingAdagradMomentumParameters + */ + public RetrieveTPUEmbeddingAdagradMomentumParameters retrieveTPUEmbeddingAdagradMomentumParameters( + Long numShards, Long shardId, + RetrieveTPUEmbeddingAdagradMomentumParameters.Options... options) { + return RetrieveTPUEmbeddingAdagradMomentumParameters.create(scope, numShards, shardId, options); + } + + /** + * 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. + * + * @param numShards The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of RetrieveTPUEmbeddingAdagradParameters + */ + public RetrieveTPUEmbeddingAdagradParameters retrieveTPUEmbeddingAdagradParameters(Long numShards, + Long shardId, RetrieveTPUEmbeddingAdagradParameters.Options... options) { + return RetrieveTPUEmbeddingAdagradParameters.create(scope, numShards, shardId, options); + } + + /** + * 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. + * + * @param numShards The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of RetrieveTPUEmbeddingCenteredRMSPropParameters + */ + public RetrieveTPUEmbeddingCenteredRMSPropParameters retrieveTPUEmbeddingCenteredRMSPropParameters( + Long numShards, Long shardId, + RetrieveTPUEmbeddingCenteredRMSPropParameters.Options... options) { + return RetrieveTPUEmbeddingCenteredRMSPropParameters.create(scope, numShards, shardId, options); + } + + /** + * 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. + * + * @param numShards The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of RetrieveTPUEmbeddingFTRLParameters + */ + public RetrieveTPUEmbeddingFTRLParameters retrieveTPUEmbeddingFTRLParameters(Long numShards, + Long shardId, RetrieveTPUEmbeddingFTRLParameters.Options... options) { + return RetrieveTPUEmbeddingFTRLParameters.create(scope, numShards, shardId, options); + } + + /** + * Retrieve frequency estimator 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. + * + * @param numShards The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of RetrieveTPUEmbeddingFrequencyEstimatorParameters + */ + public RetrieveTPUEmbeddingFrequencyEstimatorParameters retrieveTPUEmbeddingFrequencyEstimatorParameters( + Long numShards, Long shardId, + RetrieveTPUEmbeddingFrequencyEstimatorParameters.Options... options) { + return RetrieveTPUEmbeddingFrequencyEstimatorParameters.create(scope, numShards, shardId, options); + } + + /** + * 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. + * + * @param numShards The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of RetrieveTPUEmbeddingMDLAdagradLightParameters + */ + public RetrieveTPUEmbeddingMDLAdagradLightParameters retrieveTPUEmbeddingMDLAdagradLightParameters( + Long numShards, Long shardId, + RetrieveTPUEmbeddingMDLAdagradLightParameters.Options... options) { + return RetrieveTPUEmbeddingMDLAdagradLightParameters.create(scope, numShards, shardId, options); + } + + /** + * 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. + * + * @param numShards The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of RetrieveTPUEmbeddingMomentumParameters + */ + public RetrieveTPUEmbeddingMomentumParameters retrieveTPUEmbeddingMomentumParameters( + Long numShards, Long shardId, RetrieveTPUEmbeddingMomentumParameters.Options... options) { + return RetrieveTPUEmbeddingMomentumParameters.create(scope, numShards, shardId, options); + } + + /** + * 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. + * + * @param numShards The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of RetrieveTPUEmbeddingProximalAdagradParameters + */ + public RetrieveTPUEmbeddingProximalAdagradParameters retrieveTPUEmbeddingProximalAdagradParameters( + Long numShards, Long shardId, + RetrieveTPUEmbeddingProximalAdagradParameters.Options... options) { + return RetrieveTPUEmbeddingProximalAdagradParameters.create(scope, numShards, shardId, options); + } + + /** + * The RetrieveTPUEmbeddingProximalYogiParameters operation + * + * @param numShards The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of RetrieveTPUEmbeddingProximalYogiParameters + */ + public RetrieveTPUEmbeddingProximalYogiParameters retrieveTPUEmbeddingProximalYogiParameters( + Long numShards, Long shardId, RetrieveTPUEmbeddingProximalYogiParameters.Options... options) { + return RetrieveTPUEmbeddingProximalYogiParameters.create(scope, numShards, shardId, options); + } + + /** + * 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. + * + * @param numShards The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of RetrieveTPUEmbeddingRMSPropParameters + */ + public RetrieveTPUEmbeddingRMSPropParameters retrieveTPUEmbeddingRMSPropParameters(Long numShards, + Long shardId, RetrieveTPUEmbeddingRMSPropParameters.Options... options) { + return RetrieveTPUEmbeddingRMSPropParameters.create(scope, numShards, shardId, options); + } + + /** + * 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. + * + * @param numShards The value of the numShards attribute + * @param shardId The value of the shardId attribute + * @param options carries optional attribute values + * @return a new instance of RetrieveTPUEmbeddingStochasticGradientDescentParameters + */ + public RetrieveTPUEmbeddingStochasticGradientDescentParameters retrieveTPUEmbeddingStochasticGradientDescentParameters( + Long numShards, Long shardId, + RetrieveTPUEmbeddingStochasticGradientDescentParameters.Options... options) { + return RetrieveTPUEmbeddingStochasticGradientDescentParameters.create(scope, numShards, shardId, options); + } + + /** + * Performs gradient updates of embedding tables. + * + * @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. + * @param options carries optional attribute values + * @return a new instance of SendTPUEmbeddingGradients + */ + public SendTPUEmbeddingGradients sendTPUEmbeddingGradients(Iterable> inputs, + Iterable> learningRates, String config, + SendTPUEmbeddingGradients.Options... options) { + return SendTPUEmbeddingGradients.create(scope, inputs, learningRates, config, options); + } + + /** + * Shuts down a running distributed TPU system. + * The op returns an error if no system is running. + * + * @return a new instance of ShutdownDistributedTPU + */ + public ShutdownDistributedTPU shutdownDistributedTPU() { + return ShutdownDistributedTPU.create(scope); + } + + /** + * An op that shuts down the TPU system. + * + * @return a new instance of ShutdownTPUSystem + */ + public ShutdownTPUSystem shutdownTPUSystem() { + return ShutdownTPUSystem.create(scope); + } + + /** + * An op splits input deduplication data XLA tuple into integer and floating point + * tensors. + * Deduplication data is an XLA tuple, which consists of integer and floating point + * values. This op is to split these values into two groups for two types, and + * construct each group as one tensor to return. + * + * @param input An XLA tuple including integer and float elements as deduplication data tuple. + * @param integerType integer_tensor type. Allowed types: int32, int64, uint32, uint64. + * @param floatType float_tensor type. Allowed types: half, bfloat16, float. + * @param tupleMask A serialized TensorProto string of output tuple mask. This mask is a 2-D tensor, + * with first column as tuple element type, and second column as span of this type. + * For example, an output tuple of (1, 2, 0.1, 3), its mask is [[0, 2], [1, 1], [0, + * 1]]. We expect only two types of elements: integer(0) and float(1). + * @param options carries optional attribute values + * @param data type for {@code SplitDedupData} output and operands + * @param data type for {@code SplitDedupData} output and operands + * @return a new instance of SplitDedupData + */ + public SplitDedupData splitDedupData( + Operand input, Class integerType, Class floatType, String tupleMask, + SplitDedupData.Options... options) { + return SplitDedupData.create(scope, input, integerType, floatType, tupleMask, options); + } + + /** + * The StoreMinibatchStatisticsInFdo operation + * + * @param programKey The programKey value + * @param maxIds The maxIds value + * @param maxUniques The maxUniques value + * @param sampleCount The value of the sampleCount attribute + * @param numReplica The value of the numReplica attribute + * @param featureWidth The value of the featureWidth attribute + * @param numScPerChip The value of the numScPerChip attribute + * @param tableName The value of the tableName attribute + * @param miniBatchSplits The value of the miniBatchSplits attribute + * @return a new instance of StoreMinibatchStatisticsInFdo + */ + public StoreMinibatchStatisticsInFdo storeMinibatchStatisticsInFdo(Operand programKey, + Operand maxIds, Operand maxUniques, Long sampleCount, Long numReplica, + Long featureWidth, Long numScPerChip, String tableName, String miniBatchSplits) { + return StoreMinibatchStatisticsInFdo.create(scope, programKey, maxIds, maxUniques, sampleCount, numReplica, featureWidth, numScPerChip, tableName, miniBatchSplits); + } + + /** + * The TPUAnnotateTensorsWithDynamicShape operation + * + * @param tensors The tensors value + * @return a new instance of TPUAnnotateTensorsWithDynamicShape + */ + public TPUAnnotateTensorsWithDynamicShape tPUAnnotateTensorsWithDynamicShape( + Iterable> tensors) { + return TPUAnnotateTensorsWithDynamicShape.create(scope, tensors); + } + + /** + * Returns the result of a TPU compilation. + * This operation returns the result of a TPU compilation as a serialized + * CompilationResultProto, which holds a status and an error message if an error + * occurred during compilation. + * + * @deprecated use {@link org.tensorflow.op.tpu.CompilationResult} instead + * @return a new instance of TPUCompilationResult + */ + @Deprecated + public TPUCompilationResult tPUCompilationResult() { + return TPUCompilationResult.create(scope); + } + + /** + * Op that copies host tensor to device with dynamic shape support. + * For internal use only. + * + * @param tensors The tensors value + * @param unpaddedSizes The unpaddedSizes value + * @return a new instance of TPUCopyWithDynamicShape + */ + public TPUCopyWithDynamicShape tPUCopyWithDynamicShape(Iterable> tensors, + Iterable> unpaddedSizes) { + return TPUCopyWithDynamicShape.create(scope, tensors, unpaddedSizes); + } + + /** + * 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. + * + * @deprecated use {@link org.tensorflow.op.tpu.EmbeddingActivations} instead + * @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 + */ + @Deprecated + public TPUEmbeddingActivations tPUEmbeddingActivations(Operand embeddingVariable, + Operand slicedActivations, Long tableId, Long lookupId) { + return TPUEmbeddingActivations.create(scope, embeddingVariable, slicedActivations, tableId, lookupId); + } + + /** + * Metadata indicating how the TPU computation should be replicated. + * This operation holds the metadata common to operations of a {@code tpu.replicate()} computation subgraph. + * + * @deprecated use {@link org.tensorflow.op.tpu.ReplicateMetadata} instead + * @param numReplicas Number of replicas of the computation + * @param options carries optional attribute values + * @return a new instance of TPUReplicateMetadata + */ + @Deprecated + public TPUReplicateMetadata tPUReplicateMetadata(Long numReplicas, + TPUReplicateMetadata.Options... options) { + return TPUReplicateMetadata.create(scope, numReplicas, options); + } + + /** + * Connects N inputs to an N-way replicated TPU computation. + * This operation holds a replicated input to a {@code tpu.replicate()} computation subgraph. + * Each replicated input has the same shape and type alongside the output. + *

For example: + *

+   *  %a = "tf.opA"()
+   *  %b = "tf.opB"()
+   *  %replicated_input = "tf.TPUReplicatedInput"(%a, %b)
+   *  %computation = "tf.Computation"(%replicated_input)
+   *  
+ *

The above computation has a replicated input of two replicas. + * + * @deprecated use {@link org.tensorflow.op.tpu.ReplicatedInput} instead + * @param inputs The inputs value + * @param options carries optional attribute values + * @param data type for {@code TPUReplicatedInput} output and operands + * @return a new instance of TPUReplicatedInput + */ + @Deprecated + public TPUReplicatedInput tPUReplicatedInput(Iterable> inputs, + TPUReplicatedInput.Options... options) { + return TPUReplicatedInput.create(scope, inputs, options); + } + + /** + * Connects N outputs from an N-way replicated TPU computation. + * This operation holds a replicated output from a {@code tpu.replicate()} computation subgraph. + * Each replicated output has the same shape and type alongside the input. + *

For example: + *

+   *  %computation = "tf.Computation"()
+   *  %replicated_output:2 = "tf.TPUReplicatedOutput"(%computation)
+   *  
+ *

The above computation has a replicated output of two replicas. + * + * @deprecated use {@link org.tensorflow.op.tpu.ReplicatedOutput} instead + * @param input The input value + * @param numReplicas The value of the numReplicas attribute + * @param data type for {@code TPUReplicatedOutput} output and operands + * @return a new instance of TPUReplicatedOutput + */ + @Deprecated + public TPUReplicatedOutput tPUReplicatedOutput(Operand input, + Long numReplicas) { + return TPUReplicatedOutput.create(scope, input, numReplicas); + } + + /** + * Op that reshards on-device TPU variables to specified state. + * Op that reshards on-device TPU variables to specified state. Internal use only. + *

The sharding state is represented as the key of the compilation that generated + * the sharding/unsharding programs along with the main program. new_format_key + * specifies the desired state, and format_state_var is the current state of the + * variables. + * + * @param vars The vars value + * @param newFormatKey The newFormatKey value + * @param formatStateVar The formatStateVar value + * @return a new instance of TPUReshardVariables + */ + public TPUReshardVariables tPUReshardVariables(Iterable> vars, + Operand newFormatKey, Operand formatStateVar) { + return TPUReshardVariables.create(scope, vars, newFormatKey, formatStateVar); + } + + /** + * Round-robin load balancing on TPU cores. + * A load balancing op that round-robins among TPU cores. + *

This op round-robins between the integers in [0, NumTPUCoresVisiblePerHost]. It + * is useful for interfacing with TensorFlow ops that take as input a TPU core on + * which to execute computations, such as {@code TPUPartitionedCall}. + *

device_ordinal: An integer in [0, NumTPUCoresVisiblePerHost]. + * + * @return a new instance of TPURoundRobin + */ + public TPURoundRobin tPURoundRobin() { + return TPURoundRobin.create(scope); + } + + /** + * Converts XRT's uid handles to TensorFlow-friendly input format. + * Converts a uid handle for a compiled program into a vector of proto keys. + *

XRT compile ops return uids, and the TensorFlow execute op takes a proto + * key. This op enables a client to compile on TPU using XRT and execute using the + * standard TensorFlow execute op. + *

'uid' is the input handle. + * 'proto_keys' is a vector of proto keys, one for each core program. + * + * @param uid The uid value + * @return a new instance of TpuHandleToProtoKey + */ + public TpuHandleToProtoKey tpuHandleToProtoKey(Operand uid) { + return TpuHandleToProtoKey.create(scope, uid); + } + + /** + * 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. + * + * @param request A string tensor containing a serialized WorkerHeartbeatRequest + * @return a new instance of WorkerHeartbeat + */ + public WorkerHeartbeat workerHeartbeat(Operand request) { + return WorkerHeartbeat.create(scope, request); + } + + /** + * Get the parent {@link Ops} object. + */ + public final Ops ops() { + return ops; + } +} 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 index c73f3d3b5fa..3ee5b8de813 100644 --- 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 @@ -1,15 +1,35 @@ +// Copyright 2020-2022 The TensorFlow Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ============================================================================== +// +// This class has been generated, DO NOT EDIT! +// package org.tensorflow.op; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.ConcreteFunction; import org.tensorflow.Operand; +import org.tensorflow.ndarray.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.ApplyAdaMax; import org.tensorflow.op.train.ApplyAdadelta; import org.tensorflow.op.train.ApplyAdagrad; import org.tensorflow.op.train.ApplyAdagradDa; +import org.tensorflow.op.train.ApplyAdagradV2; import org.tensorflow.op.train.ApplyAdam; import org.tensorflow.op.train.ApplyAddSign; import org.tensorflow.op.train.ApplyCenteredRmsProp; @@ -20,29 +40,42 @@ import org.tensorflow.op.train.ApplyProximalAdagrad; import org.tensorflow.op.train.ApplyProximalGradientDescent; import org.tensorflow.op.train.ApplyRmsProp; +import org.tensorflow.op.train.BatchMatMul; +import org.tensorflow.op.train.ComputeBatchSize; import org.tensorflow.op.train.ConditionalAccumulator; +import org.tensorflow.op.train.DistributedSave; 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.ResourceAccumulatorApplyGradient; +import org.tensorflow.op.train.ResourceAccumulatorNumAccumulated; +import org.tensorflow.op.train.ResourceAccumulatorSetGlobalStep; +import org.tensorflow.op.train.ResourceAccumulatorTakeGradient; +import org.tensorflow.op.train.ResourceApplyAdaMax; 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.ResourceApplyAdamWithAmsgrad; 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.ResourceApplyKerasMomentum; 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.ResourceConditionalAccumulator; import org.tensorflow.op.train.ResourceSparseApplyAdadelta; import org.tensorflow.op.train.ResourceSparseApplyAdagrad; import org.tensorflow.op.train.ResourceSparseApplyAdagradDa; +import org.tensorflow.op.train.ResourceSparseApplyAdagradV2; import org.tensorflow.op.train.ResourceSparseApplyCenteredRmsProp; import org.tensorflow.op.train.ResourceSparseApplyFtrl; +import org.tensorflow.op.train.ResourceSparseApplyKerasMomentum; import org.tensorflow.op.train.ResourceSparseApplyMomentum; import org.tensorflow.op.train.ResourceSparseApplyProximalAdagrad; import org.tensorflow.op.train.ResourceSparseApplyProximalGradientDescent; @@ -52,6 +85,7 @@ import org.tensorflow.op.train.Save; import org.tensorflow.op.train.SaveSlices; import org.tensorflow.op.train.SdcaFprint; +import org.tensorflow.op.train.SdcaOptimizer; import org.tensorflow.op.train.SdcaShrinkL1; import org.tensorflow.op.train.SparseApplyAdadelta; import org.tensorflow.op.train.SparseApplyAdagrad; @@ -62,9 +96,9 @@ import org.tensorflow.op.train.SparseApplyProximalAdagrad; import org.tensorflow.op.train.SparseApplyProximalGradientDescent; import org.tensorflow.op.train.SparseApplyRmsProp; +import org.tensorflow.op.train.SymbolicGradient; import org.tensorflow.op.train.TileGrad; -import org.tensorflow.tools.Shape; -import org.tensorflow.types.TFloat; +import org.tensorflow.types.TFloat32; import org.tensorflow.types.TInt32; import org.tensorflow.types.TInt64; import org.tensorflow.types.TString; @@ -74,146 +108,250 @@ /** * An API for building {@code train} operations as {@link Op Op}s * - * @see {@link Ops} + * @see Ops */ public final class TrainOps { private final Scope scope; - TrainOps(Scope scope) { - this.scope = scope; + private final Ops ops; + + TrainOps(Ops ops) { + this.scope = ops.scope(); + this.ops = ops; + } + + /** + * Applies a gradient to a given accumulator. + * Does not add if local_step is lesser than the accumulator's global_step. + * + * @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 AccumulatorApplyGradient accumulatorApplyGradient(Operand handle, + Operand localStep, Operand gradient) { + return AccumulatorApplyGradient.create(scope, handle, localStep, gradient); + } + + /** + * Returns the number of gradients aggregated in the given accumulators. + * + * @param handle The handle to an accumulator. + * @return a new instance of AccumulatorNumAccumulated + */ + public AccumulatorNumAccumulated accumulatorNumAccumulated(Operand handle) { + return AccumulatorNumAccumulated.create(scope, handle); + } + + /** + * Updates the accumulator with a new value for global_step. + * Logs warning if the accumulator's value is already higher than + * new_global_step. + * + * @param handle The handle to an accumulator. + * @param newGlobalStep The new global_step value to set. + * @return a new instance of AccumulatorSetGlobalStep + */ + public AccumulatorSetGlobalStep accumulatorSetGlobalStep(Operand handle, + Operand newGlobalStep) { + return AccumulatorSetGlobalStep.create(scope, handle, newGlobalStep); + } + + /** + * 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 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. + * @param data type for {@code AccumulatorTakeGradient} output and operands + * @return a new instance of AccumulatorTakeGradient + */ + public AccumulatorTakeGradient accumulatorTakeGradient( + Operand handle, Operand numRequired, Class dtype) { + return AccumulatorTakeGradient.create(scope, handle, numRequired, dtype); } /** - * Builds an {@link SparseApplyFtrl} operation + * 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 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 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 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 + * @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 attribute values + * @param data type for {@code ApplyAdaMax} output and operands + * @return a new instance of ApplyAdaMax */ - 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); + public ApplyAdaMax applyAdaMax(Operand var, Operand m, Operand v, + Operand beta1Power, Operand lr, Operand beta1, Operand beta2, Operand epsilon, + Operand grad, ApplyAdaMax.Options... options) { + return ApplyAdaMax.create(scope, var, m, v, beta1Power, lr, beta1, beta2, epsilon, grad, options); } /** - * Builds an {@link ApplyPowerSign} operation + * 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 var Should be from a Variable(). - * @param m 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 logbase Must be a scalar. - * @param signDecay Must be a scalar. - * @param beta 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 ApplyPowerSign - * @see org.tensorflow.op.train.ApplyPowerSign + * @param options carries optional attribute values + * @param data type for {@code ApplyAdadelta} output and operands + * @return a new instance of ApplyAdadelta */ - 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); + 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 ResourceSparseApplyAdagrad} operation + * Update '*var' according to the adagrad scheme. + * accum += grad * grad + * var -= lr * grad * (1 / sqrt(accum)) * * @param var Should be from a Variable(). * @param accum Should be from a Variable(). - * @param lr Learning rate. Must be a scalar. + * @param lr Scaling 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 ResourceSparseApplyAdagrad - * @see org.tensorflow.op.train.ResourceSparseApplyAdagrad + * @param options carries optional attribute values + * @param data type for {@code ApplyAdagrad} output and operands + * @return a new instance of ApplyAdagrad */ - 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); + 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 ApplyCenteredRmsProp} operation + * Update '*var' according to the proximal adagrad scheme. * * @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 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 rho Decay rate. Must be a scalar. - * @param momentum - * @param epsilon Ridge term. 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 attribute values + * @param data type for {@code ApplyAdagradDA} output and operands + * @return a new instance of 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); + } + + /** + * Update '*var' according to the adagrad scheme. + * accum += grad * grad + * var -= lr * grad * (1 / sqrt(accum)) + * + * @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 ApplyCenteredRmsProp - * @see org.tensorflow.op.train.ApplyCenteredRmsProp + * @param options carries optional attribute values + * @param data type for {@code ApplyAdagradV2} output and operands + * @return a new instance of ApplyAdagradV2 */ - 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); + public ApplyAdagradV2 applyAdagradV2(Operand var, Operand accum, + Operand lr, Operand epsilon, Operand grad, ApplyAdagradV2.Options... options) { + return ApplyAdagradV2.create(scope, var, accum, lr, epsilon, grad, options); } /** - * Builds an {@link ResourceApplyPowerSign} operation + * Update '*var' according to the Adam algorithm. + * $$\text{lr}t := \mathrm{lr} \cdot \frac{\sqrt{1 - \beta_2^t}}{1 - \beta_1^t}$$ + * $$m_t := \beta_1 \cdot m{t-1} + (1 - \beta_1) \cdot g$$ + * $$v_t := \beta_2 \cdot v_{t-1} + (1 - \beta_2) \cdot g^2$$ + * $$\text{var} := \begin{cases} \text{var} - (m_t \beta_1 + g \cdot (1 - \beta_1))\cdot\text{lr}_t/(\sqrt{v_t} + \epsilon), &\text{if use_nesterov}\\ \text{var} - m_t \cdot \text{lr}_t /(\sqrt{v_t} + \epsilon), &\text{otherwise} \end{cases}$$ * * @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 logbase Must be a scalar. - * @param signDecay Must be a scalar. - * @param beta 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 ResourceApplyPowerSign - * @see org.tensorflow.op.train.ResourceApplyPowerSign + * @param options carries optional attribute values + * @param data type for {@code ApplyAdam} output and operands + * @return a new instance of ApplyAdam */ - 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); + 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 ResourceSparseApplyFtrl} operation + * 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 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 m Should be from a Variable(). * @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 + * @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 attribute values + * @param data type for {@code ApplyAddSign} output and operands + * @return a new instance of ApplyAddSign */ - 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); + 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 ResourceApplyCenteredRmsProp} operation + * 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 var Should be from a Variable(). * @param mg Should be from a Variable(). @@ -221,35 +359,42 @@ public ResourceSparseApplyFtrl resourceSpar * @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 momentum Momentum Scale. 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 ResourceApplyCenteredRmsProp - * @see org.tensorflow.op.train.ResourceApplyCenteredRmsProp + * @param options carries optional attribute values + * @param data type for {@code ApplyCenteredRMSProp} output and operands + * @return a new instance of ApplyCenteredRmsProp */ - public ResourceApplyCenteredRmsProp resourceApplyCenteredRmsProp(Operand var, - Operand mg, Operand ms, Operand mom, Operand lr, Operand rho, + public ApplyCenteredRmsProp applyCenteredRmsProp(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); + ApplyCenteredRmsProp.Options... options) { + return ApplyCenteredRmsProp.create(scope, var, mg, ms, mom, lr, rho, momentum, epsilon, grad, options); } /** - * Builds an {@link ApplyFtrl} operation + * Update '*var' according to the Ftrl-proximal scheme. + * grad_with_shrinkage = grad + 2 * l2_shrinkage * var + * accum_new = accum + grad * grad + * 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 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 l1 L1 regularization. Must be a scalar. + * @param l2 L2 shrinkage regularization. Must be a scalar. + * @param l2Shrinkage The l2Shrinkage value * @param lrPower Scaling factor. Must be a scalar. - * @param options carries optional attributes values + * @param options carries optional attribute values + * @param data type for {@code ApplyFtrlV2} output and operands * @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, @@ -258,96 +403,127 @@ public ApplyFtrl applyFtrl(Operand var, Operand accum } /** - * Builds an {@link AccumulatorApplyGradient} operation + * Update '*var' by subtracting 'alpha' * 'delta' from it. * - * @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 + * @param var Should be from a Variable(). + * @param alpha Scaling factor. Must be a scalar. + * @param delta The change. + * @param options carries optional attribute values + * @param data type for {@code ApplyGradientDescent} output and operands + * @return a new instance of ApplyGradientDescent */ - public AccumulatorApplyGradient accumulatorApplyGradient( - Operand handle, Operand localStep, Operand gradient) { - return AccumulatorApplyGradient.create(scope, handle, localStep, gradient); + public ApplyGradientDescent applyGradientDescent(Operand var, + Operand alpha, Operand delta, ApplyGradientDescent.Options... options) { + return ApplyGradientDescent.create(scope, var, alpha, delta, options); } /** - * Builds an {@link SparseApplyRmsProp} operation + * 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 var Should be from a Variable(). - * @param ms Should be from a Variable(). - * @param mom Should be from a Variable(). + * @param accum 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 + * @param momentum Momentum. Must be a scalar. + * @param options carries optional attribute values + * @param data type for {@code ApplyMomentum} output and operands + * @return a new instance of ApplyMomentum */ - 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); + 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 ResourceApplyFtrl} operation + * 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 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 m Should be from a Variable(). * @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 + * @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 attribute values + * @param data type for {@code ApplyPowerSign} output and operands + * @return a new instance of ApplyPowerSign */ - 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); + 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 + * 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 var Should be from a Variable(). * @param accum Should be from a Variable(). - * @param lr Learning rate. Must be a scalar. + * @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 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 + * @param options carries optional attribute values + * @param data type for {@code ApplyProximalAdagrad} output and operands + * @return a new instance of 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); + } + + /** + * 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 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 attribute values + * @param data type for {@code ApplyProximalGradientDescent} output and operands + * @return a new instance of ApplyProximalGradientDescent */ - 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); + 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 ApplyRmsProp} operation + * 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 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 momentum The momentum value * @param epsilon Ridge term. Must be a scalar. * @param grad The gradient. - * @param options carries optional attributes values + * @param options carries optional attribute values + * @param data type for {@code ApplyRMSProp} output and operands * @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, @@ -356,102 +532,178 @@ public ApplyRmsProp applyRmsProp(Operand var, Operand } /** - * Builds an {@link RestoreSlice} operation + * Multiplies slices of two tensors in batches. + * Multiplies all slices of {@code Tensor} {@code x} and {@code 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 {@code adj_x} or {@code adj_y} flag to {@code True}, which are by default {@code False}. + *

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

The output tensor is 2-D or higher with shape {@code [..., 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: {@code train.BatchMatMul} supports broadcasting in the batch dimensions. More + * about broadcasting + * here . * - * @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 + * @param x 2-D or higher with shape {@code [..., r_x, c_x]}. + * @param y 2-D or higher with shape {@code [..., r_y, c_y]}. + * @param Tout If not spcified, Tout is the same type to input type. + * @param options carries optional attribute values + * @param data type for {@code BatchMatMulV3} output and operands + * @return a new instance of BatchMatMul */ - public RestoreSlice restoreSlice(Operand filePattern, - Operand tensorName, Operand shapeAndSlice, DataType dt, - RestoreSlice.Options... options) { - return RestoreSlice.create(scope, filePattern, tensorName, shapeAndSlice, dt, options); + public BatchMatMul batchMatMul(Operand x, + Operand y, Class Tout, BatchMatMul.Options... options) { + return BatchMatMul.create(scope, x, y, Tout, options); } /** - * Builds an {@link ResourceApplyGradientDescent} operation + * Computes the static batch size of a dataset sans partial batches. * - * @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 + * @param inputDataset The inputDataset value + * @return a new instance of ComputeBatchSize */ - public ResourceApplyGradientDescent resourceApplyGradientDescent(Operand var, - Operand alpha, Operand delta, ResourceApplyGradientDescent.Options... options) { - return ResourceApplyGradientDescent.create(scope, var, alpha, delta, options); + public ComputeBatchSize computeBatchSize(Operand inputDataset) { + return ComputeBatchSize.create(scope, inputDataset); } /** - * Builds an {@link SparseApplyAdagradDa} operation + * 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. * - * @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 + * @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 attribute values + * @param data type for {@code ConditionalAccumulator} output and operands + * @return a new instance of ConditionalAccumulator */ - 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); + public ConditionalAccumulator conditionalAccumulator(Class dtype, + Shape shape, ConditionalAccumulator.Options... options) { + return ConditionalAccumulator.create(scope, dtype, shape, options); } /** - * Builds an {@link ApplyAdagrad} operation + * The DistributedSave 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 + * @param dataset The dataset value + * @param directory The directory value + * @param address The address value + * @param options carries optional attribute values + * @return a new instance of DistributedSave */ - public ApplyAdagrad applyAdagrad(Operand var, Operand accum, - Operand lr, Operand grad, ApplyAdagrad.Options... options) { - return ApplyAdagrad.create(scope, var, accum, lr, grad, options); + public DistributedSave distributedSave(Operand dataset, + Operand directory, Operand address, DistributedSave.Options... options) { + return DistributedSave.create(scope, dataset, directory, address, options); } /** - * Builds an {@link SparseApplyProximalGradientDescent} operation + * Given a path to new and old vocabulary files, returns a remapping Tensor of + * length {@code num_new_vocab}, where {@code remapping[i]} contains the row number in the old + * vocabulary that corresponds to row {@code i} in the new vocabulary (starting at line + * {@code new_vocab_offset} and up to {@code num_new_vocab} entities), or {@code -1} if entry {@code i} + * in the new vocabulary is not in the old vocabulary. The old vocabulary is + * constrained to the first {@code old_vocab_size} entries if {@code old_vocab_size} is not the + * default value of -1. + *

{@code 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 {@code new_vocab_file} a text file containing each of the following + * elements on a single line: {@code [f0, f1, f2, f3]}, old_vocab_file = [f1, f0, f3], + * {@code num_new_vocab = 3, new_vocab_offset = 1}, the returned remapping would be + * {@code [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). * - * @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 + * @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 attribute values + * @return a new instance of GenerateVocabRemapping */ - 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); + public GenerateVocabRemapping generateVocabRemapping(Operand newVocabFile, + Operand oldVocabFile, Long newVocabOffset, Long numNewVocab, + GenerateVocabRemapping.Options... options) { + return GenerateVocabRemapping.create(scope, newVocabFile, oldVocabFile, newVocabOffset, numNewVocab, options); + } + + /** + * 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. + *

If allow_missing_files is true, merges the checkpoint prefixes as long as + * at least one file exists. Otherwise, if no files exist, an error will be thrown. + * The default value for allow_missing_files is false. + * + * @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 attribute values + * @return a new instance of MergeV2Checkpoints + */ + public MergeV2Checkpoints mergeV2Checkpoints(Operand checkpointPrefixes, + Operand destinationPrefix, MergeV2Checkpoints.Options... options) { + return MergeV2Checkpoints.create(scope, checkpointPrefixes, destinationPrefix, options); + } + + /** + * Training via negative sampling. + * + * @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 The lr value + * @param vocabCount Count of words in the vocabulary. + * @param numNegativeSamples Number of negative samples per example. + * @return a new instance of 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 PreventGradient} operation + * 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 input any tensor. - * @param options carries optional attributes values + * @param options carries optional attribute values + * @param data type for {@code PreventGradient} output and operands * @return a new instance of PreventGradient - * @see org.tensorflow.op.train.PreventGradient */ public PreventGradient preventGradient(Operand input, PreventGradient.Options... options) { @@ -459,98 +711,223 @@ public PreventGradient preventGradient(Operand input, } /** - * Builds an {@link ResourceSparseApplyAdagradDa} operation + * Applies a gradient to a given accumulator. + * Does not add if local_step is lesser than the accumulator's global_step. + * + * @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 ResourceAccumulatorApplyGradient resourceAccumulatorApplyGradient( + Operand handle, Operand localStep, + Operand gradient) { + return ResourceAccumulatorApplyGradient.create(scope, handle, localStep, gradient); + } + + /** + * Returns the number of gradients aggregated in the given accumulators. + * + * @param handle The handle to an accumulator. + * @return a new instance of ResourceAccumulatorNumAccumulated + */ + public ResourceAccumulatorNumAccumulated resourceAccumulatorNumAccumulated( + Operand handle) { + return ResourceAccumulatorNumAccumulated.create(scope, handle); + } + + /** + * Updates the accumulator with a new value for global_step. + * Logs warning if the accumulator's value is already higher than + * new_global_step. + * + * @param handle The handle to an accumulator. + * @param newGlobalStep The new global_step value to set. + * @return a new instance of ResourceAccumulatorSetGlobalStep + */ + public ResourceAccumulatorSetGlobalStep resourceAccumulatorSetGlobalStep( + Operand handle, Operand newGlobalStep) { + return ResourceAccumulatorSetGlobalStep.create(scope, handle, newGlobalStep); + } + + /** + * 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 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. + * @param data type for {@code ResourceAccumulatorTakeGradient} output and operands + * @return a new instance of ResourceAccumulatorTakeGradient + */ + public ResourceAccumulatorTakeGradient resourceAccumulatorTakeGradient( + Operand handle, Operand numRequired, Class dtype) { + return ResourceAccumulatorTakeGradient.create(scope, handle, numRequired, dtype); + } + + /** + * 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 var Should be from a Variable(). - * @param gradientAccumulator Should be from a Variable(). - * @param gradientSquaredAccumulator 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 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 + * @param options carries optional attribute values + * @param data type for {@code ResourceApplyAdaMax} output and operands + * @return a new instance of ResourceApplyAdaMax */ - 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); + public ResourceApplyAdaMax resourceApplyAdaMax(Operand var, + Operand m, Operand v, Operand beta1Power, Operand lr, + Operand beta1, Operand beta2, Operand epsilon, Operand grad, + ResourceApplyAdaMax.Options... options) { + return ResourceApplyAdaMax.create(scope, var, m, v, beta1Power, lr, beta1, beta2, epsilon, grad, options); } /** - * Builds an {@link ApplyProximalGradientDescent} operation + * 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 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 + * @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 attribute values + * @param data type for {@code ResourceApplyAdadelta} output and operands + * @return a new instance of ResourceApplyAdadelta */ - 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); + 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 GenerateVocabRemapping} operation + * Update '*var' according to the adagrad scheme. + * accum += grad * grad + * var -= lr * grad * (1 / (sqrt(accum) + epsilon)) * - * @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 + * @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 attribute values + * @param data type for {@code ResourceApplyAdagradV2} output and operands + * @return a new instance of ResourceApplyAdagrad */ - public GenerateVocabRemapping generateVocabRemapping(Operand newVocabFile, - Operand oldVocabFile, Long newVocabOffset, Long numNewVocab, - GenerateVocabRemapping.Options... options) { - return GenerateVocabRemapping.create(scope, newVocabFile, oldVocabFile, newVocabOffset, numNewVocab, options); + public ResourceApplyAdagrad resourceApplyAdagrad(Operand var, + Operand accum, Operand lr, Operand epsilon, Operand grad, + ResourceApplyAdagrad.Options... options) { + return ResourceApplyAdagrad.create(scope, var, accum, lr, epsilon, grad, options); } /** - * Builds an {@link ResourceApplyProximalGradientDescent} operation + * Update '*var' according to the proximal adagrad scheme. * * @param var Should be from a Variable(). - * @param alpha Scaling factor. Must be a scalar. + * @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 delta The change. - * @param options carries optional attributes values - * @return a new instance of ResourceApplyProximalGradientDescent - * @see org.tensorflow.op.train.ResourceApplyProximalGradientDescent + * @param globalStep Training step number. Must be a scalar. + * @param options carries optional attribute values + * @param data type for {@code ResourceApplyAdagradDA} output and operands + * @return a new instance of ResourceApplyAdagradDa */ - 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); + 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 Save} operation + * Update '*var' according to the Adam algorithm. + * $$\text{lr}t := \mathrm{lr} \cdot \frac{\sqrt{1 - \beta_2^t}}{1 - \beta_1^t}$$ + * $$m_t := \beta_1 \cdot m{t-1} + (1 - \beta_1) \cdot g$$ + * $$v_t := \beta_2 \cdot v_{t-1} + (1 - \beta_2) \cdot g^2$$ + * $$\text{var} := \begin{cases} \text{var} - (m_t \beta_1 + g \cdot (1 - \beta_1))\cdot\text{lr}_t/(\sqrt{v_t} + \epsilon), &\text{if use_nesterov}\\ \text{var} - m_t \cdot \text{lr}_t /(\sqrt{v_t} + \epsilon), &\text{otherwise} \end{cases}$$ * - * @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 + * @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 attribute values + * @param data type for {@code ResourceApplyAdam} output and operands + * @return a new instance of ResourceApplyAdam */ - public Save save(Operand prefix, Operand tensorNames, - Operand shapeAndSlices, Iterable> tensors) { - return Save.create(scope, prefix, tensorNames, shapeAndSlices, tensors); + 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 ResourceApplyAddSign} operation + * Update '*var' according to the Adam algorithm. + * $$\text{lr}t := \mathrm{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$$ + * $$\hat{v}t := max{\hat{v}{t-1}, v_t}$$ + * $$\text{variable} := \text{variable} - \text{lr}_t * m_t / (\sqrt{\hat{v}_t} + \epsilon)$$ + * + * @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 attribute values + * @param data type for {@code ResourceApplyAdamWithAmsgrad} output and operands + * @return a new instance of 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); + } + + /** + * 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 var Should be from a Variable(). * @param m Should be from a Variable(). @@ -559,109 +936,263 @@ public Save save(Operand prefix, Operand tensorNames, * @param signDecay Must be a scalar. * @param beta Must be a scalar. * @param grad The gradient. - * @param options carries optional attributes values + * @param options carries optional attribute values + * @param data type for {@code ResourceApplyAddSign} output and operands * @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) { + 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 SaveSlices} operation + * 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 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 + * @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 Momentum Scale. Must be a scalar. + * @param epsilon Ridge term. Must be a scalar. + * @param grad The gradient. + * @param options carries optional attribute values + * @param data type for {@code ResourceApplyCenteredRMSProp} output and operands + * @return a new instance of ResourceApplyCenteredRmsProp */ - public SaveSlices saveSlices(Operand filename, Operand tensorNames, - Operand shapesAndSlices, Iterable> data) { - return SaveSlices.create(scope, filename, tensorNames, shapesAndSlices, data); + 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 Restore} operation + * Update '*var' according to the Ftrl-proximal scheme. + * accum_new = accum + grad * grad + * grad_with_shrinkage = grad + 2 * l2_shrinkage * var + * 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 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 + * @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 regularization. Must be a scalar. + * @param l2 L2 shrinkage regularization. Must be a scalar. + * @param l2Shrinkage The l2Shrinkage value + * @param lrPower Scaling factor. Must be a scalar. + * @param options carries optional attribute values + * @param data type for {@code ResourceApplyFtrlV2} output and operands + * @return a new instance of ResourceApplyFtrl */ - public Restore restore(Operand prefix, Operand tensorNames, - Operand shapeAndSlices, List> dtypes) { - return Restore.create(scope, prefix, tensorNames, shapeAndSlices, dtypes); + 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 AccumulatorSetGlobalStep} operation + * Update '*var' by subtracting 'alpha' * 'delta' from it. * - * @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 + * @param var Should be from a Variable(). + * @param alpha Scaling factor. Must be a scalar. + * @param delta The change. + * @param options carries optional attribute values + * @param data type for {@code ResourceApplyGradientDescent} output and operands + * @return a new instance of ResourceApplyGradientDescent */ - public AccumulatorSetGlobalStep accumulatorSetGlobalStep(Operand handle, - Operand newGlobalStep) { - return AccumulatorSetGlobalStep.create(scope, handle, newGlobalStep); + public ResourceApplyGradientDescent resourceApplyGradientDescent( + Operand var, Operand alpha, Operand delta, + ResourceApplyGradientDescent.Options... options) { + return ResourceApplyGradientDescent.create(scope, var, alpha, delta, options); } /** - * Builds an {@link MergeV2Checkpoints} operation + * 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 * - * @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 + * @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 attribute values + * @param data type for {@code ResourceApplyKerasMomentum} output and operands + * @return a new instance of ResourceApplyKerasMomentum */ - public MergeV2Checkpoints mergeV2Checkpoints(Operand checkpointPrefixes, - Operand destinationPrefix, MergeV2Checkpoints.Options... options) { - return MergeV2Checkpoints.create(scope, checkpointPrefixes, destinationPrefix, options); + 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 AccumulatorNumAccumulated} operation + * 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 handle The handle to an accumulator. - * @return a new instance of AccumulatorNumAccumulated - * @see org.tensorflow.op.train.AccumulatorNumAccumulated + * @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 attribute values + * @param data type for {@code ResourceApplyMomentum} output and operands + * @return a new instance of ResourceApplyMomentum */ - public AccumulatorNumAccumulated accumulatorNumAccumulated(Operand handle) { - return AccumulatorNumAccumulated.create(scope, handle); + 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); + } + + /** + * 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 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 attribute values + * @param data type for {@code ResourceApplyPowerSign} output and operands + * @return a new instance of 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); + } + + /** + * 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 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 attribute values + * @param data type for {@code ResourceApplyProximalAdagrad} output and operands + * @return a new instance of 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 ResourceApplyRmsProp} operation + * 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 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 attribute values + * @param data type for {@code ResourceApplyProximalGradientDescent} output and operands + * @return a new instance of 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); + } + + /** + * 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 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 momentum The momentum value * @param epsilon Ridge term. Must be a scalar. * @param grad The gradient. - * @param options carries optional attributes values + * @param options carries optional attribute values + * @param data type for {@code ResourceApplyRMSProp} output and operands * @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) { + 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 SparseApplyAdadelta} operation + * 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. + * + * @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 attribute values + * @param data type for {@code ResourceConditionalAccumulator} output and operands + * @return a new instance of ResourceConditionalAccumulator + */ + public ResourceConditionalAccumulator resourceConditionalAccumulator( + Class dtype, Shape shape, ResourceConditionalAccumulator.Options... options) { + return ResourceConditionalAccumulator.create(scope, dtype, shape, options); + } + + /** + * var: Should be from a Variable(). * - * @param var + * @param var The var value * @param accum Should be from a Variable(). * @param accumUpdate : Should be from a Variable(). * @param lr Learning rate. Must be a scalar. @@ -669,117 +1200,187 @@ public ResourceApplyRmsProp resourceApplyRmsProp(Operand va * @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 + * @param options carries optional attribute values + * @param data type for {@code ResourceSparseApplyAdadelta} output and operands + * @return a new instance of ResourceSparseApplyAdadelta */ - 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); + 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 SparseApplyCenteredRmsProp} operation + * 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 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 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, ms and mom. - * @param options carries optional attributes values - * @return a new instance of SparseApplyCenteredRmsProp - * @see org.tensorflow.op.train.SparseApplyCenteredRmsProp + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attribute values + * @param data type for {@code ResourceSparseApplyAdagrad} output and operands + * @return a new instance of ResourceSparseApplyAdagrad */ - 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); + 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 ApplyAdadelta} operation + * Update entries in '*var' and '*accum' according to the proximal adagrad scheme. + * + * @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 attribute values + * @param data type for {@code ResourceSparseApplyAdagradDA} output and operands + * @return a new instance of 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); + } + + /** + * 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 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 lr Learning rate. 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 + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attribute values + * @param data type for {@code ResourceSparseApplyAdagradV2} output and operands + * @return a new instance of ResourceSparseApplyAdagradV2 */ - 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); + public ResourceSparseApplyAdagradV2 resourceSparseApplyAdagradV2( + Operand var, Operand accum, Operand lr, + Operand epsilon, Operand grad, Operand indices, + ResourceSparseApplyAdagradV2.Options... options) { + return ResourceSparseApplyAdagradV2.create(scope, var, accum, lr, epsilon, grad, indices, options); } /** - * Builds an {@link TileGrad} operation + * 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 input - * @param multiples - * @return a new instance of TileGrad - * @see org.tensorflow.op.train.TileGrad + * @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 The momentum value + * @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 attribute values + * @param data type for {@code ResourceSparseApplyCenteredRMSProp} output and operands + * @return a new instance of ResourceSparseApplyCenteredRmsProp */ - public TileGrad tileGrad(Operand input, Operand multiples) { - return TileGrad.create(scope, input, multiples); + 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 ResourceSparseApplyProximalAdagrad} operation + * 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 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 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 options carries optional attributes values - * @return a new instance of ResourceSparseApplyProximalAdagrad - * @see org.tensorflow.op.train.ResourceSparseApplyProximalAdagrad + * @param lr Scaling factor. Must be a scalar. + * @param l1 L1 regularization. Must be a scalar. + * @param l2 L2 shrinkage regularization. Must be a scalar. + * @param l2Shrinkage The l2Shrinkage value + * @param lrPower Scaling factor. Must be a scalar. + * @param options carries optional attribute values + * @param data type for {@code ResourceSparseApplyFtrlV2} output and operands + * @return a new instance of ResourceSparseApplyFtrl */ - 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); + 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 ApplyAdagradDa} operation + * 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 * * @param var Should be from a Variable(). - * @param gradientAccumulator Should be from a Variable(). - * @param gradientSquaredAccumulator 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 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 + * @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 attribute values + * @param data type for {@code ResourceSparseApplyKerasMomentum} output and operands + * @return a new instance of ResourceSparseApplyKerasMomentum */ - 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); + 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 ResourceSparseApplyMomentum} operation + * 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 var Should be from a Variable(). * @param accum Should be from a Variable(). @@ -787,240 +1388,363 @@ public ApplyAdagradDa applyAdagradDa(Operand var, * @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 + * @param options carries optional attribute values + * @param data type for {@code ResourceSparseApplyMomentum} output and operands * @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) { + 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 ResourceApplyProximalAdagrad} operation + * 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 var Should be from a Variable(). * @param accum Should be from a Variable(). - * @param lr Scaling factor. Must be a scalar. + * @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 options carries optional attributes values - * @return a new instance of ResourceApplyProximalAdagrad - * @see org.tensorflow.op.train.ResourceApplyProximalAdagrad + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attribute values + * @param data type for {@code ResourceSparseApplyProximalAdagrad} output and operands + * @return a new instance of ResourceSparseApplyProximalAdagrad */ - 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); + 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 NegTrain} operation + * 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 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 + * @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 attribute values + * @param data type for {@code ResourceSparseApplyProximalGradientDescent} output and operands + * @return a new instance of ResourceSparseApplyProximalGradientDescent */ - 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); + 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 SdcaShrinkL1} operation + * 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 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 + * @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 The momentum value + * @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 attribute values + * @param data type for {@code ResourceSparseApplyRMSProp} output and operands + * @return a new instance of 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); + } + + /** + * 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. + * + * @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 SdcaShrinkL1 sdcaShrinkL1(Iterable> weights, Float l1, Float l2) { - return SdcaShrinkL1.create(scope, weights, l1, l2); + public Restore restore(Operand prefix, Operand tensorNames, + Operand shapeAndSlices, List> dtypes) { + return Restore.create(scope, prefix, tensorNames, shapeAndSlices, dtypes); } /** - * Builds an {@link ConditionalAccumulator} operation + * Restores a tensor from checkpoint files. + * This is like {@code Restore} except that restored tensor can be listed as filling + * only a slice of a larger tensor. {@code shape_and_slice} specifies the shape of the + * larger tensor and the slice that the restored tensor covers. + *

The {@code shape_and_slice} input has the same format as the + * elements of the {@code shapes_and_slices} input of the {@code SaveSlices} op. * - * @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 + * @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 attribute values + * @param data type for {@code RestoreSlice} output and operands + * @return a new instance of RestoreSlice */ - public ConditionalAccumulator conditionalAccumulator(DataType dtype, - Shape shape, ConditionalAccumulator.Options... options) { - return ConditionalAccumulator.create(scope, dtype, shape, options); + 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 SparseApplyProximalAdagrad} operation + * 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. * - * @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 + * @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 {@code N} tensors to save. + * @return a new instance of Save */ - 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); + public Save save(Operand prefix, Operand tensorNames, + Operand shapeAndSlices, Iterable> tensors) { + return Save.create(scope, prefix, tensorNames, shapeAndSlices, tensors); } /** - * Builds an {@link ApplyAdam} operation + * Saves input tensors slices to disk. + * This is like {@code Save} except that tensors can be listed in the saved file as being + * a slice of a larger tensor. {@code shapes_and_slices} specifies the shape of the + * larger tensor and the slice that this tensor covers. {@code shapes_and_slices} must + * have as many elements as {@code tensor_names}. + *

Elements of the {@code shapes_and_slices} input must either be: + *

    + *
  • The empty string, in which case the corresponding tensor is + * saved normally.
  • + *
  • A string of the form {@code dim0 dim1 ... dimN-1 slice-spec} where the + * {@code dimI} are the dimensions of the larger tensor and {@code slice-spec} + * specifies what part is covered by the tensor to save.
  • + *
+ *

{@code slice-spec} itself is a {@code :}-separated list: {@code slice0:slice1:...:sliceN-1} + * where each {@code sliceI} is either: + *

    + *
  • The string {@code -} meaning that the slice covers all indices of this dimension
  • + *
  • {@code start,length} where {@code start} and {@code length} are integers. In that + * case the slice covers {@code length} indices starting at {@code start}.
  • + *
+ *

See also {@code Save}. * - * @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 + * @param filename Must have a single element. The name of the file to which we write the + * tensor. + * @param tensorNames Shape {@code [N]}. The names of the tensors to be saved. + * @param shapesAndSlices Shape {@code [N]}. The shapes and slice specifications to use when + * saving the tensors. + * @param data {@code N} tensors to save. + * @return a new instance of SaveSlices */ - 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); + public SaveSlices saveSlices(Operand filename, Operand tensorNames, + Operand shapesAndSlices, Iterable> data) { + return SaveSlices.create(scope, filename, tensorNames, shapesAndSlices, data); } /** - * Builds an {@link ResourceApplyAdagrad} operation + * Computes fingerprints of the input strings. * - * @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 + * @param input vector of strings to compute fingerprints on. + * @return a new instance of SdcaFprint */ - public ResourceApplyAdagrad resourceApplyAdagrad(Operand var, - Operand accum, Operand lr, Operand grad, ResourceApplyAdagrad.Options... options) { - return ResourceApplyAdagrad.create(scope, var, accum, lr, grad, options); + public SdcaFprint sdcaFprint(Operand input) { + return SdcaFprint.create(scope, input); } /** - * Builds an {@link ApplyProximalAdagrad} operation + * 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 .
+ * 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 .
+ * Chenxin Ma, Virginia Smith, Martin Jaggi, Michael I. Jordan, + * Peter Richtarik, Martin Takac. 2015 + *

Stochastic Dual Coordinate Ascent with Adaptive Probabilities .
+ * Dominik Csiba, Zheng Qu, Peter Richtarik. 2015 * - * @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 + * @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 attribute values + * @return a new instance of SdcaOptimizer */ - 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); + public SdcaOptimizer sdcaOptimizer(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, + SdcaOptimizer.Options... options) { + return SdcaOptimizer.create(scope, sparseExampleIndices, sparseFeatureIndices, sparseFeatureValues, denseFeatures, exampleWeights, exampleLabels, sparseIndices, sparseWeights, denseWeights, exampleStateData, lossType, l1, l2, numLossPartitions, numInnerIterations, options); } /** - * Builds an {@link ResourceApplyAdam} operation + * Applies L1 regularization shrink step on the parameters. * - * @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 + * @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 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); + public SdcaShrinkL1 sdcaShrinkL1(Iterable> weights, Float l1, Float l2) { + return SdcaShrinkL1.create(scope, weights, l1, l2); } /** - * Builds an {@link ResourceSparseApplyProximalGradientDescent} operation + * var: Should be from a Variable(). * - * @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 var The var value + * @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 ResourceSparseApplyProximalGradientDescent - * @see org.tensorflow.op.train.ResourceSparseApplyProximalGradientDescent + * @param options carries optional attribute values + * @param data type for {@code SparseApplyAdadelta} output and operands + * @return a new instance of SparseApplyAdadelta */ - 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); + 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 ResourceApplyAdadelta} operation + * 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 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 lr Learning rate. 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 + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attribute values + * @param data type for {@code SparseApplyAdagradV2} output and operands + * @return a new instance of SparseApplyAdagrad */ - 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); + public SparseApplyAdagrad sparseApplyAdagrad(Operand var, + Operand accum, Operand lr, Operand epsilon, Operand grad, + Operand indices, SparseApplyAdagrad.Options... options) { + return SparseApplyAdagrad.create(scope, var, accum, lr, epsilon, grad, indices, options); } /** - * Builds an {@link ResourceApplyMomentum} operation + * Update entries in '*var' and '*accum' according to the proximal adagrad scheme. * * @param var Should be from a Variable(). - * @param accum Should be from a Variable(). - * @param lr Scaling factor. Must be a scalar. + * @param gradientAccumulator Should be from a Variable(). + * @param gradientSquaredAccumulator Should be from a Variable(). * @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 + * @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 attribute values + * @param data type for {@code SparseApplyAdagradDA} output and operands + * @return a new instance of SparseApplyAdagradDa */ - 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); + 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 ResourceSparseApplyCenteredRmsProp} operation + * 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 var Should be from a Variable(). * @param mg Should be from a Variable(). @@ -1028,181 +1752,198 @@ public ResourceApplyMomentum resourceApplyMomentum(Operand * @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 momentum The momentum value * @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 + * @param options carries optional attribute values + * @param data type for {@code SparseApplyCenteredRMSProp} output and operands + * @return a new instance of SparseApplyCenteredRmsProp */ - 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); + 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 ApplyAddSign} operation + * 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 * grad + * 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 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 accum Should be from a Variable(). + * @param linear Should be from a Variable(). * @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 SdcaFprint} operation - * - * @param input vector of strings to compute fingerprints on. - * @return a new instance of SdcaFprint - * @see org.tensorflow.op.train.SdcaFprint + * @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 regularization. Must be a scalar. + * @param l2Shrinkage The l2Shrinkage value + * @param lrPower Scaling factor. Must be a scalar. + * @param options carries optional attribute values + * @param data type for {@code SparseApplyFtrlV2} output and operands + * @return a new instance of SparseApplyFtrl */ - public SdcaFprint sdcaFprint(Operand input) { - return SdcaFprint.create(scope, input); + 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 ResourceSparseApplyRmsProp} operation + * 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 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 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, ms and mom. - * @param options carries optional attributes values - * @return a new instance of ResourceSparseApplyRmsProp - * @see org.tensorflow.op.train.ResourceSparseApplyRmsProp + * @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 attribute values + * @param data type for {@code SparseApplyMomentum} output and operands + * @return a new instance of SparseApplyMomentum */ - 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); + 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 ApplyMomentum} operation + * 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 var Should be from a Variable(). * @param accum Should be from a Variable(). - * @param lr Scaling factor. Must be a scalar. + * @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 momentum Momentum. Must be a scalar. - * @param options carries optional attributes values - * @return a new instance of ApplyMomentum - * @see org.tensorflow.op.train.ApplyMomentum + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attribute values + * @param data type for {@code SparseApplyProximalAdagrad} output and operands + * @return a new instance of SparseApplyProximalAdagrad */ - 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); + 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 ResourceApplyAdagradDa} operation + * 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 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 alpha 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 + * @param grad The gradient. + * @param indices A vector of indices into the first dimension of var and accum. + * @param options carries optional attribute values + * @param data type for {@code SparseApplyProximalGradientDescent} output and operands + * @return a new instance of SparseApplyProximalGradientDescent */ - 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); + 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 SparseApplyMomentum} operation + * 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 var Should be from a Variable(). - * @param accum Should be from a Variable(). - * @param lr Learning rate. Must be a scalar. + * @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 The momentum value + * @param epsilon Ridge term. 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 + * @param indices A vector of indices into the first dimension of var, ms and mom. + * @param options carries optional attribute values + * @param data type for {@code SparseApplyRMSProp} output and operands + * @return a new instance of SparseApplyRmsProp */ - 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); + 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 AccumulatorTakeGradient} operation + * Computes the gradient function for function f via backpropagation. * - * @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 + * @param input a list of input tensors of size N + M; + * @param Tout the type list for the input list. + * @param f The function we want to compute the gradient for. + *

The function 'f' must be a numerical function which takes N inputs and + * produces M outputs. Its gradient function 'g', which is computed by + * this SymbolicGradient op is a function taking N + M inputs and + * produces N outputs. + *

I.e. if we have + * (y1, y2, ..., y_M) = f(x1, x2, ..., x_N), + * then, g is + * (dL/dx1, dL/dx2, ..., dL/dx_N) = g(x1, x2, ..., x_N, + * dL/dy1, dL/dy2, ..., dL/dy_M), + *

where L is a scalar-value function of (x1, x2, ..., xN) (e.g., the + * loss function). dL/dx_i is the partial derivative of L with respect + * to x_i. + *

(Needs some math expert to say the comment above better.) + * @return a new instance of SymbolicGradient */ - public AccumulatorTakeGradient accumulatorTakeGradient( - Operand handle, Operand numRequired, DataType dtype) { - return AccumulatorTakeGradient.create(scope, handle, numRequired, dtype); + public SymbolicGradient symbolicGradient(Iterable> input, + List> Tout, ConcreteFunction f) { + return SymbolicGradient.create(scope, input, Tout, f); } /** - * Builds an {@link ResourceSparseApplyAdadelta} operation + * Returns the gradient of {@code Tile}. + * Since {@code Tile} takes an input and repeats the input {@code multiples} times + * along each dimension, {@code train.TileGrad} takes in {@code multiples} and aggregates + * each repeated tile of {@code input} into {@code output}. * - * @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 + * @param input The input value + * @param multiples The multiples value + * @param data type for {@code TileGrad} output and operands + * @return a new instance of TileGrad */ - 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); + public TileGrad tileGrad(Operand input, Operand multiples) { + return TileGrad.create(scope, input, multiples); } /** - * 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 + * Get the parent {@link Ops} object. */ - public ApplyGradientDescent applyGradientDescent(Operand var, - Operand alpha, Operand delta, ApplyGradientDescent.Options... options) { - return ApplyGradientDescent.create(scope, var, alpha, delta, options); + public final Ops ops() { + return ops; } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/XlaOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/XlaOps.java new file mode 100644 index 00000000000..38961e1570a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/XlaOps.java @@ -0,0 +1,837 @@ +// Copyright 2020-2022 The TensorFlow Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ============================================================================== +// +// This class has been generated, DO NOT EDIT! +// +package org.tensorflow.op; + +import java.util.List; +import org.tensorflow.ConcreteFunction; +import org.tensorflow.Operand; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.xla.AssignVariableConcatND; +import org.tensorflow.op.xla.ConcatND; +import org.tensorflow.op.xla.ReadVariableSplitND; +import org.tensorflow.op.xla.SplitND; +import org.tensorflow.op.xla.XlaHostCompute; +import org.tensorflow.op.xla.XlaRecvFromHost; +import org.tensorflow.op.xla.XlaSendToHost; +import org.tensorflow.op.xla.XlaSparseActivationsUnstack; +import org.tensorflow.op.xla.XlaSparseCoreAdagrad; +import org.tensorflow.op.xla.XlaSparseCoreAdagradMomentum; +import org.tensorflow.op.xla.XlaSparseCoreAdam; +import org.tensorflow.op.xla.XlaSparseCoreFtrl; +import org.tensorflow.op.xla.XlaSparseCoreSgd; +import org.tensorflow.op.xla.XlaSparseDenseMatmul; +import org.tensorflow.op.xla.XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdagradAndCsrInput; +import org.tensorflow.op.xla.XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdagradMomentumAndCsrInput; +import org.tensorflow.op.xla.XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdamAndCsrInput; +import org.tensorflow.op.xla.XlaSparseDenseMatmulCustomCombinerOnTcGradWithCsrInput; +import org.tensorflow.op.xla.XlaSparseDenseMatmulCustomCombinerOnTcGradWithFtrlAndCsrInput; +import org.tensorflow.op.xla.XlaSparseDenseMatmulGradWithAdagradAndCsrInput; +import org.tensorflow.op.xla.XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInput; +import org.tensorflow.op.xla.XlaSparseDenseMatmulGradWithAdamAndCsrInput; +import org.tensorflow.op.xla.XlaSparseDenseMatmulGradWithFtrlAndCsrInput; +import org.tensorflow.op.xla.XlaSparseDenseMatmulGradWithSgdAndCsrInput; +import org.tensorflow.op.xla.XlaSparseDenseMatmulWithCsrInput; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TNumber; +import org.tensorflow.types.family.TType; + +/** + * An API for building {@code xla} operations as {@link Op Op}s + * + * @see Ops + */ +public final class XlaOps { + private final Scope scope; + + private final Ops ops; + + XlaOps(Ops ops) { + this.scope = ops.scope(); + this.ops = ops; + } + + /** + * Concats input tensor across all dimensions. + * An op which merges slices the input tensor based on the given num_splits + * attribute, strips paddings optionally, and writes the merged tensor without + * paddings to the resource variable. + *

This op may be generated via the TPU bridge. + *

For example, with {@code input} tensor: + *

+   *  [[0, 1],
+   *   [4, 5]]
+   *  [[2, 3],
+   *   [6, 7]]
+   *  [[8, 9],
+   *   [12, 13]]
+   *  [[10, 11],
+   *   [14, 15]]
+   *  
+ *

{@code num_splits}: + *

+   *  [2, 2]
+   *  
+ *

and {@code paddings}: + *

+   *  [1, 1]
+   *  
+ *

the expected {@code outputs} is: + *

+   *  [[0, 1, 2],
+   *   [4, 5, 6],
+   *   [8, 9, 10]]
+   *  
+ * + * @param resource Resource variable for concatenated input tensors across all dimensions. + * @param inputs Input tensor slices in row-major order to merge across all dimensions. All + * inputs must have the same shape. + * @param numConcats Number of ways to merge per dimension. + * @param options carries optional attribute values + * @return a new instance of AssignVariableConcatND + */ + public AssignVariableConcatND assignVariableConcatND(Operand resource, + Iterable> inputs, List numConcats, + AssignVariableConcatND.Options... options) { + return AssignVariableConcatND.create(scope, resource, inputs, numConcats, options); + } + + /** + * Concats input tensor across all dimensions. + * An op which merges slices the input tensor based on the given num_splits + * attribute, strips paddings optionally, and returns the merged tensor without + * paddings. + *

This op may be generated via the TPU bridge. + *

For example, with {@code input} tensor: + *

+   *  [[0, 1],
+   *   [4, 5]]
+   *  [[2, 3],
+   *   [6, 7]]
+   *  [[8, 9],
+   *   [12, 13]]
+   *  [[10, 11],
+   *   [14, 15]]
+   *  
+ *

{@code num_splits}: + *

+   *  [2, 2]
+   *  
+ *

and {@code paddings}: + *

+   *  [1, 1]
+   *  
+ *

the expected {@code outputs} is: + *

+   *  [[0, 1, 2],
+   *   [4, 5, 6],
+   *   [8, 9, 10]]
+   *  
+ * + * @param inputs Input tensor slices in row-major order to merge across all dimensions. All + * inputs must have the same shape. + * @param numConcats Number of ways to merge per dimension. + * @param options carries optional attribute values + * @param data type for {@code XlaConcatND} output and operands + * @return a new instance of ConcatND + */ + public ConcatND concatND(Iterable> inputs, List numConcats, + ConcatND.Options... options) { + return ConcatND.create(scope, inputs, numConcats, options); + } + + /** + * Splits resource variable input tensor across all dimensions. + * An op which splits the resource variable input tensor based on the given + * num_splits attribute, pads slices optionally, and returned the slices. Slices + * are returned in row-major order. + *

This op may be generated via the TPU bridge. + *

For example, with {@code input} tensor: + *

+   *  [[0, 1, 2],
+   *   [3, 4, 5],
+   *   [6, 7, 8]]
+   *  
+ *

{@code num_splits}: + *

+   *  [2, 2]
+   *  
+ *

and {@code paddings}: + *

+   *  [1, 1]
+   *  
+ *

the expected {@code outputs} is: + *

+   *  [[0, 1],
+   *   [3, 4]]
+   *  [[2, 0],
+   *   [5, 0]]
+   *  [[6, 7],
+   *   [0, 0]]
+   *  [[8, 0],
+   *   [0, 0]]
+   *  
+ * + * @param resource Resource variable of input tensor to split across all dimensions. + * @param T The value of the T attribute + * @param N The value of the N attribute + * @param numSplits Number of ways to split per dimension. Shape dimensions must be evenly + * divisible. + * @param options carries optional attribute values + * @param data type for {@code ReadVariableXlaSplitND} output and operands + * @return a new instance of ReadVariableSplitND + */ + public ReadVariableSplitND readVariableSplitND( + Operand resource, Class T, Long N, List numSplits, + ReadVariableSplitND.Options... options) { + return ReadVariableSplitND.create(scope, resource, T, N, numSplits, options); + } + + /** + * Splits input tensor across all dimensions. + * An op which slices the input tensor based on the given num_splits attribute, + * pads slices optionally, and returned the slices. Slices are returned in + * row-major order. + *

This op may be generated via the TPU bridge. + *

For example, with {@code input} tensor: + *

+   *  [[0, 1, 2],
+   *   [3, 4, 5],
+   *   [6, 7, 8]]
+   *  
+ *

{@code num_splits}: + *

+   *  [2, 2]
+   *  
+ *

and {@code paddings}: + *

+   *  [1, 1]
+   *  
+ *

the expected {@code outputs} is: + *

+   *  [[0, 1],
+   *   [3, 4]]
+   *  [[2, 0],
+   *   [5, 0]]
+   *  [[6, 7],
+   *   [0, 0]]
+   *  [[8, 0],
+   *   [0, 0]]
+   *  
+ * + * @param input Input tensor to split across all dimensions. + * @param N The value of the N attribute + * @param numSplits Number of ways to split per dimension. Shape dimensions must be evenly + * divisible. + * @param options carries optional attribute values + * @param data type for {@code XlaSplitND} output and operands + * @return a new instance of SplitND + */ + public SplitND splitND(Operand input, Long N, List numSplits, + SplitND.Options... options) { + return SplitND.create(scope, input, N, numSplits, options); + } + + /** + * A pseudo-op to represent host-side computation in an XLA program. + * + * @param inputs A list of tensors that will be sent to the host. + * @param Toutputs The element types of each element in {@code outputs}. + * @param ancestors A list of names of HostCompute computations that must be + * sequenced before this computation. + * @param shapes If shape_inference_graph is empty, a list of the shapes of {@code outputs}. + * @param shapeInferenceGraph If non-empty, a serialized GraphDef representing a graph + * that must be analyzed at compile time to determine the shapes of the outputs. + * @param key A unique identifier for this region used to match up host transfers. + * @param options carries optional attribute values + * @return a new instance of XlaHostCompute + */ + public XlaHostCompute xlaHostCompute(Iterable> inputs, + List> Toutputs, List ancestors, List shapes, + ConcreteFunction shapeInferenceGraph, String key, XlaHostCompute.Options... options) { + return XlaHostCompute.create(scope, inputs, Toutputs, ancestors, shapes, shapeInferenceGraph, key, options); + } + + /** + * An op to receive a tensor from the host. + * output: the tensor that will be received from the host. + * Toutput: element type for output. + * shape: shape for output. + * key: A unique identifier for this region used to match up host transfers. + * + * @param Toutput The value of the Toutput attribute + * @param shape The value of the shape attribute + * @param key The value of the key attribute + * @param data type for {@code XlaRecvFromHost} output and operands + * @return a new instance of XlaRecvFromHost + */ + public XlaRecvFromHost xlaRecvFromHost(Class Toutput, Shape shape, + String key) { + return XlaRecvFromHost.create(scope, Toutput, shape, key); + } + + /** + * An op to send a tensor to the host. + * input: the tensor that will be sent to the host. + * Tinput: element type for input. + * key: A unique identifier for this region used to match up host transfers. + * + * @param input The input value + * @param key The value of the key attribute + * @return a new instance of XlaSendToHost + */ + public XlaSendToHost xlaSendToHost(Operand input, String key) { + return XlaSendToHost.create(scope, input, key); + } + + /** + * The XlaSparseActivationsUnstack operation + * + * @param stackedActivations The stackedActivations value + * @param numTables The value of the numTables attribute + * @param sampleCounts The value of the sampleCounts attribute + * @param features The value of the features attribute + * @param interleaved The value of the interleaved attribute + * @param dtype The value of the dtype attribute + * @param data type for {@code XlaSparseActivationsUnstack} output and operands + * @return a new instance of XlaSparseActivationsUnstack + */ + public XlaSparseActivationsUnstack xlaSparseActivationsUnstack( + Operand stackedActivations, Long numTables, List sampleCounts, + List features, Boolean interleaved, Class dtype) { + return XlaSparseActivationsUnstack.create(scope, stackedActivations, numTables, sampleCounts, features, interleaved, dtype); + } + + /** + * The XlaSparseCoreAdagrad operation + * + * @param indices The indices value + * @param gradient The gradient value + * @param learningRate The learningRate value + * @param accumulator The accumulator value + * @param embeddingTable The embeddingTable value + * @param featureWidth The value of the featureWidth attribute + * @return a new instance of XlaSparseCoreAdagrad + */ + public XlaSparseCoreAdagrad xlaSparseCoreAdagrad(Operand indices, + Operand gradient, Operand learningRate, Operand accumulator, + Operand embeddingTable, Long featureWidth) { + return XlaSparseCoreAdagrad.create(scope, indices, gradient, learningRate, accumulator, embeddingTable, featureWidth); + } + + /** + * The XlaSparseCoreAdagradMomentum operation + * + * @param indices The indices value + * @param gradient The gradient value + * @param learningRate The learningRate value + * @param beta1 The beta1 value + * @param epsilon The epsilon value + * @param accumulator The accumulator value + * @param momentum The momentum value + * @param embeddingTable The embeddingTable value + * @param featureWidth The value of the featureWidth attribute + * @param useNesterov The value of the useNesterov attribute + * @param beta2 The value of the beta2 attribute + * @param exponent The value of the exponent attribute + * @return a new instance of XlaSparseCoreAdagradMomentum + */ + public XlaSparseCoreAdagradMomentum xlaSparseCoreAdagradMomentum(Operand indices, + Operand gradient, Operand learningRate, Operand beta1, + Operand epsilon, Operand accumulator, Operand momentum, + Operand embeddingTable, Long featureWidth, Boolean useNesterov, Float beta2, + Float exponent) { + return XlaSparseCoreAdagradMomentum.create(scope, indices, gradient, learningRate, beta1, epsilon, accumulator, momentum, embeddingTable, featureWidth, useNesterov, beta2, exponent); + } + + /** + * The XlaSparseCoreAdam operation + * + * @param embeddingTable The embeddingTable value + * @param indices The indices value + * @param gradient The gradient value + * @param learningRate The learningRate value + * @param momentum The momentum value + * @param velocity The velocity value + * @param beta1 The beta1 value + * @param beta2 The beta2 value + * @param epsilon The epsilon value + * @param featureWidth The value of the featureWidth attribute + * @param useSumInsideSqrt The value of the useSumInsideSqrt attribute + * @return a new instance of XlaSparseCoreAdam + */ + public XlaSparseCoreAdam xlaSparseCoreAdam(Operand embeddingTable, + Operand indices, Operand gradient, Operand learningRate, + Operand momentum, Operand velocity, Operand beta1, + Operand beta2, Operand epsilon, Long featureWidth, + Boolean useSumInsideSqrt) { + return XlaSparseCoreAdam.create(scope, embeddingTable, indices, gradient, learningRate, momentum, velocity, beta1, beta2, epsilon, featureWidth, useSumInsideSqrt); + } + + /** + * The XlaSparseCoreFtrl operation + * + * @param embeddingTable The embeddingTable value + * @param accumulator The accumulator value + * @param linear The linear value + * @param learningRate The learningRate value + * @param indices The indices value + * @param gradient The gradient value + * @param beta The beta value + * @param learningRatePower The learningRatePower value + * @param l2RegularizationStrength The l2RegularizationStrength value + * @param featureWidth The value of the featureWidth attribute + * @param multiplyLinearByLearningRate The value of the multiplyLinearByLearningRate attribute + * @param l1RegularizationStrength The value of the l1RegularizationStrength attribute + * @return a new instance of XlaSparseCoreFtrl + */ + public XlaSparseCoreFtrl xlaSparseCoreFtrl(Operand embeddingTable, + Operand accumulator, Operand linear, Operand learningRate, + Operand indices, Operand gradient, Operand beta, + Operand learningRatePower, Operand l2RegularizationStrength, + Long featureWidth, Boolean multiplyLinearByLearningRate, Float l1RegularizationStrength) { + return XlaSparseCoreFtrl.create(scope, embeddingTable, accumulator, linear, learningRate, indices, gradient, beta, learningRatePower, l2RegularizationStrength, featureWidth, multiplyLinearByLearningRate, l1RegularizationStrength); + } + + /** + * The XlaSparseCoreSgd operation + * + * @param indices The indices value + * @param gradient The gradient value + * @param learningRate The learningRate value + * @param embeddingTable The embeddingTable value + * @param featureWidth The value of the featureWidth attribute + * @return a new instance of XlaSparseCoreSgd + */ + public XlaSparseCoreSgd xlaSparseCoreSgd(Operand indices, Operand gradient, + Operand learningRate, Operand embeddingTable, Long featureWidth) { + return XlaSparseCoreSgd.create(scope, indices, gradient, learningRate, embeddingTable, featureWidth); + } + + /** + * The XlaSparseDenseMatmul operation + * + * @param rowIds The rowIds value + * @param colIds The colIds value + * @param values The values value + * @param offsets The offsets value + * @param embeddingTable The embeddingTable value + * @param maxIdsPerPartition The value of the maxIdsPerPartition attribute + * @param maxUniqueIdsPerPartition The value of the maxUniqueIdsPerPartition attribute + * @param inputSize The value of the inputSize attribute + * @return a new instance of XlaSparseDenseMatmul + */ + public XlaSparseDenseMatmul xlaSparseDenseMatmul(Operand rowIds, + Operand colIds, Operand values, Operand offsets, + Operand embeddingTable, Long maxIdsPerPartition, Long maxUniqueIdsPerPartition, + Long inputSize) { + return XlaSparseDenseMatmul.create(scope, rowIds, colIds, values, offsets, embeddingTable, maxIdsPerPartition, maxUniqueIdsPerPartition, inputSize); + } + + /** + * The XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdagradAndCsrInput operation + * + * @param rowPointers The rowPointers value + * @param sortedSampleIds The sortedSampleIds value + * @param sortedTokenIds The sortedTokenIds value + * @param sortedPosIds The sortedPosIds value + * @param sortedGains The sortedGains value + * @param weights The weights value + * @param preservedValencies The preservedValencies value + * @param preservedVectors The preservedVectors value + * @param preservedWeights The preservedWeights value + * @param activationGradients The activationGradients value + * @param learningRate The learningRate value + * @param combinerWeightsLearningRate The combinerWeightsLearningRate value + * @param embeddingTable The embeddingTable value + * @param accumulator The accumulator value + * @param maxValency The value of the maxValency attribute + * @param numWeights The value of the numWeights attribute + * @param combinerTableVjpComputation The value of the combinerTableVjpComputation attribute + * @param combinerWeightsVjpComputation The value of the combinerWeightsVjpComputation attribute + * @param tableName The value of the tableName attribute + * @param options carries optional attribute values + * @return a new instance of XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdagradAndCsrInput + */ + public XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdagradAndCsrInput xlaSparseDenseMatmulCustomCombinerOnTcGradWithAdagradAndCsrInput( + Operand rowPointers, Operand sortedSampleIds, Operand sortedTokenIds, + Operand sortedPosIds, Operand sortedGains, Operand weights, + Operand preservedValencies, Operand preservedVectors, + Operand preservedWeights, Operand activationGradients, + Operand learningRate, Operand combinerWeightsLearningRate, + Operand embeddingTable, Operand accumulator, Long maxValency, + Long numWeights, ConcreteFunction combinerTableVjpComputation, + ConcreteFunction combinerWeightsVjpComputation, String tableName, + XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdagradAndCsrInput.Options... options) { + return XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdagradAndCsrInput.create(scope, rowPointers, sortedSampleIds, sortedTokenIds, sortedPosIds, sortedGains, weights, preservedValencies, preservedVectors, preservedWeights, activationGradients, learningRate, combinerWeightsLearningRate, embeddingTable, accumulator, maxValency, numWeights, combinerTableVjpComputation, combinerWeightsVjpComputation, tableName, options); + } + + /** + * The XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdagradMomentumAndCsrInput operation + * + * @param rowPointers The rowPointers value + * @param sortedSampleIds The sortedSampleIds value + * @param sortedTokenIds The sortedTokenIds value + * @param sortedPosIds The sortedPosIds value + * @param sortedGains The sortedGains value + * @param weights The weights value + * @param preservedValencies The preservedValencies value + * @param preservedVectors The preservedVectors value + * @param preservedWeights The preservedWeights value + * @param activationGradients The activationGradients value + * @param learningRate The learningRate value + * @param combinerWeightsLearningRate The combinerWeightsLearningRate value + * @param embeddingTable The embeddingTable value + * @param accumulator The accumulator value + * @param momenta The momenta value + * @param useNesterov The value of the useNesterov attribute + * @param exponent The value of the exponent attribute + * @param beta1 The value of the beta1 attribute + * @param beta2 The value of the beta2 attribute + * @param epsilon The value of the epsilon attribute + * @param maxValency The value of the maxValency attribute + * @param numWeights The value of the numWeights attribute + * @param combinerTableVjpComputation The value of the combinerTableVjpComputation attribute + * @param combinerWeightsVjpComputation The value of the combinerWeightsVjpComputation attribute + * @param tableName The value of the tableName attribute + * @param options carries optional attribute values + * @return a new instance of XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdagradMomentumAndCsrInput + */ + public XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdagradMomentumAndCsrInput xlaSparseDenseMatmulCustomCombinerOnTcGradWithAdagradMomentumAndCsrInput( + Operand rowPointers, Operand sortedSampleIds, Operand sortedTokenIds, + Operand sortedPosIds, Operand sortedGains, Operand weights, + Operand preservedValencies, Operand preservedVectors, + Operand preservedWeights, Operand activationGradients, + Operand learningRate, Operand combinerWeightsLearningRate, + Operand embeddingTable, Operand accumulator, Operand momenta, + Boolean useNesterov, Float exponent, Float beta1, Float beta2, Float epsilon, Long maxValency, + Long numWeights, ConcreteFunction combinerTableVjpComputation, + ConcreteFunction combinerWeightsVjpComputation, String tableName, + XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdagradMomentumAndCsrInput.Options... options) { + return XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdagradMomentumAndCsrInput.create(scope, rowPointers, sortedSampleIds, sortedTokenIds, sortedPosIds, sortedGains, weights, preservedValencies, preservedVectors, preservedWeights, activationGradients, learningRate, combinerWeightsLearningRate, embeddingTable, accumulator, momenta, useNesterov, exponent, beta1, beta2, epsilon, maxValency, numWeights, combinerTableVjpComputation, combinerWeightsVjpComputation, tableName, options); + } + + /** + * The XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdamAndCsrInput operation + * + * @param rowPointers The rowPointers value + * @param sortedSampleIds The sortedSampleIds value + * @param sortedTokenIds The sortedTokenIds value + * @param sortedPosIds The sortedPosIds value + * @param sortedGains The sortedGains value + * @param weights The weights value + * @param preservedValencies The preservedValencies value + * @param preservedVectors The preservedVectors value + * @param preservedWeights The preservedWeights value + * @param activationGradients The activationGradients value + * @param learningRate The learningRate value + * @param combinerWeightsLearningRate The combinerWeightsLearningRate value + * @param embeddingTable The embeddingTable value + * @param momenta The momenta value + * @param velocity The velocity value + * @param useSumInsideSqrt The value of the useSumInsideSqrt attribute + * @param beta1 The value of the beta1 attribute + * @param beta2 The value of the beta2 attribute + * @param epsilon The value of the epsilon attribute + * @param maxValency The value of the maxValency attribute + * @param numWeights The value of the numWeights attribute + * @param combinerTableVjpComputation The value of the combinerTableVjpComputation attribute + * @param combinerWeightsVjpComputation The value of the combinerWeightsVjpComputation attribute + * @param tableName The value of the tableName attribute + * @param options carries optional attribute values + * @return a new instance of XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdamAndCsrInput + */ + public XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdamAndCsrInput xlaSparseDenseMatmulCustomCombinerOnTcGradWithAdamAndCsrInput( + Operand rowPointers, Operand sortedSampleIds, Operand sortedTokenIds, + Operand sortedPosIds, Operand sortedGains, Operand weights, + Operand preservedValencies, Operand preservedVectors, + Operand preservedWeights, Operand activationGradients, + Operand learningRate, Operand combinerWeightsLearningRate, + Operand embeddingTable, Operand momenta, Operand velocity, + Boolean useSumInsideSqrt, Float beta1, Float beta2, Float epsilon, Long maxValency, + Long numWeights, ConcreteFunction combinerTableVjpComputation, + ConcreteFunction combinerWeightsVjpComputation, String tableName, + XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdamAndCsrInput.Options... options) { + return XlaSparseDenseMatmulCustomCombinerOnTcGradWithAdamAndCsrInput.create(scope, rowPointers, sortedSampleIds, sortedTokenIds, sortedPosIds, sortedGains, weights, preservedValencies, preservedVectors, preservedWeights, activationGradients, learningRate, combinerWeightsLearningRate, embeddingTable, momenta, velocity, useSumInsideSqrt, beta1, beta2, epsilon, maxValency, numWeights, combinerTableVjpComputation, combinerWeightsVjpComputation, tableName, options); + } + + /** + * The XlaSparseDenseMatmulCustomCombinerOnTcGradWithCsrInput operation + * + * @param rowPointers The rowPointers value + * @param sortedSampleIds The sortedSampleIds value + * @param sortedTokenIds The sortedTokenIds value + * @param sortedPosIds The sortedPosIds value + * @param sortedGains The sortedGains value + * @param weights The weights value + * @param preservedValencies The preservedValencies value + * @param preservedVectors The preservedVectors value + * @param preservedWeights The preservedWeights value + * @param activationGradients The activationGradients value + * @param tables The tables value + * @param hyperparameters The hyperparameters value + * @param combinerWeightsLearningRate The combinerWeightsLearningRate value + * @param maxValency The value of the maxValency attribute + * @param numWeights The value of the numWeights attribute + * @param combinerTableVjpComputation The value of the combinerTableVjpComputation attribute + * @param combinerWeightsVjpComputation The value of the combinerWeightsVjpComputation attribute + * @param optimizerCustomComputation The value of the optimizerCustomComputation attribute + * @param tableName The value of the tableName attribute + * @param options carries optional attribute values + * @return a new instance of XlaSparseDenseMatmulCustomCombinerOnTcGradWithCsrInput + */ + public XlaSparseDenseMatmulCustomCombinerOnTcGradWithCsrInput xlaSparseDenseMatmulCustomCombinerOnTcGradWithCsrInput( + Operand rowPointers, Operand sortedSampleIds, Operand sortedTokenIds, + Operand sortedPosIds, Operand sortedGains, Operand weights, + Operand preservedValencies, Operand preservedVectors, + Operand preservedWeights, Operand activationGradients, + Iterable> tables, Iterable> hyperparameters, + Operand combinerWeightsLearningRate, Long maxValency, Long numWeights, + ConcreteFunction combinerTableVjpComputation, ConcreteFunction combinerWeightsVjpComputation, + ConcreteFunction optimizerCustomComputation, String tableName, + XlaSparseDenseMatmulCustomCombinerOnTcGradWithCsrInput.Options... options) { + return XlaSparseDenseMatmulCustomCombinerOnTcGradWithCsrInput.create(scope, rowPointers, sortedSampleIds, sortedTokenIds, sortedPosIds, sortedGains, weights, preservedValencies, preservedVectors, preservedWeights, activationGradients, tables, hyperparameters, combinerWeightsLearningRate, maxValency, numWeights, combinerTableVjpComputation, combinerWeightsVjpComputation, optimizerCustomComputation, tableName, options); + } + + /** + * The XlaSparseDenseMatmulCustomCombinerOnTcGradWithFtrlAndCsrInput operation + * + * @param rowPointers The rowPointers value + * @param sortedSampleIds The sortedSampleIds value + * @param sortedTokenIds The sortedTokenIds value + * @param sortedPosIds The sortedPosIds value + * @param sortedGains The sortedGains value + * @param weights The weights value + * @param preservedValencies The preservedValencies value + * @param preservedVectors The preservedVectors value + * @param preservedWeights The preservedWeights value + * @param activationGradients The activationGradients value + * @param learningRate The learningRate value + * @param combinerWeightsLearningRate The combinerWeightsLearningRate value + * @param embeddingTable The embeddingTable value + * @param accumulator The accumulator value + * @param linear The linear value + * @param multiplyLinearByLearningRate The value of the multiplyLinearByLearningRate attribute + * @param beta The value of the beta attribute + * @param learningRatePower The value of the learningRatePower attribute + * @param l1RegularizationStrength The value of the l1RegularizationStrength attribute + * @param l2RegularizationStrength The value of the l2RegularizationStrength attribute + * @param maxValency The value of the maxValency attribute + * @param numWeights The value of the numWeights attribute + * @param combinerTableVjpComputation The value of the combinerTableVjpComputation attribute + * @param combinerWeightsVjpComputation The value of the combinerWeightsVjpComputation attribute + * @param tableName The value of the tableName attribute + * @param options carries optional attribute values + * @return a new instance of XlaSparseDenseMatmulCustomCombinerOnTcGradWithFtrlAndCsrInput + */ + public XlaSparseDenseMatmulCustomCombinerOnTcGradWithFtrlAndCsrInput xlaSparseDenseMatmulCustomCombinerOnTcGradWithFtrlAndCsrInput( + Operand rowPointers, Operand sortedSampleIds, Operand sortedTokenIds, + Operand sortedPosIds, Operand sortedGains, Operand weights, + Operand preservedValencies, Operand preservedVectors, + Operand preservedWeights, Operand activationGradients, + Operand learningRate, Operand combinerWeightsLearningRate, + Operand embeddingTable, Operand accumulator, Operand linear, + Boolean multiplyLinearByLearningRate, Float beta, Float learningRatePower, + Float l1RegularizationStrength, Float l2RegularizationStrength, Long maxValency, + Long numWeights, ConcreteFunction combinerTableVjpComputation, + ConcreteFunction combinerWeightsVjpComputation, String tableName, + XlaSparseDenseMatmulCustomCombinerOnTcGradWithFtrlAndCsrInput.Options... options) { + return XlaSparseDenseMatmulCustomCombinerOnTcGradWithFtrlAndCsrInput.create(scope, rowPointers, sortedSampleIds, sortedTokenIds, sortedPosIds, sortedGains, weights, preservedValencies, preservedVectors, preservedWeights, activationGradients, learningRate, combinerWeightsLearningRate, embeddingTable, accumulator, linear, multiplyLinearByLearningRate, beta, learningRatePower, l1RegularizationStrength, l2RegularizationStrength, maxValency, numWeights, combinerTableVjpComputation, combinerWeightsVjpComputation, tableName, options); + } + + /** + * The XlaSparseDenseMatmulGradWithAdagradAndCsrInput operation + * + * @param rowPointers The rowPointers value + * @param sortedSampleIds The sortedSampleIds value + * @param sortedTokenIds The sortedTokenIds value + * @param sortedGains The sortedGains value + * @param activationGradients The activationGradients value + * @param learningRate The learningRate value + * @param embeddingTable The embeddingTable value + * @param accumulator The accumulator value + * @param numMinibatchesPerPhysicalSparseCore The numMinibatchesPerPhysicalSparseCore value + * @param tableName The value of the tableName attribute + * @param options carries optional attribute values + * @return a new instance of XlaSparseDenseMatmulGradWithAdagradAndCsrInput + */ + public XlaSparseDenseMatmulGradWithAdagradAndCsrInput xlaSparseDenseMatmulGradWithAdagradAndCsrInput( + Operand rowPointers, Operand sortedSampleIds, Operand sortedTokenIds, + Operand sortedGains, Operand activationGradients, + Operand learningRate, Operand embeddingTable, + Operand accumulator, Operand numMinibatchesPerPhysicalSparseCore, + String tableName, XlaSparseDenseMatmulGradWithAdagradAndCsrInput.Options... options) { + return XlaSparseDenseMatmulGradWithAdagradAndCsrInput.create(scope, rowPointers, sortedSampleIds, sortedTokenIds, sortedGains, activationGradients, learningRate, embeddingTable, accumulator, numMinibatchesPerPhysicalSparseCore, tableName, options); + } + + /** + * The XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInput operation + * + * @param rowPointers The rowPointers value + * @param sortedSampleIds The sortedSampleIds value + * @param sortedTokenIds The sortedTokenIds value + * @param sortedGains The sortedGains value + * @param activationGradients The activationGradients value + * @param learningRate The learningRate value + * @param embeddingTable The embeddingTable value + * @param accumulator The accumulator value + * @param momenta The momenta value + * @param numMinibatchesPerPhysicalSparseCore The numMinibatchesPerPhysicalSparseCore value + * @param useNesterov The value of the useNesterov attribute + * @param exponent The value of the exponent attribute + * @param beta1 The value of the beta1 attribute + * @param beta2 The value of the beta2 attribute + * @param epsilon The value of the epsilon attribute + * @param tableName The value of the tableName attribute + * @param options carries optional attribute values + * @return a new instance of XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInput + */ + public XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInput xlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInput( + Operand rowPointers, Operand sortedSampleIds, Operand sortedTokenIds, + Operand sortedGains, Operand activationGradients, + Operand learningRate, Operand embeddingTable, + Operand accumulator, Operand momenta, + Operand numMinibatchesPerPhysicalSparseCore, Boolean useNesterov, Float exponent, + Float beta1, Float beta2, Float epsilon, String tableName, + XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInput.Options... options) { + return XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInput.create(scope, rowPointers, sortedSampleIds, sortedTokenIds, sortedGains, activationGradients, learningRate, embeddingTable, accumulator, momenta, numMinibatchesPerPhysicalSparseCore, useNesterov, exponent, beta1, beta2, epsilon, tableName, options); + } + + /** + * The XlaSparseDenseMatmulGradWithAdamAndCsrInput operation + * + * @param rowPointers The rowPointers value + * @param sortedSampleIds The sortedSampleIds value + * @param sortedTokenIds The sortedTokenIds value + * @param sortedGains The sortedGains value + * @param activationGradients The activationGradients value + * @param learningRate The learningRate value + * @param embeddingTable The embeddingTable value + * @param momenta The momenta value + * @param velocity The velocity value + * @param numMinibatchesPerPhysicalSparseCore The numMinibatchesPerPhysicalSparseCore value + * @param useSumInsideSqrt The value of the useSumInsideSqrt attribute + * @param beta1 The value of the beta1 attribute + * @param beta2 The value of the beta2 attribute + * @param epsilon The value of the epsilon attribute + * @param tableName The value of the tableName attribute + * @param options carries optional attribute values + * @return a new instance of XlaSparseDenseMatmulGradWithAdamAndCsrInput + */ + public XlaSparseDenseMatmulGradWithAdamAndCsrInput xlaSparseDenseMatmulGradWithAdamAndCsrInput( + Operand rowPointers, Operand sortedSampleIds, Operand sortedTokenIds, + Operand sortedGains, Operand activationGradients, + Operand learningRate, Operand embeddingTable, Operand momenta, + Operand velocity, Operand numMinibatchesPerPhysicalSparseCore, + Boolean useSumInsideSqrt, Float beta1, Float beta2, Float epsilon, String tableName, + XlaSparseDenseMatmulGradWithAdamAndCsrInput.Options... options) { + return XlaSparseDenseMatmulGradWithAdamAndCsrInput.create(scope, rowPointers, sortedSampleIds, sortedTokenIds, sortedGains, activationGradients, learningRate, embeddingTable, momenta, velocity, numMinibatchesPerPhysicalSparseCore, useSumInsideSqrt, beta1, beta2, epsilon, tableName, options); + } + + /** + * The XlaSparseDenseMatmulGradWithFtrlAndCsrInput operation + * + * @param rowPointers The rowPointers value + * @param sortedSampleIds The sortedSampleIds value + * @param sortedTokenIds The sortedTokenIds value + * @param sortedGains The sortedGains value + * @param activationGradients The activationGradients value + * @param learningRate The learningRate value + * @param embeddingTable The embeddingTable value + * @param accumulator The accumulator value + * @param linear The linear value + * @param numMinibatchesPerPhysicalSparseCore The numMinibatchesPerPhysicalSparseCore value + * @param multiplyLinearByLearningRate The value of the multiplyLinearByLearningRate attribute + * @param beta The value of the beta attribute + * @param learningRatePower The value of the learningRatePower attribute + * @param l1RegularizationStrength The value of the l1RegularizationStrength attribute + * @param l2RegularizationStrength The value of the l2RegularizationStrength attribute + * @param tableName The value of the tableName attribute + * @param options carries optional attribute values + * @return a new instance of XlaSparseDenseMatmulGradWithFtrlAndCsrInput + */ + public XlaSparseDenseMatmulGradWithFtrlAndCsrInput xlaSparseDenseMatmulGradWithFtrlAndCsrInput( + Operand rowPointers, Operand sortedSampleIds, Operand sortedTokenIds, + Operand sortedGains, Operand activationGradients, + Operand learningRate, Operand embeddingTable, + Operand accumulator, Operand linear, + Operand numMinibatchesPerPhysicalSparseCore, Boolean multiplyLinearByLearningRate, + Float beta, Float learningRatePower, Float l1RegularizationStrength, + Float l2RegularizationStrength, String tableName, + XlaSparseDenseMatmulGradWithFtrlAndCsrInput.Options... options) { + return XlaSparseDenseMatmulGradWithFtrlAndCsrInput.create(scope, rowPointers, sortedSampleIds, sortedTokenIds, sortedGains, activationGradients, learningRate, embeddingTable, accumulator, linear, numMinibatchesPerPhysicalSparseCore, multiplyLinearByLearningRate, beta, learningRatePower, l1RegularizationStrength, l2RegularizationStrength, tableName, options); + } + + /** + * The XlaSparseDenseMatmulGradWithSgdAndCsrInput operation + * + * @param rowPointers The rowPointers value + * @param sortedSampleIds The sortedSampleIds value + * @param sortedTokenIds The sortedTokenIds value + * @param sortedGains The sortedGains value + * @param activationGradients The activationGradients value + * @param learningRate The learningRate value + * @param embeddingTable The embeddingTable value + * @param numMinibatchesPerPhysicalSparseCore The numMinibatchesPerPhysicalSparseCore value + * @param tableName The value of the tableName attribute + * @param options carries optional attribute values + * @return a new instance of XlaSparseDenseMatmulGradWithSgdAndCsrInput + */ + public XlaSparseDenseMatmulGradWithSgdAndCsrInput xlaSparseDenseMatmulGradWithSgdAndCsrInput( + Operand rowPointers, Operand sortedSampleIds, Operand sortedTokenIds, + Operand sortedGains, Operand activationGradients, + Operand learningRate, Operand embeddingTable, + Operand numMinibatchesPerPhysicalSparseCore, String tableName, + XlaSparseDenseMatmulGradWithSgdAndCsrInput.Options... options) { + return XlaSparseDenseMatmulGradWithSgdAndCsrInput.create(scope, rowPointers, sortedSampleIds, sortedTokenIds, sortedGains, activationGradients, learningRate, embeddingTable, numMinibatchesPerPhysicalSparseCore, tableName, options); + } + + /** + * The XlaSparseDenseMatmulWithCsrInput operation + * + * @param rowPointers The rowPointers value + * @param sortedSampleIds The sortedSampleIds value + * @param sortedTokenIds The sortedTokenIds value + * @param sortedGains The sortedGains value + * @param embeddingTable The embeddingTable value + * @param numMinibatchesPerPhysicalSparseCore The numMinibatchesPerPhysicalSparseCore value + * @param inputSize The value of the inputSize attribute + * @param quantizationConfigLow The value of the quantizationConfigLow attribute + * @param quantizationConfigHigh The value of the quantizationConfigHigh attribute + * @param quantizationConfigNumBuckets The value of the quantizationConfigNumBuckets attribute + * @param tableName The value of the tableName attribute + * @param options carries optional attribute values + * @param data type for {@code XlaSparseDenseMatmulWithCsrInput} output and operands + * @return a new instance of XlaSparseDenseMatmulWithCsrInput + */ + public XlaSparseDenseMatmulWithCsrInput xlaSparseDenseMatmulWithCsrInput( + Operand rowPointers, Operand sortedSampleIds, Operand sortedTokenIds, + Operand sortedGains, Operand embeddingTable, + Operand numMinibatchesPerPhysicalSparseCore, Long inputSize, + Float quantizationConfigLow, Float quantizationConfigHigh, Long quantizationConfigNumBuckets, + String tableName, XlaSparseDenseMatmulWithCsrInput.Options... options) { + return XlaSparseDenseMatmulWithCsrInput.create(scope, rowPointers, sortedSampleIds, sortedTokenIds, sortedGains, embeddingTable, numMinibatchesPerPhysicalSparseCore, inputSize, quantizationConfigLow, quantizationConfigHigh, quantizationConfigNumBuckets, tableName, options); + } + + /** + * Get the parent {@link Ops} object. + */ + public final Ops ops() { + return ops; + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Compute_func_Pointer_TF_OpKernelContext.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Compute_func_Pointer_TF_OpKernelContext.java deleted file mode 100644 index 3cb38cf2581..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Compute_func_Pointer_TF_OpKernelContext.java +++ /dev/null @@ -1,19 +0,0 @@ -// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE - -package org.tensorflow.internal.c_api; - -import java.nio.*; -import org.bytedeco.javacpp.*; -import org.bytedeco.javacpp.annotation.*; - -import static org.tensorflow.internal.c_api.global.tensorflow.*; - -@Properties(inherit = org.tensorflow.internal.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/internal/c_api/Create_func_TF_OpKernelConstruction.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Create_func_TF_OpKernelConstruction.java deleted file mode 100644 index 7d9cf68a96e..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Create_func_TF_OpKernelConstruction.java +++ /dev/null @@ -1,48 +0,0 @@ -// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE - -package org.tensorflow.internal.c_api; - -import java.nio.*; -import org.bytedeco.javacpp.*; -import org.bytedeco.javacpp.annotation.*; - -import static org.tensorflow.internal.c_api.global.tensorflow.*; - - -// 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.internal.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/internal/c_api/Delete_func_Pointer.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Delete_func_Pointer.java deleted file mode 100644 index 89a99f2c207..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Delete_func_Pointer.java +++ /dev/null @@ -1,19 +0,0 @@ -// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE - -package org.tensorflow.internal.c_api; - -import java.nio.*; -import org.bytedeco.javacpp.*; -import org.bytedeco.javacpp.annotation.*; - -import static org.tensorflow.internal.c_api.global.tensorflow.*; - -@Properties(inherit = org.tensorflow.internal.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/internal/c_api/Shape_inference_func_TF_ShapeInferenceContext_TF_Status.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Shape_inference_func_TF_ShapeInferenceContext_TF_Status.java deleted file mode 100644 index 3aa62142056..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/Shape_inference_func_TF_ShapeInferenceContext_TF_Status.java +++ /dev/null @@ -1,22 +0,0 @@ -// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE - -package org.tensorflow.internal.c_api; - -import java.nio.*; -import org.bytedeco.javacpp.*; -import org.bytedeco.javacpp.annotation.*; - -import static org.tensorflow.internal.c_api.global.tensorflow.*; - - -// Sets the shape inference function for the op. -@Properties(inherit = org.tensorflow.internal.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/internal/c_api/TF_DimensionHandle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_DimensionHandle.java deleted file mode 100644 index afa0eeef73d..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_DimensionHandle.java +++ /dev/null @@ -1,19 +0,0 @@ -// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE - -package org.tensorflow.internal.c_api; - -import java.nio.*; -import org.bytedeco.javacpp.*; -import org.bytedeco.javacpp.annotation.*; - -import static org.tensorflow.internal.c_api.global.tensorflow.*; - -// #endif - -@Opaque @Properties(inherit = org.tensorflow.internal.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/internal/c_api/TF_KernelBuilder.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_KernelBuilder.java deleted file mode 100644 index 397fa3a417a..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_KernelBuilder.java +++ /dev/null @@ -1,31 +0,0 @@ -// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE - -package org.tensorflow.internal.c_api; - -import java.nio.*; -import org.bytedeco.javacpp.*; -import org.bytedeco.javacpp.annotation.*; - -import static org.tensorflow.internal.c_api.global.tensorflow.*; - - -// -------------------------------------------------------------------------- -// 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.internal.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/internal/c_api/TF_OpDefinitionBuilder.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OpDefinitionBuilder.java deleted file mode 100644 index 7f708de3f24..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OpDefinitionBuilder.java +++ /dev/null @@ -1,17 +0,0 @@ -// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE - -package org.tensorflow.internal.c_api; - -import java.nio.*; -import org.bytedeco.javacpp.*; -import org.bytedeco.javacpp.annotation.*; - -import static org.tensorflow.internal.c_api.global.tensorflow.*; - -@Opaque @Properties(inherit = org.tensorflow.internal.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/internal/c_api/TF_OpKernelConstruction.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OpKernelConstruction.java deleted file mode 100644 index 86b1b5f5665..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OpKernelConstruction.java +++ /dev/null @@ -1,17 +0,0 @@ -// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE - -package org.tensorflow.internal.c_api; - -import java.nio.*; -import org.bytedeco.javacpp.*; -import org.bytedeco.javacpp.annotation.*; - -import static org.tensorflow.internal.c_api.global.tensorflow.*; - -@Opaque @Properties(inherit = org.tensorflow.internal.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/internal/c_api/TF_OpKernelContext.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OpKernelContext.java deleted file mode 100644 index 1aceaf9edce..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_OpKernelContext.java +++ /dev/null @@ -1,17 +0,0 @@ -// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE - -package org.tensorflow.internal.c_api; - -import java.nio.*; -import org.bytedeco.javacpp.*; -import org.bytedeco.javacpp.annotation.*; - -import static org.tensorflow.internal.c_api.global.tensorflow.*; - -@Opaque @Properties(inherit = org.tensorflow.internal.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/internal/c_api/TF_ShapeHandle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ShapeHandle.java deleted file mode 100644 index be32e10bfe4..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ShapeHandle.java +++ /dev/null @@ -1,17 +0,0 @@ -// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE - -package org.tensorflow.internal.c_api; - -import java.nio.*; -import org.bytedeco.javacpp.*; -import org.bytedeco.javacpp.annotation.*; - -import static org.tensorflow.internal.c_api.global.tensorflow.*; - -@Opaque @Properties(inherit = org.tensorflow.internal.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/internal/c_api/TF_ShapeInferenceContext.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ShapeInferenceContext.java deleted file mode 100644 index 9f5a95fd889..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_ShapeInferenceContext.java +++ /dev/null @@ -1,17 +0,0 @@ -// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE - -package org.tensorflow.internal.c_api; - -import java.nio.*; -import org.bytedeco.javacpp.*; -import org.bytedeco.javacpp.annotation.*; - -import static org.tensorflow.internal.c_api.global.tensorflow.*; - -@Opaque @Properties(inherit = org.tensorflow.internal.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/internal/c_api/global/tensorflow.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/global/tensorflow.java deleted file mode 100644 index 402032162c4..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/global/tensorflow.java +++ /dev/null @@ -1,3972 +0,0 @@ -// Targeted by JavaCPP version 1.5.1: DO NOT EDIT THIS FILE - -package org.tensorflow.internal.c_api.global; - -import org.tensorflow.internal.c_api.*; - -import java.nio.*; -import org.bytedeco.javacpp.*; -import org.bytedeco.javacpp.annotation.*; - -public class tensorflow extends org.tensorflow.internal.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 index 1dcbdc28da5..35eb9cb2bb1 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,82 +17,84 @@ package org.tensorflow.op.audio; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.types.TFloat; +import org.tensorflow.types.TFloat32; /** * 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 + *

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 + * 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 + *

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 + *

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 + *

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 { - +@OpMetadata( + opType = AudioSpectrogram.OP_NAME, + inputsClass = AudioSpectrogram.Inputs.class +) +@Operator( + group = "audio" +) +public final class AudioSpectrogram extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.audio.AudioSpectrogram} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "AudioSpectrogram"; + + private Output spectrogram; + + public AudioSpectrogram(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + spectrogram = operation.output(outputIdx++); } - + /** * 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 + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static AudioSpectrogram create(Scope scope, Operand input, Long windowSize, + Long stride, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "AudioSpectrogram"); opBuilder.addInput(input.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); opBuilder.setAttr("window_size", windowSize); opBuilder.setAttr("stride", stride); if (options != null) { @@ -104,32 +106,87 @@ public static AudioSpectrogram create(Scope scope, Operand input, Long w } return new AudioSpectrogram(opBuilder.build()); } - + /** + * Sets the magnitudeSquared option. + * * @param magnitudeSquared Whether to return the squared magnitude or just the * magnitude. Using squared magnitude can avoid extra calculations. + * @return this Options instance. */ public static Options magnitudeSquared(Boolean magnitudeSquared) { return new Options().magnitudeSquared(magnitudeSquared); } - + /** + * Gets spectrogram. * 3D representation of the audio frequencies as an image. + * @return spectrogram. */ - public Output spectrogram() { + public Output spectrogram() { return spectrogram; } - + @Override - public Output asOutput() { + public Output asOutput() { return spectrogram; } - - private Output spectrogram; - - private AudioSpectrogram(Operation operation) { - super(operation); - int outputIdx = 0; - spectrogram = operation.output(outputIdx++); + + /** + * Optional attributes for {@link org.tensorflow.op.audio.AudioSpectrogram} + */ + public static class Options { + private Boolean magnitudeSquared; + + private Options() { + } + + /** + * Sets the magnitudeSquared option. + * + * @param magnitudeSquared Whether to return the squared magnitude or just the + * magnitude. Using squared magnitude can avoid extra calculations. + * @return this Options instance. + */ + public Options magnitudeSquared(Boolean magnitudeSquared) { + this.magnitudeSquared = magnitudeSquared; + return this; + } + } + + @OpInputsMetadata( + outputsClass = AudioSpectrogram.class + ) + public static class Inputs extends RawOpInputs { + /** + * Float representation of audio data. + */ + public final Operand input; + + /** + * How wide the input window is in samples. For the highest efficiency + * this should be a power of two, but other values are accepted. + */ + public final long windowSize; + + /** + * How widely apart the center of adjacent sample windows should be. + */ + public final long stride; + + /** + * Whether to return the squared magnitude or just the + * magnitude. Using squared magnitude can avoid extra calculations. + */ + public final boolean magnitudeSquared; + + public Inputs(GraphOperation op) { + super(new AudioSpectrogram(op), op, Arrays.asList("window_size", "stride", "magnitude_squared")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + windowSize = op.attributes().getAttrInt("window_size"); + stride = op.attributes().getAttrInt("stride"); + magnitudeSquared = op.attributes().getAttrBool("magnitude_squared"); + } } } 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 index 4202e0f221e..793ef8aed8f 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,78 +17,75 @@ package org.tensorflow.op.audio; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.types.TFloat; +import org.tensorflow.types.TFloat32; import org.tensorflow.types.TInt32; import org.tensorflow.types.TString; /** * 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 + *

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 + *

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 + *

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 { - +@OpMetadata( + opType = DecodeWav.OP_NAME, + inputsClass = DecodeWav.Inputs.class +) +@Operator( + group = "audio" +) +public final class DecodeWav extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.audio.DecodeWav} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "DecodeWav"; + + private Output audio; + + private Output sampleRate; + + public DecodeWav(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + audio = operation.output(outputIdx++); + sampleRate = operation.output(outputIdx++); } - + /** * 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 + * @param options carries optional attribute values * @return a new instance of DecodeWav */ + @Endpoint( + describeByClass = true + ) public static DecodeWav create(Scope scope, Operand contents, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("DecodeWav", scope.makeOpName("DecodeWav")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "DecodeWav"); opBuilder.addInput(contents.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.desiredChannels != null) { @@ -101,42 +98,104 @@ public static DecodeWav create(Scope scope, Operand contents, Options.. } return new DecodeWav(opBuilder.build()); } - + /** + * Sets the desiredChannels option. + * * @param desiredChannels Number of sample channels wanted. + * @return this Options instance. */ public static Options desiredChannels(Long desiredChannels) { return new Options().desiredChannels(desiredChannels); } - + /** + * Sets the desiredSamples option. + * * @param desiredSamples Length of audio requested. + * @return this Options instance. */ public static Options desiredSamples(Long desiredSamples) { return new Options().desiredSamples(desiredSamples); } - + /** - * 2-D with shape `[length, channels]`. + * Gets audio. + * 2-D with shape {@code [length, channels]}. + * @return audio. */ - public Output audio() { + public Output audio() { return audio; } - + /** + * Gets sampleRate. * Scalar holding the sample rate found in the WAV header. + * @return sampleRate. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.audio.DecodeWav} + */ + public static class Options { + private Long desiredChannels; + + private Long desiredSamples; + + private Options() { + } + + /** + * Sets the desiredChannels option. + * + * @param desiredChannels Number of sample channels wanted. + * @return this Options instance. + */ + public Options desiredChannels(Long desiredChannels) { + this.desiredChannels = desiredChannels; + return this; + } + + /** + * Sets the desiredSamples option. + * + * @param desiredSamples Length of audio requested. + * @return this Options instance. + */ + public Options desiredSamples(Long desiredSamples) { + this.desiredSamples = desiredSamples; + return this; + } + } + + @OpInputsMetadata( + outputsClass = DecodeWav.class + ) + public static class Inputs extends RawOpInputs { + /** + * The WAV-encoded audio, usually from a file. + */ + public final Operand contents; + + /** + * Number of sample channels wanted. + */ + public final long desiredChannels; + + /** + * Length of audio requested. + */ + public final long desiredSamples; + + public Inputs(GraphOperation op) { + super(new DecodeWav(op), op, Arrays.asList("desired_channels", "desired_samples")); + int inputIndex = 0; + contents = (Operand) op.input(inputIndex++); + desiredChannels = op.attributes().getAttrInt("desired_channels"); + desiredSamples = op.attributes().getAttrInt("desired_samples"); + } } } 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 index 5243e7f2539..71298e578a1 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,64 +17,104 @@ package org.tensorflow.op.audio; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.types.TFloat; +import org.tensorflow.types.TFloat32; import org.tensorflow.types.TInt32; import org.tensorflow.types.TString; /** * 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). + *

{@code audio} is a 2-D float Tensor of shape {@code [length, channels]}. + * {@code 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 { - +@OpMetadata( + opType = EncodeWav.OP_NAME, + inputsClass = EncodeWav.Inputs.class +) +@Operator( + group = "audio" +) +public final class EncodeWav extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "EncodeWav"; + + private Output contents; + + public EncodeWav(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + contents = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new EncodeWav operation. - * + * * @param scope current scope - * @param audio 2-D with shape `[length, channels]`. + * @param audio 2-D with shape {@code [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")); + @Endpoint( + describeByClass = true + ) + public static EncodeWav create(Scope scope, Operand audio, Operand sampleRate) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "EncodeWav"); opBuilder.addInput(audio.asOutput()); opBuilder.addInput(sampleRate.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new EncodeWav(opBuilder.build()); } - + /** + * Gets contents. * 0-D. WAV-encoded file contents. + * @return 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++); + + @OpInputsMetadata( + outputsClass = EncodeWav.class + ) + public static class Inputs extends RawOpInputs { + /** + * 2-D with shape {@code [length, channels]}. + */ + public final Operand audio; + + /** + * Scalar containing the sample frequency. + */ + public final Operand sampleRate; + + public Inputs(GraphOperation op) { + super(new EncodeWav(op), op, Arrays.asList()); + int inputIndex = 0; + audio = (Operand) op.input(inputIndex++); + sampleRate = (Operand) op.input(inputIndex++); + } } } 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 index a8a3c14c07c..3654035e929 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,19 +17,24 @@ package org.tensorflow.op.audio; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.types.TFloat; +import org.tensorflow.types.TFloat32; import org.tensorflow.types.TInt32; /** * 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 @@ -37,72 +42,45 @@ * 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 { - +@OpMetadata( + opType = Mfcc.OP_NAME, + inputsClass = Mfcc.Inputs.class +) +@Operator( + group = "audio" +) +public final class Mfcc extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.audio.Mfcc} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Mfcc"; + + private Output output; + + public Mfcc(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * 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 + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static Mfcc create(Scope scope, Operand spectrogram, Operand sampleRate, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Mfcc"); opBuilder.addInput(spectrogram.asOutput()); opBuilder.addInput(sampleRate.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.upperFrequencyLimit != null) { @@ -121,53 +99,171 @@ public static Mfcc create(Scope scope, Operand spectrogram, Operand output() { + public Output output() { return output; } - + @Override - public Output asOutput() { + public Output asOutput() { return output; } - - private Output output; - - private Mfcc(Operation operation) { - super(operation); - int outputIdx = 0; - output = operation.output(outputIdx++); + + /** + * Optional attributes for {@link org.tensorflow.op.audio.Mfcc} + */ + public static class Options { + private Float upperFrequencyLimit; + + private Float lowerFrequencyLimit; + + private Long filterbankChannelCount; + + private Long dctCoefficientCount; + + private Options() { + } + + /** + * Sets the upperFrequencyLimit option. + * + * @param upperFrequencyLimit The highest frequency to use when calculating the + * ceptstrum. + * @return this Options instance. + */ + public Options upperFrequencyLimit(Float upperFrequencyLimit) { + this.upperFrequencyLimit = upperFrequencyLimit; + return this; + } + + /** + * Sets the lowerFrequencyLimit option. + * + * @param lowerFrequencyLimit The lowest frequency to use when calculating the + * ceptstrum. + * @return this Options instance. + */ + public Options lowerFrequencyLimit(Float lowerFrequencyLimit) { + this.lowerFrequencyLimit = lowerFrequencyLimit; + return this; + } + + /** + * Sets the filterbankChannelCount option. + * + * @param filterbankChannelCount Resolution of the Mel bank used internally. + * @return this Options instance. + */ + public Options filterbankChannelCount(Long filterbankChannelCount) { + this.filterbankChannelCount = filterbankChannelCount; + return this; + } + + /** + * Sets the dctCoefficientCount option. + * + * @param dctCoefficientCount How many output channels to produce per time slice. + * @return this Options instance. + */ + public Options dctCoefficientCount(Long dctCoefficientCount) { + this.dctCoefficientCount = dctCoefficientCount; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Mfcc.class + ) + public static class Inputs extends RawOpInputs { + /** + * Typically produced by the Spectrogram op, with magnitude_squared + * set to true. + */ + public final Operand spectrogram; + + /** + * How many samples per second the source audio used. + */ + public final Operand sampleRate; + + /** + * The highest frequency to use when calculating the + * ceptstrum. + */ + public final float upperFrequencyLimit; + + /** + * The lowest frequency to use when calculating the + * ceptstrum. + */ + public final float lowerFrequencyLimit; + + /** + * Resolution of the Mel bank used internally. + */ + public final long filterbankChannelCount; + + /** + * How many output channels to produce per time slice. + */ + public final long dctCoefficientCount; + + public Inputs(GraphOperation op) { + super(new Mfcc(op), op, Arrays.asList("upper_frequency_limit", "lower_frequency_limit", "filterbank_channel_count", "dct_coefficient_count")); + int inputIndex = 0; + spectrogram = (Operand) op.input(inputIndex++); + sampleRate = (Operand) op.input(inputIndex++); + upperFrequencyLimit = op.attributes().getAttrFloat("upper_frequency_limit"); + lowerFrequencyLimit = op.attributes().getAttrFloat("lower_frequency_limit"); + filterbankChannelCount = op.attributes().getAttrInt("filterbank_channel_count"); + dctCoefficientCount = op.attributes().getAttrInt("dct_coefficient_count"); + } } } 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 index 4d10a7d7c1b..7fea36a03b3 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,76 +17,121 @@ package org.tensorflow.op.bitwise; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** - * 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
+ * Elementwise computes the bitwise AND of {@code x} and {@code y}.
+ * The result will have those bits set, that are set in both {@code x} and {@code y}. The
+ * computation is performed on the underlying representations of {@code x} and {@code y}.
+ * 

For example: + *

  * 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 { - +@OpMetadata( + opType = BitwiseAnd.OP_NAME, + inputsClass = BitwiseAnd.Inputs.class +) +@Operator( + group = "bitwise" +) +public final class BitwiseAnd extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "BitwiseAnd"; + + private Output z; + + public BitwiseAnd(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + z = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new BitwiseAnd operation. - * + * * @param scope current scope - * @param x - * @param y + * @param x The x value + * @param y The y value + * @param data type for {@code BitwiseAnd} output and operands * @return a new instance of BitwiseAnd */ + @Endpoint( + describeByClass = true + ) public static BitwiseAnd create(Scope scope, Operand x, Operand y) { - OperationBuilder opBuilder = scope.env().opBuilder("BitwiseAnd", scope.makeOpName("BitwiseAnd")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "BitwiseAnd"); opBuilder.addInput(x.asOutput()); opBuilder.addInput(y.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new BitwiseAnd(opBuilder.build()); + return new BitwiseAnd<>(opBuilder.build()); } - + /** + * Gets z. + * + * @return z. */ 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++); + + @OpInputsMetadata( + outputsClass = BitwiseAnd.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The x input + */ + public final Operand x; + + /** + * The y input + */ + public final Operand y; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new BitwiseAnd<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + x = (Operand) op.input(inputIndex++); + y = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index 140650d91a4..1e57451698b 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,76 +17,121 @@ package org.tensorflow.op.bitwise; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** - * 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
+ * Elementwise computes the bitwise OR of {@code x} and {@code y}.
+ * The result will have those bits set, that are set in {@code x}, {@code y} or both. The
+ * computation is performed on the underlying representations of {@code x} and {@code y}.
+ * 

For example: + *

  * 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 { - +@OpMetadata( + opType = BitwiseOr.OP_NAME, + inputsClass = BitwiseOr.Inputs.class +) +@Operator( + group = "bitwise" +) +public final class BitwiseOr extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "BitwiseOr"; + + private Output z; + + public BitwiseOr(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + z = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new BitwiseOr operation. - * + * * @param scope current scope - * @param x - * @param y + * @param x The x value + * @param y The y value + * @param data type for {@code BitwiseOr} output and operands * @return a new instance of BitwiseOr */ + @Endpoint( + describeByClass = true + ) public static BitwiseOr create(Scope scope, Operand x, Operand y) { - OperationBuilder opBuilder = scope.env().opBuilder("BitwiseOr", scope.makeOpName("BitwiseOr")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "BitwiseOr"); opBuilder.addInput(x.asOutput()); opBuilder.addInput(y.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new BitwiseOr(opBuilder.build()); + return new BitwiseOr<>(opBuilder.build()); } - + /** + * Gets z. + * + * @return z. */ 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++); + + @OpInputsMetadata( + outputsClass = BitwiseOr.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The x input + */ + public final Operand x; + + /** + * The y input + */ + public final Operand y; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new BitwiseOr<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + x = (Operand) op.input(inputIndex++); + y = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index 8edf129964a..52953422482 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,76 +17,121 @@ package org.tensorflow.op.bitwise; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** - * 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
+ * Elementwise computes the bitwise XOR of {@code x} and {@code y}.
+ * The result will have those bits set, that are different in {@code x} and {@code y}. The
+ * computation is performed on the underlying representations of {@code x} and {@code y}.
+ * 

For example: + *

  * 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 { - +@OpMetadata( + opType = BitwiseXor.OP_NAME, + inputsClass = BitwiseXor.Inputs.class +) +@Operator( + group = "bitwise" +) +public final class BitwiseXor extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "BitwiseXor"; + + private Output z; + + public BitwiseXor(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + z = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new BitwiseXor operation. - * + * * @param scope current scope - * @param x - * @param y + * @param x The x value + * @param y The y value + * @param data type for {@code BitwiseXor} output and operands * @return a new instance of BitwiseXor */ + @Endpoint( + describeByClass = true + ) public static BitwiseXor create(Scope scope, Operand x, Operand y) { - OperationBuilder opBuilder = scope.env().opBuilder("BitwiseXor", scope.makeOpName("BitwiseXor")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "BitwiseXor"); opBuilder.addInput(x.asOutput()); opBuilder.addInput(y.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new BitwiseXor(opBuilder.build()); + return new BitwiseXor<>(opBuilder.build()); } - + /** + * Gets z. + * + * @return z. */ 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++); + + @OpInputsMetadata( + outputsClass = BitwiseXor.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The x input + */ + public final Operand x; + + /** + * The y input + */ + public final Operand y; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new BitwiseXor<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + x = (Operand) op.input(inputIndex++); + y = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index c836c84c62d..8dcb5a72de7 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,33 +17,37 @@ package org.tensorflow.op.bitwise; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** - * 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
+ * Invert (flip) each bit of supported types; for example, type {@code uint8} value 01010101 becomes 10101010.
+ * Flip each bit of supported types.  For example, type {@code int8} (decimal 2) binary 00000010 becomes (decimal -3) binary 11111101.
+ * This operation is performed on each element of the tensor argument {@code x}.
+ * 

Example: + *

  * 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.
@@ -56,56 +60,91 @@
  *                                       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 { - +@OpMetadata( + opType = Invert.OP_NAME, + inputsClass = Invert.Inputs.class +) +@Operator( + group = "bitwise" +) +public final class Invert extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Invert"; + + private Output y; + + public Invert(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + y = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new Invert operation. - * + * * @param scope current scope - * @param x + * @param x The x value + * @param data type for {@code Invert} output and operands * @return a new instance of Invert */ + @Endpoint( + describeByClass = true + ) public static Invert create(Scope scope, Operand x) { - OperationBuilder opBuilder = scope.env().opBuilder("Invert", scope.makeOpName("Invert")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Invert"); opBuilder.addInput(x.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new Invert(opBuilder.build()); + return new Invert<>(opBuilder.build()); } - + /** + * Gets y. + * + * @return y. */ 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++); + + @OpInputsMetadata( + outputsClass = Invert.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The x input + */ + public final Operand x; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new Invert<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + x = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index f60b9d41990..ccf41c473f8 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,87 +17,132 @@ package org.tensorflow.op.bitwise; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** - * 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 + * Elementwise computes the bitwise left-shift of {@code x} and {@code y}. + * If {@code y} is negative, or greater than or equal to the width of {@code x} in bits the * result is implementation defined. - *

- * Example: - *

{@code
+ * 

Example: + *

  * 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 + * # <tf.Tensor: shape=(4,), dtype=int8, numpy=array([ -2, 64, 101, 32], dtype=int8)> + *
*/ -@Operator(group = "bitwise") -public final class LeftShift extends PrimitiveOp implements Operand { - +@OpMetadata( + opType = LeftShift.OP_NAME, + inputsClass = LeftShift.Inputs.class +) +@Operator( + group = "bitwise" +) +public final class LeftShift extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "LeftShift"; + + private Output z; + + public LeftShift(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + z = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new LeftShift operation. - * + * * @param scope current scope - * @param x - * @param y + * @param x The x value + * @param y The y value + * @param data type for {@code LeftShift} output and operands * @return a new instance of LeftShift */ + @Endpoint( + describeByClass = true + ) public static LeftShift create(Scope scope, Operand x, Operand y) { - OperationBuilder opBuilder = scope.env().opBuilder("LeftShift", scope.makeOpName("LeftShift")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "LeftShift"); opBuilder.addInput(x.asOutput()); opBuilder.addInput(y.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new LeftShift(opBuilder.build()); + return new LeftShift<>(opBuilder.build()); } - + /** + * Gets z. + * + * @return z. */ 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++); + + @OpInputsMetadata( + outputsClass = LeftShift.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The x input + */ + public final Operand x; + + /** + * The y input + */ + public final Operand y; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new LeftShift<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + x = (Operand) op.input(inputIndex++); + y = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index d88433a7ad4..6c1407b9d19 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,90 +17,134 @@ package org.tensorflow.op.bitwise; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** - * Elementwise computes the bitwise right-shift of `x` and `y`. - *

+ * Elementwise computes the bitwise right-shift of {@code x} and {@code 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 + *

If {@code y} is negative, or greater than or equal to than the width of {@code x} in bits * the result is implementation defined. - *

- * Example: - *

{@code
+ * 

Example: + *

  * 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 + * # <tf.Tensor: shape=(4,), dtype=int8, numpy=array([ -2, 64, 101, 32], dtype=int8)> + *
*/ -@Operator(group = "bitwise") -public final class RightShift extends PrimitiveOp implements Operand { - +@OpMetadata( + opType = RightShift.OP_NAME, + inputsClass = RightShift.Inputs.class +) +@Operator( + group = "bitwise" +) +public final class RightShift extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "RightShift"; + + private Output z; + + public RightShift(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + z = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new RightShift operation. - * + * * @param scope current scope - * @param x - * @param y + * @param x The x value + * @param y The y value + * @param data type for {@code RightShift} output and operands * @return a new instance of RightShift */ + @Endpoint( + describeByClass = true + ) public static RightShift create(Scope scope, Operand x, Operand y) { - OperationBuilder opBuilder = scope.env().opBuilder("RightShift", scope.makeOpName("RightShift")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "RightShift"); opBuilder.addInput(x.asOutput()); opBuilder.addInput(y.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new RightShift(opBuilder.build()); + return new RightShift<>(opBuilder.build()); } - + /** + * Gets z. + * + * @return z. */ 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++); + + @OpInputsMetadata( + outputsClass = RightShift.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The x input + */ + public final Operand x; + + /** + * The y input + */ + public final Operand y; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new RightShift<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + x = (Operand) op.input(inputIndex++); + y = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/cluster/KMC2ChainInitialization.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/cluster/KMC2ChainInitialization.java new file mode 100644 index 00000000000..fb5a6c31581 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/cluster/KMC2ChainInitialization.java @@ -0,0 +1,120 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.cluster; + +import java.util.Arrays; +import org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TInt64; + +/** + * 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. + */ +@OpMetadata( + opType = KMC2ChainInitialization.OP_NAME, + inputsClass = KMC2ChainInitialization.Inputs.class +) +@Operator( + group = "cluster" +) +public final class KMC2ChainInitialization extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "KMC2ChainInitialization"; + + private Output index; + + public KMC2ChainInitialization(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + index = operation.output(outputIdx++); + } + + /** + * 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 + */ + @Endpoint( + describeByClass = true + ) + public static KMC2ChainInitialization create(Scope scope, Operand distances, + Operand seed) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "KMC2ChainInitialization"); + opBuilder.addInput(distances.asOutput()); + opBuilder.addInput(seed.asOutput()); + return new KMC2ChainInitialization(opBuilder.build()); + } + + /** + * Gets index. + * Scalar with the index of the sampled point. + * @return index. + */ + public Output index() { + return index; + } + + @Override + public Output asOutput() { + return index; + } + + @OpInputsMetadata( + outputsClass = KMC2ChainInitialization.class + ) + public static class Inputs extends RawOpInputs { + /** + * Vector with squared distances to the closest previously sampled cluster center + * for each candidate point. + */ + public final Operand distances; + + /** + * Scalar. Seed for initializing the random number generator. + */ + public final Operand seed; + + public Inputs(GraphOperation op) { + super(new KMC2ChainInitialization(op), op, Arrays.asList()); + int inputIndex = 0; + distances = (Operand) op.input(inputIndex++); + seed = (Operand) op.input(inputIndex++); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/cluster/KmeansPlusPlusInitialization.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/cluster/KmeansPlusPlusInitialization.java new file mode 100644 index 00000000000..820fdabb7b9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/cluster/KmeansPlusPlusInitialization.java @@ -0,0 +1,140 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +=======================================================================*/ + +// This class has been generated, DO NOT EDIT! + +package org.tensorflow.op.cluster; + +import java.util.Arrays; +import org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TInt64; + +/** + * 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. + */ +@OpMetadata( + opType = KmeansPlusPlusInitialization.OP_NAME, + inputsClass = KmeansPlusPlusInitialization.Inputs.class +) +@Operator( + group = "cluster" +) +public final class KmeansPlusPlusInitialization extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "KmeansPlusPlusInitialization"; + + private Output samples; + + public KmeansPlusPlusInitialization(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + samples = operation.output(outputIdx++); + } + + /** + * 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 + */ + @Endpoint( + describeByClass = true + ) + public static KmeansPlusPlusInitialization create(Scope scope, Operand points, + Operand numToSample, Operand seed, Operand numRetriesPerSample) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "KmeansPlusPlusInitialization"); + opBuilder.addInput(points.asOutput()); + opBuilder.addInput(numToSample.asOutput()); + opBuilder.addInput(seed.asOutput()); + opBuilder.addInput(numRetriesPerSample.asOutput()); + return new KmeansPlusPlusInitialization(opBuilder.build()); + } + + /** + * Gets samples. + * Matrix of shape (num_to_sample, d). The sampled rows. + * @return samples. + */ + public Output samples() { + return samples; + } + + @Override + public Output asOutput() { + return samples; + } + + @OpInputsMetadata( + outputsClass = KmeansPlusPlusInitialization.class + ) + public static class Inputs extends RawOpInputs { + /** + * Matrix of shape (n, d). Rows are assumed to be input points. + */ + public final Operand points; + + /** + * Scalar. The number of rows to sample. This value must not be larger than n. + */ + public final Operand numToSample; + + /** + * Scalar. Seed for initializing the random number generator. + */ + public final Operand seed; + + /** + * 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. + */ + public final Operand numRetriesPerSample; + + public Inputs(GraphOperation op) { + super(new KmeansPlusPlusInitialization(op), op, Arrays.asList()); + int inputIndex = 0; + points = (Operand) op.input(inputIndex++); + numToSample = (Operand) op.input(inputIndex++); + seed = (Operand) op.input(inputIndex++); + numRetriesPerSample = (Operand) op.input(inputIndex++); + } + } +} 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 deleted file mode 100644 index ebe55e41e6e..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/AllReduce.java +++ /dev/null @@ -1,123 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the 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; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * Mutually reduces multiple tensors of identical type and shape. - * - * @param data type for {@code output()} 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 output() { - return output; - } - - @Override - public Output asOutput() { - return output; - } - - private Output output; - - private AllReduce(Operation operation) { - super(operation); - int outputIdx = 0; - output = 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 deleted file mode 100644 index 46d2722a63d..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/BroadcastRecv.java +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the 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.op.PrimitiveOp; -import org.tensorflow.op.Scope; -import org.tensorflow.tools.Shape; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * Receives a tensor value broadcast from another device. - * - * @param data type for {@code output()} 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, DataType 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", 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 output() { - return output; - } - - @Override - public Output asOutput() { - return output; - } - - private Output output; - - private BroadcastRecv(Operation operation) { - super(operation); - int outputIdx = 0; - output = 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 deleted file mode 100644 index d16b3b0bba9..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/BroadcastSend.java +++ /dev/null @@ -1,77 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the 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.op.PrimitiveOp; -import org.tensorflow.op.Scope; -import org.tensorflow.tools.Shape; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * Broadcasts a tensor value to one or more other devices. - * - * @param data type for {@code output()} 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 output() { - return output; - } - - @Override - public Output asOutput() { - return output; - } - - private Output output; - - private BroadcastSend(Operation operation) { - super(operation); - int outputIdx = 0; - output = operation.output(outputIdx++); - } -} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveAllToAll.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveAllToAll.java new file mode 100644 index 00000000000..9c513486b9b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveAllToAll.java @@ -0,0 +1,176 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the 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.Arrays; +import org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TNumber; +import org.tensorflow.types.family.TType; + +/** + * Mutually exchanges multiple tensors of identical type and shape. + */ +@OpMetadata( + opType = CollectiveAllToAll.OP_NAME, + inputsClass = CollectiveAllToAll.Inputs.class +) +@Operator( + group = "collective" +) +public final class CollectiveAllToAll extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "CollectiveAllToAllV3"; + + private Output data; + + public CollectiveAllToAll(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + data = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new CollectiveAllToAllV3 operation. + * + * @param scope current scope + * @param input The input value + * @param communicator The communicator value + * @param groupAssignment The groupAssignment value + * @param options carries optional attribute values + * @param data type for {@code CollectiveAllToAllV3} output and operands + * @return a new instance of CollectiveAllToAll + */ + @Endpoint( + describeByClass = true + ) + public static CollectiveAllToAll create(Scope scope, Operand input, + Operand communicator, Operand groupAssignment, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "CollectiveAllToAll"); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(communicator.asOutput()); + opBuilder.addInput(groupAssignment.asOutput()); + if (options != null) { + for (Options opts : options) { + if (opts.timeoutSeconds != null) { + opBuilder.setAttr("timeout_seconds", opts.timeoutSeconds); + } + } + } + return new CollectiveAllToAll<>(opBuilder.build()); + } + + /** + * Sets the timeoutSeconds option. + * + * @param timeoutSeconds the timeoutSeconds option + * @return this Options instance. + */ + public static Options timeoutSeconds(Float timeoutSeconds) { + return new Options().timeoutSeconds(timeoutSeconds); + } + + /** + * Gets data. + * + * @return data. + */ + public Output data() { + return data; + } + + @Override + public Output asOutput() { + return data; + } + + /** + * Optional attributes for {@link org.tensorflow.op.collective.CollectiveAllToAll} + */ + public static class Options { + private Float timeoutSeconds; + + private Options() { + } + + /** + * Sets the timeoutSeconds option. + * + * @param timeoutSeconds the timeoutSeconds option + * @return this Options instance. + */ + public Options timeoutSeconds(Float timeoutSeconds) { + this.timeoutSeconds = timeoutSeconds; + return this; + } + } + + @OpInputsMetadata( + outputsClass = CollectiveAllToAll.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * The communicator input + */ + public final Operand communicator; + + /** + * The groupAssignment input + */ + public final Operand groupAssignment; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The timeoutSeconds attribute + */ + public final float timeoutSeconds; + + public Inputs(GraphOperation op) { + super(new CollectiveAllToAll<>(op), op, Arrays.asList("T", "timeout_seconds")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + communicator = (Operand) op.input(inputIndex++); + groupAssignment = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + timeoutSeconds = op.attributes().getAttrFloat("timeout_seconds"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveAssignGroup.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveAssignGroup.java new file mode 100644 index 00000000000..598986e3da3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveAssignGroup.java @@ -0,0 +1,128 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the 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.Arrays; +import org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.TInt32; + +/** + * Assign group keys based on group assignment. + */ +@OpMetadata( + opType = CollectiveAssignGroup.OP_NAME, + inputsClass = CollectiveAssignGroup.Inputs.class +) +@Operator( + group = "collective" +) +public final class CollectiveAssignGroup extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "CollectiveAssignGroupV2"; + + private Output groupSize; + + private Output groupKey; + + public CollectiveAssignGroup(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + groupSize = operation.output(outputIdx++); + groupKey = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new CollectiveAssignGroupV2 operation. + * + * @param scope current scope + * @param groupAssignment The groupAssignment value + * @param deviceIndex The deviceIndex value + * @param baseKey The baseKey value + * @return a new instance of CollectiveAssignGroup + */ + @Endpoint( + describeByClass = true + ) + public static CollectiveAssignGroup create(Scope scope, Operand groupAssignment, + Operand deviceIndex, Operand baseKey) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "CollectiveAssignGroup"); + opBuilder.addInput(groupAssignment.asOutput()); + opBuilder.addInput(deviceIndex.asOutput()); + opBuilder.addInput(baseKey.asOutput()); + return new CollectiveAssignGroup(opBuilder.build()); + } + + /** + * Gets groupSize. + * + * @return groupSize. + */ + public Output groupSize() { + return groupSize; + } + + /** + * Gets groupKey. + * + * @return groupKey. + */ + public Output groupKey() { + return groupKey; + } + + @OpInputsMetadata( + outputsClass = CollectiveAssignGroup.class + ) + public static class Inputs extends RawOpInputs { + /** + * The groupAssignment input + */ + public final Operand groupAssignment; + + /** + * The deviceIndex input + */ + public final Operand deviceIndex; + + /** + * The baseKey input + */ + public final Operand baseKey; + + public Inputs(GraphOperation op) { + super(new CollectiveAssignGroup(op), op, Arrays.asList()); + int inputIndex = 0; + groupAssignment = (Operand) op.input(inputIndex++); + deviceIndex = (Operand) op.input(inputIndex++); + baseKey = (Operand) op.input(inputIndex++); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveBcastRecv.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveBcastRecv.java new file mode 100644 index 00000000000..a66995e4d4e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveBcastRecv.java @@ -0,0 +1,226 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the 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.Arrays; +import org.tensorflow.GraphOperation; +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.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TNumber; +import org.tensorflow.types.family.TType; + +/** + * Receives a tensor value broadcast from another device. + */ +@OpMetadata( + opType = CollectiveBcastRecv.OP_NAME, + inputsClass = CollectiveBcastRecv.Inputs.class +) +@Operator( + group = "collective" +) +public final class CollectiveBcastRecv extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "CollectiveBcastRecvV2"; + + private Output data; + + public CollectiveBcastRecv(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + data = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new CollectiveBcastRecvV2 operation. + * + * @param scope current scope + * @param groupSize The groupSize value + * @param groupKey The groupKey value + * @param instanceKey The instanceKey value + * @param shape The shape value + * @param T The value of the T attribute + * @param options carries optional attribute values + * @param data type for {@code CollectiveBcastRecvV2} output and operands + * @return a new instance of CollectiveBcastRecv + */ + @Endpoint( + describeByClass = true + ) + public static CollectiveBcastRecv create(Scope scope, + Operand groupSize, Operand groupKey, Operand instanceKey, + Operand shape, Class T, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "CollectiveBcastRecv"); + opBuilder.addInput(groupSize.asOutput()); + opBuilder.addInput(groupKey.asOutput()); + opBuilder.addInput(instanceKey.asOutput()); + opBuilder.addInput(shape.asOutput()); + opBuilder.setAttr("T", Operands.toDataType(T)); + if (options != null) { + for (Options opts : options) { + if (opts.communicationHint != null) { + opBuilder.setAttr("communication_hint", opts.communicationHint); + } + if (opts.timeoutSeconds != null) { + opBuilder.setAttr("timeout_seconds", opts.timeoutSeconds); + } + } + } + return new CollectiveBcastRecv<>(opBuilder.build()); + } + + /** + * Sets the communicationHint option. + * + * @param communicationHint the communicationHint option + * @return this Options instance. + */ + public static Options communicationHint(String communicationHint) { + return new Options().communicationHint(communicationHint); + } + + /** + * Sets the timeoutSeconds option. + * + * @param timeoutSeconds the timeoutSeconds option + * @return this Options instance. + */ + public static Options timeoutSeconds(Float timeoutSeconds) { + return new Options().timeoutSeconds(timeoutSeconds); + } + + /** + * Gets data. + * + * @return data. + */ + public Output data() { + return data; + } + + @Override + public Output asOutput() { + return data; + } + + /** + * Optional attributes for {@link org.tensorflow.op.collective.CollectiveBcastRecv} + */ + public static class Options { + private String communicationHint; + + private Float timeoutSeconds; + + private Options() { + } + + /** + * Sets the communicationHint option. + * + * @param communicationHint the communicationHint option + * @return this Options instance. + */ + public Options communicationHint(String communicationHint) { + this.communicationHint = communicationHint; + return this; + } + + /** + * Sets the timeoutSeconds option. + * + * @param timeoutSeconds the timeoutSeconds option + * @return this Options instance. + */ + public Options timeoutSeconds(Float timeoutSeconds) { + this.timeoutSeconds = timeoutSeconds; + return this; + } + } + + @OpInputsMetadata( + outputsClass = CollectiveBcastRecv.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The groupSize input + */ + public final Operand groupSize; + + /** + * The groupKey input + */ + public final Operand groupKey; + + /** + * The instanceKey input + */ + public final Operand instanceKey; + + /** + * The shape input + */ + public final Operand shape; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tshape attribute + */ + public final DataType Tshape; + + /** + * The communicationHint attribute + */ + public final String communicationHint; + + /** + * The timeoutSeconds attribute + */ + public final float timeoutSeconds; + + public Inputs(GraphOperation op) { + super(new CollectiveBcastRecv<>(op), op, Arrays.asList("T", "Tshape", "communication_hint", "timeout_seconds")); + int inputIndex = 0; + groupSize = (Operand) op.input(inputIndex++); + groupKey = (Operand) op.input(inputIndex++); + instanceKey = (Operand) op.input(inputIndex++); + shape = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tshape = op.attributes().getAttrType("Tshape"); + communicationHint = op.attributes().getAttrString("communication_hint"); + timeoutSeconds = op.attributes().getAttrFloat("timeout_seconds"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveBcastSend.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveBcastSend.java new file mode 100644 index 00000000000..df7a315413f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveBcastSend.java @@ -0,0 +1,216 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the 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.Arrays; +import org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TType; + +/** + * Broadcasts a tensor value to one or more other devices. + */ +@OpMetadata( + opType = CollectiveBcastSend.OP_NAME, + inputsClass = CollectiveBcastSend.Inputs.class +) +@Operator( + group = "collective" +) +public final class CollectiveBcastSend extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "CollectiveBcastSendV2"; + + private Output data; + + public CollectiveBcastSend(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + data = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new CollectiveBcastSendV2 operation. + * + * @param scope current scope + * @param input The input value + * @param groupSize The groupSize value + * @param groupKey The groupKey value + * @param instanceKey The instanceKey value + * @param options carries optional attribute values + * @param data type for {@code CollectiveBcastSendV2} output and operands + * @return a new instance of CollectiveBcastSend + */ + @Endpoint( + describeByClass = true + ) + public static CollectiveBcastSend create(Scope scope, Operand input, + Operand groupSize, Operand groupKey, Operand instanceKey, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "CollectiveBcastSend"); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(groupSize.asOutput()); + opBuilder.addInput(groupKey.asOutput()); + opBuilder.addInput(instanceKey.asOutput()); + if (options != null) { + for (Options opts : options) { + if (opts.communicationHint != null) { + opBuilder.setAttr("communication_hint", opts.communicationHint); + } + if (opts.timeoutSeconds != null) { + opBuilder.setAttr("timeout_seconds", opts.timeoutSeconds); + } + } + } + return new CollectiveBcastSend<>(opBuilder.build()); + } + + /** + * Sets the communicationHint option. + * + * @param communicationHint the communicationHint option + * @return this Options instance. + */ + public static Options communicationHint(String communicationHint) { + return new Options().communicationHint(communicationHint); + } + + /** + * Sets the timeoutSeconds option. + * + * @param timeoutSeconds the timeoutSeconds option + * @return this Options instance. + */ + public static Options timeoutSeconds(Float timeoutSeconds) { + return new Options().timeoutSeconds(timeoutSeconds); + } + + /** + * Gets data. + * + * @return data. + */ + public Output data() { + return data; + } + + @Override + public Output asOutput() { + return data; + } + + /** + * Optional attributes for {@link org.tensorflow.op.collective.CollectiveBcastSend} + */ + public static class Options { + private String communicationHint; + + private Float timeoutSeconds; + + private Options() { + } + + /** + * Sets the communicationHint option. + * + * @param communicationHint the communicationHint option + * @return this Options instance. + */ + public Options communicationHint(String communicationHint) { + this.communicationHint = communicationHint; + return this; + } + + /** + * Sets the timeoutSeconds option. + * + * @param timeoutSeconds the timeoutSeconds option + * @return this Options instance. + */ + public Options timeoutSeconds(Float timeoutSeconds) { + this.timeoutSeconds = timeoutSeconds; + return this; + } + } + + @OpInputsMetadata( + outputsClass = CollectiveBcastSend.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * The groupSize input + */ + public final Operand groupSize; + + /** + * The groupKey input + */ + public final Operand groupKey; + + /** + * The instanceKey input + */ + public final Operand instanceKey; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The communicationHint attribute + */ + public final String communicationHint; + + /** + * The timeoutSeconds attribute + */ + public final float timeoutSeconds; + + public Inputs(GraphOperation op) { + super(new CollectiveBcastSend<>(op), op, Arrays.asList("T", "communication_hint", "timeout_seconds")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + groupSize = (Operand) op.input(inputIndex++); + groupKey = (Operand) op.input(inputIndex++); + instanceKey = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + communicationHint = op.attributes().getAttrString("communication_hint"); + timeoutSeconds = op.attributes().getAttrFloat("timeout_seconds"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveGather.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveGather.java new file mode 100644 index 00000000000..57a2b134ff6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveGather.java @@ -0,0 +1,289 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the 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.Arrays; +import org.tensorflow.GraphOperation; +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.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TNumber; +import org.tensorflow.types.family.TType; + +/** + * Mutually accumulates multiple tensors of identical type and shape. + * {@code is_stateless} means each op does not need control dependencies to other + * collective ops. In this case, keys that are unique at runtime + * (e.g. {@code instance_key}) should be used to distinguish collective groups. + */ +@OpMetadata( + opType = CollectiveGather.OP_NAME, + inputsClass = CollectiveGather.Inputs.class +) +@Operator( + group = "collective" +) +public final class CollectiveGather extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "CollectiveGatherV2"; + + private Output data; + + public CollectiveGather(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + data = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new CollectiveGatherV2 operation. + * + * @param scope current scope + * @param input The input value + * @param groupSize The groupSize value + * @param groupKey The groupKey value + * @param instanceKey The instanceKey value + * @param orderingToken The orderingToken value + * @param options carries optional attribute values + * @param data type for {@code CollectiveGatherV2} output and operands + * @return a new instance of CollectiveGather + */ + @Endpoint( + describeByClass = true + ) + public static CollectiveGather create(Scope scope, Operand input, + Operand groupSize, Operand groupKey, Operand instanceKey, + Iterable> orderingToken, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "CollectiveGather"); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(groupSize.asOutput()); + opBuilder.addInput(groupKey.asOutput()); + opBuilder.addInput(instanceKey.asOutput()); + opBuilder.addInputList(Operands.asOutputs(orderingToken)); + if (options != null) { + for (Options opts : options) { + if (opts.communicationHint != null) { + opBuilder.setAttr("communication_hint", opts.communicationHint); + } + if (opts.timeoutSeconds != null) { + opBuilder.setAttr("timeout_seconds", opts.timeoutSeconds); + } + if (opts.isStateless != null) { + opBuilder.setAttr("is_stateless", opts.isStateless); + } + if (opts.NorderingToken != null) { + opBuilder.setAttr("Nordering_token", opts.NorderingToken); + } + } + } + return new CollectiveGather<>(opBuilder.build()); + } + + /** + * Sets the communicationHint option. + * + * @param communicationHint the communicationHint option + * @return this Options instance. + */ + public static Options communicationHint(String communicationHint) { + return new Options().communicationHint(communicationHint); + } + + /** + * Sets the timeoutSeconds option. + * + * @param timeoutSeconds the timeoutSeconds option + * @return this Options instance. + */ + public static Options timeoutSeconds(Float timeoutSeconds) { + return new Options().timeoutSeconds(timeoutSeconds); + } + + /** + * Sets the isStateless option. + * + * @param isStateless the isStateless option + * @return this Options instance. + */ + public static Options isStateless(Boolean isStateless) { + return new Options().isStateless(isStateless); + } + + /** + * Sets the NorderingToken option. + * + * @param NorderingToken the NorderingToken option + * @return this Options instance. + */ + public static Options NorderingToken(Long NorderingToken) { + return new Options().NorderingToken(NorderingToken); + } + + /** + * Gets data. + * + * @return data. + */ + public Output data() { + return data; + } + + @Override + public Output asOutput() { + return data; + } + + /** + * Optional attributes for {@link org.tensorflow.op.collective.CollectiveGather} + */ + public static class Options { + private String communicationHint; + + private Float timeoutSeconds; + + private Boolean isStateless; + + private Long NorderingToken; + + private Options() { + } + + /** + * Sets the communicationHint option. + * + * @param communicationHint the communicationHint option + * @return this Options instance. + */ + public Options communicationHint(String communicationHint) { + this.communicationHint = communicationHint; + return this; + } + + /** + * Sets the timeoutSeconds option. + * + * @param timeoutSeconds the timeoutSeconds option + * @return this Options instance. + */ + public Options timeoutSeconds(Float timeoutSeconds) { + this.timeoutSeconds = timeoutSeconds; + return this; + } + + /** + * Sets the isStateless option. + * + * @param isStateless the isStateless option + * @return this Options instance. + */ + public Options isStateless(Boolean isStateless) { + this.isStateless = isStateless; + return this; + } + + /** + * Sets the NorderingToken option. + * + * @param NorderingToken the NorderingToken option + * @return this Options instance. + */ + public Options NorderingToken(Long NorderingToken) { + this.NorderingToken = NorderingToken; + return this; + } + } + + @OpInputsMetadata( + outputsClass = CollectiveGather.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * The groupSize input + */ + public final Operand groupSize; + + /** + * The groupKey input + */ + public final Operand groupKey; + + /** + * The instanceKey input + */ + public final Operand instanceKey; + + /** + * The orderingToken input + */ + public final Iterable> orderingToken; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The communicationHint attribute + */ + public final String communicationHint; + + /** + * The timeoutSeconds attribute + */ + public final float timeoutSeconds; + + /** + * The isStateless attribute + */ + public final boolean isStateless; + + public Inputs(GraphOperation op) { + super(new CollectiveGather<>(op), op, Arrays.asList("T", "communication_hint", "timeout_seconds", "is_stateless")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + groupSize = (Operand) op.input(inputIndex++); + groupKey = (Operand) op.input(inputIndex++); + instanceKey = (Operand) op.input(inputIndex++); + int orderingTokenLength = op.inputListLength("ordering_token"); + orderingToken = Arrays.asList((Operand[]) op.inputList(inputIndex, orderingTokenLength)); + inputIndex += orderingTokenLength; + T = op.attributes().getAttrType("T"); + communicationHint = op.attributes().getAttrString("communication_hint"); + timeoutSeconds = op.attributes().getAttrFloat("timeout_seconds"); + isStateless = op.attributes().getAttrBool("is_stateless"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveInitializeCommunicator.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveInitializeCommunicator.java new file mode 100644 index 00000000000..e6ea4b8b79c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveInitializeCommunicator.java @@ -0,0 +1,201 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the 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.Arrays; +import org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TType; + +/** + * Initializes a group for collective operations. + */ +@OpMetadata( + opType = CollectiveInitializeCommunicator.OP_NAME, + inputsClass = CollectiveInitializeCommunicator.Inputs.class +) +@Operator( + group = "collective" +) +public final class CollectiveInitializeCommunicator extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "CollectiveInitializeCommunicator"; + + private Output communicator; + + @SuppressWarnings("unchecked") + public CollectiveInitializeCommunicator(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + communicator = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new CollectiveInitializeCommunicator operation. + * + * @param scope current scope + * @param groupKey The groupKey value + * @param rank The rank value + * @param groupSize The groupSize value + * @param options carries optional attribute values + * @return a new instance of CollectiveInitializeCommunicator + */ + @Endpoint( + describeByClass = true + ) + public static CollectiveInitializeCommunicator create(Scope scope, Operand groupKey, + Operand rank, Operand groupSize, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "CollectiveInitializeCommunicator"); + opBuilder.addInput(groupKey.asOutput()); + opBuilder.addInput(rank.asOutput()); + opBuilder.addInput(groupSize.asOutput()); + if (options != null) { + for (Options opts : options) { + if (opts.communicationHint != null) { + opBuilder.setAttr("communication_hint", opts.communicationHint); + } + if (opts.timeoutSeconds != null) { + opBuilder.setAttr("timeout_seconds", opts.timeoutSeconds); + } + } + } + return new CollectiveInitializeCommunicator(opBuilder.build()); + } + + /** + * Sets the communicationHint option. + * + * @param communicationHint the communicationHint option + * @return this Options instance. + */ + public static Options communicationHint(String communicationHint) { + return new Options().communicationHint(communicationHint); + } + + /** + * Sets the timeoutSeconds option. + * + * @param timeoutSeconds the timeoutSeconds option + * @return this Options instance. + */ + public static Options timeoutSeconds(Float timeoutSeconds) { + return new Options().timeoutSeconds(timeoutSeconds); + } + + /** + * Gets communicator. + * + * @return communicator. + */ + public Output communicator() { + return communicator; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) communicator; + } + + /** + * Optional attributes for {@link org.tensorflow.op.collective.CollectiveInitializeCommunicator} + */ + public static class Options { + private String communicationHint; + + private Float timeoutSeconds; + + private Options() { + } + + /** + * Sets the communicationHint option. + * + * @param communicationHint the communicationHint option + * @return this Options instance. + */ + public Options communicationHint(String communicationHint) { + this.communicationHint = communicationHint; + return this; + } + + /** + * Sets the timeoutSeconds option. + * + * @param timeoutSeconds the timeoutSeconds option + * @return this Options instance. + */ + public Options timeoutSeconds(Float timeoutSeconds) { + this.timeoutSeconds = timeoutSeconds; + return this; + } + } + + @OpInputsMetadata( + outputsClass = CollectiveInitializeCommunicator.class + ) + public static class Inputs extends RawOpInputs { + /** + * The groupKey input + */ + public final Operand groupKey; + + /** + * The rank input + */ + public final Operand rank; + + /** + * The groupSize input + */ + public final Operand groupSize; + + /** + * The communicationHint attribute + */ + public final String communicationHint; + + /** + * The timeoutSeconds attribute + */ + public final float timeoutSeconds; + + public Inputs(GraphOperation op) { + super(new CollectiveInitializeCommunicator(op), op, Arrays.asList("communication_hint", "timeout_seconds")); + int inputIndex = 0; + groupKey = (Operand) op.input(inputIndex++); + rank = (Operand) op.input(inputIndex++); + groupSize = (Operand) op.input(inputIndex++); + communicationHint = op.attributes().getAttrString("communication_hint"); + timeoutSeconds = op.attributes().getAttrFloat("timeout_seconds"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectivePermute.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectivePermute.java new file mode 100644 index 00000000000..380a949a664 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectivePermute.java @@ -0,0 +1,128 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the 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.Arrays; +import org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TType; + +/** + * An Op to permute tensors across replicated TPU instances. + * Each instance supplies its own input. + *

For example, suppose there are 4 TPU instances: {@code [A, B, C, D]}. Passing + * source_target_pairs={@code [[0,1],[1,2],[2,3],[3,0]]} gets the outputs: + * {@code [D, A, B, C]}. + */ +@OpMetadata( + opType = CollectivePermute.OP_NAME, + inputsClass = CollectivePermute.Inputs.class +) +@Operator( + group = "collective" +) +public final class CollectivePermute extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "CollectivePermute"; + + private Output output; + + public CollectivePermute(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * 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]. + * @param data type for {@code CollectivePermute} output and operands + * @return a new instance of CollectivePermute + */ + @Endpoint( + describeByClass = true + ) + public static CollectivePermute create(Scope scope, Operand input, + Operand sourceTargetPairs) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "CollectivePermute"); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(sourceTargetPairs.asOutput()); + return new CollectivePermute<>(opBuilder.build()); + } + + /** + * Gets output. + * The permuted input. + * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + @OpInputsMetadata( + outputsClass = CollectivePermute.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The local input to be permuted. Currently only supports float and + * bfloat16. + */ + public final Operand input; + + /** + * A tensor with shape [num_pairs, 2]. + */ + public final Operand sourceTargetPairs; + + /** + * The type of elements to be exchanged. + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new CollectivePermute<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + sourceTargetPairs = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveReduce.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveReduce.java new file mode 100644 index 00000000000..8f6c26778e1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveReduce.java @@ -0,0 +1,185 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the 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.Arrays; +import org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TNumber; +import org.tensorflow.types.family.TType; + +/** + * Mutually reduces multiple tensors of identical type and shape. + */ +@OpMetadata( + opType = CollectiveReduce.OP_NAME, + inputsClass = CollectiveReduce.Inputs.class +) +@Operator( + group = "collective" +) +public final class CollectiveReduce extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "CollectiveReduceV3"; + + private Output data; + + public CollectiveReduce(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + data = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new CollectiveReduceV3 operation. + * + * @param scope current scope + * @param input The input value + * @param communicator The communicator value + * @param groupAssignment The groupAssignment value + * @param reduction The value of the reduction attribute + * @param options carries optional attribute values + * @param data type for {@code CollectiveReduceV3} output and operands + * @return a new instance of CollectiveReduce + */ + @Endpoint( + describeByClass = true + ) + public static CollectiveReduce create(Scope scope, Operand input, + Operand communicator, Operand groupAssignment, String reduction, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "CollectiveReduce"); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(communicator.asOutput()); + opBuilder.addInput(groupAssignment.asOutput()); + opBuilder.setAttr("reduction", reduction); + if (options != null) { + for (Options opts : options) { + if (opts.timeoutSeconds != null) { + opBuilder.setAttr("timeout_seconds", opts.timeoutSeconds); + } + } + } + return new CollectiveReduce<>(opBuilder.build()); + } + + /** + * Sets the timeoutSeconds option. + * + * @param timeoutSeconds the timeoutSeconds option + * @return this Options instance. + */ + public static Options timeoutSeconds(Float timeoutSeconds) { + return new Options().timeoutSeconds(timeoutSeconds); + } + + /** + * Gets data. + * + * @return data. + */ + public Output data() { + return data; + } + + @Override + public Output asOutput() { + return data; + } + + /** + * Optional attributes for {@link org.tensorflow.op.collective.CollectiveReduce} + */ + public static class Options { + private Float timeoutSeconds; + + private Options() { + } + + /** + * Sets the timeoutSeconds option. + * + * @param timeoutSeconds the timeoutSeconds option + * @return this Options instance. + */ + public Options timeoutSeconds(Float timeoutSeconds) { + this.timeoutSeconds = timeoutSeconds; + return this; + } + } + + @OpInputsMetadata( + outputsClass = CollectiveReduce.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * The communicator input + */ + public final Operand communicator; + + /** + * The groupAssignment input + */ + public final Operand groupAssignment; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The reduction attribute + */ + public final String reduction; + + /** + * The timeoutSeconds attribute + */ + public final float timeoutSeconds; + + public Inputs(GraphOperation op) { + super(new CollectiveReduce<>(op), op, Arrays.asList("T", "reduction", "timeout_seconds")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + communicator = (Operand) op.input(inputIndex++); + groupAssignment = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + reduction = op.attributes().getAttrString("reduction"); + timeoutSeconds = op.attributes().getAttrFloat("timeout_seconds"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveReduceScatter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveReduceScatter.java new file mode 100644 index 00000000000..8b89dbaf183 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/CollectiveReduceScatter.java @@ -0,0 +1,338 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the 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.Arrays; +import org.tensorflow.GraphOperation; +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.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TNumber; +import org.tensorflow.types.family.TType; + +/** + * Mutually reduces multiple tensors of identical type and shape and scatters the result. + * {@code is_stateless} means each op does not need control dependencies to other + * collective ops. In this case, keys that are unique at runtime + * (e.g. {@code instance_key}) should be used to distinguish collective groups. + */ +@OpMetadata( + opType = CollectiveReduceScatter.OP_NAME, + inputsClass = CollectiveReduceScatter.Inputs.class +) +@Operator( + group = "collective" +) +public final class CollectiveReduceScatter extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "CollectiveReduceScatterV2"; + + private Output data; + + public CollectiveReduceScatter(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + data = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new CollectiveReduceScatterV2 operation. + * + * @param scope current scope + * @param input The input value + * @param groupSize The groupSize value + * @param groupKey The groupKey value + * @param instanceKey The instanceKey value + * @param orderingToken The orderingToken value + * @param mergeOp The value of the mergeOp attribute + * @param finalOp The value of the finalOp attribute + * @param options carries optional attribute values + * @param data type for {@code CollectiveReduceScatterV2} output and operands + * @return a new instance of CollectiveReduceScatter + */ + @Endpoint( + describeByClass = true + ) + public static CollectiveReduceScatter create(Scope scope, Operand input, + Operand groupSize, Operand groupKey, Operand instanceKey, + Iterable> orderingToken, String mergeOp, String finalOp, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "CollectiveReduceScatter"); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(groupSize.asOutput()); + opBuilder.addInput(groupKey.asOutput()); + opBuilder.addInput(instanceKey.asOutput()); + opBuilder.addInputList(Operands.asOutputs(orderingToken)); + opBuilder.setAttr("merge_op", mergeOp); + opBuilder.setAttr("final_op", finalOp); + if (options != null) { + for (Options opts : options) { + if (opts.communicationHint != null) { + opBuilder.setAttr("communication_hint", opts.communicationHint); + } + if (opts.timeoutSeconds != null) { + opBuilder.setAttr("timeout_seconds", opts.timeoutSeconds); + } + if (opts.isStateless != null) { + opBuilder.setAttr("is_stateless", opts.isStateless); + } + if (opts.NorderingToken != null) { + opBuilder.setAttr("Nordering_token", opts.NorderingToken); + } + if (opts.maxSubdivsPerDevice != null) { + opBuilder.setAttr("max_subdivs_per_device", opts.maxSubdivsPerDevice); + } + } + } + return new CollectiveReduceScatter<>(opBuilder.build()); + } + + /** + * Sets the communicationHint option. + * + * @param communicationHint the communicationHint option + * @return this Options instance. + */ + public static Options communicationHint(String communicationHint) { + return new Options().communicationHint(communicationHint); + } + + /** + * Sets the timeoutSeconds option. + * + * @param timeoutSeconds the timeoutSeconds option + * @return this Options instance. + */ + public static Options timeoutSeconds(Float timeoutSeconds) { + return new Options().timeoutSeconds(timeoutSeconds); + } + + /** + * Sets the isStateless option. + * + * @param isStateless the isStateless option + * @return this Options instance. + */ + public static Options isStateless(Boolean isStateless) { + return new Options().isStateless(isStateless); + } + + /** + * Sets the NorderingToken option. + * + * @param NorderingToken the NorderingToken option + * @return this Options instance. + */ + public static Options NorderingToken(Long NorderingToken) { + return new Options().NorderingToken(NorderingToken); + } + + /** + * Sets the maxSubdivsPerDevice option. + * + * @param maxSubdivsPerDevice the maxSubdivsPerDevice option + * @return this Options instance. + */ + public static Options maxSubdivsPerDevice(Long maxSubdivsPerDevice) { + return new Options().maxSubdivsPerDevice(maxSubdivsPerDevice); + } + + /** + * Gets data. + * + * @return data. + */ + public Output data() { + return data; + } + + @Override + public Output asOutput() { + return data; + } + + /** + * Optional attributes for {@link org.tensorflow.op.collective.CollectiveReduceScatter} + */ + public static class Options { + private String communicationHint; + + private Float timeoutSeconds; + + private Boolean isStateless; + + private Long NorderingToken; + + private Long maxSubdivsPerDevice; + + private Options() { + } + + /** + * Sets the communicationHint option. + * + * @param communicationHint the communicationHint option + * @return this Options instance. + */ + public Options communicationHint(String communicationHint) { + this.communicationHint = communicationHint; + return this; + } + + /** + * Sets the timeoutSeconds option. + * + * @param timeoutSeconds the timeoutSeconds option + * @return this Options instance. + */ + public Options timeoutSeconds(Float timeoutSeconds) { + this.timeoutSeconds = timeoutSeconds; + return this; + } + + /** + * Sets the isStateless option. + * + * @param isStateless the isStateless option + * @return this Options instance. + */ + public Options isStateless(Boolean isStateless) { + this.isStateless = isStateless; + return this; + } + + /** + * Sets the NorderingToken option. + * + * @param NorderingToken the NorderingToken option + * @return this Options instance. + */ + public Options NorderingToken(Long NorderingToken) { + this.NorderingToken = NorderingToken; + return this; + } + + /** + * Sets the maxSubdivsPerDevice option. + * + * @param maxSubdivsPerDevice the maxSubdivsPerDevice option + * @return this Options instance. + */ + public Options maxSubdivsPerDevice(Long maxSubdivsPerDevice) { + this.maxSubdivsPerDevice = maxSubdivsPerDevice; + return this; + } + } + + @OpInputsMetadata( + outputsClass = CollectiveReduceScatter.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * The groupSize input + */ + public final Operand groupSize; + + /** + * The groupKey input + */ + public final Operand groupKey; + + /** + * The instanceKey input + */ + public final Operand instanceKey; + + /** + * The orderingToken input + */ + public final Iterable> orderingToken; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The mergeOp attribute + */ + public final String mergeOp; + + /** + * The finalOp attribute + */ + public final String finalOp; + + /** + * The communicationHint attribute + */ + public final String communicationHint; + + /** + * The timeoutSeconds attribute + */ + public final float timeoutSeconds; + + /** + * The isStateless attribute + */ + public final boolean isStateless; + + /** + * The maxSubdivsPerDevice attribute + */ + public final long maxSubdivsPerDevice; + + public Inputs(GraphOperation op) { + super(new CollectiveReduceScatter<>(op), op, Arrays.asList("T", "merge_op", "final_op", "communication_hint", "timeout_seconds", "is_stateless", "max_subdivs_per_device")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + groupSize = (Operand) op.input(inputIndex++); + groupKey = (Operand) op.input(inputIndex++); + instanceKey = (Operand) op.input(inputIndex++); + int orderingTokenLength = op.inputListLength("ordering_token"); + orderingToken = Arrays.asList((Operand[]) op.inputList(inputIndex, orderingTokenLength)); + inputIndex += orderingTokenLength; + T = op.attributes().getAttrType("T"); + mergeOp = op.attributes().getAttrString("merge_op"); + finalOp = op.attributes().getAttrString("final_op"); + communicationHint = op.attributes().getAttrString("communication_hint"); + timeoutSeconds = op.attributes().getAttrFloat("timeout_seconds"); + isStateless = op.attributes().getAttrBool("is_stateless"); + maxSubdivsPerDevice = op.attributes().getAttrInt("max_subdivs_per_device"); + } + } +} 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 index 39c22032b8c..f634f318b2b 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,61 +17,51 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; 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. + *

Returns nothing but an exception. */ +@OpMetadata( + opType = Abort.OP_NAME, + inputsClass = Abort.Inputs.class +) @Operator -public final class Abort extends PrimitiveOp { - +public final class Abort extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.Abort} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Abort"; + + public Abort(Operation operation) { + super(operation, OP_NAME); } - + /** * Factory method to create a class wrapping a new Abort operation. - * + * * @param scope current scope - * @param options carries optional attributes values + * @param options carries optional attribute values * @return a new instance of Abort */ + @Endpoint( + describeByClass = true + ) public static Abort create(Scope scope, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("Abort", scope.makeOpName("Abort")); - opBuilder = scope.applyControlDependencies(opBuilder); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Abort"); if (options != null) { for (Options opts : options) { if (opts.errorMsg != null) { @@ -84,23 +74,80 @@ public static Abort create(Scope scope, Options... options) { } return new Abort(opBuilder.build()); } - + /** + * Sets the errorMsg option. + * * @param errorMsg A string which is the message associated with the exception. + * @return this Options instance. */ public static Options errorMsg(String errorMsg) { return new Options().errorMsg(errorMsg); } - + /** - * @param exitWithoutError + * Sets the exitWithoutError option. + * + * @param exitWithoutError the exitWithoutError option + * @return this Options instance. */ public static Options exitWithoutError(Boolean exitWithoutError) { return new Options().exitWithoutError(exitWithoutError); } - - - private Abort(Operation operation) { - super(operation); + + /** + * Optional attributes for {@link org.tensorflow.op.core.Abort} + */ + public static class Options { + private String errorMsg; + + private Boolean exitWithoutError; + + private Options() { + } + + /** + * Sets the errorMsg option. + * + * @param errorMsg A string which is the message associated with the exception. + * @return this Options instance. + */ + public Options errorMsg(String errorMsg) { + this.errorMsg = errorMsg; + return this; + } + + /** + * Sets the exitWithoutError option. + * + * @param exitWithoutError the exitWithoutError option + * @return this Options instance. + */ + public Options exitWithoutError(Boolean exitWithoutError) { + this.exitWithoutError = exitWithoutError; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Abort.class + ) + public static class Inputs extends RawOpInputs { + /** + * A string which is the message associated with the exception. + */ + public final String errorMsg; + + /** + * The exitWithoutError attribute + */ + public final boolean exitWithoutError; + + public Inputs(GraphOperation op) { + super(new Abort(op), op, Arrays.asList("error_msg", "exit_without_error")); + int inputIndex = 0; + errorMsg = op.attributes().getAttrString("error_msg"); + exitWithoutError = op.attributes().getAttrBool("exit_without_error"); + } } } 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 index c5511c40bd3..defb98c912b 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,62 +17,67 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TBool; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** - * 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 + * Computes the "logical and" of elements across dimensions of a tensor. + * Reduces {@code input} along the dimensions given in {@code axis}. Unless + * {@code keep_dims} is true, the rank of the tensor is reduced by 1 for each entry in + * {@code axis}. If {@code keep_dims} is true, the reduced dimensions are * retained with length 1. */ +@OpMetadata( + opType = All.OP_NAME, + inputsClass = All.Inputs.class +) @Operator -public final class All extends PrimitiveOp implements Operand { - +public final class All extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.All} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "All"; + + private Output output; + + public All(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * 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 + * {@code [-rank(input), rank(input))}. + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static All create(Scope scope, Operand input, Operand axis, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "All"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.keepDims != null) { @@ -82,31 +87,84 @@ public static All create(Scope scope, Operand input, } return new All(opBuilder.build()); } - + /** + * Sets the keepDims option. + * * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. */ public static Options keepDims(Boolean keepDims) { return new Options().keepDims(keepDims); } - + /** + * Gets output. * The reduced tensor. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.All} + */ + public static class Options { + private Boolean keepDims; + + private Options() { + } + + /** + * Sets the keepDims option. + * + * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + } + + @OpInputsMetadata( + outputsClass = All.class + ) + public static class Inputs extends RawOpInputs { + /** + * The tensor to reduce. + */ + public final Operand input; + + /** + * The dimensions to reduce. Must be in the range + * {@code [-rank(input), rank(input))}. + */ + public final Operand axis; + + /** + * If true, retain reduced dimensions with length 1. + */ + public final boolean keepDims; + + /** + * The Tidx attribute + */ + public final DataType Tidx; + + public Inputs(GraphOperation op) { + super(new All(op), op, Arrays.asList("keep_dims", "Tidx")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + axis = (Operand) op.input(inputIndex++); + keepDims = op.attributes().getAttrBool("keep_dims"); + Tidx = op.attributes().getAttrType("Tidx"); + } } } 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 deleted file mode 100644 index dce3ea4259f..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AllToAll.java +++ /dev/null @@ -1,97 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt32; -import org.tensorflow.types.family.TType; - -/** - * 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/AnonymousHashTable.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousHashTable.java new file mode 100644 index 00000000000..0dcfd8003dc --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousHashTable.java @@ -0,0 +1,125 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +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.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * Creates a uninitialized anonymous hash table. + * This op creates a new anonymous hash table (as a resource) everytime + * it is executed, with the specified dtype of its keys and values, + * returning the resource handle. Before using the table you will have + * to initialize it. After initialization the table will be + * immutable. The table is anonymous in the sense that it can only be + * accessed by the returned resource handle (e.g. it cannot be looked up + * by a name in a resource manager). The table will be automatically + * deleted when all resource handles pointing to it are gone. + */ +@OpMetadata( + opType = AnonymousHashTable.OP_NAME, + inputsClass = AnonymousHashTable.Inputs.class +) +@Operator +public final class AnonymousHashTable extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "AnonymousHashTable"; + + private Output tableHandle; + + @SuppressWarnings("unchecked") + public AnonymousHashTable(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + tableHandle = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new AnonymousHashTable operation. + * + * @param scope current scope + * @param keyDtype Type of the table keys. + * @param valueDtype Type of the table values. + * @param data type for {@code AnonymousHashTable} output and operands + * @param data type for {@code AnonymousHashTable} output and operands + * @return a new instance of AnonymousHashTable + */ + @Endpoint( + describeByClass = true + ) + public static AnonymousHashTable create(Scope scope, + Class keyDtype, Class valueDtype) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "AnonymousHashTable"); + opBuilder.setAttr("key_dtype", Operands.toDataType(keyDtype)); + opBuilder.setAttr("value_dtype", Operands.toDataType(valueDtype)); + return new AnonymousHashTable(opBuilder.build()); + } + + /** + * Gets tableHandle. + * The resource handle to the newly created hash-table resource. + * @return tableHandle. + */ + public Output tableHandle() { + return tableHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) tableHandle; + } + + @OpInputsMetadata( + outputsClass = AnonymousHashTable.class + ) + public static class Inputs extends RawOpInputs { + /** + * Type of the table keys. + */ + public final DataType keyDtype; + + /** + * Type of the table values. + */ + public final DataType valueDtype; + + public Inputs(GraphOperation op) { + super(new AnonymousHashTable(op), op, Arrays.asList("key_dtype", "value_dtype")); + int inputIndex = 0; + keyDtype = op.attributes().getAttrType("key_dtype"); + valueDtype = op.attributes().getAttrType("value_dtype"); + } + } +} 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 deleted file mode 100644 index 860ff7ec002..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousIteratorV2.java +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.op.PrimitiveOp; -import org.tensorflow.op.Scope; -import org.tensorflow.tools.Shape; - -/** - * 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] = 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 deleted file mode 100644 index 6ad9c51d392..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousMemoryCache.java +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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 deleted file mode 100644 index aa5f1df880d..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousMultiDeviceIterator.java +++ /dev/null @@ -1,90 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.op.PrimitiveOp; -import org.tensorflow.op.Scope; -import org.tensorflow.tools.Shape; - -/** - * 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] = 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/AnonymousMutableDenseHashTable.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousMutableDenseHashTable.java new file mode 100644 index 00000000000..9e3baa34b1f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousMutableDenseHashTable.java @@ -0,0 +1,261 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * Creates an empty anonymous mutable hash table that uses tensors as the backing store. + * This op creates a new anonymous mutable hash table (as a resource) everytime + * it is executed, with the specified dtype of its keys and values, + * returning the resource handle. Each value must be a scalar. + * Data can be inserted into the table using + * the insert operations. It does not support the initialization operation. + *

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

The table is anonymous in the sense that it can only be + * accessed by the returned resource handle (e.g. it cannot be looked up + * by a name in a resource manager). The table will be automatically + * deleted when all resource handles pointing to it are gone. + */ +@OpMetadata( + opType = AnonymousMutableDenseHashTable.OP_NAME, + inputsClass = AnonymousMutableDenseHashTable.Inputs.class +) +@Operator +public final class AnonymousMutableDenseHashTable extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "AnonymousMutableDenseHashTable"; + + private Output tableHandle; + + @SuppressWarnings("unchecked") + public AnonymousMutableDenseHashTable(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + tableHandle = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new AnonymousMutableDenseHashTable 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 The deletedKey value + * @param valueDtype Type of the table values. + * @param options carries optional attribute values + * @param data type for {@code AnonymousMutableDenseHashTable} output and operands + * @param data type for {@code AnonymousMutableDenseHashTable} output and operands + * @return a new instance of AnonymousMutableDenseHashTable + */ + @Endpoint( + describeByClass = true + ) + public static AnonymousMutableDenseHashTable create( + Scope scope, Operand emptyKey, Operand deletedKey, Class valueDtype, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "AnonymousMutableDenseHashTable"); + opBuilder.addInput(emptyKey.asOutput()); + opBuilder.addInput(deletedKey.asOutput()); + opBuilder.setAttr("value_dtype", Operands.toDataType(valueDtype)); + if (options != null) { + for (Options opts : options) { + 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 AnonymousMutableDenseHashTable(opBuilder.build()); + } + + /** + * Sets the valueShape option. + * + * @param valueShape The shape of each value. + * @return this Options instance. + */ + public static Options valueShape(Shape valueShape) { + return new Options().valueShape(valueShape); + } + + /** + * Sets the initialNumBuckets option. + * + * @param initialNumBuckets The initial number of hash table buckets. Must be a power + * to 2. + * @return this Options instance. + */ + public static Options initialNumBuckets(Long initialNumBuckets) { + return new Options().initialNumBuckets(initialNumBuckets); + } + + /** + * Sets the maxLoadFactor option. + * + * @param maxLoadFactor The maximum ratio between number of entries and number of + * buckets before growing the table. Must be between 0 and 1. + * @return this Options instance. + */ + public static Options maxLoadFactor(Float maxLoadFactor) { + return new Options().maxLoadFactor(maxLoadFactor); + } + + /** + * Gets tableHandle. + * The resource handle to the newly created hash-table resource. + * @return tableHandle. + */ + public Output tableHandle() { + return tableHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) tableHandle; + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.AnonymousMutableDenseHashTable} + */ + public static class Options { + private Shape valueShape; + + private Long initialNumBuckets; + + private Float maxLoadFactor; + + private Options() { + } + + /** + * Sets the valueShape option. + * + * @param valueShape The shape of each value. + * @return this Options instance. + */ + public Options valueShape(Shape valueShape) { + this.valueShape = valueShape; + return this; + } + + /** + * Sets the initialNumBuckets option. + * + * @param initialNumBuckets The initial number of hash table buckets. Must be a power + * to 2. + * @return this Options instance. + */ + public Options initialNumBuckets(Long initialNumBuckets) { + this.initialNumBuckets = initialNumBuckets; + return this; + } + + /** + * Sets the maxLoadFactor option. + * + * @param maxLoadFactor The maximum ratio between number of entries and number of + * buckets before growing the table. Must be between 0 and 1. + * @return this Options instance. + */ + public Options maxLoadFactor(Float maxLoadFactor) { + this.maxLoadFactor = maxLoadFactor; + return this; + } + } + + @OpInputsMetadata( + outputsClass = AnonymousMutableDenseHashTable.class + ) + public static class Inputs extends RawOpInputs { + /** + * The key used to represent empty key buckets internally. Must not + * be used in insert or lookup operations. + */ + public final Operand emptyKey; + + /** + * The deletedKey input + */ + public final Operand deletedKey; + + /** + * Type of the table keys. + */ + public final DataType keyDtype; + + /** + * Type of the table values. + */ + public final DataType valueDtype; + + /** + * The shape of each value. + */ + public final Shape valueShape; + + /** + * The initial number of hash table buckets. Must be a power + * to 2. + */ + public final long initialNumBuckets; + + /** + * The maximum ratio between number of entries and number of + * buckets before growing the table. Must be between 0 and 1. + */ + public final float maxLoadFactor; + + public Inputs(GraphOperation op) { + super(new AnonymousMutableDenseHashTable(op), op, Arrays.asList("key_dtype", "value_dtype", "value_shape", "initial_num_buckets", "max_load_factor")); + int inputIndex = 0; + emptyKey = (Operand) op.input(inputIndex++); + deletedKey = (Operand) op.input(inputIndex++); + keyDtype = op.attributes().getAttrType("key_dtype"); + valueDtype = op.attributes().getAttrType("value_dtype"); + valueShape = op.attributes().getAttrShape("value_shape"); + initialNumBuckets = op.attributes().getAttrInt("initial_num_buckets"); + maxLoadFactor = op.attributes().getAttrFloat("max_load_factor"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousMutableHashTable.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousMutableHashTable.java new file mode 100644 index 00000000000..a010e6bc71c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousMutableHashTable.java @@ -0,0 +1,126 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +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.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * Creates an empty anonymous mutable hash table. + * This op creates a new anonymous mutable hash table (as a resource) everytime + * it is executed, with the specified dtype of its keys and values, + * returning the resource handle. Each value must be a scalar. + * Data can be inserted into the table using + * the insert operations. It does not support the initialization operation. + * The table is anonymous in the sense that it can only be + * accessed by the returned resource handle (e.g. it cannot be looked up + * by a name in a resource manager). The table will be automatically + * deleted when all resource handles pointing to it are gone. + */ +@OpMetadata( + opType = AnonymousMutableHashTable.OP_NAME, + inputsClass = AnonymousMutableHashTable.Inputs.class +) +@Operator +public final class AnonymousMutableHashTable extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "AnonymousMutableHashTable"; + + private Output tableHandle; + + @SuppressWarnings("unchecked") + public AnonymousMutableHashTable(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + tableHandle = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new AnonymousMutableHashTable operation. + * + * @param scope current scope + * @param keyDtype Type of the table keys. + * @param valueDtype Type of the table values. + * @param data type for {@code AnonymousMutableHashTable} output and operands + * @param data type for {@code AnonymousMutableHashTable} output and operands + * @return a new instance of AnonymousMutableHashTable + */ + @Endpoint( + describeByClass = true + ) + public static AnonymousMutableHashTable create(Scope scope, + Class keyDtype, Class valueDtype) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "AnonymousMutableHashTable"); + opBuilder.setAttr("key_dtype", Operands.toDataType(keyDtype)); + opBuilder.setAttr("value_dtype", Operands.toDataType(valueDtype)); + return new AnonymousMutableHashTable(opBuilder.build()); + } + + /** + * Gets tableHandle. + * The resource handle to the newly created hash-table resource. + * @return tableHandle. + */ + public Output tableHandle() { + return tableHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) tableHandle; + } + + @OpInputsMetadata( + outputsClass = AnonymousMutableHashTable.class + ) + public static class Inputs extends RawOpInputs { + /** + * Type of the table keys. + */ + public final DataType keyDtype; + + /** + * Type of the table values. + */ + public final DataType valueDtype; + + public Inputs(GraphOperation op) { + super(new AnonymousMutableHashTable(op), op, Arrays.asList("key_dtype", "value_dtype")); + int inputIndex = 0; + keyDtype = op.attributes().getAttrType("key_dtype"); + valueDtype = op.attributes().getAttrType("value_dtype"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousMutableHashTableOfTensors.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousMutableHashTableOfTensors.java new file mode 100644 index 00000000000..263438f8099 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousMutableHashTableOfTensors.java @@ -0,0 +1,172 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * Creates an empty anonymous mutable hash table of vector values. + * This op creates a new anonymous mutable hash table (as a resource) everytime + * it is executed, with the specified dtype of its keys and values, + * returning the resource handle. Each value must be a vector. + * Data can be inserted into the table using + * the insert operations. It does not support the initialization operation. + * The table is anonymous in the sense that it can only be + * accessed by the returned resource handle (e.g. it cannot be looked up + * by a name in a resource manager). The table will be automatically + * deleted when all resource handles pointing to it are gone. + */ +@OpMetadata( + opType = AnonymousMutableHashTableOfTensors.OP_NAME, + inputsClass = AnonymousMutableHashTableOfTensors.Inputs.class +) +@Operator +public final class AnonymousMutableHashTableOfTensors extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "AnonymousMutableHashTableOfTensors"; + + private Output tableHandle; + + @SuppressWarnings("unchecked") + public AnonymousMutableHashTableOfTensors(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + tableHandle = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new AnonymousMutableHashTableOfTensors operation. + * + * @param scope current scope + * @param keyDtype Type of the table keys. + * @param valueDtype Type of the table values. + * @param options carries optional attribute values + * @param data type for {@code AnonymousMutableHashTableOfTensors} output and operands + * @param data type for {@code AnonymousMutableHashTableOfTensors} output and operands + * @return a new instance of AnonymousMutableHashTableOfTensors + */ + @Endpoint( + describeByClass = true + ) + public static AnonymousMutableHashTableOfTensors create( + Scope scope, Class keyDtype, Class valueDtype, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "AnonymousMutableHashTableOfTensors"); + opBuilder.setAttr("key_dtype", Operands.toDataType(keyDtype)); + opBuilder.setAttr("value_dtype", Operands.toDataType(valueDtype)); + if (options != null) { + for (Options opts : options) { + if (opts.valueShape != null) { + opBuilder.setAttr("value_shape", opts.valueShape); + } + } + } + return new AnonymousMutableHashTableOfTensors(opBuilder.build()); + } + + /** + * Sets the valueShape option. + * + * @param valueShape the valueShape option + * @return this Options instance. + */ + public static Options valueShape(Shape valueShape) { + return new Options().valueShape(valueShape); + } + + /** + * Gets tableHandle. + * The resource handle to the newly created hash-table resource. + * @return tableHandle. + */ + public Output tableHandle() { + return tableHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) tableHandle; + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.AnonymousMutableHashTableOfTensors} + */ + public static class Options { + private Shape valueShape; + + private Options() { + } + + /** + * Sets the valueShape option. + * + * @param valueShape the valueShape option + * @return this Options instance. + */ + public Options valueShape(Shape valueShape) { + this.valueShape = valueShape; + return this; + } + } + + @OpInputsMetadata( + outputsClass = AnonymousMutableHashTableOfTensors.class + ) + public static class Inputs extends RawOpInputs { + /** + * Type of the table keys. + */ + public final DataType keyDtype; + + /** + * Type of the table values. + */ + public final DataType valueDtype; + + /** + * The valueShape attribute + */ + public final Shape valueShape; + + public Inputs(GraphOperation op) { + super(new AnonymousMutableHashTableOfTensors(op), op, Arrays.asList("key_dtype", "value_dtype", "value_shape")); + int inputIndex = 0; + keyDtype = op.attributes().getAttrType("key_dtype"); + valueDtype = op.attributes().getAttrType("value_dtype"); + valueShape = op.attributes().getAttrShape("value_shape"); + } + } +} 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 deleted file mode 100644 index fbc6043a446..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AnonymousRandomSeedGenerator.java +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt64; - -/** - */ -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 index 4bcf007fef5..a3f709663e5 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,62 +17,67 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TBool; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** - * 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 + * Computes the "logical or" of elements across dimensions of a tensor. + * Reduces {@code input} along the dimensions given in {@code axis}. Unless + * {@code keep_dims} is true, the rank of the tensor is reduced by 1 for each entry in + * {@code axis}. If {@code keep_dims} is true, the reduced dimensions are * retained with length 1. */ +@OpMetadata( + opType = Any.OP_NAME, + inputsClass = Any.Inputs.class +) @Operator -public final class Any extends PrimitiveOp implements Operand { - +public final class Any extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.Any} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Any"; + + private Output output; + + public Any(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * 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 + * {@code [-rank(input), rank(input))}. + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static Any create(Scope scope, Operand input, Operand axis, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Any"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.keepDims != null) { @@ -82,31 +87,84 @@ public static Any create(Scope scope, Operand input, } return new Any(opBuilder.build()); } - + /** + * Sets the keepDims option. + * * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. */ public static Options keepDims(Boolean keepDims) { return new Options().keepDims(keepDims); } - + /** + * Gets output. * The reduced tensor. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.Any} + */ + public static class Options { + private Boolean keepDims; + + private Options() { + } + + /** + * Sets the keepDims option. + * + * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Any.class + ) + public static class Inputs extends RawOpInputs { + /** + * The tensor to reduce. + */ + public final Operand input; + + /** + * The dimensions to reduce. Must be in the range + * {@code [-rank(input), rank(input))}. + */ + public final Operand axis; + + /** + * If true, retain reduced dimensions with length 1. + */ + public final boolean keepDims; + + /** + * The Tidx attribute + */ + public final DataType Tidx; + + public Inputs(GraphOperation op) { + super(new Any(op), op, Arrays.asList("keep_dims", "Tidx")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + axis = (Operand) op.input(inputIndex++); + keepDims = op.attributes().getAttrBool("keep_dims"); + Tidx = op.attributes().getAttrType("Tidx"); + } } } 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 deleted file mode 100644 index ac60d1f8be4..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ApplyAdagradV2.java +++ /dev/null @@ -1,136 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TType; - -/** - * 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/ApproxTopK.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ApproxTopK.java new file mode 100644 index 00000000000..48f4f94315b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ApproxTopK.java @@ -0,0 +1,324 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TNumber; + +/** + * Returns min/max k values and their indices of the input operand in an approximate manner. + * See https://arxiv.org/abs/2206.14286 for the algorithm details. + * This op is only optimized on TPU currently. + */ +@OpMetadata( + opType = ApproxTopK.OP_NAME, + inputsClass = ApproxTopK.Inputs.class +) +@Operator +public final class ApproxTopK extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ApproxTopK"; + + private Output values; + + private Output indices; + + public ApproxTopK(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + values = operation.output(outputIdx++); + indices = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new ApproxTopK operation. + * + * @param scope current scope + * @param input Array to search. Must be at least 1-D of the floating type + * @param k Specifies the number of min/max-k. + * @param options carries optional attribute values + * @param data type for {@code ApproxTopK} output and operands + * @return a new instance of ApproxTopK + */ + @Endpoint( + describeByClass = true + ) + public static ApproxTopK create(Scope scope, Operand input, Long k, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ApproxTopK"); + opBuilder.addInput(input.asOutput()); + opBuilder.setAttr("k", k); + if (options != null) { + for (Options opts : options) { + if (opts.reductionDimension != null) { + opBuilder.setAttr("reduction_dimension", opts.reductionDimension); + } + if (opts.recallTarget != null) { + opBuilder.setAttr("recall_target", opts.recallTarget); + } + if (opts.isMaxK != null) { + opBuilder.setAttr("is_max_k", opts.isMaxK); + } + if (opts.reductionInputSizeOverride != null) { + opBuilder.setAttr("reduction_input_size_override", opts.reductionInputSizeOverride); + } + if (opts.aggregateToTopk != null) { + opBuilder.setAttr("aggregate_to_topk", opts.aggregateToTopk); + } + } + } + return new ApproxTopK<>(opBuilder.build()); + } + + /** + * Sets the reductionDimension option. + * + * @param reductionDimension Integer dimension along which to search. Default: -1. + * @return this Options instance. + */ + public static Options reductionDimension(Long reductionDimension) { + return new Options().reductionDimension(reductionDimension); + } + + /** + * Sets the recallTarget option. + * + * @param recallTarget Recall target for the approximation. Range in (0,1] + * @return this Options instance. + */ + public static Options recallTarget(Float recallTarget) { + return new Options().recallTarget(recallTarget); + } + + /** + * Sets the isMaxK option. + * + * @param isMaxK When true, computes max-k; otherwise computes min-k. + * @return this Options instance. + */ + public static Options isMaxK(Boolean isMaxK) { + return new Options().isMaxK(isMaxK); + } + + /** + * Sets the reductionInputSizeOverride option. + * + * @param reductionInputSizeOverride When set to a positive value, it overrides the size determined by + * {@code input[reduction_dim]} for evaluating the recall. This option is useful when + * the given {@code input} is only a subset of the overall computation in SPMD or + * distributed pipelines, where the true input size cannot be deferred by the + * {@code input} shape. + * @return this Options instance. + */ + public static Options reductionInputSizeOverride(Long reductionInputSizeOverride) { + return new Options().reductionInputSizeOverride(reductionInputSizeOverride); + } + + /** + * Sets the aggregateToTopk option. + * + * @param aggregateToTopk When true, aggregates approximate results to top-k. When false, returns the + * approximate results. The number of the approximate results is implementation + * defined and is greater equals to the specified {@code k}. + * @return this Options instance. + */ + public static Options aggregateToTopk(Boolean aggregateToTopk) { + return new Options().aggregateToTopk(aggregateToTopk); + } + + /** + * Gets values. + * The min/max k values along the {@code reduction_dimension} of the {@code input} operand. + * The dimension are the same as the {@code input} operand except for the + * {@code reduction_dimension}: when {@code aggregate_to_topk} is true, the reduction + * dimension is {@code k}; otherwise, it is greater equals to {@code k} where the size is + * implementation-defined. + * @return values. + */ + public Output values() { + return values; + } + + /** + * Gets indices. + * The indices of {@code values} along the {@code reduction_dimension} of the {@code input} operand. + * @return indices. + */ + public Output indices() { + return indices; + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.ApproxTopK} + */ + public static class Options { + private Long reductionDimension; + + private Float recallTarget; + + private Boolean isMaxK; + + private Long reductionInputSizeOverride; + + private Boolean aggregateToTopk; + + private Options() { + } + + /** + * Sets the reductionDimension option. + * + * @param reductionDimension Integer dimension along which to search. Default: -1. + * @return this Options instance. + */ + public Options reductionDimension(Long reductionDimension) { + this.reductionDimension = reductionDimension; + return this; + } + + /** + * Sets the recallTarget option. + * + * @param recallTarget Recall target for the approximation. Range in (0,1] + * @return this Options instance. + */ + public Options recallTarget(Float recallTarget) { + this.recallTarget = recallTarget; + return this; + } + + /** + * Sets the isMaxK option. + * + * @param isMaxK When true, computes max-k; otherwise computes min-k. + * @return this Options instance. + */ + public Options isMaxK(Boolean isMaxK) { + this.isMaxK = isMaxK; + return this; + } + + /** + * Sets the reductionInputSizeOverride option. + * + * @param reductionInputSizeOverride When set to a positive value, it overrides the size determined by + * {@code input[reduction_dim]} for evaluating the recall. This option is useful when + * the given {@code input} is only a subset of the overall computation in SPMD or + * distributed pipelines, where the true input size cannot be deferred by the + * {@code input} shape. + * @return this Options instance. + */ + public Options reductionInputSizeOverride(Long reductionInputSizeOverride) { + this.reductionInputSizeOverride = reductionInputSizeOverride; + return this; + } + + /** + * Sets the aggregateToTopk option. + * + * @param aggregateToTopk When true, aggregates approximate results to top-k. When false, returns the + * approximate results. The number of the approximate results is implementation + * defined and is greater equals to the specified {@code k}. + * @return this Options instance. + */ + public Options aggregateToTopk(Boolean aggregateToTopk) { + this.aggregateToTopk = aggregateToTopk; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ApproxTopK.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Array to search. Must be at least 1-D of the floating type + */ + public final Operand input; + + /** + * Specifies the number of min/max-k. + */ + public final long k; + + /** + * Integer dimension along which to search. Default: -1. + */ + public final long reductionDimension; + + /** + * Recall target for the approximation. Range in (0,1] + */ + public final float recallTarget; + + /** + * When true, computes max-k; otherwise computes min-k. + */ + public final boolean isMaxK; + + /** + * When set to a positive value, it overrides the size determined by + * {@code input[reduction_dim]} for evaluating the recall. This option is useful when + * the given {@code input} is only a subset of the overall computation in SPMD or + * distributed pipelines, where the true input size cannot be deferred by the + * {@code input} shape. + */ + public final long reductionInputSizeOverride; + + /** + * When true, aggregates approximate results to top-k. When false, returns the + * approximate results. The number of the approximate results is implementation + * defined and is greater equals to the specified {@code k}. + */ + public final boolean aggregateToTopk; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new ApproxTopK<>(op), op, Arrays.asList("k", "reduction_dimension", "recall_target", "is_max_k", "reduction_input_size_override", "aggregate_to_topk", "T")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + k = op.attributes().getAttrInt("k"); + reductionDimension = op.attributes().getAttrInt("reduction_dimension"); + recallTarget = op.attributes().getAttrFloat("recall_target"); + isMaxK = op.attributes().getAttrBool("is_max_k"); + reductionInputSizeOverride = op.attributes().getAttrInt("reduction_input_size_override"); + aggregateToTopk = op.attributes().getAttrBool("aggregate_to_topk"); + T = op.attributes().getAttrType("T"); + } + } +} 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 deleted file mode 100644 index 851bbcae377..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssertNextDataset.java +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TString; -import org.tensorflow.types.family.TType; - -/** - */ -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] = 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 index c2d2d77463f..a2ede8e9cc8 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,57 +17,59 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; 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.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TBool; /** * 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. + * If {@code condition} evaluates to false, print the list of tensors in {@code data}. + * {@code summarize} determines how many entries of the tensors to print. */ +@OpMetadata( + opType = AssertThat.OP_NAME, + inputsClass = AssertThat.Inputs.class +) @Operator -public final class AssertThat extends PrimitiveOp { - +public final class AssertThat extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.AssertThat} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Assert"; + + public AssertThat(Operation operation) { + super(operation, OP_NAME); } - + /** - * Factory method to create a class wrapping a new AssertThat operation. - * + * Factory method to create a class wrapping a new Assert 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 + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static AssertThat create(Scope scope, Operand condition, Iterable> data, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { @@ -77,16 +79,71 @@ public static AssertThat create(Scope scope, Operand condition, Iterable< } return new AssertThat(opBuilder.build()); } - + /** + * Sets the summarize option. + * * @param summarize Print this many entries of each tensor. + * @return this Options instance. */ public static Options summarize(Long summarize) { return new Options().summarize(summarize); } - - - private AssertThat(Operation operation) { - super(operation); + + /** + * Optional attributes for {@link org.tensorflow.op.core.AssertThat} + */ + public static class Options { + private Long summarize; + + private Options() { + } + + /** + * Sets the summarize option. + * + * @param summarize Print this many entries of each tensor. + * @return this Options instance. + */ + public Options summarize(Long summarize) { + this.summarize = summarize; + return this; + } + } + + @OpInputsMetadata( + outputsClass = AssertThat.class + ) + public static class Inputs extends RawOpInputs { + /** + * The condition to evaluate. + */ + public final Operand condition; + + /** + * The tensors to print out when condition is false. + */ + public final Iterable> data; + + /** + * The T attribute + */ + public final DataType[] T; + + /** + * Print this many entries of each tensor. + */ + public final long summarize; + + public Inputs(GraphOperation op) { + super(new AssertThat(op), op, Arrays.asList("T", "summarize")); + int inputIndex = 0; + condition = (Operand) op.input(inputIndex++); + int dataLength = op.inputListLength("data"); + data = Arrays.asList((Operand[]) op.inputList(inputIndex, dataLength)); + inputIndex += dataLength; + T = op.attributes().getAttrTypeList("T"); + summarize = op.attributes().getAttrInt("summarize"); + } } } 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 index f98eb5da875..e49f3eafacc 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,71 +17,64 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * Update 'ref' by assigning 'value' to it. - *

- * This operation outputs "ref" after the assignment is done. + * 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 */ +@OpMetadata( + opType = Assign.OP_NAME, + inputsClass = Assign.Inputs.class +) @Operator -public final class Assign extends PrimitiveOp implements Operand { - +public final class Assign extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.Assign} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Assign"; + + private Output outputRef; + + public Assign(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); } - + /** * 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 ref Should be from a {@code Variable} node. May be uninitialized. * @param value The value to be assigned to the variable. - * @param options carries optional attributes values + * @param options carries optional attribute values + * @param data type for {@code Assign} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static Assign create(Scope scope, Operand ref, Operand value, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Assign"); opBuilder.addInput(ref.asOutput()); opBuilder.addInput(value.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.validateShape != null) { @@ -92,44 +85,124 @@ public static Assign create(Scope scope, Operand ref, Op } } } - return new Assign(opBuilder.build()); + return new Assign<>(opBuilder.build()); } - + /** + * Sets the validateShape option. + * * @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'. + * @return this Options instance. */ public static Options validateShape(Boolean validateShape) { return new Options().validateShape(validateShape); } - + /** + * Sets the useLocking option. + * * @param useLocking If True, the assignment will be protected by a lock; * otherwise the behavior is undefined, but may exhibit less contention. + * @return this Options instance. */ public static Options useLocking(Boolean useLocking) { return new Options().useLocking(useLocking); } - + /** - * = Same as "ref". Returned as a convenience for operations that want + * Gets outputRef. + * = Same as "ref". Returned as a convenience for operations that want * to use the new value after the variable has been reset. + * @return outputRef. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.Assign} + */ + public static class Options { + private Boolean validateShape; + + private Boolean useLocking; + + private Options() { + } + + /** + * Sets the validateShape option. + * + * @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'. + * @return this Options instance. + */ + public Options validateShape(Boolean validateShape) { + this.validateShape = validateShape; + return this; + } + + /** + * Sets the useLocking option. + * + * @param useLocking If True, the assignment will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + * @return this Options instance. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Assign.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Should be from a {@code Variable} node. May be uninitialized. + */ + public final Operand ref; + + /** + * The value to be assigned to the variable. + */ + public final Operand value; + + /** + * The T attribute + */ + public final DataType T; + + /** + * 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 final boolean validateShape; + + /** + * If True, the assignment will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public final boolean useLocking; + + public Inputs(GraphOperation op) { + super(new Assign<>(op), op, Arrays.asList("T", "validate_shape", "use_locking")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + value = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + validateShape = op.attributes().getAttrBool("validate_shape"); + useLocking = op.attributes().getAttrBool("use_locking"); + } } } 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 index 680730284c5..848231d569a 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,60 +17,64 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * Update 'ref' by adding 'value' to it. - *

- * This operation outputs "ref" after the update is done. + * 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 */ +@OpMetadata( + opType = AssignAdd.OP_NAME, + inputsClass = AssignAdd.Inputs.class +) @Operator -public final class AssignAdd extends PrimitiveOp implements Operand { - +public final class AssignAdd extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.AssignAdd} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "AssignAdd"; + + private Output outputRef; + + public AssignAdd(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); } - + /** * Factory method to create a class wrapping a new AssignAdd operation. - * + * * @param scope current scope - * @param ref Should be from a `Variable` node. + * @param ref Should be from a {@code Variable} node. * @param value The value to be added to the variable. - * @param options carries optional attributes values + * @param options carries optional attribute values + * @param data type for {@code AssignAdd} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static AssignAdd create(Scope scope, Operand ref, Operand value, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "AssignAdd"); opBuilder.addInput(ref.asOutput()); opBuilder.addInput(value.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.useLocking != null) { @@ -78,35 +82,89 @@ public static AssignAdd create(Scope scope, Operand ref, } } } - return new AssignAdd(opBuilder.build()); + return new AssignAdd<>(opBuilder.build()); } - + /** + * Sets the useLocking option. + * * @param useLocking If True, the addition will be protected by a lock; * otherwise the behavior is undefined, but may exhibit less contention. + * @return this Options instance. */ public static Options useLocking(Boolean useLocking) { return new Options().useLocking(useLocking); } - + /** - * = Same as "ref". Returned as a convenience for operations that want + * Gets outputRef. + * = Same as "ref". Returned as a convenience for operations that want * to use the new value after the variable has been updated. + * @return outputRef. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.AssignAdd} + */ + public static class Options { + private Boolean useLocking; + + private Options() { + } + + /** + * Sets the useLocking option. + * + * @param useLocking If True, the addition will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + * @return this Options instance. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + } + + @OpInputsMetadata( + outputsClass = AssignAdd.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Should be from a {@code Variable} node. + */ + public final Operand ref; + + /** + * The value to be added to the variable. + */ + public final Operand value; + + /** + * The T attribute + */ + public final DataType T; + + /** + * If True, the addition will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public final boolean useLocking; + + public Inputs(GraphOperation op) { + super(new AssignAdd<>(op), op, Arrays.asList("T", "use_locking")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + value = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + useLocking = op.attributes().getAttrBool("use_locking"); + } } } 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 index e260991a1e1..1b0fb994278 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,41 +17,85 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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. */ +@OpMetadata( + opType = AssignAddVariableOp.OP_NAME, + inputsClass = AssignAddVariableOp.Inputs.class +) @Operator -public final class AssignAddVariableOp extends PrimitiveOp { - +public final class AssignAddVariableOp extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "AssignAddVariableOp"; + + public AssignAddVariableOp(Operation operation) { + super(operation, OP_NAME); + } + /** * 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")); + @Endpoint( + describeByClass = true + ) + public static AssignAddVariableOp create(Scope scope, Operand resource, + Operand value) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "AssignAddVariableOp"); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(value.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new AssignAddVariableOp(opBuilder.build()); } - - - private AssignAddVariableOp(Operation operation) { - super(operation); + + @OpInputsMetadata( + outputsClass = AssignAddVariableOp.class + ) + public static class Inputs extends RawOpInputs { + /** + * handle to the resource in which to store the variable. + */ + public final Operand resource; + + /** + * the value by which the variable will be incremented. + */ + public final Operand value; + + /** + * the dtype of the value. + */ + public final DataType dtype; + + public Inputs(GraphOperation op) { + super(new AssignAddVariableOp(op), op, Arrays.asList("dtype")); + int inputIndex = 0; + resource = (Operand) op.input(inputIndex++); + value = (Operand) op.input(inputIndex++); + dtype = op.attributes().getAttrType("dtype"); + } } } 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 index ea9b9b70db9..cc96d634945 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,60 +17,64 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * Update 'ref' by subtracting 'value' from it. - *

- * This operation outputs "ref" after the update is done. + * 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 */ +@OpMetadata( + opType = AssignSub.OP_NAME, + inputsClass = AssignSub.Inputs.class +) @Operator -public final class AssignSub extends PrimitiveOp implements Operand { - +public final class AssignSub extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.AssignSub} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "AssignSub"; + + private Output outputRef; + + public AssignSub(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); } - + /** * Factory method to create a class wrapping a new AssignSub operation. - * + * * @param scope current scope - * @param ref Should be from a `Variable` node. + * @param ref Should be from a {@code Variable} node. * @param value The value to be subtracted to the variable. - * @param options carries optional attributes values + * @param options carries optional attribute values + * @param data type for {@code AssignSub} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static AssignSub create(Scope scope, Operand ref, Operand value, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "AssignSub"); opBuilder.addInput(ref.asOutput()); opBuilder.addInput(value.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.useLocking != null) { @@ -78,35 +82,89 @@ public static AssignSub create(Scope scope, Operand ref, } } } - return new AssignSub(opBuilder.build()); + return new AssignSub<>(opBuilder.build()); } - + /** + * Sets the useLocking option. + * * @param useLocking If True, the subtraction will be protected by a lock; * otherwise the behavior is undefined, but may exhibit less contention. + * @return this Options instance. */ public static Options useLocking(Boolean useLocking) { return new Options().useLocking(useLocking); } - + /** - * = Same as "ref". Returned as a convenience for operations that want + * Gets outputRef. + * = Same as "ref". Returned as a convenience for operations that want * to use the new value after the variable has been updated. + * @return outputRef. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.AssignSub} + */ + public static class Options { + private Boolean useLocking; + + private Options() { + } + + /** + * Sets the useLocking option. + * + * @param useLocking If True, the subtraction will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + * @return this Options instance. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + } + + @OpInputsMetadata( + outputsClass = AssignSub.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Should be from a {@code Variable} node. + */ + public final Operand ref; + + /** + * The value to be subtracted to the variable. + */ + public final Operand value; + + /** + * The T attribute + */ + public final DataType T; + + /** + * If True, the subtraction will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public final boolean useLocking; + + public Inputs(GraphOperation op) { + super(new AssignSub<>(op), op, Arrays.asList("T", "use_locking")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + value = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + useLocking = op.attributes().getAttrBool("use_locking"); + } } } 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 index b6669e19dd7..e5a22f772e3 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,41 +17,85 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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. */ +@OpMetadata( + opType = AssignSubVariableOp.OP_NAME, + inputsClass = AssignSubVariableOp.Inputs.class +) @Operator -public final class AssignSubVariableOp extends PrimitiveOp { - +public final class AssignSubVariableOp extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "AssignSubVariableOp"; + + public AssignSubVariableOp(Operation operation) { + super(operation, OP_NAME); + } + /** * 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")); + @Endpoint( + describeByClass = true + ) + public static AssignSubVariableOp create(Scope scope, Operand resource, + Operand value) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "AssignSubVariableOp"); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(value.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new AssignSubVariableOp(opBuilder.build()); } - - - private AssignSubVariableOp(Operation operation) { - super(operation); + + @OpInputsMetadata( + outputsClass = AssignSubVariableOp.class + ) + public static class Inputs extends RawOpInputs { + /** + * handle to the resource in which to store the variable. + */ + public final Operand resource; + + /** + * the value by which the variable will be incremented. + */ + public final Operand value; + + /** + * the dtype of the value. + */ + public final DataType dtype; + + public Inputs(GraphOperation op) { + super(new AssignSubVariableOp(op), op, Arrays.asList("dtype")); + int inputIndex = 0; + resource = (Operand) op.input(inputIndex++); + value = (Operand) op.input(inputIndex++); + dtype = op.attributes().getAttrType("dtype"); + } } } 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 index 5c1393ea4fa..19672d6db42 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,41 +17,130 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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. */ +@OpMetadata( + opType = AssignVariableOp.OP_NAME, + inputsClass = AssignVariableOp.Inputs.class +) @Operator -public final class AssignVariableOp extends PrimitiveOp { - +public final class AssignVariableOp extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "AssignVariableOp"; + + public AssignVariableOp(Operation operation) { + super(operation, OP_NAME); + } + /** * 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. + * @param options carries optional attribute values * @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")); + @Endpoint( + describeByClass = true + ) + public static AssignVariableOp create(Scope scope, Operand resource, + Operand value, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "AssignVariableOp"); opBuilder.addInput(resource.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); + } + } + } return new AssignVariableOp(opBuilder.build()); } - - - private AssignVariableOp(Operation operation) { - super(operation); + + /** + * Sets the validateShape option. + * + * @param validateShape the validateShape option + * @return this Options instance. + */ + public static Options validateShape(Boolean validateShape) { + return new Options().validateShape(validateShape); + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.AssignVariableOp} + */ + public static class Options { + private Boolean validateShape; + + private Options() { + } + + /** + * Sets the validateShape option. + * + * @param validateShape the validateShape option + * @return this Options instance. + */ + public Options validateShape(Boolean validateShape) { + this.validateShape = validateShape; + return this; + } + } + + @OpInputsMetadata( + outputsClass = AssignVariableOp.class + ) + public static class Inputs extends RawOpInputs { + /** + * handle to the resource in which to store the variable. + */ + public final Operand resource; + + /** + * the value to set the new tensor to use. + */ + public final Operand value; + + /** + * the dtype of the value. + */ + public final DataType dtype; + + /** + * The validateShape attribute + */ + public final boolean validateShape; + + public Inputs(GraphOperation op) { + super(new AssignVariableOp(op), op, Arrays.asList("dtype", "validate_shape")); + int inputIndex = 0; + resource = (Operand) op.input(inputIndex++); + value = (Operand) op.input(inputIndex++); + dtype = op.attributes().getAttrType("dtype"); + validateShape = op.attributes().getAttrBool("validate_shape"); + } } } 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 deleted file mode 100644 index eb6bdbaf9b6..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AutoShardDataset.java +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 index 853f22d2e50..114a98f2020 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,105 +17,75 @@ package org.tensorflow.op.core; +import java.util.Arrays; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.tools.Shape; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TString; +import org.tensorflow.types.family.TType; /** * 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' + *

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. */ +@OpMetadata( + opType = Barrier.OP_NAME, + inputsClass = Barrier.Inputs.class +) @Operator -public final class Barrier extends PrimitiveOp implements Operand { - +public final class Barrier extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.Barrier} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Barrier"; + + private Output handle; + + public Barrier(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + handle = operation.output(outputIdx++); } - + /** * 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 + * @param options carries optional attribute 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] = componentTypes.get(i); - } - opBuilder.setAttr("component_types", componentTypesArray); + @Endpoint( + describeByClass = true + ) + public static Barrier create(Scope scope, List> componentTypes, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Barrier"); + opBuilder.setAttr("component_types", Operands.toDataTypes(componentTypes)); 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) { + for (int i = 0 ; i < shapesArray.length ; i++) { shapesArray[i] = opts.shapes.get(i); } opBuilder.setAttr("shapes", shapesArray); @@ -133,57 +103,198 @@ public static Barrier create(Scope scope, List> componentTypes, Opti } return new Barrier(opBuilder.build()); } - + /** + * Sets the shapes option. + * * @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. + * @return this Options instance. */ public static Options shapes(List shapes) { return new Options().shapes(shapes); } - + /** + * Sets the shapes option. + * + * @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. + * @return this Options instance. + */ + public static Options shapes(Shape... shapes) { + return new Options().shapes(shapes); + } + + /** + * Sets the capacity option. + * * @param capacity The capacity of the barrier. The default capacity is MAX_INT32, * which is the largest capacity of the underlying queue. + * @return this Options instance. */ public static Options capacity(Long capacity) { return new Options().capacity(capacity); } - + /** + * Sets the container option. + * * @param container If non-empty, this barrier is placed in the given container. * Otherwise, a default container is used. + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** + * Sets the sharedName option. + * * @param sharedName If non-empty, this barrier will be shared under the given name * across multiple sessions. + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - + /** + * Gets handle. * The handle to the barrier. + * @return handle. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.Barrier} + */ + public static class Options { + private List shapes; + + private Long capacity; + + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the shapes option. + * + * @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. + * @return this Options instance. + */ + public Options shapes(List shapes) { + this.shapes = shapes; + return this; + } + + /** + * Sets the shapes option. + * + * @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. + * @return this Options instance. + */ + public Options shapes(Shape... shapes) { + this.shapes = Arrays.asList(shapes); + return this; + } + + /** + * Sets the capacity option. + * + * @param capacity The capacity of the barrier. The default capacity is MAX_INT32, + * which is the largest capacity of the underlying queue. + * @return this Options instance. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Sets the container option. + * + * @param container If non-empty, this barrier is placed in the given container. + * Otherwise, a default container is used. + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName If non-empty, this barrier will be shared under the given name + * across multiple sessions. + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Barrier.class + ) + public static class Inputs extends RawOpInputs { + /** + * The type of each component in a value. + */ + public final DataType[] componentTypes; + + /** + * 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 final Shape[] shapes; + + /** + * The capacity of the barrier. The default capacity is MAX_INT32, + * which is the largest capacity of the underlying queue. + */ + public final long capacity; + + /** + * If non-empty, this barrier is placed in the given container. + * Otherwise, a default container is used. + */ + public final String container; + + /** + * If non-empty, this barrier will be shared under the given name + * across multiple sessions. + */ + public final String sharedName; + + public Inputs(GraphOperation op) { + super(new Barrier(op), op, Arrays.asList("component_types", "shapes", "capacity", "container", "shared_name")); + int inputIndex = 0; + componentTypes = op.attributes().getAttrTypeList("component_types"); + shapes = op.attributes().getAttrShapeList("shapes"); + capacity = op.attributes().getAttrInt("capacity"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + } } } 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 index b73f4127f84..3cd742dbc36 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,17 +17,22 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; import org.tensorflow.types.TString; /** * 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 @@ -35,42 +40,35 @@ * continue to succeed if sufficient completed elements remain in the barrier. * Subsequent TakeMany operations that would block will fail immediately. */ +@OpMetadata( + opType = BarrierClose.OP_NAME, + inputsClass = BarrierClose.Inputs.class +) @Operator -public final class BarrierClose extends PrimitiveOp { - +public final class BarrierClose extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.BarrierClose} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "BarrierClose"; + + public BarrierClose(Operation operation) { + super(operation, OP_NAME); } - + /** * 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 + * @param options carries optional attribute values * @return a new instance of BarrierClose */ + @Endpoint( + describeByClass = true + ) public static BarrierClose create(Scope scope, Operand handle, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("BarrierClose", scope.makeOpName("BarrierClose")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "BarrierClose"); opBuilder.addInput(handle.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.cancelPendingEnqueues != null) { @@ -80,18 +78,63 @@ public static BarrierClose create(Scope scope, Operand handle, Options. } return new BarrierClose(opBuilder.build()); } - + /** + * Sets the cancelPendingEnqueues option. + * * @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. + * @return this Options instance. */ public static Options cancelPendingEnqueues(Boolean cancelPendingEnqueues) { return new Options().cancelPendingEnqueues(cancelPendingEnqueues); } - - - private BarrierClose(Operation operation) { - super(operation); + + /** + * Optional attributes for {@link org.tensorflow.op.core.BarrierClose} + */ + public static class Options { + private Boolean cancelPendingEnqueues; + + private Options() { + } + + /** + * Sets the cancelPendingEnqueues option. + * + * @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. + * @return this Options instance. + */ + public Options cancelPendingEnqueues(Boolean cancelPendingEnqueues) { + this.cancelPendingEnqueues = cancelPendingEnqueues; + return this; + } + } + + @OpInputsMetadata( + outputsClass = BarrierClose.class + ) + public static class Inputs extends RawOpInputs { + /** + * The handle to a barrier. + */ + public final Operand handle; + + /** + * 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 final boolean cancelPendingEnqueues; + + public Inputs(GraphOperation op) { + super(new BarrierClose(op), op, Arrays.asList("cancel_pending_enqueues")); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + cancelPendingEnqueues = op.attributes().getAttrBool("cancel_pending_enqueues"); + } } } 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 index 85830ddcc34..3e3525b4731 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,12 +17,18 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; import org.tensorflow.types.TInt32; import org.tensorflow.types.TString; @@ -30,41 +36,69 @@ /** * Computes the number of incomplete elements in the given barrier. */ +@OpMetadata( + opType = BarrierIncompleteSize.OP_NAME, + inputsClass = BarrierIncompleteSize.Inputs.class +) @Operator -public final class BarrierIncompleteSize extends PrimitiveOp implements Operand { - +public final class BarrierIncompleteSize extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "BarrierIncompleteSize"; + + private Output output; + + public BarrierIncompleteSize(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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 */ + @Endpoint( + describeByClass = true + ) public static BarrierIncompleteSize create(Scope scope, Operand handle) { - OperationBuilder opBuilder = scope.env().opBuilder("BarrierIncompleteSize", scope.makeOpName("BarrierIncompleteSize")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "BarrierIncompleteSize"); opBuilder.addInput(handle.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new BarrierIncompleteSize(opBuilder.build()); } - + /** + * Gets output. * The number of incomplete elements (i.e. those with some of their value * components not set) in the barrier. + * @return output. */ - public Output size() { - return size; + public Output output() { + return output; } - + @Override public Output asOutput() { - return size; + return output; } - - private Output size; - - private BarrierIncompleteSize(Operation operation) { - super(operation); - int outputIdx = 0; - size = operation.output(outputIdx++); + + @OpInputsMetadata( + outputsClass = BarrierIncompleteSize.class + ) + public static class Inputs extends RawOpInputs { + /** + * The handle to a barrier. + */ + public final Operand handle; + + public Inputs(GraphOperation op) { + super(new BarrierIncompleteSize(op), op, Arrays.asList()); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + } } } 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 index dd3f42bdb9d..f21f9b16411 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,29 +17,47 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TString; import org.tensorflow.types.family.TType; /** * 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. */ +@OpMetadata( + opType = BarrierInsertMany.OP_NAME, + inputsClass = BarrierInsertMany.Inputs.class +) @Operator -public final class BarrierInsertMany extends PrimitiveOp { - +public final class BarrierInsertMany extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "BarrierInsertMany"; + + public BarrierInsertMany(Operation operation) { + super(operation, OP_NAME); + } + /** * 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. @@ -48,18 +66,57 @@ public final class BarrierInsertMany extends PrimitiveOp { * @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")); + @Endpoint( + describeByClass = true + ) + public static BarrierInsertMany create(Scope scope, Operand handle, + Operand keys, Operand values, Long componentIndex) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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); + + @OpInputsMetadata( + outputsClass = BarrierInsertMany.class + ) + public static class Inputs extends RawOpInputs { + /** + * The handle to a barrier. + */ + public final Operand handle; + + /** + * A one-dimensional tensor of keys, with length n. + */ + public final Operand keys; + + /** + * An any-dimensional tensor of values, which are associated with the + * respective keys. The 0th dimension must have length n. + */ + public final Operand values; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The component of the barrier elements that is being assigned. + */ + public final long componentIndex; + + public Inputs(GraphOperation op) { + super(new BarrierInsertMany(op), op, Arrays.asList("T", "component_index")); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + keys = (Operand) op.input(inputIndex++); + values = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + componentIndex = op.attributes().getAttrInt("component_index"); + } } } 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 index 1218eb85915..7f699b2b2e3 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,12 +17,18 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; import org.tensorflow.types.TInt32; import org.tensorflow.types.TString; @@ -30,41 +36,69 @@ /** * Computes the number of complete elements in the given barrier. */ +@OpMetadata( + opType = BarrierReadySize.OP_NAME, + inputsClass = BarrierReadySize.Inputs.class +) @Operator -public final class BarrierReadySize extends PrimitiveOp implements Operand { - +public final class BarrierReadySize extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "BarrierReadySize"; + + private Output output; + + public BarrierReadySize(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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 */ + @Endpoint( + describeByClass = true + ) public static BarrierReadySize create(Scope scope, Operand handle) { - OperationBuilder opBuilder = scope.env().opBuilder("BarrierReadySize", scope.makeOpName("BarrierReadySize")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "BarrierReadySize"); opBuilder.addInput(handle.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new BarrierReadySize(opBuilder.build()); } - + /** + * Gets output. * The number of complete elements (i.e. those with all of their value * components set) in the barrier. + * @return output. */ - public Output size() { - return size; + public Output output() { + return output; } - + @Override public Output asOutput() { - return size; + return output; } - - private Output size; - - private BarrierReadySize(Operation operation) { - super(operation); - int outputIdx = 0; - size = operation.output(outputIdx++); + + @OpInputsMetadata( + outputsClass = BarrierReadySize.class + ) + public static class Inputs extends RawOpInputs { + /** + * The handle to a barrier. + */ + public final Operand handle; + + public Inputs(GraphOperation op) { + super(new BarrierReadySize(op), op, Arrays.asList()); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + } } } 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 index cc09957acf9..307b4087091 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,93 +19,83 @@ import java.util.Arrays; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.TInt64; import org.tensorflow.types.TString; +import org.tensorflow.types.family.TType; /** * 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 + *

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. */ +@OpMetadata( + opType = BarrierTakeMany.OP_NAME, + inputsClass = BarrierTakeMany.Inputs.class +) @Operator -public final class BarrierTakeMany extends PrimitiveOp { - +public final class BarrierTakeMany extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.BarrierTakeMany} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "BarrierTakeMany"; + + private Output indices; + + private Output keys; + + private List> values; + + @SuppressWarnings("unchecked") + public BarrierTakeMany(Operation operation) { + super(operation, OP_NAME); + 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; } - + /** * 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 + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static BarrierTakeMany create(Scope scope, Operand handle, + Operand numElements, List> componentTypes, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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] = componentTypes.get(i); - } - opBuilder.setAttr("component_types", componentTypesArray); + opBuilder.setAttr("component_types", Operands.toDataTypes(componentTypes)); if (options != null) { for (Options opts : options) { if (opts.allowSmallBatch != null) { @@ -121,66 +111,167 @@ public static BarrierTakeMany create(Scope scope, Operand handle, Opera } return new BarrierTakeMany(opBuilder.build()); } - + /** + * Sets the allowSmallBatch option. + * * @param allowSmallBatch Allow to return less than num_elements items if barrier is * already closed. + * @return this Options instance. */ public static Options allowSmallBatch(Boolean allowSmallBatch) { return new Options().allowSmallBatch(allowSmallBatch); } - + /** - * @param waitForIncomplete + * Sets the waitForIncomplete option. + * + * @param waitForIncomplete the waitForIncomplete option + * @return this Options instance. */ public static Options waitForIncomplete(Boolean waitForIncomplete) { return new Options().waitForIncomplete(waitForIncomplete); } - + /** + * Sets the timeoutMs option. + * * @param timeoutMs If the queue is empty, this operation will block for up to * timeout_ms milliseconds. * Note: This option is not supported yet. + * @return this Options instance. */ public static Options timeoutMs(Long timeoutMs) { return new Options().timeoutMs(timeoutMs); } - + /** + * Gets indices. * 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). + * @return indices. */ public Output indices() { return indices; } - + /** + * Gets keys. * A one-dimensional tensor of keys, with length num_elements. + * @return keys. */ public Output keys() { return keys; } - + /** + * Gets values. * One any-dimensional tensor per component in a barrier element. All * values have length num_elements in the 0th dimension. + * @return values. */ 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; + + /** + * Optional attributes for {@link org.tensorflow.op.core.BarrierTakeMany} + */ + public static class Options { + private Boolean allowSmallBatch; + + private Boolean waitForIncomplete; + + private Long timeoutMs; + + private Options() { + } + + /** + * Sets the allowSmallBatch option. + * + * @param allowSmallBatch Allow to return less than num_elements items if barrier is + * already closed. + * @return this Options instance. + */ + public Options allowSmallBatch(Boolean allowSmallBatch) { + this.allowSmallBatch = allowSmallBatch; + return this; + } + + /** + * Sets the waitForIncomplete option. + * + * @param waitForIncomplete the waitForIncomplete option + * @return this Options instance. + */ + public Options waitForIncomplete(Boolean waitForIncomplete) { + this.waitForIncomplete = waitForIncomplete; + return this; + } + + /** + * Sets the timeoutMs option. + * + * @param timeoutMs If the queue is empty, this operation will block for up to + * timeout_ms milliseconds. + * Note: This option is not supported yet. + * @return this Options instance. + */ + public Options timeoutMs(Long timeoutMs) { + this.timeoutMs = timeoutMs; + return this; + } + } + + @OpInputsMetadata( + outputsClass = BarrierTakeMany.class + ) + public static class Inputs extends RawOpInputs { + /** + * The handle to a barrier. + */ + public final Operand handle; + + /** + * A single-element tensor containing the number of elements to + * take. + */ + public final Operand numElements; + + /** + * The type of each component in a value. + */ + public final DataType[] componentTypes; + + /** + * Allow to return less than num_elements items if barrier is + * already closed. + */ + public final boolean allowSmallBatch; + + /** + * The waitForIncomplete attribute + */ + public final boolean waitForIncomplete; + + /** + * If the queue is empty, this operation will block for up to + * timeout_ms milliseconds. + * Note: This option is not supported yet. + */ + public final long timeoutMs; + + public Inputs(GraphOperation op) { + super(new BarrierTakeMany(op), op, Arrays.asList("component_types", "allow_small_batch", "wait_for_incomplete", "timeout_ms")); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + numElements = (Operand) op.input(inputIndex++); + componentTypes = op.attributes().getAttrTypeList("component_types"); + allowSmallBatch = op.attributes().getAttrBool("allow_small_batch"); + waitForIncomplete = op.attributes().getAttrBool("wait_for_incomplete"); + timeoutMs = op.attributes().getAttrInt("timeout_ms"); + } } } 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 index 69c2c8d9e29..c6130676b8d 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,130 +19,103 @@ import java.util.Arrays; import java.util.List; +import org.tensorflow.GraphOperation; 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.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt64; /** * 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 + *

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 + *

Each invocation of batch emits an {@code 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 + *

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 + *

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. + *

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. + * 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. + * 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. + * 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. + * 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. */ +@OpMetadata( + opType = Batch.OP_NAME, + inputsClass = Batch.Inputs.class +) @Operator -public final class Batch extends PrimitiveOp { - +public final class Batch extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.Batch} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Batch"; + + private List> batchedTensors; + + private Output batchIndex; + + private Output id; + + @SuppressWarnings("unchecked") + public Batch(Operation operation) { + super(operation, OP_NAME); + 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++); } - + /** * 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 + * @param inTensors The inTensors value + * @param numBatchThreads The value of the numBatchThreads attribute + * @param maxBatchSize The value of the maxBatchSize attribute + * @param batchTimeoutMicros The value of the batchTimeoutMicros attribute + * @param gradTimeoutMicros The value of the gradTimeoutMicros attribute + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static Batch create(Scope scope, Iterable> inTensors, Long numBatchThreads, + Long maxBatchSize, Long batchTimeoutMicros, Long gradTimeoutMicros, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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); @@ -154,7 +127,7 @@ public static Batch create(Scope scope, Iterable> inTensors, Long num } if (opts.allowedBatchSizes != null) { long[] allowedBatchSizesArray = new long[opts.allowedBatchSizes.size()]; - for (int i = 0; i < allowedBatchSizesArray.length; ++i) { + for (int i = 0 ; i < allowedBatchSizesArray.length ; i++) { allowedBatchSizesArray[i] = opts.allowedBatchSizes.get(i); } opBuilder.setAttr("allowed_batch_sizes", allowedBatchSizesArray); @@ -172,71 +145,253 @@ public static Batch create(Scope scope, Iterable> inTensors, Long num } return new Batch(opBuilder.build()); } - + /** - * @param maxEnqueuedBatches + * Sets the maxEnqueuedBatches option. + * + * @param maxEnqueuedBatches the maxEnqueuedBatches option + * @return this Options instance. */ public static Options maxEnqueuedBatches(Long maxEnqueuedBatches) { return new Options().maxEnqueuedBatches(maxEnqueuedBatches); } - + /** - * @param allowedBatchSizes + * Sets the allowedBatchSizes option. + * + * @param allowedBatchSizes the allowedBatchSizes option + * @return this Options instance. */ public static Options allowedBatchSizes(List allowedBatchSizes) { return new Options().allowedBatchSizes(allowedBatchSizes); } - + + /** + * Sets the allowedBatchSizes option. + * + * @param allowedBatchSizes the allowedBatchSizes option + * @return this Options instance. + */ + public static Options allowedBatchSizes(Long... allowedBatchSizes) { + return new Options().allowedBatchSizes(allowedBatchSizes); + } + /** - * @param container + * Sets the container option. + * + * @param container the container option + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** - * @param sharedName + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - + /** - * @param batchingQueue + * Sets the batchingQueue option. + * + * @param batchingQueue the batchingQueue option + * @return this Options instance. */ public static Options batchingQueue(String batchingQueue) { return new Options().batchingQueue(batchingQueue); } - + /** + * Gets batchedTensors. + * + * @return batchedTensors. */ public List> batchedTensors() { return batchedTensors; } - + /** + * Gets batchIndex. + * + * @return batchIndex. */ public Output batchIndex() { return batchIndex; } - + /** + * Gets id. + * + * @return id. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.Batch} + */ + public static class Options { + private Long maxEnqueuedBatches; + + private List allowedBatchSizes; + + private String container; + + private String sharedName; + + private String batchingQueue; + + private Options() { + } + + /** + * Sets the maxEnqueuedBatches option. + * + * @param maxEnqueuedBatches the maxEnqueuedBatches option + * @return this Options instance. + */ + public Options maxEnqueuedBatches(Long maxEnqueuedBatches) { + this.maxEnqueuedBatches = maxEnqueuedBatches; + return this; + } + + /** + * Sets the allowedBatchSizes option. + * + * @param allowedBatchSizes the allowedBatchSizes option + * @return this Options instance. + */ + public Options allowedBatchSizes(List allowedBatchSizes) { + this.allowedBatchSizes = allowedBatchSizes; + return this; + } + + /** + * Sets the allowedBatchSizes option. + * + * @param allowedBatchSizes the allowedBatchSizes option + * @return this Options instance. + */ + public Options allowedBatchSizes(Long... allowedBatchSizes) { + this.allowedBatchSizes = Arrays.asList(allowedBatchSizes); + return this; + } + + /** + * Sets the container option. + * + * @param container the container option + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + /** + * Sets the batchingQueue option. + * + * @param batchingQueue the batchingQueue option + * @return this Options instance. + */ + public Options batchingQueue(String batchingQueue) { + this.batchingQueue = batchingQueue; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Batch.class + ) + public static class Inputs extends RawOpInputs { + /** + * The inTensors input + */ + public final Iterable> inTensors; + + /** + * The numBatchThreads attribute + */ + public final long numBatchThreads; + + /** + * The maxBatchSize attribute + */ + public final long maxBatchSize; + + /** + * The maxEnqueuedBatches attribute + */ + public final long maxEnqueuedBatches; + + /** + * The batchTimeoutMicros attribute + */ + public final long batchTimeoutMicros; + + /** + * The allowedBatchSizes attribute + */ + public final long[] allowedBatchSizes; + + /** + * The gradTimeoutMicros attribute + */ + public final long gradTimeoutMicros; + + /** + * The container attribute + */ + public final String container; + + /** + * The sharedName attribute + */ + public final String sharedName; + + /** + * The batchingQueue attribute + */ + public final String batchingQueue; + + /** + * The T attribute + */ + public final DataType[] T; + + public Inputs(GraphOperation op) { + super(new Batch(op), op, Arrays.asList("num_batch_threads", "max_batch_size", "max_enqueued_batches", "batch_timeout_micros", "allowed_batch_sizes", "grad_timeout_micros", "container", "shared_name", "batching_queue", "T")); + int inputIndex = 0; + int inTensorsLength = op.inputListLength("in_tensors"); + inTensors = Arrays.asList((Operand[]) op.inputList(inputIndex, inTensorsLength)); + inputIndex += inTensorsLength; + numBatchThreads = op.attributes().getAttrInt("num_batch_threads"); + maxBatchSize = op.attributes().getAttrInt("max_batch_size"); + maxEnqueuedBatches = op.attributes().getAttrInt("max_enqueued_batches"); + batchTimeoutMicros = op.attributes().getAttrInt("batch_timeout_micros"); + allowedBatchSizes = op.attributes().getAttrIntList("allowed_batch_sizes"); + gradTimeoutMicros = op.attributes().getAttrInt("grad_timeout_micros"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + batchingQueue = op.attributes().getAttrString("batching_queue"); + T = op.attributes().getAttrTypeList("T"); + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BatchFunction.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BatchFunction.java new file mode 100644 index 00000000000..577f213f47d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BatchFunction.java @@ -0,0 +1,686 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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.ConcreteFunction; +import org.tensorflow.GraphOperation; +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.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * Batches all the inputs tensors to the computation done by the function. + * So, for example, in the following code + *

+ *
+ * # This input will be captured.
+ * y = tf.placeholder_with_default(1.0, shape=[])
+ *
+ * {@literal @}tf.Defun(tf.float32)
+ * def computation(a):
+ *   return tf.matmul(a, a) + y
+ *
+ * b = gen_batch_ops.batch_function(
+ *         f=computation
+ *         in_tensors=[a],
+ *         captured_tensors=computation.captured_inputs,
+ *         Tout=[o.type for o in computation.definition.signature.output_arg],
+ *         num_batch_threads=1,
+ *         max_batch_size=10,
+ *         batch_timeout_micros=100000,  # 100ms
+ *         allowed_batch_sizes=[3, 10],
+ *         batching_queue="")
+ * 
+ *

If more than one session.run call is simultaneously trying to compute {@code b} + * the values of {@code a} will be gathered, non-deterministically concatenated + * along the first axis, and only one thread will run the computation. + *

Assumes that all arguments of the function are Tensors which will be batched + * along their first dimension. + *

Arguments that are captured, are not batched. The session.run call which does + * the concatenation, will use the values of the captured tensors available to it. + * Therefore, typical uses of captured tensors should involve values which remain + * unchanged across session.run calls. Inference is a good example of this. + *

SparseTensor is not supported. The return value of the decorated function + * must be a Tensor or a list/tuple of Tensors. + */ +@OpMetadata( + opType = BatchFunction.OP_NAME, + inputsClass = BatchFunction.Inputs.class +) +@Operator +public final class BatchFunction extends RawOp implements Iterable> { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "BatchFunction"; + + private List> outTensors; + + @SuppressWarnings("unchecked") + public BatchFunction(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int outTensorsLength = operation.outputListLength("out_tensors"); + outTensors = Arrays.asList(operation.outputList(outputIdx, outTensorsLength)); + outputIdx += outTensorsLength; + } + + /** + * Factory method to create a class wrapping a new BatchFunction operation. + * + * @param scope current scope + * @param inTensors The tensors to be batched. + * @param capturedTensors The tensors which are captured in the function, and don't need + * to be batched. + * @param f The value of the f attribute + * @param numBatchThreads Number of scheduling threads for processing batches of work. + * Determines the number of batches processed in parallel. + * @param maxBatchSize Batch sizes will never be bigger than this. + * @param batchTimeoutMicros Maximum number of microseconds to wait before outputting + * an incomplete batch. + * @param Tout the types of the output tensors. + * @param options carries optional attribute values + * @return a new instance of BatchFunction + */ + @Endpoint( + describeByClass = true + ) + public static BatchFunction create(Scope scope, Iterable> inTensors, + Iterable> capturedTensors, ConcreteFunction f, Long numBatchThreads, + Long maxBatchSize, Long batchTimeoutMicros, List> Tout, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "BatchFunction"); + opBuilder.addInputList(Operands.asOutputs(inTensors)); + opBuilder.addInputList(Operands.asOutputs(capturedTensors)); + opBuilder.setAttr("f", f); + opBuilder.setAttr("num_batch_threads", numBatchThreads); + opBuilder.setAttr("max_batch_size", maxBatchSize); + opBuilder.setAttr("batch_timeout_micros", batchTimeoutMicros); + opBuilder.setAttr("Tout", Operands.toDataTypes(Tout)); + 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); + } + if (opts.lowPriorityMaxBatchSize != null) { + opBuilder.setAttr("low_priority_max_batch_size", opts.lowPriorityMaxBatchSize); + } + if (opts.lowPriorityBatchTimeoutMicros != null) { + opBuilder.setAttr("low_priority_batch_timeout_micros", opts.lowPriorityBatchTimeoutMicros); + } + if (opts.lowPriorityAllowedBatchSizes != null) { + long[] lowPriorityAllowedBatchSizesArray = new long[opts.lowPriorityAllowedBatchSizes.size()]; + for (int i = 0 ; i < lowPriorityAllowedBatchSizesArray.length ; i++) { + lowPriorityAllowedBatchSizesArray[i] = opts.lowPriorityAllowedBatchSizes.get(i); + } + opBuilder.setAttr("low_priority_allowed_batch_sizes", lowPriorityAllowedBatchSizesArray); + } + if (opts.lowPriorityMaxEnqueuedBatches != null) { + opBuilder.setAttr("low_priority_max_enqueued_batches", opts.lowPriorityMaxEnqueuedBatches); + } + if (opts.mixedPriorityPolicy != null) { + opBuilder.setAttr("mixed_priority_policy", opts.mixedPriorityPolicy); + } + if (opts.batchPaddingPolicy != null) { + opBuilder.setAttr("batch_padding_policy", opts.batchPaddingPolicy); + } + if (opts.enableLargeBatchSplitting != null) { + opBuilder.setAttr("enable_large_batch_splitting", opts.enableLargeBatchSplitting); + } + } + } + return new BatchFunction(opBuilder.build()); + } + + /** + * Sets the maxEnqueuedBatches option. + * + * @param maxEnqueuedBatches Maximum number of batches enqueued. Default: 10. + * @return this Options instance. + */ + public static Options maxEnqueuedBatches(Long maxEnqueuedBatches) { + return new Options().maxEnqueuedBatches(maxEnqueuedBatches); + } + + /** + * Sets the allowedBatchSizes option. + * + * @param allowedBatchSizes 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. + * If enable_large_batch_splitting is false (i.e., large-input-split is not + * enabled) the final entry must equal max_batch_size. + * @return this Options instance. + */ + public static Options allowedBatchSizes(List allowedBatchSizes) { + return new Options().allowedBatchSizes(allowedBatchSizes); + } + + /** + * Sets the allowedBatchSizes option. + * + * @param allowedBatchSizes 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. + * If enable_large_batch_splitting is false (i.e., large-input-split is not + * enabled) the final entry must equal max_batch_size. + * @return this Options instance. + */ + public static Options allowedBatchSizes(Long... allowedBatchSizes) { + return new Options().allowedBatchSizes(allowedBatchSizes); + } + + /** + * Sets the container option. + * + * @param container Controls the scope of sharing of this batch. + * @return this Options instance. + */ + public static Options container(String container) { + return new Options().container(container); + } + + /** + * Sets the sharedName option. + * + * @param sharedName 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. + * @return this Options instance. + */ + public static Options sharedName(String sharedName) { + return new Options().sharedName(sharedName); + } + + /** + * Sets the batchingQueue option. + * + * @param batchingQueue the batchingQueue option + * @return this Options instance. + */ + public static Options batchingQueue(String batchingQueue) { + return new Options().batchingQueue(batchingQueue); + } + + /** + * Sets the lowPriorityMaxBatchSize option. + * + * @param lowPriorityMaxBatchSize the lowPriorityMaxBatchSize option + * @return this Options instance. + */ + public static Options lowPriorityMaxBatchSize(Long lowPriorityMaxBatchSize) { + return new Options().lowPriorityMaxBatchSize(lowPriorityMaxBatchSize); + } + + /** + * Sets the lowPriorityBatchTimeoutMicros option. + * + * @param lowPriorityBatchTimeoutMicros the lowPriorityBatchTimeoutMicros option + * @return this Options instance. + */ + public static Options lowPriorityBatchTimeoutMicros(Long lowPriorityBatchTimeoutMicros) { + return new Options().lowPriorityBatchTimeoutMicros(lowPriorityBatchTimeoutMicros); + } + + /** + * Sets the lowPriorityAllowedBatchSizes option. + * + * @param lowPriorityAllowedBatchSizes the lowPriorityAllowedBatchSizes option + * @return this Options instance. + */ + public static Options lowPriorityAllowedBatchSizes(List lowPriorityAllowedBatchSizes) { + return new Options().lowPriorityAllowedBatchSizes(lowPriorityAllowedBatchSizes); + } + + /** + * Sets the lowPriorityAllowedBatchSizes option. + * + * @param lowPriorityAllowedBatchSizes the lowPriorityAllowedBatchSizes option + * @return this Options instance. + */ + public static Options lowPriorityAllowedBatchSizes(Long... lowPriorityAllowedBatchSizes) { + return new Options().lowPriorityAllowedBatchSizes(lowPriorityAllowedBatchSizes); + } + + /** + * Sets the lowPriorityMaxEnqueuedBatches option. + * + * @param lowPriorityMaxEnqueuedBatches the lowPriorityMaxEnqueuedBatches option + * @return this Options instance. + */ + public static Options lowPriorityMaxEnqueuedBatches(Long lowPriorityMaxEnqueuedBatches) { + return new Options().lowPriorityMaxEnqueuedBatches(lowPriorityMaxEnqueuedBatches); + } + + /** + * Sets the mixedPriorityPolicy option. + * + * @param mixedPriorityPolicy the mixedPriorityPolicy option + * @return this Options instance. + */ + public static Options mixedPriorityPolicy(String mixedPriorityPolicy) { + return new Options().mixedPriorityPolicy(mixedPriorityPolicy); + } + + /** + * Sets the batchPaddingPolicy option. + * + * @param batchPaddingPolicy the batchPaddingPolicy option + * @return this Options instance. + */ + public static Options batchPaddingPolicy(String batchPaddingPolicy) { + return new Options().batchPaddingPolicy(batchPaddingPolicy); + } + + /** + * Sets the enableLargeBatchSplitting option. + * + * @param enableLargeBatchSplitting input with a large size (i.e., larger than the largest value of + * {@code allowed_batch_sizes}) will be splitted into multiple batches with batch size. + * @return this Options instance. + */ + public static Options enableLargeBatchSplitting(Boolean enableLargeBatchSplitting) { + return new Options().enableLargeBatchSplitting(enableLargeBatchSplitting); + } + + /** + * Gets outTensors. + * The output tensors. + * @return outTensors. + */ + public List> outTensors() { + return outTensors; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) outTensors.iterator(); + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.BatchFunction} + */ + public static class Options { + private Long maxEnqueuedBatches; + + private List allowedBatchSizes; + + private String container; + + private String sharedName; + + private String batchingQueue; + + private Long lowPriorityMaxBatchSize; + + private Long lowPriorityBatchTimeoutMicros; + + private List lowPriorityAllowedBatchSizes; + + private Long lowPriorityMaxEnqueuedBatches; + + private String mixedPriorityPolicy; + + private String batchPaddingPolicy; + + private Boolean enableLargeBatchSplitting; + + private Options() { + } + + /** + * Sets the maxEnqueuedBatches option. + * + * @param maxEnqueuedBatches Maximum number of batches enqueued. Default: 10. + * @return this Options instance. + */ + public Options maxEnqueuedBatches(Long maxEnqueuedBatches) { + this.maxEnqueuedBatches = maxEnqueuedBatches; + return this; + } + + /** + * Sets the allowedBatchSizes option. + * + * @param allowedBatchSizes 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. + * If enable_large_batch_splitting is false (i.e., large-input-split is not + * enabled) the final entry must equal max_batch_size. + * @return this Options instance. + */ + public Options allowedBatchSizes(List allowedBatchSizes) { + this.allowedBatchSizes = allowedBatchSizes; + return this; + } + + /** + * Sets the allowedBatchSizes option. + * + * @param allowedBatchSizes 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. + * If enable_large_batch_splitting is false (i.e., large-input-split is not + * enabled) the final entry must equal max_batch_size. + * @return this Options instance. + */ + public Options allowedBatchSizes(Long... allowedBatchSizes) { + this.allowedBatchSizes = Arrays.asList(allowedBatchSizes); + return this; + } + + /** + * Sets the container option. + * + * @param container Controls the scope of sharing of this batch. + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName 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. + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + /** + * Sets the batchingQueue option. + * + * @param batchingQueue the batchingQueue option + * @return this Options instance. + */ + public Options batchingQueue(String batchingQueue) { + this.batchingQueue = batchingQueue; + return this; + } + + /** + * Sets the lowPriorityMaxBatchSize option. + * + * @param lowPriorityMaxBatchSize the lowPriorityMaxBatchSize option + * @return this Options instance. + */ + public Options lowPriorityMaxBatchSize(Long lowPriorityMaxBatchSize) { + this.lowPriorityMaxBatchSize = lowPriorityMaxBatchSize; + return this; + } + + /** + * Sets the lowPriorityBatchTimeoutMicros option. + * + * @param lowPriorityBatchTimeoutMicros the lowPriorityBatchTimeoutMicros option + * @return this Options instance. + */ + public Options lowPriorityBatchTimeoutMicros(Long lowPriorityBatchTimeoutMicros) { + this.lowPriorityBatchTimeoutMicros = lowPriorityBatchTimeoutMicros; + return this; + } + + /** + * Sets the lowPriorityAllowedBatchSizes option. + * + * @param lowPriorityAllowedBatchSizes the lowPriorityAllowedBatchSizes option + * @return this Options instance. + */ + public Options lowPriorityAllowedBatchSizes(List lowPriorityAllowedBatchSizes) { + this.lowPriorityAllowedBatchSizes = lowPriorityAllowedBatchSizes; + return this; + } + + /** + * Sets the lowPriorityAllowedBatchSizes option. + * + * @param lowPriorityAllowedBatchSizes the lowPriorityAllowedBatchSizes option + * @return this Options instance. + */ + public Options lowPriorityAllowedBatchSizes(Long... lowPriorityAllowedBatchSizes) { + this.lowPriorityAllowedBatchSizes = Arrays.asList(lowPriorityAllowedBatchSizes); + return this; + } + + /** + * Sets the lowPriorityMaxEnqueuedBatches option. + * + * @param lowPriorityMaxEnqueuedBatches the lowPriorityMaxEnqueuedBatches option + * @return this Options instance. + */ + public Options lowPriorityMaxEnqueuedBatches(Long lowPriorityMaxEnqueuedBatches) { + this.lowPriorityMaxEnqueuedBatches = lowPriorityMaxEnqueuedBatches; + return this; + } + + /** + * Sets the mixedPriorityPolicy option. + * + * @param mixedPriorityPolicy the mixedPriorityPolicy option + * @return this Options instance. + */ + public Options mixedPriorityPolicy(String mixedPriorityPolicy) { + this.mixedPriorityPolicy = mixedPriorityPolicy; + return this; + } + + /** + * Sets the batchPaddingPolicy option. + * + * @param batchPaddingPolicy the batchPaddingPolicy option + * @return this Options instance. + */ + public Options batchPaddingPolicy(String batchPaddingPolicy) { + this.batchPaddingPolicy = batchPaddingPolicy; + return this; + } + + /** + * Sets the enableLargeBatchSplitting option. + * + * @param enableLargeBatchSplitting input with a large size (i.e., larger than the largest value of + * {@code allowed_batch_sizes}) will be splitted into multiple batches with batch size. + * @return this Options instance. + */ + public Options enableLargeBatchSplitting(Boolean enableLargeBatchSplitting) { + this.enableLargeBatchSplitting = enableLargeBatchSplitting; + return this; + } + } + + @OpInputsMetadata( + outputsClass = BatchFunction.class + ) + public static class Inputs extends RawOpInputs { + /** + * The tensors to be batched. + */ + public final Iterable> inTensors; + + /** + * The tensors which are captured in the function, and don't need + * to be batched. + */ + public final Iterable> capturedTensors; + + /** + * Number of scheduling threads for processing batches of work. + * Determines the number of batches processed in parallel. + */ + public final long numBatchThreads; + + /** + * Batch sizes will never be bigger than this. + */ + public final long maxBatchSize; + + /** + * Maximum number of microseconds to wait before outputting + * an incomplete batch. + */ + public final long batchTimeoutMicros; + + /** + * Maximum number of batches enqueued. Default: 10. + */ + public final long maxEnqueuedBatches; + + /** + * 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. + * If enable_large_batch_splitting is false (i.e., large-input-split is not + * enabled) the final entry must equal max_batch_size. + */ + public final long[] allowedBatchSizes; + + /** + * Controls the scope of sharing of this batch. + */ + public final String container; + + /** + * 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. + */ + public final String sharedName; + + /** + * The batchingQueue attribute + */ + public final String batchingQueue; + + /** + * The lowPriorityMaxBatchSize attribute + */ + public final long lowPriorityMaxBatchSize; + + /** + * The lowPriorityBatchTimeoutMicros attribute + */ + public final long lowPriorityBatchTimeoutMicros; + + /** + * The lowPriorityAllowedBatchSizes attribute + */ + public final long[] lowPriorityAllowedBatchSizes; + + /** + * The lowPriorityMaxEnqueuedBatches attribute + */ + public final long lowPriorityMaxEnqueuedBatches; + + /** + * The mixedPriorityPolicy attribute + */ + public final String mixedPriorityPolicy; + + /** + * The batchPaddingPolicy attribute + */ + public final String batchPaddingPolicy; + + /** + * the types of tensors to be batched. + */ + public final DataType[] Tin; + + /** + * the types of the captured tensors. + */ + public final DataType[] Tcaptured; + + /** + * the types of the output tensors. + */ + public final DataType[] Tout; + + /** + * input with a large size (i.e., larger than the largest value of + * {@code allowed_batch_sizes}) will be splitted into multiple batches with batch size. + */ + public final boolean enableLargeBatchSplitting; + + public Inputs(GraphOperation op) { + super(new BatchFunction(op), op, Arrays.asList("num_batch_threads", "max_batch_size", "batch_timeout_micros", "max_enqueued_batches", "allowed_batch_sizes", "container", "shared_name", "batching_queue", "low_priority_max_batch_size", "low_priority_batch_timeout_micros", "low_priority_allowed_batch_sizes", "low_priority_max_enqueued_batches", "mixed_priority_policy", "batch_padding_policy", "Tin", "Tcaptured", "Tout", "enable_large_batch_splitting")); + int inputIndex = 0; + int inTensorsLength = op.inputListLength("in_tensors"); + inTensors = Arrays.asList((Operand[]) op.inputList(inputIndex, inTensorsLength)); + inputIndex += inTensorsLength; + int capturedTensorsLength = op.inputListLength("captured_tensors"); + capturedTensors = Arrays.asList((Operand[]) op.inputList(inputIndex, capturedTensorsLength)); + inputIndex += capturedTensorsLength; + numBatchThreads = op.attributes().getAttrInt("num_batch_threads"); + maxBatchSize = op.attributes().getAttrInt("max_batch_size"); + batchTimeoutMicros = op.attributes().getAttrInt("batch_timeout_micros"); + maxEnqueuedBatches = op.attributes().getAttrInt("max_enqueued_batches"); + allowedBatchSizes = op.attributes().getAttrIntList("allowed_batch_sizes"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + batchingQueue = op.attributes().getAttrString("batching_queue"); + lowPriorityMaxBatchSize = op.attributes().getAttrInt("low_priority_max_batch_size"); + lowPriorityBatchTimeoutMicros = op.attributes().getAttrInt("low_priority_batch_timeout_micros"); + lowPriorityAllowedBatchSizes = op.attributes().getAttrIntList("low_priority_allowed_batch_sizes"); + lowPriorityMaxEnqueuedBatches = op.attributes().getAttrInt("low_priority_max_enqueued_batches"); + mixedPriorityPolicy = op.attributes().getAttrString("mixed_priority_policy"); + batchPaddingPolicy = op.attributes().getAttrString("batch_padding_policy"); + Tin = op.attributes().getAttrTypeList("Tin"); + Tcaptured = op.attributes().getAttrTypeList("Tcaptured"); + Tout = op.attributes().getAttrTypeList("Tout"); + enableLargeBatchSplitting = op.attributes().getAttrBool("enable_large_batch_splitting"); + } + } +} 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 deleted file mode 100644 index e5b3513b717..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BatchMatMulV2.java +++ /dev/null @@ -1,149 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.family.TType; - -/** - * 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 index 64123abb4f8..09fa1d49bcb 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,126 +17,187 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 + *

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 + * this op outputs a copy of the input tensor where values from the {@code batch} + * dimension are moved in spatial blocks to the {@code height} and {@code width} dimensions, + * followed by cropping along the {@code height} and {@code width} dimensions. */ +@OpMetadata( + opType = BatchToSpace.OP_NAME, + inputsClass = BatchToSpace.Inputs.class +) @Operator -public final class BatchToSpace extends PrimitiveOp implements Operand { - +public final class BatchToSpace extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "BatchToSpace"; + + private Output output; + + public BatchToSpace(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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 + * {@code [batch*block_size*block_size, height_pad/block_size, width_pad/block_size, depth]}. Note that the batch size of the input tensor must be divisible by + * {@code block_size * block_size}. + * @param crops 2-D tensor of non-negative integers with shape {@code [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 + *

+   * crops = [[crop_top, crop_bottom], [crop_left, crop_right]]
+   * 
+ * @param blockSize The value of the blockSize attribute + * @param data type for {@code BatchToSpace} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static BatchToSpace create(Scope scope, Operand input, + Operand crops, Long blockSize) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "BatchToSpace"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(crops.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); opBuilder.setAttr("block_size", blockSize); - return new BatchToSpace(opBuilder.build()); + 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
+   * Gets output.
+   * 4-D with shape {@code [batch, height, width, depth]}, where:
+   * 
+   *   height = height_pad - crop_top - crop_bottom
+   *   width = width_pad - crop_left - crop_right
+   * 
+ *

The attr {@code block_size} must be greater than one. It indicates the block size. + *

Some examples: + *

(1) For the following input of shape {@code [4, 1, 1, 1]} and block_size of 2: + *

    * [[[[1]]], [[[2]]], [[[3]]], [[[4]]]]
-   * }
- * The output tensor has shape `[1, 2, 2, 1]` and value: - *
{@code
+   * 
+ *

The output tensor has shape {@code [1, 2, 2, 1]} and value: + *

    * x = [[[[1], [2]], [[3], [4]]]]
-   * }
- * (2) For the following input of shape `[4, 1, 1, 3]` and block_size of 2: - *
{@code
+   * 
+ *

(2) For the following input of shape {@code [4, 1, 1, 3]} and block_size of 2: + *

    * [[[[1, 2, 3]]], [[[4, 5, 6]]], [[[7, 8, 9]]], [[[10, 11, 12]]]]
-   * }
- * The output tensor has shape `[1, 2, 2, 3]` and value: - *
{@code
+   * 
+ *

The output tensor has shape {@code [1, 2, 2, 3]} and value: + *

    * 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
+   * 
+ *

(3) For the following input of shape {@code [4, 2, 2, 1]} and block_size of 2: + *

    * 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
+   * 
+ *

The output tensor has shape {@code [1, 4, 4, 1]} and value: + *

    * 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
+   * 
+ *

(4) For the following input of shape {@code [8, 1, 2, 1]} and block_size of 2: + *

    * 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
+   * 
+ *

The output tensor has shape {@code [2, 2, 4, 1]} and value: + *

    * x = [[[[1], [3]], [[5], [7]]],
    *      [[[2], [4]], [[10], [12]]],
    *      [[[5], [7]], [[13], [15]]],
    *      [[[6], [8]], [[14], [16]]]]
-   * }
- * + *
+ * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = BatchToSpace.class + ) + public static class Inputs extends RawOpInputs> { + /** + * 4-D tensor with shape + * {@code [batch*block_size*block_size, height_pad/block_size, width_pad/block_size, depth]}. Note that the batch size of the input tensor must be divisible by + * {@code block_size * block_size}. + */ + public final Operand input; + + /** + * 2-D tensor of non-negative integers with shape {@code [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]]
+     * 
+ */ + public final Operand crops; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The blockSize attribute + */ + public final long blockSize; + + /** + * The Tidx attribute + */ + public final DataType Tidx; + + public Inputs(GraphOperation op) { + super(new BatchToSpace<>(op), op, Arrays.asList("T", "block_size", "Tidx")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + crops = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + blockSize = op.attributes().getAttrInt("block_size"); + Tidx = op.attributes().getAttrType("Tidx"); + } } } 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 index b1e84532395..65a98188342 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,160 +17,312 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 + * This operation reshapes the "batch" dimension 0 into {@code M + 1} dimensions of shape + * {@code block_shape + [batch]}, interleaves these blocks back into the grid defined by + * the spatial dimensions {@code [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 + * optionally cropped according to {@code crops} to produce the output. This is the * reverse of SpaceToBatch. See below for a precise description. - * - * @param data type for {@code output()} output */ +@OpMetadata( + opType = BatchToSpaceNd.OP_NAME, + inputsClass = BatchToSpaceNd.Inputs.class +) @Operator -public final class BatchToSpaceNd extends PrimitiveOp implements Operand { - +public final class BatchToSpaceNd extends RawOp implements Operand { /** - * Factory method to create a class wrapping a new BatchToSpaceNd operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "BatchToSpaceND"; + + private Output output; + + public BatchToSpaceNd(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * 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`, + * @param input N-D with shape {@code 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
+   * @param blockShape 1-D with shape {@code [M]}, all values must be >= 1.
+   * @param crops 2-D with shape {@code [M, 2]}, all values must be >= 0.
+   * {@code crops[i] = [crop_start, crop_end]} specifies the amount to crop from input
+   * dimension {@code i + 1}, which corresponds to spatial dimension {@code i}.  It is
+   * required that
+   * {@code crop_start[i] + crop_end[i] <= block_shape[i] * input_shape[i + 1]}.
+   * 

This operation is equivalent to the following steps: + *

    + *
  1. + *

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

  2. + *
  3. + *

    Permute dimensions of {@code reshaped} to produce {@code 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. + *
  5. + *

    Reshape {@code permuted} to produce {@code 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]] + *

  6. + *
  7. + *

    Crop the start and end of dimensions {@code [1, ..., M]} of + * {@code reshaped_permuted} according to {@code 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]] + *

  8. + *
+ *

Some examples: + *

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

    * [[[[1]]], [[[2]]], [[[3]]], [[[4]]]]
-   * }
- * The output tensor has shape `[1, 2, 2, 1]` and value: - *
{@code
+   * 
+ *

The output tensor has shape {@code [1, 2, 2, 1]} and value: + *

    * 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
+   * 
+ *

(2) For the following input of shape {@code [4, 1, 1, 3]}, {@code block_shape = [2, 2]}, and + * {@code crops = [[0, 0], [0, 0]]}: + *

    * [[[[1, 2, 3]]], [[[4, 5, 6]]], [[[7, 8, 9]]], [[[10, 11, 12]]]]
-   * }
- * The output tensor has shape `[1, 2, 2, 3]` and value: - *
{@code
+   * 
+ *

The output tensor has shape {@code [1, 2, 2, 3]} and value: + *

    * 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
+   * 
+ *

(3) For the following input of shape {@code [4, 2, 2, 1]}, {@code block_shape = [2, 2]}, and + * {@code crops = [[0, 0], [0, 0]]}: + *

    * 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
+   * 
+ *

The output tensor has shape {@code [1, 4, 4, 1]} and value: + *

    * 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
+   * 
+ *

(4) For the following input of shape {@code [8, 1, 3, 1]}, {@code block_shape = [2, 2]}, and + * {@code crops = [[0, 0], [2, 0]]}: + *

    * 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
+   * 
+ *

The output tensor has shape {@code [2, 2, 4, 1]} and value: + *

    * x = [[[[1],   [2],  [3],  [4]],
    *       [[5],   [6],  [7],  [8]]],
    *      [[[9],  [10], [11],  [12]],
    *       [[13], [14], [15],  [16]]]]
-   * }
- * + *
+ * @param data type for {@code BatchToSpaceND} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static BatchToSpaceNd create(Scope scope, Operand input, + Operand blockShape, Operand crops) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "BatchToSpaceNd"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(blockShape.asOutput()); opBuilder.addInput(crops.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new BatchToSpaceNd(opBuilder.build()); + return new BatchToSpaceNd<>(opBuilder.build()); } - + /** + * Gets output. + * + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = BatchToSpaceNd.class + ) + public static class Inputs extends RawOpInputs> { + /** + * N-D with shape {@code input_shape = [batch] + spatial_shape + remaining_shape}, + * where spatial_shape has M dimensions. + */ + public final Operand input; + + /** + * 1-D with shape {@code [M]}, all values must be >= 1. + */ + public final Operand blockShape; + + /** + * 2-D with shape {@code [M, 2]}, all values must be >= 0. + * {@code crops[i] = [crop_start, crop_end]} specifies the amount to crop from input + * dimension {@code i + 1}, which corresponds to spatial dimension {@code i}. It is + * required that + * {@code crop_start[i] + crop_end[i] <= block_shape[i] * input_shape[i + 1]}. + *

This operation is equivalent to the following steps: + *

    + *
  1. + *

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

  2. + *
  3. + *

    Permute dimensions of {@code reshaped} to produce {@code 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. + *
  5. + *

    Reshape {@code permuted} to produce {@code 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]] + *

  6. + *
  7. + *

    Crop the start and end of dimensions {@code [1, ..., M]} of + * {@code reshaped_permuted} according to {@code 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]] + *

  8. + *
+ *

Some examples: + *

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

+     * [[[[1]]], [[[2]]], [[[3]]], [[[4]]]]
+     * 
+ *

The output tensor has shape {@code [1, 2, 2, 1]} and value: + *

+     * x = [[[[1], [2]], [[3], [4]]]]
+     * 
+ *

(2) For the following input of shape {@code [4, 1, 1, 3]}, {@code block_shape = [2, 2]}, and + * {@code crops = [[0, 0], [0, 0]]}: + *

+     * [[[[1, 2, 3]]], [[[4, 5, 6]]], [[[7, 8, 9]]], [[[10, 11, 12]]]]
+     * 
+ *

The output tensor has shape {@code [1, 2, 2, 3]} and value: + *

+     * x = [[[[1, 2, 3], [4, 5, 6]],
+     *       [[7, 8, 9], [10, 11, 12]]]]
+     * 
+ *

(3) For the following input of shape {@code [4, 2, 2, 1]}, {@code block_shape = [2, 2]}, and + * {@code crops = [[0, 0], [0, 0]]}: + *

+     * x = [[[[1], [3]], [[9], [11]]],
+     *      [[[2], [4]], [[10], [12]]],
+     *      [[[5], [7]], [[13], [15]]],
+     *      [[[6], [8]], [[14], [16]]]]
+     * 
+ *

The output tensor has shape {@code [1, 4, 4, 1]} and value: + *

+     * x = [[[[1],   [2],  [3],  [4]],
+     *      [[5],   [6],  [7],  [8]],
+     *      [[9],  [10], [11],  [12]],
+     *      [[13], [14], [15],  [16]]]]
+     * 
+ *

(4) For the following input of shape {@code [8, 1, 3, 1]}, {@code block_shape = [2, 2]}, and + * {@code crops = [[0, 0], [2, 0]]}: + *

+     * 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 {@code [2, 2, 4, 1]} and value: + *

+     * x = [[[[1],   [2],  [3],  [4]],
+     *       [[5],   [6],  [7],  [8]]],
+     *      [[[9],  [10], [11],  [12]],
+     *       [[13], [14], [15],  [16]]]]
+     * 
+ */ + public final Operand crops; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The TblockShape attribute + */ + public final DataType TblockShape; + + /** + * The Tcrops attribute + */ + public final DataType Tcrops; + + public Inputs(GraphOperation op) { + super(new BatchToSpaceNd<>(op), op, Arrays.asList("T", "Tblock_shape", "Tcrops")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + blockShape = (Operand) op.input(inputIndex++); + crops = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + TblockShape = op.attributes().getAttrType("Tblock_shape"); + Tcrops = op.attributes().getAttrType("Tcrops"); + } } } 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 index 5c7435e6fe4..82a2a99d295 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,105 +17,164 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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 + * Given a tensor {@code input}, this operation returns a tensor that has the same buffer + * data as {@code input} with datatype {@code type}. + *

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

If {@code T} is smaller than {@code type}, the operator requires that the rightmost + * dimension be equal to sizeof({@code type})/sizeof({@code T}). The shape then goes from + * [..., sizeof({@code type})/sizeof({@code 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)
+ * 

Example 1: + *

+ *
+ *
+ *

a = [1., 2., 3.] + * equality_bitcast = tf.bitcast(a, tf.complex128) + * Traceback (most recent call last): + * ... + * InvalidArgumentError: Cannot bitcast from 1 to 18 [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)
+ * 
+ * 
+ * 
+ * 

Example 2: + *

+ *
+ *
+ *

tf.bitcast(tf.constant(0xffffffff, dtype=tf.uint32), tf.uint8) + * <tf.Tensor: shape=(4,), dtype=uint8, numpy=array([255, 255, 255, 255], dtype=uint8)> + *

+ *
+ *
+ *

Example 3: + *

+ *
+ *
+ *

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) + * print(equality_cast) * tf.Tensor([0. 1. 1.], shape=(3,), dtype=float32) - * >>> print(equality_bitcast) + * 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 + * [[ 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. A copy from input buffer to output + * buffer is made on BE machines when types are of different sizes in order to get + * the same casting results as on LE machines. */ +@OpMetadata( + opType = Bitcast.OP_NAME, + inputsClass = Bitcast.Inputs.class +) @Operator -public final class Bitcast extends PrimitiveOp implements Operand { - +public final class Bitcast extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Bitcast"; + + private Output output; + + public Bitcast(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new Bitcast operation. - * + * * @param scope current scope - * @param input - * @param type + * @param input The input value + * @param type The value of the type attribute + * @param data type for {@code Bitcast} output and operands * @return a new instance of Bitcast */ - public static Bitcast create(Scope scope, Operand input, DataType type) { - OperationBuilder opBuilder = scope.env().opBuilder("Bitcast", scope.makeOpName("Bitcast")); + @Endpoint( + describeByClass = true + ) + public static Bitcast create(Scope scope, Operand input, + Class type) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Bitcast"); opBuilder.addInput(input.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("type", type); - return new Bitcast(opBuilder.build()); + opBuilder.setAttr("type", Operands.toDataType(type)); + return new Bitcast<>(opBuilder.build()); } - + /** + * Gets output. + * + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = Bitcast.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The type attribute + */ + public final DataType type; + + public Inputs(GraphOperation op) { + super(new Bitcast<>(op), op, Arrays.asList("T", "type")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + type = op.attributes().getAttrType("type"); + } } } 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 deleted file mode 100644 index ad29b14a98b..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BlockLSTM.java +++ /dev/null @@ -1,226 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt64; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index bcc08bdde69..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BlockLSTMGrad.java +++ /dev/null @@ -1,167 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt64; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index b55391e142d..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesAggregateStats.java +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; -import org.tensorflow.types.TInt32; - -/** - * 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 deleted file mode 100644 index 1b75c417a7f..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesBucketize.java +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.TFloat; -import org.tensorflow.types.TInt32; - -/** - * 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 deleted file mode 100644 index 3e90fead098..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesCalculateBestFeatureSplit.java +++ /dev/null @@ -1,172 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; -import org.tensorflow.types.TInt32; -import org.tensorflow.types.TString; - -/** - * 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 deleted file mode 100644 index f0a5032f108..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesCalculateBestGainsPerFeature.java +++ /dev/null @@ -1,133 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.TFloat; -import org.tensorflow.types.TInt32; - -/** - * 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 deleted file mode 100644 index 632db799992..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesCenterBias.java +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TBool; -import org.tensorflow.types.TFloat; - -/** - * 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 deleted file mode 100644 index ed730f33d3b..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesCreateEnsemble.java +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt64; -import org.tensorflow.types.TString; - -/** - * 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 deleted file mode 100644 index b83527f70bf..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesCreateQuantileStreamResource.java +++ /dev/null @@ -1,89 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; -import org.tensorflow.types.TInt64; - -/** - * 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 deleted file mode 100644 index f5f21376a82..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesDeserializeEnsemble.java +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt64; -import org.tensorflow.types.TString; - -/** - * 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 deleted file mode 100644 index 2dae6f7df85..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesEnsembleResourceHandleOp.java +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TType; - -/** - * 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 deleted file mode 100644 index 63a6d4a4f0a..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesExampleDebugOutputs.java +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt32; -import org.tensorflow.types.TString; - -/** - * 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 deleted file mode 100644 index a84b8fec4b2..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesFlushQuantileSummaries.java +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index d64222c136d..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesGetEnsembleStates.java +++ /dev/null @@ -1,99 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt32; -import org.tensorflow.types.TInt64; - -/** - * 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 deleted file mode 100644 index 1781b0b9d8e..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesMakeQuantileSummaries.java +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 21e4904f177..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesMakeStatsSummary.java +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; -import org.tensorflow.types.TInt32; - -/** - * 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 deleted file mode 100644 index c8e607bed1e..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesPredict.java +++ /dev/null @@ -1,77 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; -import org.tensorflow.types.TInt32; - -/** - * 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 deleted file mode 100644 index 182866fd6e6..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesQuantileStreamResourceAddSummaries.java +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 388dbebbbb2..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesQuantileStreamResourceDeserialize.java +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index eab27aeb708..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesQuantileStreamResourceFlush.java +++ /dev/null @@ -1,98 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt64; - -/** - * 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 deleted file mode 100644 index 93ce9b96285..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesQuantileStreamResourceGetBucketBoundaries.java +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 043f422c7f4..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesQuantileStreamResourceHandleOp.java +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TType; - -/** - * 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 deleted file mode 100644 index 268541ad6f8..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesSerializeEnsemble.java +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt64; -import org.tensorflow.types.TString; - -/** - * 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 deleted file mode 100644 index cd2f5d33289..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesSparseAggregateStats.java +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; -import org.tensorflow.types.TInt32; - -/** - * 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 deleted file mode 100644 index 48f193ac74d..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesSparseCalculateBestFeatureSplit.java +++ /dev/null @@ -1,177 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; -import org.tensorflow.types.TInt32; -import org.tensorflow.types.TString; - -/** - * 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 deleted file mode 100644 index d7cb2a7f3d6..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesTrainingPredict.java +++ /dev/null @@ -1,98 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; -import org.tensorflow.types.TInt32; - -/** - * 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 deleted file mode 100644 index 46399d6bb9e..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BoostedTreesUpdateEnsemble.java +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; -import org.tensorflow.types.TInt32; - -/** - * 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 index 002fd93e4bd..165e7e12b9a 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,59 +17,105 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** * 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 + * Given {@code s0} and {@code s1}, tensors that represent shapes, compute {@code r0}, the + * broadcasted shape. {@code s0}, {@code s1} and {@code r0} are all integer vectors. */ +@OpMetadata( + opType = BroadcastDynamicShape.OP_NAME, + inputsClass = BroadcastDynamicShape.Inputs.class +) @Operator -public final class BroadcastDynamicShape extends PrimitiveOp implements Operand { - +public final class BroadcastDynamicShape extends RawOp implements Operand { /** - * Factory method to create a class wrapping a new BroadcastDynamicShape operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "BroadcastArgs"; + + private Output r0; + + public BroadcastDynamicShape(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + r0 = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new BroadcastArgs operation. + * * @param scope current scope - * @param s0 - * @param s1 + * @param s0 The s0 value + * @param s1 The s1 value + * @param data type for {@code BroadcastArgs} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static BroadcastDynamicShape create(Scope scope, Operand s0, + Operand s1) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "BroadcastDynamicShape"); opBuilder.addInput(s0.asOutput()); opBuilder.addInput(s1.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new BroadcastDynamicShape(opBuilder.build()); + return new BroadcastDynamicShape<>(opBuilder.build()); } - + /** + * Gets r0. + * + * @return r0. */ 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++); + + @OpInputsMetadata( + outputsClass = BroadcastDynamicShape.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The s0 input + */ + public final Operand s0; + + /** + * The s1 input + */ + public final Operand s1; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new BroadcastDynamicShape<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + s0 = (Operand) op.input(inputIndex++); + s1 = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index 6efe36d0a58..f29d66c8de6 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,59 +17,111 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** * 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 { - +@OpMetadata( + opType = BroadcastGradientArgs.OP_NAME, + inputsClass = BroadcastGradientArgs.Inputs.class +) +@Operator +public final class BroadcastGradientArgs extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "BroadcastGradientArgs"; + + private Output r0; + + private Output r1; + + public BroadcastGradientArgs(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + r0 = operation.output(outputIdx++); + r1 = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new BroadcastGradientArgs operation. - * + * * @param scope current scope - * @param s0 - * @param s1 + * @param s0 The s0 value + * @param s1 The s1 value + * @param data type for {@code BroadcastGradientArgs} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static BroadcastGradientArgs create(Scope scope, Operand s0, + Operand s1) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "BroadcastGradientArgs"); opBuilder.addInput(s0.asOutput()); opBuilder.addInput(s1.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new BroadcastGradientArgs(opBuilder.build()); + return new BroadcastGradientArgs<>(opBuilder.build()); } - + /** + * Gets r0. + * + * @return r0. */ public Output r0() { return r0; } - + /** + * Gets r1. + * + * @return r1. */ 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++); + + @OpInputsMetadata( + outputsClass = BroadcastGradientArgs.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The s0 input + */ + public final Operand s0; + + /** + * The s1 input + */ + public final Operand s1; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new BroadcastGradientArgs<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + s0 = (Operand) op.input(inputIndex++); + s1 = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index db39581fb42..f27247cd37a 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,75 +17,146 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 + * dimension pair they are either equal or one of them is one. + *

For example: + *

+ *
+ *
+ *

x = tf.constant([[1, 2, 3]]) # Shape (1, 3,) + * y = tf.broadcast_to(x, [2, 3]) + * print(y) + * tf.Tensor( + * [[1 2 3] + * [1 2 3]], shape=(2, 3), dtype=int32) + *

+ *
+ *
+ *

In the above example, the input Tensor with the shape of {@code [1, 3]} + * is broadcasted to output Tensor with shape of {@code [2, 3]}. + *

When broadcasting, if a tensor has fewer axes than necessary its shape is + * padded on the left with ones. So this gives the same result as the previous + * example: + *

+ *
+ *
+ *

x = tf.constant([1, 2, 3]) # Shape (3,) + * y = tf.broadcast_to(x, [2, 3]) + *

+ *
+ *
+ *

When doing broadcasted operations such as multiplying a tensor + * by a scalar, broadcasting (usually) confers some time or space + * benefit, as the broadcasted tensor is never materialized. + *

However, {@code broadcast_to} does not carry with it any such benefits. + * The newly-created tensor takes the full memory of the broadcasted + * shape. (In a graph context, {@code broadcast_to} might be fused to + * subsequent operation and then be optimized away, however.) */ +@OpMetadata( + opType = BroadcastTo.OP_NAME, + inputsClass = BroadcastTo.Inputs.class +) @Operator -public final class BroadcastTo extends PrimitiveOp implements Operand { - +public final class BroadcastTo extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "BroadcastTo"; + + private Output output; + + public BroadcastTo(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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. + * @param shape An 1-D {@code int} Tensor. The shape of the desired output. + * @param data type for {@code BroadcastTo} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static BroadcastTo create(Scope scope, Operand input, + Operand shape) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "BroadcastTo"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(shape.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new BroadcastTo(opBuilder.build()); + return new BroadcastTo<>(opBuilder.build()); } - + /** + * Gets output. * A Tensor. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = BroadcastTo.class + ) + public static class Inputs extends RawOpInputs> { + /** + * A Tensor to broadcast. + */ + public final Operand input; + + /** + * An 1-D {@code int} Tensor. The shape of the desired output. + */ + public final Operand shape; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tidx attribute + */ + public final DataType Tidx; + + public Inputs(GraphOperation op) { + super(new BroadcastTo<>(op), op, Arrays.asList("T", "Tidx")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + shape = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tidx = op.attributes().getAttrType("Tidx"); + } } } 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 index de5f9b92eea..33ae116612f 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,76 +17,120 @@ package org.tensorflow.op.core; +import java.util.Arrays; import java.util.List; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** * 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]] + * boundaries = [0, 10, 100] + * input = [[-5, 10000] + * [150, 10] + * [5, 100]] + *

then the output will be + * output = [[0, 3] + * [3, 2] + * [1, 3]] */ +@OpMetadata( + opType = Bucketize.OP_NAME, + inputsClass = Bucketize.Inputs.class +) @Operator -public final class Bucketize extends PrimitiveOp implements Operand { - +public final class Bucketize extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Bucketize"; + + private Output output; + + public Bucketize(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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")); + @Endpoint( + describeByClass = true + ) + public static Bucketize create(Scope scope, Operand input, + List boundaries) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Bucketize"); opBuilder.addInput(input.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); float[] boundariesArray = new float[boundaries.size()]; - for (int i = 0; i < boundariesArray.length; ++i) { + for (int i = 0 ; i < boundariesArray.length ; i++) { boundariesArray[i] = boundaries.get(i); } opBuilder.setAttr("boundaries", boundariesArray); return new Bucketize(opBuilder.build()); } - + /** + * Gets output. * Same shape with 'input', each value of input replaced with bucket index. - *

- * @compatibility(numpy) + *

{@literal @}compatibility(numpy)
* Equivalent to np.digitize. - * @end_compatibility + *
{@literal @}end_compatibility + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = Bucketize.class + ) + public static class Inputs extends RawOpInputs { + /** + * Any shape of Tensor contains with int or float type. + */ + public final Operand input; + + /** + * The T attribute + */ + public final DataType T; + + /** + * A sorted list of floats gives the boundary of the buckets. + */ + public final float[] boundaries; + + public Inputs(GraphOperation op) { + super(new Bucketize(op), op, Arrays.asList("T", "boundaries")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + boundaries = op.attributes().getAttrFloatList("boundaries"); + } } } 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 deleted file mode 100644 index 875af208d77..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CSVDataset.java +++ /dev/null @@ -1,93 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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; -import org.tensorflow.tools.Shape; -import org.tensorflow.types.TBool; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.TString; -import org.tensorflow.types.family.TType; - -/** - */ -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 deleted file mode 100644 index eedc1e3cfa6..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CacheDatasetV2.java +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TString; -import org.tensorflow.types.family.TType; - -/** - */ -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] = 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/Case.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Case.java new file mode 100644 index 00000000000..7fbdce56dda --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Case.java @@ -0,0 +1,151 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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.ConcreteFunction; +import org.tensorflow.Operand; +import org.tensorflow.Output; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TType; + +/** + * An n-way switch statement which calls a single branch function. + *

+ * An n-way switch statement, implementing the following:
+ * ```
+ * switch (branch_index) {
+ *   case 0:
+ *     output = branches[0](input);
+ *     break;
+ *   case 1:
+ *     output = branches[1](input);
+ *     break;
+ *   ...
+ *   case [[nbranches-1]]:
+ *   default:
+ *     output = branches[nbranches-1](input);
+ *     break;
+ * }
+ * ```
+ * 
+ * + *

Selects between {@link StatefulCase} and {@link StatelessCase} based on the statefulness of the function arguments. + */ +@Operator +public interface Case extends Iterable> { + /** + * Factory method to create a class wrapping a new Case operation. + * + * @param scope current scope + * @param branchIndex The branch selector, an int32 Tensor. + * @param input A list of input tensors passed to the branch function. + * @param Tout A list of output types. + * @param branches

+   *   A list of functions each of which takes 'inputs' and returns a list of
+   *   tensors, whose types are the same as what every other branch returns.
+   * 
+ * @param options carries optional attribute values + * @return a new instance of Case + */ + @Endpoint( + describeByClass = true, + name = "caseOp" + ) + static Case create(Scope scope, Operand branchIndex, Iterable> input, + List> Tout, List branches, Options... options) { + boolean isStateful = false; + if (branches.stream().anyMatch(x -> x.isStateful())) { + isStateful = true; + } + if (isStateful) { + return StatefulCase.create(scope, branchIndex, input, Tout, branches, options); + } else { + return StatelessCase.create(scope, branchIndex, input, Tout, branches, options); + } + } + + /** + * Sets the outputShapes option. + * + * @param outputShapes the outputShapes option + * @return this Options instance. + */ + static Options outputShapes(List outputShapes) { + return new Options().outputShapes(outputShapes); + } + + /** + * Sets the outputShapes option. + * + * @param outputShapes the outputShapes option + * @return this Options instance. + */ + static Options outputShapes(Shape... outputShapes) { + return new Options().outputShapes(outputShapes); + } + + /** + * Gets output. + * A list of return values. + * @return output. + */ + List> output(); + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + Iterator> iterator(); + + /** + * Optional attributes for {@link org.tensorflow.op.core.Case} + */ + class Options { + List outputShapes; + + private Options() { + } + + /** + * Sets the outputShapes option. + * + * @param outputShapes the outputShapes option + * @return this Options instance. + */ + public Options outputShapes(List outputShapes) { + this.outputShapes = outputShapes; + return this; + } + + /** + * Sets the outputShapes option. + * + * @param outputShapes the outputShapes option + * @return this Options instance. + */ + public Options outputShapes(Shape... outputShapes) { + this.outputShapes = Arrays.asList(outputShapes); + return this; + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CheckPinned.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CheckPinned.java new file mode 100644 index 00000000000..2708bcad2bf --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CheckPinned.java @@ -0,0 +1,115 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * Checks whether a tensor is located in host memory pinned for GPU. + * When run: + *
    + *
  • Reports an {@code InvalidArgument} error if {@code tensor} is not in pinned memory.
  • + *
  • Reports a {@code FailedPrecondition} error if not built with CUDA.
  • + *
+ */ +@OpMetadata( + opType = CheckPinned.OP_NAME, + inputsClass = CheckPinned.Inputs.class +) +@Operator +public final class CheckPinned extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "CheckPinned"; + + private Output output; + + public CheckPinned(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new CheckPinned operation. + * + * @param scope current scope + * @param tensor The tensor value + * @param data type for {@code CheckPinned} output and operands + * @return a new instance of CheckPinned + */ + @Endpoint( + describeByClass = true + ) + public static CheckPinned create(Scope scope, Operand tensor) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "CheckPinned"); + opBuilder.addInput(tensor.asOutput()); + return new CheckPinned<>(opBuilder.build()); + } + + /** + * Gets output. + * + * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + @OpInputsMetadata( + outputsClass = CheckPinned.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensor input + */ + public final Operand tensor; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new CheckPinned<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + tensor = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } + } +} 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 deleted file mode 100644 index cea1724cea0..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ChooseFastestDataset.java +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.Operands; -import org.tensorflow.op.PrimitiveOp; -import org.tensorflow.op.Scope; -import org.tensorflow.tools.Shape; -import org.tensorflow.types.family.TType; - -/** - */ -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] = 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 index 7d921f6c272..2ae7185a7e5 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,65 +17,119 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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 + * Given a tensor {@code t}, this operation returns a tensor of the same type and + * shape as {@code t} with its values clipped to {@code clip_value_min} and {@code clip_value_max}. + * Any values less than {@code clip_value_min} are set to {@code clip_value_min}. Any values + * greater than {@code clip_value_max} are set to {@code clip_value_max}. */ +@OpMetadata( + opType = ClipByValue.OP_NAME, + inputsClass = ClipByValue.Inputs.class +) @Operator -public final class ClipByValue extends PrimitiveOp implements Operand { - +public final class ClipByValue extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ClipByValue"; + + private Output output; + + public ClipByValue(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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. + * @param t A {@code Tensor}. + * @param clipValueMin A 0-D (scalar) {@code Tensor}, or a {@code Tensor} with the same shape + * as {@code t}. The minimum value to clip by. + * @param clipValueMax A 0-D (scalar) {@code Tensor}, or a {@code Tensor} with the same shape + * as {@code t}. The maximum value to clip by. + * @param data type for {@code ClipByValue} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ClipByValue create(Scope scope, Operand t, + Operand clipValueMin, Operand clipValueMax) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ClipByValue"); opBuilder.addInput(t.asOutput()); opBuilder.addInput(clipValueMin.asOutput()); opBuilder.addInput(clipValueMax.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new ClipByValue(opBuilder.build()); + return new ClipByValue<>(opBuilder.build()); } - + /** - * A clipped `Tensor` with the same shape as input 't'. + * Gets output. + * A clipped {@code Tensor} with the same shape as input 't'. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = ClipByValue.class + ) + public static class Inputs extends RawOpInputs> { + /** + * A {@code Tensor}. + */ + public final Operand t; + + /** + * A 0-D (scalar) {@code Tensor}, or a {@code Tensor} with the same shape + * as {@code t}. The minimum value to clip by. + */ + public final Operand clipValueMin; + + /** + * A 0-D (scalar) {@code Tensor}, or a {@code Tensor} with the same shape + * as {@code t}. The maximum value to clip by. + */ + public final Operand clipValueMax; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new ClipByValue<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + t = (Operand) op.input(inputIndex++); + clipValueMin = (Operand) op.input(inputIndex++); + clipValueMax = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 deleted file mode 100644 index 781d9e33956..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CollectiveGather.java +++ /dev/null @@ -1,77 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.tools.Shape; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * Mutually accumulates multiple tensors of identical type and shape. - * - * @param data type for {@code output()} 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 output() { - return output; - } - - @Override - public Output asOutput() { - return output; - } - - private Output output; - - private CollectiveGather(Operation 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/CollectivePermute.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CollectivePermute.java deleted file mode 100644 index 4391ebbefb9..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CollectivePermute.java +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt32; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index fa1079b0800..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CombinedNonMaxSuppression.java +++ /dev/null @@ -1,192 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.TFloat; -import org.tensorflow.types.TInt32; - -/** - * 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/CompositeTensorVariantFromComponents.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CompositeTensorVariantFromComponents.java new file mode 100644 index 00000000000..bc5322574d7 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CompositeTensorVariantFromComponents.java @@ -0,0 +1,127 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +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.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * Encodes an {@code ExtensionType} value into a {@code variant} scalar Tensor. + * Returns a scalar variant tensor containing a single {@code CompositeTensorVariant} + * with the specified Tensor components and TypeSpec. + */ +@OpMetadata( + opType = CompositeTensorVariantFromComponents.OP_NAME, + inputsClass = CompositeTensorVariantFromComponents.Inputs.class +) +@Operator +public final class CompositeTensorVariantFromComponents extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "CompositeTensorVariantFromComponents"; + + private Output encoded; + + @SuppressWarnings("unchecked") + public CompositeTensorVariantFromComponents(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + encoded = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new CompositeTensorVariantFromComponents operation. + * + * @param scope current scope + * @param components The component tensors for the extension type value. + * @param metadata String serialization for the TypeSpec. (Note: the encoding for the TypeSpec + * may change in future versions of TensorFlow.) + * @return a new instance of CompositeTensorVariantFromComponents + */ + @Endpoint( + describeByClass = true + ) + public static CompositeTensorVariantFromComponents create(Scope scope, + Iterable> components, String metadata) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "CompositeTensorVariantFromComponents"); + opBuilder.addInputList(Operands.asOutputs(components)); + opBuilder.setAttr("metadata", metadata); + return new CompositeTensorVariantFromComponents(opBuilder.build()); + } + + /** + * Gets encoded. + * A {@code variant} Tensor that containing the encoded value. + * @return encoded. + */ + public Output encoded() { + return encoded; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) encoded; + } + + @OpInputsMetadata( + outputsClass = CompositeTensorVariantFromComponents.class + ) + public static class Inputs extends RawOpInputs { + /** + * The component tensors for the extension type value. + */ + public final Iterable> components; + + /** + * String serialization for the TypeSpec. (Note: the encoding for the TypeSpec + * may change in future versions of TensorFlow.) + */ + public final String metadata; + + /** + * The Tcomponents attribute + */ + public final DataType[] Tcomponents; + + public Inputs(GraphOperation op) { + super(new CompositeTensorVariantFromComponents(op), op, Arrays.asList("metadata", "Tcomponents")); + int inputIndex = 0; + int componentsLength = op.inputListLength("components"); + components = Arrays.asList((Operand[]) op.inputList(inputIndex, componentsLength)); + inputIndex += componentsLength; + metadata = op.attributes().getAttrString("metadata"); + Tcomponents = op.attributes().getAttrTypeList("Tcomponents"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CompositeTensorVariantToComponents.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CompositeTensorVariantToComponents.java new file mode 100644 index 00000000000..e8288c59607 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CompositeTensorVariantToComponents.java @@ -0,0 +1,134 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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.GraphOperation; +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.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * Decodes a {@code variant} scalar Tensor into an {@code ExtensionType} value. + * Returns the Tensor components encoded in a {@code CompositeTensorVariant}. + *

Raises an error if {@code type_spec_proto} doesn't match the TypeSpec + * in {@code encoded}. + */ +@OpMetadata( + opType = CompositeTensorVariantToComponents.OP_NAME, + inputsClass = CompositeTensorVariantToComponents.Inputs.class +) +@Operator +public final class CompositeTensorVariantToComponents extends RawOp implements Iterable> { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "CompositeTensorVariantToComponents"; + + private List> components; + + @SuppressWarnings("unchecked") + public CompositeTensorVariantToComponents(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int componentsLength = operation.outputListLength("components"); + components = Arrays.asList(operation.outputList(outputIdx, componentsLength)); + outputIdx += componentsLength; + } + + /** + * Factory method to create a class wrapping a new CompositeTensorVariantToComponents operation. + * + * @param scope current scope + * @param encoded A scalar {@code variant} Tensor containing an encoded ExtensionType value. + * @param metadata String serialization for the TypeSpec. Must be compatible with the + * {@code TypeSpec} contained in {@code encoded}. (Note: the encoding for the TypeSpec + * may change in future versions of TensorFlow.) + * @param Tcomponents Expected dtypes for components. + * @return a new instance of CompositeTensorVariantToComponents + */ + @Endpoint( + describeByClass = true + ) + public static CompositeTensorVariantToComponents create(Scope scope, + Operand encoded, String metadata, List> Tcomponents) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "CompositeTensorVariantToComponents"); + opBuilder.addInput(encoded.asOutput()); + opBuilder.setAttr("metadata", metadata); + opBuilder.setAttr("Tcomponents", Operands.toDataTypes(Tcomponents)); + return new CompositeTensorVariantToComponents(opBuilder.build()); + } + + /** + * Gets components. + * The component tensors for the ExtensionType value in {@code encoded}. + * @return components. + */ + public List> components() { + return components; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) components.iterator(); + } + + @OpInputsMetadata( + outputsClass = CompositeTensorVariantToComponents.class + ) + public static class Inputs extends RawOpInputs { + /** + * A scalar {@code variant} Tensor containing an encoded ExtensionType value. + */ + public final Operand encoded; + + /** + * String serialization for the TypeSpec. Must be compatible with the + * {@code TypeSpec} contained in {@code encoded}. (Note: the encoding for the TypeSpec + * may change in future versions of TensorFlow.) + */ + public final String metadata; + + /** + * Expected dtypes for components. + */ + public final DataType[] Tcomponents; + + public Inputs(GraphOperation op) { + super(new CompositeTensorVariantToComponents(op), op, Arrays.asList("metadata", "Tcomponents")); + int inputIndex = 0; + encoded = (Operand) op.input(inputIndex++); + metadata = op.attributes().getAttrString("metadata"); + Tcomponents = op.attributes().getAttrTypeList("Tcomponents"); + } + } +} 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 index 5c022eb5d72..cf3b735f4be 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,62 +17,119 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; 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.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * Concatenates tensors along one dimension. - * - * @param data type for {@code output()} output */ +@OpMetadata( + opType = Concat.OP_NAME, + inputsClass = Concat.Inputs.class +) @Operator -public final class Concat extends PrimitiveOp implements Operand { - +public final class Concat extends RawOp implements Operand { /** - * Factory method to create a class wrapping a new Concat operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ConcatV2"; + + private Output output; + + public Concat(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new ConcatV2 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 values List of {@code N} Tensors to concatenate. Their ranks and types must match, + * and their sizes must match in all dimensions except {@code concat_dim}. * @param axis 0-D. The dimension along which to concatenate. Must be in the * range [-rank(values), rank(values)). + * @param data type for {@code ConcatV2} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static Concat create(Scope scope, Iterable> values, + Operand axis) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Concat"); opBuilder.addInputList(Operands.asOutputs(values)); opBuilder.addInput(axis.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new Concat(opBuilder.build()); + 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. + * Gets output. + * A {@code Tensor} with the concatenation of values stacked along the + * {@code concat_dim} dimension. This tensor's shape matches that of {@code values} except + * in {@code concat_dim} where it has the sum of the sizes. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = Concat.class + ) + public static class Inputs extends RawOpInputs> { + /** + * List of {@code N} Tensors to concatenate. Their ranks and types must match, + * and their sizes must match in all dimensions except {@code concat_dim}. + */ + public final Iterable> values; + + /** + * 0-D. The dimension along which to concatenate. Must be in the + * range [-rank(values), rank(values)). + */ + public final Operand axis; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tidx attribute + */ + public final DataType Tidx; + + public Inputs(GraphOperation op) { + super(new Concat<>(op), op, Arrays.asList("T", "Tidx")); + int inputIndex = 0; + int valuesLength = op.inputListLength("values"); + values = Arrays.asList((Operand[]) op.inputList(inputIndex, valuesLength)); + inputIndex += valuesLength; + axis = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tidx = op.attributes().getAttrType("Tidx"); + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ConcatOffset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ConcatOffset.java new file mode 100644 index 00000000000..9b9a8d813c3 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ConcatOffset.java @@ -0,0 +1,144 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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.GraphOperation; +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.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TNumber; + +/** + * Computes offsets of concat inputs within its output. + * For example: + *

+ *
+ *
+ *

x = [2, 2, 7] + * y = [2, 3, 7] + * z = [2, 9, 7] + * offsets = concat_offset(1, [x, y, z]) + * [[a.item() for a in list(off.numpy())] for off in offsets] + * [[0, 0, 0], [0, 2, 0], [0, 5, 0]] + *

+ *
+ *
+ *

This is typically used by gradient computations for a concat operation. + */ +@OpMetadata( + opType = ConcatOffset.OP_NAME, + inputsClass = ConcatOffset.Inputs.class +) +@Operator +public final class ConcatOffset extends RawOp implements Iterable> { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ConcatOffset"; + + private List> offset; + + @SuppressWarnings("unchecked") + public ConcatOffset(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int offsetLength = operation.outputListLength("offset"); + offset = Arrays.asList((Output[]) operation.outputList(outputIdx, offsetLength)); + outputIdx += offsetLength; + } + + /** + * Factory method to create a class wrapping a new ConcatOffset operation. + * + * @param scope current scope + * @param concatDim The dimension along which to concatenate. + * @param shape The {@code N} int32 or int64 vectors representing shape of tensors being concatenated. + * @param data type for {@code ConcatOffset} output and operands + * @return a new instance of ConcatOffset + */ + @Endpoint( + describeByClass = true + ) + public static ConcatOffset create(Scope scope, Operand concatDim, + Iterable> shape) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ConcatOffset"); + opBuilder.addInput(concatDim.asOutput()); + opBuilder.addInputList(Operands.asOutputs(shape)); + return new ConcatOffset<>(opBuilder.build()); + } + + /** + * Gets offset. + * The {@code N} vectors representing the starting offset + * of input tensors within the concatenated output with type matching {@code shape}. + * @return offset. + */ + public List> offset() { + return offset; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) offset.iterator(); + } + + @OpInputsMetadata( + outputsClass = ConcatOffset.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The dimension along which to concatenate. + */ + public final Operand concatDim; + + /** + * The {@code N} int32 or int64 vectors representing shape of tensors being concatenated. + */ + public final Iterable> shape; + + /** + * The shapeType attribute + */ + public final DataType shapeType; + + public Inputs(GraphOperation op) { + super(new ConcatOffset<>(op), op, Arrays.asList("shape_type")); + int inputIndex = 0; + concatDim = (Operand) op.input(inputIndex++); + int shapeLength = op.inputListLength("shape"); + shape = Arrays.asList((Operand[]) op.inputList(inputIndex, shapeLength)); + inputIndex += shapeLength; + shapeType = op.attributes().getAttrType("shape_type"); + } + } +} 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 deleted file mode 100644 index a582e58049d..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ConfigureDistributedTPU.java +++ /dev/null @@ -1,139 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TString; - -/** - * 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 deleted file mode 100644 index 29a175c5c3c..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ConfigureTPUEmbedding.java +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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 index aeeaba81c43..9a39cc9f8d1 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,43 +17,73 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.family.TType; /** - * This op consumes a lock created by `MutexLock`. - *

- * This op exists to consume a tensor created by `MutexLock` (other than + * This op consumes a lock created by {@code MutexLock}. + * This op exists to consume a tensor created by {@code 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. + *

NOTE: This operation must run on the same device as its input. This may + * be enforced via the {@code colocate_with} mechanism. */ +@OpMetadata( + opType = ConsumeMutexLock.OP_NAME, + inputsClass = ConsumeMutexLock.Inputs.class +) @Operator -public final class ConsumeMutexLock extends PrimitiveOp { - +public final class ConsumeMutexLock extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ConsumeMutexLock"; + + public ConsumeMutexLock(Operation operation) { + super(operation, OP_NAME); + } + /** * Factory method to create a class wrapping a new ConsumeMutexLock operation. - * + * * @param scope current scope - * @param mutexLock A tensor returned by `MutexLock`. + * @param mutexLock A tensor returned by {@code MutexLock}. * @return a new instance of ConsumeMutexLock */ - public static ConsumeMutexLock create(Scope scope, Operand mutexLock) { - OperationBuilder opBuilder = scope.env().opBuilder("ConsumeMutexLock", scope.makeOpName("ConsumeMutexLock")); + @Endpoint( + describeByClass = true + ) + public static ConsumeMutexLock create(Scope scope, Operand mutexLock) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ConsumeMutexLock"); opBuilder.addInput(mutexLock.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new ConsumeMutexLock(opBuilder.build()); } - - - private ConsumeMutexLock(Operation operation) { - super(operation); + + @OpInputsMetadata( + outputsClass = ConsumeMutexLock.class + ) + public static class Inputs extends RawOpInputs { + /** + * A tensor returned by {@code MutexLock}. + */ + public final Operand mutexLock; + + public Inputs(GraphOperation op) { + super(new ConsumeMutexLock(op), op, Arrays.asList()); + int inputIndex = 0; + mutexLock = (Operand) op.input(inputIndex++); + } } } 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 index 4c53112a808..721b26668fb 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,34 +17,58 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; /** * Does nothing. Serves as a control trigger for scheduling. - *

* Only useful as a placeholder for control edges. */ +@OpMetadata( + opType = ControlTrigger.OP_NAME, + inputsClass = ControlTrigger.Inputs.class +) @Operator -public final class ControlTrigger extends PrimitiveOp { - +public final class ControlTrigger extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ControlTrigger"; + + public ControlTrigger(Operation operation) { + super(operation, OP_NAME); + } + /** * Factory method to create a class wrapping a new ControlTrigger operation. - * + * * @param scope current scope * @return a new instance of ControlTrigger */ + @Endpoint( + describeByClass = true + ) public static ControlTrigger create(Scope scope) { - OperationBuilder opBuilder = scope.env().opBuilder("ControlTrigger", scope.makeOpName("ControlTrigger")); - opBuilder = scope.applyControlDependencies(opBuilder); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ControlTrigger"); return new ControlTrigger(opBuilder.build()); } - - - private ControlTrigger(Operation operation) { - super(operation); + + @OpInputsMetadata( + outputsClass = ControlTrigger.class + ) + public static class Inputs extends RawOpInputs { + public Inputs(GraphOperation op) { + super(new ControlTrigger(op), op, Arrays.asList()); + int inputIndex = 0; + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Copy.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Copy.java new file mode 100644 index 00000000000..a04de48877b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Copy.java @@ -0,0 +1,239 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * Copy a tensor from CPU-to-CPU or GPU-to-GPU. + * Performs CPU-to-CPU or GPU-to-GPU deep-copying of tensor, depending on the + * device on which the tensor is allocated. + * N.B.: If the all downstream attached debug ops are disabled given the current + * gRPC gating status, the output will simply forward the input tensor without + * deep-copying. See the documentation of Debug* ops for more details. + *

Unlike the CopyHost Op, this op does not have HostMemory constraint on its + * input or output. + */ +@OpMetadata( + opType = Copy.OP_NAME, + inputsClass = Copy.Inputs.class +) +public final class Copy extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Copy"; + + private Output output; + + public Copy(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new Copy operation. + * + * @param scope current scope + * @param input Input tensor. + * @param options carries optional attribute values + * @param data type for {@code Copy} output and operands + * @return a new instance of Copy + */ + @Endpoint( + describeByClass = true + ) + public static Copy create(Scope scope, Operand input, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Copy"); + opBuilder.addInput(input.asOutput()); + if (options != null) { + for (Options opts : options) { + if (opts.tensorName != null) { + opBuilder.setAttr("tensor_name", opts.tensorName); + } + if (opts.debugOpsSpec != null) { + String[] debugOpsSpecArray = new String[opts.debugOpsSpec.size()]; + for (int i = 0 ; i < debugOpsSpecArray.length ; i++) { + debugOpsSpecArray[i] = opts.debugOpsSpec.get(i); + } + opBuilder.setAttr("debug_ops_spec", debugOpsSpecArray); + } + } + } + return new Copy<>(opBuilder.build()); + } + + /** + * Sets the tensorName option. + * + * @param tensorName The name of the input tensor. + * @return this Options instance. + */ + public static Options tensorName(String tensorName) { + return new Options().tensorName(tensorName); + } + + /** + * Sets the debugOpsSpec option. + * + * @param debugOpsSpec A list of debug op spec (op, url, gated_grpc) for attached debug + * ops. Each element of the list has the format + * <debug_op>;<grpc_url>;<gated_grpc>, wherein gated_grpc is boolean represented + * as 0/1. E.g., "DebugIdentity;grpc://foo:3333;1", + * "DebugIdentity;file:///tmp/tfdbg_1;0". + * @return this Options instance. + */ + public static Options debugOpsSpec(List debugOpsSpec) { + return new Options().debugOpsSpec(debugOpsSpec); + } + + /** + * Sets the debugOpsSpec option. + * + * @param debugOpsSpec A list of debug op spec (op, url, gated_grpc) for attached debug + * ops. Each element of the list has the format + * <debug_op>;<grpc_url>;<gated_grpc>, wherein gated_grpc is boolean represented + * as 0/1. E.g., "DebugIdentity;grpc://foo:3333;1", + * "DebugIdentity;file:///tmp/tfdbg_1;0". + * @return this Options instance. + */ + public static Options debugOpsSpec(String... debugOpsSpec) { + return new Options().debugOpsSpec(debugOpsSpec); + } + + /** + * Gets output. + * + * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.Copy} + */ + public static class Options { + private String tensorName; + + private List debugOpsSpec; + + private Options() { + } + + /** + * Sets the tensorName option. + * + * @param tensorName The name of the input tensor. + * @return this Options instance. + */ + public Options tensorName(String tensorName) { + this.tensorName = tensorName; + return this; + } + + /** + * Sets the debugOpsSpec option. + * + * @param debugOpsSpec A list of debug op spec (op, url, gated_grpc) for attached debug + * ops. Each element of the list has the format + * <debug_op>;<grpc_url>;<gated_grpc>, wherein gated_grpc is boolean represented + * as 0/1. E.g., "DebugIdentity;grpc://foo:3333;1", + * "DebugIdentity;file:///tmp/tfdbg_1;0". + * @return this Options instance. + */ + public Options debugOpsSpec(List debugOpsSpec) { + this.debugOpsSpec = debugOpsSpec; + return this; + } + + /** + * Sets the debugOpsSpec option. + * + * @param debugOpsSpec A list of debug op spec (op, url, gated_grpc) for attached debug + * ops. Each element of the list has the format + * <debug_op>;<grpc_url>;<gated_grpc>, wherein gated_grpc is boolean represented + * as 0/1. E.g., "DebugIdentity;grpc://foo:3333;1", + * "DebugIdentity;file:///tmp/tfdbg_1;0". + * @return this Options instance. + */ + public Options debugOpsSpec(String... debugOpsSpec) { + this.debugOpsSpec = Arrays.asList(debugOpsSpec); + return this; + } + } + + @OpInputsMetadata( + outputsClass = Copy.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Input tensor. + */ + public final Operand input; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The name of the input tensor. + */ + public final String tensorName; + + /** + * A list of debug op spec (op, url, gated_grpc) for attached debug + * ops. Each element of the list has the format + * <debug_op>;<grpc_url>;<gated_grpc>, wherein gated_grpc is boolean represented + * as 0/1. E.g., "DebugIdentity;grpc://foo:3333;1", + * "DebugIdentity;file:///tmp/tfdbg_1;0". + */ + public final String[] debugOpsSpec; + + public Inputs(GraphOperation op) { + super(new Copy<>(op), op, Arrays.asList("T", "tensor_name", "debug_ops_spec")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + tensorName = op.attributes().getAttrString("tensor_name"); + debugOpsSpec = op.attributes().getAttrStringList("debug_ops_spec"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CopyHost.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CopyHost.java new file mode 100644 index 00000000000..055c9d878bf --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CopyHost.java @@ -0,0 +1,237 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * Copy a tensor to host. + * Performs CPU-to-CPU deep-copying of tensor. + * N.B.: If the all downstream attached debug ops are disabled given the current + * gRPC gating status, the output will simply forward the input tensor without + * deep-copying. See the documentation of Debug* ops for more details. + *

Unlike the Copy Op, this op has HostMemory constraint on its input or output. + */ +@OpMetadata( + opType = CopyHost.OP_NAME, + inputsClass = CopyHost.Inputs.class +) +public final class CopyHost extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "CopyHost"; + + private Output output; + + public CopyHost(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new CopyHost operation. + * + * @param scope current scope + * @param input Input tensor. + * @param options carries optional attribute values + * @param data type for {@code CopyHost} output and operands + * @return a new instance of CopyHost + */ + @Endpoint( + describeByClass = true + ) + public static CopyHost create(Scope scope, Operand input, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "CopyHost"); + opBuilder.addInput(input.asOutput()); + if (options != null) { + for (Options opts : options) { + if (opts.tensorName != null) { + opBuilder.setAttr("tensor_name", opts.tensorName); + } + if (opts.debugOpsSpec != null) { + String[] debugOpsSpecArray = new String[opts.debugOpsSpec.size()]; + for (int i = 0 ; i < debugOpsSpecArray.length ; i++) { + debugOpsSpecArray[i] = opts.debugOpsSpec.get(i); + } + opBuilder.setAttr("debug_ops_spec", debugOpsSpecArray); + } + } + } + return new CopyHost<>(opBuilder.build()); + } + + /** + * Sets the tensorName option. + * + * @param tensorName The name of the input tensor. + * @return this Options instance. + */ + public static Options tensorName(String tensorName) { + return new Options().tensorName(tensorName); + } + + /** + * Sets the debugOpsSpec option. + * + * @param debugOpsSpec A list of debug op spec (op, url, gated_grpc) for attached debug + * ops. Each element of the list has the format + * <debug_op>;<grpc_url>;<gated_grpc>, wherein gated_grpc is boolean represented + * as 0/1. E.g., "DebugIdentity;grpc://foo:3333;1", + * "DebugIdentity;file:///tmp/tfdbg_1;0". + * @return this Options instance. + */ + public static Options debugOpsSpec(List debugOpsSpec) { + return new Options().debugOpsSpec(debugOpsSpec); + } + + /** + * Sets the debugOpsSpec option. + * + * @param debugOpsSpec A list of debug op spec (op, url, gated_grpc) for attached debug + * ops. Each element of the list has the format + * <debug_op>;<grpc_url>;<gated_grpc>, wherein gated_grpc is boolean represented + * as 0/1. E.g., "DebugIdentity;grpc://foo:3333;1", + * "DebugIdentity;file:///tmp/tfdbg_1;0". + * @return this Options instance. + */ + public static Options debugOpsSpec(String... debugOpsSpec) { + return new Options().debugOpsSpec(debugOpsSpec); + } + + /** + * Gets output. + * + * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.CopyHost} + */ + public static class Options { + private String tensorName; + + private List debugOpsSpec; + + private Options() { + } + + /** + * Sets the tensorName option. + * + * @param tensorName The name of the input tensor. + * @return this Options instance. + */ + public Options tensorName(String tensorName) { + this.tensorName = tensorName; + return this; + } + + /** + * Sets the debugOpsSpec option. + * + * @param debugOpsSpec A list of debug op spec (op, url, gated_grpc) for attached debug + * ops. Each element of the list has the format + * <debug_op>;<grpc_url>;<gated_grpc>, wherein gated_grpc is boolean represented + * as 0/1. E.g., "DebugIdentity;grpc://foo:3333;1", + * "DebugIdentity;file:///tmp/tfdbg_1;0". + * @return this Options instance. + */ + public Options debugOpsSpec(List debugOpsSpec) { + this.debugOpsSpec = debugOpsSpec; + return this; + } + + /** + * Sets the debugOpsSpec option. + * + * @param debugOpsSpec A list of debug op spec (op, url, gated_grpc) for attached debug + * ops. Each element of the list has the format + * <debug_op>;<grpc_url>;<gated_grpc>, wherein gated_grpc is boolean represented + * as 0/1. E.g., "DebugIdentity;grpc://foo:3333;1", + * "DebugIdentity;file:///tmp/tfdbg_1;0". + * @return this Options instance. + */ + public Options debugOpsSpec(String... debugOpsSpec) { + this.debugOpsSpec = Arrays.asList(debugOpsSpec); + return this; + } + } + + @OpInputsMetadata( + outputsClass = CopyHost.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Input tensor. + */ + public final Operand input; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The name of the input tensor. + */ + public final String tensorName; + + /** + * A list of debug op spec (op, url, gated_grpc) for attached debug + * ops. Each element of the list has the format + * <debug_op>;<grpc_url>;<gated_grpc>, wherein gated_grpc is boolean represented + * as 0/1. E.g., "DebugIdentity;grpc://foo:3333;1", + * "DebugIdentity;file:///tmp/tfdbg_1;0". + */ + public final String[] debugOpsSpec; + + public Inputs(GraphOperation op) { + super(new CopyHost<>(op), op, Arrays.asList("T", "tensor_name", "debug_ops_spec")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + tensorName = op.attributes().getAttrString("tensor_name"); + debugOpsSpec = op.attributes().getAttrStringList("debug_ops_spec"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CopyToMesh.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CopyToMesh.java new file mode 100644 index 00000000000..166d4613d54 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CopyToMesh.java @@ -0,0 +1,118 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * The CopyToMesh operation + */ +@OpMetadata( + opType = CopyToMesh.OP_NAME, + inputsClass = CopyToMesh.Inputs.class +) +@Operator +public final class CopyToMesh extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "CopyToMesh"; + + private Output output; + + public CopyToMesh(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new CopyToMesh operation. + * + * @param scope current scope + * @param input The input value + * @param mesh The value of the mesh attribute + * @param data type for {@code CopyToMesh} output and operands + * @return a new instance of CopyToMesh + */ + @Endpoint( + describeByClass = true + ) + public static CopyToMesh create(Scope scope, Operand input, String mesh) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "CopyToMesh"); + opBuilder.addInput(input.asOutput()); + opBuilder.setAttr("mesh", mesh); + return new CopyToMesh<>(opBuilder.build()); + } + + /** + * Gets output. + * + * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + @OpInputsMetadata( + outputsClass = CopyToMesh.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * The mesh attribute + */ + public final String mesh; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new CopyToMesh<>(op), op, Arrays.asList("mesh", "T")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + mesh = op.attributes().getAttrString("mesh"); + T = op.attributes().getAttrType("T"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CopyToMeshGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CopyToMeshGrad.java new file mode 100644 index 00000000000..095d5b5d7ce --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CopyToMeshGrad.java @@ -0,0 +1,119 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * The CopyToMeshGrad operation + */ +@OpMetadata( + opType = CopyToMeshGrad.OP_NAME, + inputsClass = CopyToMeshGrad.Inputs.class +) +@Operator +public final class CopyToMeshGrad extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "CopyToMeshGrad"; + + private Output output; + + public CopyToMeshGrad(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new CopyToMeshGrad operation. + * + * @param scope current scope + * @param input The input value + * @param forwardInput The forwardInput value + * @param data type for {@code CopyToMeshGrad} output and operands + * @return a new instance of CopyToMeshGrad + */ + @Endpoint( + describeByClass = true + ) + public static CopyToMeshGrad create(Scope scope, Operand input, + Operand forwardInput) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "CopyToMeshGrad"); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(forwardInput.asOutput()); + return new CopyToMeshGrad<>(opBuilder.build()); + } + + /** + * Gets output. + * + * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + @OpInputsMetadata( + outputsClass = CopyToMeshGrad.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * The forwardInput input + */ + public final Operand forwardInput; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new CopyToMeshGrad<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + forwardInput = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } + } +} 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 index 4a5a93a96f2..0f404fa1419 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,59 +17,105 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** * Increments 'ref' until it reaches 'limit'. - * - * @param data type for {@code output()} output */ +@OpMetadata( + opType = CountUpTo.OP_NAME, + inputsClass = CountUpTo.Inputs.class +) @Operator -public final class CountUpTo extends PrimitiveOp implements Operand { - +public final class CountUpTo extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "CountUpTo"; + + private Output output; + + public CountUpTo(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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 ref Should be from a scalar {@code Variable} node. * @param limit If incrementing ref would bring it above limit, instead generates an * 'OutOfRange' error. + * @param data type for {@code CountUpTo} output and operands * @return a new instance of CountUpTo */ + @Endpoint( + describeByClass = true + ) public static CountUpTo create(Scope scope, Operand ref, Long limit) { - OperationBuilder opBuilder = scope.env().opBuilder("CountUpTo", scope.makeOpName("CountUpTo")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "CountUpTo"); opBuilder.addInput(ref.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); opBuilder.setAttr("limit", limit); - return new CountUpTo(opBuilder.build()); + return new CountUpTo<>(opBuilder.build()); } - + /** + * Gets output. * A copy of the input before increment. If nothing else modifies the * input, the values produced will all be distinct. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = CountUpTo.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Should be from a scalar {@code Variable} node. + */ + public final Operand ref; + + /** + * If incrementing ref would bring it above limit, instead generates an + * 'OutOfRange' error. + */ + public final long limit; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new CountUpTo<>(op), op, Arrays.asList("limit", "T")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + limit = op.attributes().getAttrInt("limit"); + T = op.attributes().getAttrType("T"); + } } } 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 deleted file mode 100644 index e993992ea95..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CrossReplicaSum.java +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt32; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index a6b749c5f85..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CudnnRNNBackpropV3.java +++ /dev/null @@ -1,327 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt32; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index e7186f5260c..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CudnnRNNCanonicalToParamsV2.java +++ /dev/null @@ -1,259 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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; -import org.tensorflow.types.TInt32; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index 378c2c47ed9..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CudnnRNNParamsToCanonicalV2.java +++ /dev/null @@ -1,270 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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; -import org.tensorflow.types.TInt32; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index 6074100ede5..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CudnnRNNV3.java +++ /dev/null @@ -1,328 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt32; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index 10572542b74..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/CumulativeLogsumexp.java +++ /dev/null @@ -1,142 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index 1a6094d5a92..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DatasetCardinality.java +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt64; - -/** - * 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 deleted file mode 100644 index d534c8431a7..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DatasetFromGraph.java +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TString; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index 3d438dba3cc..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DebugGradientIdentity.java +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TType; - -/** - * 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 deleted file mode 100644 index 69dd0110df1..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DebugGradientRefIdentity.java +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TType; - -/** - * 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 deleted file mode 100644 index a1f5430c61c..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DecodePaddedRaw.java +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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; -import org.tensorflow.types.TInt32; -import org.tensorflow.types.TString; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType 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", 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 index 705511a0386..be36191dd31 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,134 +19,142 @@ import java.util.Arrays; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.TString; +import org.tensorflow.types.family.TType; /** * 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. + * Note: This API is designed for orthogonality rather than human-friendliness. It + * can be used to parse input protos by hand, but it is intended for use in + * generated code. + *

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

A {@code 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 + * {@code 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 + * repeat counts for each example in the minibatch can be found in the {@code sizes} + * output. In many cases the output of {@code 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 + *

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 + *

    + *
  • + *

    A proto field that contains a submessage or group can only be converted + * to {@code 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 + *

  • + *
  • + *

    TensorFlow lacks support for unsigned integers. The ops represent uint64 + * types as a {@code 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 + * {@code DT_INT64}, or using twos-complement if the caller specifies {@code DT_INT32} in + * the {@code output_types} attribute. + *

  • + *
  • + *

    {@code map} fields are not directly decoded. They are treated as {@code repeated} fields, + * of the appropriate entry type. The proto-compiler defines entry types for each + * map field. The type-name is the field name, converted to "CamelCase" with + * "Entry" appended. The {@code tf.train.Features.FeatureEntry} message is an example of + * one of these implicit {@code Entry} types. + *

  • + *
  • + *

    {@code enum} fields should be read as int32. + *

  • + *
+ *

Both binary and text proto serializations are supported, and can be + * chosen using the {@code format} attribute. + *

The {@code descriptor_source} attribute selects the source of protocol + * descriptors to consult when looking up {@code 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. + *

  • + *
  • + *

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

  • + *
  • + *

    A "bytes://<bytes>", in which protocol descriptors are created from {@code }, + * which is expected to be a {@code FileDescriptorSet} serialized as a string. + *

  • + *
*/ -public final class DecodeProto extends PrimitiveOp { - +@OpMetadata( + opType = DecodeProto.OP_NAME, + inputsClass = DecodeProto.Inputs.class +) +@Operator +public final class DecodeProto extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.DecodeProto} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "DecodeProtoV2"; + + private Output sizes; + + private List> values; + + @SuppressWarnings("unchecked") + public DecodeProto(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + sizes = operation.output(outputIdx++); + int valuesLength = operation.outputListLength("values"); + values = Arrays.asList(operation.outputList(outputIdx, valuesLength)); + outputIdx += valuesLength; } - + /** - * Factory method to create a class wrapping a new DecodeProto operation. - * + * Factory method to create a class wrapping a new DecodeProtoV2 operation. + * * @param scope current scope - * @param bytes Tensor of serialized protos with shape `batch_shape`. + * @param bytes Tensor of serialized protos with shape {@code 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 + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static DecodeProto create(Scope scope, Operand bytes, String messageType, + List fieldNames, List> outputTypes, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { + 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] = outputTypes.get(i); - } - opBuilder.setAttr("output_types", outputTypesArray); + opBuilder.setAttr("output_types", Operands.toDataTypes(outputTypes)); if (options != null) { for (Options opts : options) { if (opts.descriptorSource != null) { @@ -162,56 +170,159 @@ public static DecodeProto create(Scope scope, Operand bytes, String mes } return new DecodeProto(opBuilder.build()); } - + /** - * @param descriptorSource Either the special value `local://` or a path to a file containing - * a serialized `FileDescriptorSet`. + * Sets the descriptorSource option. + * + * @param descriptorSource Either the special value {@code local://} or a path to a file containing + * a serialized {@code FileDescriptorSet}. + * @return this Options instance. */ public static Options descriptorSource(String descriptorSource) { return new Options().descriptorSource(descriptorSource); } - + /** - * @param messageFormat Either `binary` or `text`. + * Sets the messageFormat option. + * + * @param messageFormat Either {@code binary} or {@code text}. + * @return this Options instance. */ public static Options messageFormat(String messageFormat) { return new Options().messageFormat(messageFormat); } - + /** + * Sets the sanitize option. + * * @param sanitize Whether to sanitize the result or not. + * @return this Options instance. */ public static Options sanitize(Boolean sanitize) { return new Options().sanitize(sanitize); } - + /** - * Tensor of int32 with shape `[batch_shape, len(field_names)]`. + * Gets sizes. + * Tensor of int32 with shape {@code [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. + * @return sizes. */ public Output sizes() { return sizes; } - + /** + * Gets values. * List of tensors containing values for the corresponding field. - * `values[i]` has datatype `output_types[i]` - * and shape `[batch_shape, max(sizes[...,i])]`. + * {@code values[i]} has datatype {@code output_types[i]} + * and shape {@code [batch_shape, max(sizes[...,i])]}. + * @return values. */ 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; + + /** + * Optional attributes for {@link org.tensorflow.op.core.DecodeProto} + */ + public static class Options { + private String descriptorSource; + + private String messageFormat; + + private Boolean sanitize; + + private Options() { + } + + /** + * Sets the descriptorSource option. + * + * @param descriptorSource Either the special value {@code local://} or a path to a file containing + * a serialized {@code FileDescriptorSet}. + * @return this Options instance. + */ + public Options descriptorSource(String descriptorSource) { + this.descriptorSource = descriptorSource; + return this; + } + + /** + * Sets the messageFormat option. + * + * @param messageFormat Either {@code binary} or {@code text}. + * @return this Options instance. + */ + public Options messageFormat(String messageFormat) { + this.messageFormat = messageFormat; + return this; + } + + /** + * Sets the sanitize option. + * + * @param sanitize Whether to sanitize the result or not. + * @return this Options instance. + */ + public Options sanitize(Boolean sanitize) { + this.sanitize = sanitize; + return this; + } + } + + @OpInputsMetadata( + outputsClass = DecodeProto.class + ) + public static class Inputs extends RawOpInputs { + /** + * Tensor of serialized protos with shape {@code batch_shape}. + */ + public final Operand bytes; + + /** + * Name of the proto message type to decode. + */ + public final String messageType; + + /** + * 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. + */ + public final String[] fieldNames; + + /** + * List of TF types to use for the respective field in field_names. + */ + public final DataType[] outputTypes; + + /** + * Either the special value {@code local://} or a path to a file containing + * a serialized {@code FileDescriptorSet}. + */ + public final String descriptorSource; + + /** + * Either {@code binary} or {@code text}. + */ + public final String messageFormat; + + /** + * Whether to sanitize the result or not. + */ + public final boolean sanitize; + + public Inputs(GraphOperation op) { + super(new DecodeProto(op), op, Arrays.asList("message_type", "field_names", "output_types", "descriptor_source", "message_format", "sanitize")); + int inputIndex = 0; + bytes = (Operand) op.input(inputIndex++); + messageType = op.attributes().getAttrString("message_type"); + fieldNames = op.attributes().getAttrStringList("field_names"); + outputTypes = op.attributes().getAttrTypeList("output_types"); + descriptorSource = op.attributes().getAttrString("descriptor_source"); + messageFormat = op.attributes().getAttrString("message_format"); + sanitize = op.attributes().getAttrBool("sanitize"); + } } } 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 index 5e2c8120d03..f0b9b3927a8 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,55 +17,97 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** - * Makes a copy of `x`. - * - * @param data type for {@code y()} output + * Makes a copy of {@code x}. */ +@OpMetadata( + opType = DeepCopy.OP_NAME, + inputsClass = DeepCopy.Inputs.class +) @Operator -public final class DeepCopy extends PrimitiveOp implements Operand { - +public final class DeepCopy extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "DeepCopy"; + + private Output y; + + public DeepCopy(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + y = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new DeepCopy operation. - * + * * @param scope current scope - * @param x The source tensor of type `T`. + * @param x The source tensor of type {@code T}. + * @param data type for {@code DeepCopy} output and operands * @return a new instance of DeepCopy */ + @Endpoint( + describeByClass = true + ) public static DeepCopy create(Scope scope, Operand x) { - OperationBuilder opBuilder = scope.env().opBuilder("DeepCopy", scope.makeOpName("DeepCopy")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "DeepCopy"); opBuilder.addInput(x.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new DeepCopy(opBuilder.build()); + return new DeepCopy<>(opBuilder.build()); } - + /** - * y: A `Tensor` of type `T`. A copy of `x`. Guaranteed that `y` - * is not an alias of `x`. + * Gets y. + *
+   * y: A `Tensor` of type `T`. A copy of `x`. Guaranteed that `y`
+   *   is not an alias of `x`.
+   * 
+ * @return y. */ 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++); + + @OpInputsMetadata( + outputsClass = DeepCopy.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The source tensor of type {@code T}. + */ + public final Operand x; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new DeepCopy<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + x = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 deleted file mode 100644 index c5110f028e3..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeleteIterator.java +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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 deleted file mode 100644 index 93fb7a03beb..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeleteMemoryCache.java +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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 deleted file mode 100644 index 5de56ff7286..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeleteMultiDeviceIterator.java +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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 deleted file mode 100644 index 8803d608ad3..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeleteRandomSeedGenerator.java +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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 index 4da393ce1af..4557500c448 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,36 +17,67 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; import org.tensorflow.types.TString; /** * Delete the tensor specified by its handle in the session. */ +@OpMetadata( + opType = DeleteSessionTensor.OP_NAME, + inputsClass = DeleteSessionTensor.Inputs.class +) @Operator -public final class DeleteSessionTensor extends PrimitiveOp { - +public final class DeleteSessionTensor extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "DeleteSessionTensor"; + + public DeleteSessionTensor(Operation operation) { + super(operation, OP_NAME); + } + /** * 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 */ + @Endpoint( + describeByClass = true + ) public static DeleteSessionTensor create(Scope scope, Operand handle) { - OperationBuilder opBuilder = scope.env().opBuilder("DeleteSessionTensor", scope.makeOpName("DeleteSessionTensor")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "DeleteSessionTensor"); opBuilder.addInput(handle.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new DeleteSessionTensor(opBuilder.build()); } - - - private DeleteSessionTensor(Operation operation) { - super(operation); + + @OpInputsMetadata( + outputsClass = DeleteSessionTensor.class + ) + public static class Inputs extends RawOpInputs { + /** + * The handle for a tensor stored in the session state. + */ + public final Operand handle; + + public Inputs(GraphOperation op) { + super(new DeleteSessionTensor(op), op, Arrays.asList()); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + } } } 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 index d4a93656172..01a9dc71df0 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,54 +17,55 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.family.TType; /** * Deletes the resource specified by the handle. - *

* All subsequent operations using the resource will result in a NotFound * error status. */ +@OpMetadata( + opType = DestroyResourceOp.OP_NAME, + inputsClass = DestroyResourceOp.Inputs.class +) @Operator -public final class DestroyResourceOp extends PrimitiveOp { - +public final class DestroyResourceOp extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.DestroyResourceOp} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "DestroyResourceOp"; + + public DestroyResourceOp(Operation operation) { + super(operation, OP_NAME); } - + /** * 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 + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static DestroyResourceOp create(Scope scope, Operand resource, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "DestroyResourceOp"); opBuilder.addInput(resource.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.ignoreLookupError != null) { @@ -74,17 +75,60 @@ public static DestroyResourceOp create(Scope scope, Operand resource, Options } return new DestroyResourceOp(opBuilder.build()); } - + /** + * Sets the ignoreLookupError option. + * * @param ignoreLookupError whether to ignore the error when the resource * doesn't exist. + * @return this Options instance. */ public static Options ignoreLookupError(Boolean ignoreLookupError) { return new Options().ignoreLookupError(ignoreLookupError); } - - - private DestroyResourceOp(Operation operation) { - super(operation); + + /** + * Optional attributes for {@link org.tensorflow.op.core.DestroyResourceOp} + */ + public static class Options { + private Boolean ignoreLookupError; + + private Options() { + } + + /** + * Sets the ignoreLookupError option. + * + * @param ignoreLookupError whether to ignore the error when the resource + * doesn't exist. + * @return this Options instance. + */ + public Options ignoreLookupError(Boolean ignoreLookupError) { + this.ignoreLookupError = ignoreLookupError; + return this; + } + } + + @OpInputsMetadata( + outputsClass = DestroyResourceOp.class + ) + public static class Inputs extends RawOpInputs { + /** + * handle to the resource to delete. + */ + public final Operand resource; + + /** + * whether to ignore the error when the resource + * doesn't exist. + */ + public final boolean ignoreLookupError; + + public Inputs(GraphOperation op) { + super(new DestroyResourceOp(op), op, Arrays.asList("ignore_lookup_error")); + int inputIndex = 0; + resource = (Operand) op.input(inputIndex++); + ignoreLookupError = op.attributes().getAttrBool("ignore_lookup_error"); + } } } 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 index b077366e669..876a1e46ee5 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,64 +17,111 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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. + * 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 + *

Outputs the final value of the tensor pointed to by 'ref'. */ +@OpMetadata( + opType = DestroyTemporaryVariable.OP_NAME, + inputsClass = DestroyTemporaryVariable.Inputs.class +) @Operator -public final class DestroyTemporaryVariable extends PrimitiveOp implements Operand { - +public final class DestroyTemporaryVariable extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "DestroyTemporaryVariable"; + + private Output value; + + public DestroyTemporaryVariable(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + value = operation.output(outputIdx++); + } + /** * 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. + * @param data type for {@code DestroyTemporaryVariable} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static DestroyTemporaryVariable create(Scope scope, Operand ref, + String varName) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "DestroyTemporaryVariable"); opBuilder.addInput(ref.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); opBuilder.setAttr("var_name", varName); - return new DestroyTemporaryVariable(opBuilder.build()); + return new DestroyTemporaryVariable<>(opBuilder.build()); } - + /** + * Gets value. + * + * @return value. */ 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++); + + @OpInputsMetadata( + outputsClass = DestroyTemporaryVariable.class + ) + public static class Inputs extends RawOpInputs> { + /** + * A reference to the temporary variable tensor. + */ + public final Operand ref; + + /** + * The T attribute + */ + public final DataType T; + + /** + * Name of the temporary variable, usually the name of the matching + * 'TemporaryVariable' op. + */ + public final String varName; + + public Inputs(GraphOperation op) { + super(new DestroyTemporaryVariable<>(op), op, Arrays.asList("T", "var_name")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + varName = op.attributes().getAttrString("var_name"); + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeviceIndex.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeviceIndex.java new file mode 100644 index 00000000000..fb05a1a7a09 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DeviceIndex.java @@ -0,0 +1,111 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.TInt32; + +/** + * Return the index of device the op runs. + * Given a list of device names, this operation returns the index of the device + * this op runs. The length of the list is returned in two cases: + * (1) Device does not exist in the given device list. + * (2) It is in XLA compilation. + */ +@OpMetadata( + opType = DeviceIndex.OP_NAME, + inputsClass = DeviceIndex.Inputs.class +) +@Operator +public final class DeviceIndex extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "DeviceIndex"; + + private Output index; + + public DeviceIndex(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + index = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new DeviceIndex operation. + * + * @param scope current scope + * @param deviceNames The value of the deviceNames attribute + * @return a new instance of DeviceIndex + */ + @Endpoint( + describeByClass = true + ) + public static DeviceIndex create(Scope scope, List deviceNames) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "DeviceIndex"); + String[] deviceNamesArray = new String[deviceNames.size()]; + for (int i = 0 ; i < deviceNamesArray.length ; i++) { + deviceNamesArray[i] = deviceNames.get(i); + } + opBuilder.setAttr("device_names", deviceNamesArray); + return new DeviceIndex(opBuilder.build()); + } + + /** + * Gets index. + * + * @return index. + */ + public Output index() { + return index; + } + + @Override + public Output asOutput() { + return index; + } + + @OpInputsMetadata( + outputsClass = DeviceIndex.class + ) + public static class Inputs extends RawOpInputs { + /** + * The deviceNames attribute + */ + public final String[] deviceNames; + + public Inputs(GraphOperation op) { + super(new DeviceIndex(op), op, Arrays.asList("device_names")); + int inputIndex = 0; + deviceNames = op.attributes().getAttrStringList("device_names"); + } + } +} 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 deleted file mode 100644 index e8e685f6919..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DirectedInterleaveDataset.java +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.Operands; -import org.tensorflow.op.PrimitiveOp; -import org.tensorflow.op.Scope; -import org.tensorflow.tools.Shape; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 deleted file mode 100644 index 815c84bfb7f..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DrawBoundingBoxesV2.java +++ /dev/null @@ -1,90 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.TFloat; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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/DummyMemoryCache.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DummyMemoryCache.java new file mode 100644 index 00000000000..d4dcdcb0735 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DummyMemoryCache.java @@ -0,0 +1,96 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.family.TType; + +/** + * The DummyMemoryCache operation + */ +@OpMetadata( + opType = DummyMemoryCache.OP_NAME, + inputsClass = DummyMemoryCache.Inputs.class +) +@Operator +public final class DummyMemoryCache extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "DummyMemoryCache"; + + private Output handle; + + @SuppressWarnings("unchecked") + public DummyMemoryCache(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new DummyMemoryCache operation. + * + * @param scope current scope + * @return a new instance of DummyMemoryCache + */ + @Endpoint( + describeByClass = true + ) + public static DummyMemoryCache create(Scope scope) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "DummyMemoryCache"); + return new DummyMemoryCache(opBuilder.build()); + } + + /** + * Gets handle. + * + * @return handle. + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + @OpInputsMetadata( + outputsClass = DummyMemoryCache.class + ) + public static class Inputs extends RawOpInputs { + public Inputs(GraphOperation op) { + super(new DummyMemoryCache(op), op, Arrays.asList()); + int inputIndex = 0; + } + } +} 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 index c7149fb36cd..d7d7bf7c328 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,96 +20,149 @@ import java.util.Arrays; import java.util.Iterator; import java.util.List; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** - * 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`. + * Partitions {@code data} into {@code num_partitions} tensors using indices from {@code partitions}. + * For each index tuple {@code js} of size {@code partitions.ndim}, the slice {@code data[js, ...]} + * becomes part of {@code outputs[partitions[js]]}. The slices with {@code partitions[js] = i} + * are placed in {@code outputs[i]} in lexicographic order of {@code js}, and the first + * dimension of {@code outputs[i]} is the number of entries in {@code partitions} equal to {@code 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
+ * 
+ *

{@code data.shape} must start with {@code partitions.shape}. + *

For example: + *

  *     # 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. - *

+ *

+ *

See {@code dynamic_stitch} for an example on how to merge partitions back. *

* *
- * - * @param data type for {@code outputs()} output + *

Raises: + *

    + *
  • {@code InvalidArgumentError} in following cases: + *
      + *
    • If partitions is not in range {@code [0, num_partiions)}
    • + *
    • If {@code partitions.shape} does not match prefix of {@code data.shape} argument.
    • + *
    + *
  • + *
*/ +@OpMetadata( + opType = DynamicPartition.OP_NAME, + inputsClass = DynamicPartition.Inputs.class +) @Operator -public final class DynamicPartition extends PrimitiveOp implements Iterable> { - +public final class DynamicPartition extends RawOp implements Iterable> { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "DynamicPartition"; + + private List> outputs; + + @SuppressWarnings("unchecked") + public DynamicPartition(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int outputsLength = operation.outputListLength("outputs"); + outputs = Arrays.asList((Output[]) operation.outputList(outputIdx, outputsLength)); + outputIdx += outputsLength; + } + /** * 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 data The data value + * @param partitions Any shape. Indices in the range {@code [0, num_partitions)}. * @param numPartitions The number of partitions to output. + * @param data type for {@code DynamicPartition} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static DynamicPartition create(Scope scope, Operand data, + Operand partitions, Long numPartitions) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "DynamicPartition"); opBuilder.addInput(data.asOutput()); opBuilder.addInput(partitions.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); opBuilder.setAttr("num_partitions", numPartitions); - return new DynamicPartition(opBuilder.build()); + return new DynamicPartition<>(opBuilder.build()); } - + /** + * Gets outputs. + * + * @return outputs. */ 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; + + @OpInputsMetadata( + outputsClass = DynamicPartition.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The data input + */ + public final Operand data; + + /** + * Any shape. Indices in the range {@code [0, num_partitions)}. + */ + public final Operand partitions; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new DynamicPartition<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + data = (Operand) op.input(inputIndex++); + partitions = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index 9b18cc05f52..d160ab8255c 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,46 +17,51 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; 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.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** - * Interleave the values from the `data` tensors into a single tensor. - *

+ * Interleave the values from the {@code 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
+ * 
+ *

For example, if each {@code indices[m]} is scalar or vector, we have + *

  *     # 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 + *

+ *

Each {@code data[i].shape} must start with the corresponding {@code indices[i].shape}, + * and the rest of {@code data[i].shape} must be constant w.r.t. {@code i}. That is, we + * must have {@code data[i].shape = indices[i].shape + constant}. In terms of this + * {@code constant}, the output shape is + *

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

Values are merged in order, so if an index appears in both {@code indices[m][i]} and + * {@code indices[n][j]} for {@code (m,i) < (n,j)} the slice {@code 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
+ * 

For example: + *

  *     indices[0] = 6
  *     indices[1] = [4, 1]
  *     indices[2] = [[5, 2], [0, 3]]
@@ -65,10 +70,10 @@
  *     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` + *
+ *

This method can be used to merge partitions created by {@code 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])
@@ -81,48 +86,93 @@
  *     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 */ +@OpMetadata( + opType = DynamicStitch.OP_NAME, + inputsClass = DynamicStitch.Inputs.class +) @Operator -public final class DynamicStitch extends PrimitiveOp implements Operand { - +public final class DynamicStitch extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "DynamicStitch"; + + private Output merged; + + public DynamicStitch(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + merged = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new DynamicStitch operation. - * + * * @param scope current scope - * @param indices - * @param data + * @param indices The indices value + * @param data The data value + * @param data type for {@code DynamicStitch} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static DynamicStitch create(Scope scope, + Iterable> indices, Iterable> data) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "DynamicStitch"); opBuilder.addInputList(Operands.asOutputs(indices)); opBuilder.addInputList(Operands.asOutputs(data)); - opBuilder = scope.applyControlDependencies(opBuilder); - return new DynamicStitch(opBuilder.build()); + return new DynamicStitch<>(opBuilder.build()); } - + /** + * Gets merged. + * + * @return merged. */ 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++); + + @OpInputsMetadata( + outputsClass = DynamicStitch.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The indices input + */ + public final Iterable> indices; + + /** + * The data input + */ + public final Iterable> data; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new DynamicStitch<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + int indicesLength = op.inputListLength("indices"); + indices = Arrays.asList((Operand[]) op.inputList(inputIndex, indicesLength)); + inputIndex += indicesLength; + int dataLength = op.inputListLength("data"); + data = Arrays.asList((Operand[]) op.inputList(inputIndex, dataLength)); + inputIndex += dataLength; + T = op.attributes().getAttrType("T"); + } } } 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 index 5d6517c22ff..228743f17cd 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,54 +17,54 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.types.TFloat; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TFloat32; import org.tensorflow.types.TInt64; import org.tensorflow.types.family.TType; /** * Computes the (possibly normalized) Levenshtein Edit Distance. - *

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

- * The inputs are: + * (truth_indices, truth_values, truth_shape). + *

The inputs are: */ +@OpMetadata( + opType = EditDistance.OP_NAME, + inputsClass = EditDistance.Inputs.class +) @Operator -public final class EditDistance extends PrimitiveOp implements Operand { - +public final class EditDistance extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.EditDistance} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "EditDistance"; + + private Output output; + + public EditDistance(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * 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. @@ -77,18 +77,24 @@ private Options() { * @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 + * @param options carries optional attribute values + * @param data type for {@code EditDistance} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static EditDistance create(Scope scope, + Operand hypothesisIndices, Operand hypothesisValues, + Operand hypothesisShape, Operand truthIndices, Operand truthValues, + Operand truthShape, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { @@ -98,62 +104,144 @@ public static EditDistance create(Scope scope, Operand } return new EditDistance(opBuilder.build()); } - + /** + * Sets the normalize option. + * * @param normalize boolean (if true, edit distances are normalized by length of truth). - *

- * The output is: + *

The output is: + * @return this Options instance. */ public static Options normalize(Boolean normalize) { return new Options().normalize(normalize); } - + /** + * Gets output. * 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 + *

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
+   * 
+ * @return output. */ - public Output output() { + public Output output() { return output; } - + @Override - public Output asOutput() { + public Output asOutput() { return output; } - - private Output output; - - private EditDistance(Operation operation) { - super(operation); - int outputIdx = 0; - output = operation.output(outputIdx++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.EditDistance} + */ + public static class Options { + private Boolean normalize; + + private Options() { + } + + /** + * Sets the normalize option. + * + * @param normalize boolean (if true, edit distances are normalized by length of truth). + *

The output is: + * @return this Options instance. + */ + public Options normalize(Boolean normalize) { + this.normalize = normalize; + return this; + } + } + + @OpInputsMetadata( + outputsClass = EditDistance.class + ) + public static class Inputs extends RawOpInputs { + /** + * The indices of the hypothesis list SparseTensor. + * This is an N x R int64 matrix. + */ + public final Operand hypothesisIndices; + + /** + * The values of the hypothesis list SparseTensor. + * This is an N-length vector. + */ + public final Operand hypothesisValues; + + /** + * The shape of the hypothesis list SparseTensor. + * This is an R-length vector. + */ + public final Operand hypothesisShape; + + /** + * The indices of the truth list SparseTensor. + * This is an M x R int64 matrix. + */ + public final Operand truthIndices; + + /** + * The values of the truth list SparseTensor. + * This is an M-length vector. + */ + public final Operand truthValues; + + /** + * truth indices, vector. + */ + public final Operand truthShape; + + /** + * boolean (if true, edit distances are normalized by length of truth). + *

The output is: + */ + public final boolean normalize; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new EditDistance(op), op, Arrays.asList("normalize", "T")); + int inputIndex = 0; + hypothesisIndices = (Operand) op.input(inputIndex++); + hypothesisValues = (Operand) op.input(inputIndex++); + hypothesisShape = (Operand) op.input(inputIndex++); + truthIndices = (Operand) op.input(inputIndex++); + truthValues = (Operand) op.input(inputIndex++); + truthShape = (Operand) op.input(inputIndex++); + normalize = op.attributes().getAttrBool("normalize"); + T = op.attributes().getAttrType("T"); + } } } 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 deleted file mode 100644 index 90c3bbaa331..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Einsum.java +++ /dev/null @@ -1,150 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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; -import org.tensorflow.types.family.TType; - -/** - * 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 index e1fe1f3c360..6f7d74d94e5 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,60 +17,65 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** * Creates a tensor with the given shape. - *

- * This operation creates a tensor of `shape` and `dtype`. - * - * @param data type for {@code output()} output + *

This operation creates a tensor of {@code shape} and {@code dtype}. */ +@OpMetadata( + opType = Empty.OP_NAME, + inputsClass = Empty.Inputs.class +) @Operator -public final class Empty extends PrimitiveOp implements Operand { - +public final class Empty extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.Empty} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Empty"; + + private Output output; + + public Empty(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * 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 + * @param dtype The value of the dtype attribute + * @param options carries optional attribute values + * @param data type for {@code Empty} output and operands * @return a new instance of Empty */ - public static Empty create(Scope scope, Operand shape, DataType dtype, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("Empty", scope.makeOpName("Empty")); + @Endpoint( + describeByClass = true + ) + public static Empty create(Scope scope, Operand shape, + Class dtype, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Empty"); opBuilder.addInput(shape.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("dtype", dtype); + opBuilder.setAttr("dtype", Operands.toDataType(dtype)); if (options != null) { for (Options opts : options) { if (opts.init != null) { @@ -78,33 +83,79 @@ public static Empty create(Scope scope, Operand sha } } } - return new Empty(opBuilder.build()); + return new Empty<>(opBuilder.build()); } - + /** + * Sets the init option. + * * @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. + * @return this Options instance. */ public static Options init(Boolean init) { return new Options().init(init); } - + /** - * A `Tensor` of type `T`. + * Gets output. + * A {@code Tensor} of type {@code T}. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.Empty} + */ + public static class Options { + private Boolean init; + + private Options() { + } + + /** + * Sets the init option. + * + * @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. + * @return this Options instance. + */ + public Options init(Boolean init) { + this.init = init; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Empty.class + ) + public static class Inputs extends RawOpInputs> { + /** + * 1-D. Represents the shape of the output tensor. + */ + public final Operand shape; + + /** + * The dtype attribute + */ + public final DataType dtype; + + /** + * If True, initialize the returned tensor with the default value of dtype. Otherwise, the implementation is free not to initializethe tensor's content. + */ + public final boolean init; + + public Inputs(GraphOperation op) { + super(new Empty<>(op), op, Arrays.asList("dtype", "init")); + int inputIndex = 0; + shape = (Operand) op.input(inputIndex++); + dtype = op.attributes().getAttrType("dtype"); + init = op.attributes().getAttrBool("init"); + } } } 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 index eb2c3e83ff7..9f06eda9da7 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,66 +17,122 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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. + *

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. */ +@OpMetadata( + opType = EmptyTensorList.OP_NAME, + inputsClass = EmptyTensorList.Inputs.class +) @Operator -public final class EmptyTensorList extends PrimitiveOp implements Operand { - +public final class EmptyTensorList extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "EmptyTensorList"; + + private Output handle; + + @SuppressWarnings("unchecked") + public EmptyTensorList(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new EmptyTensorList operation. - * + * * @param scope current scope - * @param elementShape - * @param maxNumElements - * @param elementDtype + * @param elementShape The elementShape value + * @param maxNumElements The maxNumElements value + * @param elementDtype The value of the elementDtype attribute + * @param data type for {@code EmptyTensorList} output and operands * @return a new instance of EmptyTensorList */ - public static EmptyTensorList create(Scope scope, Operand elementShape, Operand maxNumElements, DataType elementDtype) { - OperationBuilder opBuilder = scope.env().opBuilder("EmptyTensorList", scope.makeOpName("EmptyTensorList")); + @Endpoint( + describeByClass = true + ) + public static EmptyTensorList create(Scope scope, + Operand elementShape, Operand maxNumElements, + Class elementDtype) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "EmptyTensorList"); opBuilder.addInput(elementShape.asOutput()); opBuilder.addInput(maxNumElements.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("element_dtype", elementDtype); + opBuilder.setAttr("element_dtype", Operands.toDataType(elementDtype)); return new EmptyTensorList(opBuilder.build()); } - + /** + * Gets handle. + * + * @return handle. */ - public Output handle() { + 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++); + + @OpInputsMetadata( + outputsClass = EmptyTensorList.class + ) + public static class Inputs extends RawOpInputs { + /** + * The elementShape input + */ + public final Operand elementShape; + + /** + * The maxNumElements input + */ + public final Operand maxNumElements; + + /** + * The elementDtype attribute + */ + public final DataType elementDtype; + + /** + * The shapeType attribute + */ + public final DataType shapeType; + + public Inputs(GraphOperation op) { + super(new EmptyTensorList(op), op, Arrays.asList("element_dtype", "shape_type")); + int inputIndex = 0; + elementShape = (Operand) op.input(inputIndex++); + maxNumElements = (Operand) op.input(inputIndex++); + elementDtype = op.attributes().getAttrType("element_dtype"); + shapeType = op.attributes().getAttrType("shape_type"); + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EmptyTensorMap.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EmptyTensorMap.java new file mode 100644 index 00000000000..a0c10ecae1c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EmptyTensorMap.java @@ -0,0 +1,97 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.family.TType; + +/** + * Creates and returns an empty tensor map. + * handle: an empty tensor map + */ +@OpMetadata( + opType = EmptyTensorMap.OP_NAME, + inputsClass = EmptyTensorMap.Inputs.class +) +@Operator +public final class EmptyTensorMap extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "EmptyTensorMap"; + + private Output handle; + + @SuppressWarnings("unchecked") + public EmptyTensorMap(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new EmptyTensorMap operation. + * + * @param scope current scope + * @return a new instance of EmptyTensorMap + */ + @Endpoint( + describeByClass = true + ) + public static EmptyTensorMap create(Scope scope) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "EmptyTensorMap"); + return new EmptyTensorMap(opBuilder.build()); + } + + /** + * Gets handle. + * + * @return handle. + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + @OpInputsMetadata( + outputsClass = EmptyTensorMap.class + ) + public static class Inputs extends RawOpInputs { + public Inputs(GraphOperation op) { + super(new EmptyTensorMap(op), op, Arrays.asList()); + int inputIndex = 0; + } + } +} 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 index c3a9c16a2dc..fa8f10ba366 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,100 +17,113 @@ package org.tensorflow.op.core; +import java.util.Arrays; import java.util.List; +import org.tensorflow.GraphOperation; 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.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.TString; /** * 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 types of the tensors in {@code values} must match the schema for the fields + * specified in {@code field_names}. All the tensors in {@code values} must have a common + * shape prefix, batch_shape. + *

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

A {@code 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 + * {@code 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 + *

    + *
  • + *

    A proto field that contains a submessage or group can only be converted + * to {@code 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 + *

  • + *
  • + *

    TensorFlow lacks support for unsigned integers. The ops represent uint64 + * types as a {@code 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 + * {@code DT_INT64}, or using twos-complement if the caller specifies {@code DT_INT32} in + * the {@code output_types} attribute. + *

  • + *
+ *

The {@code descriptor_source} attribute selects the source of protocol + * descriptors to consult when looking up {@code 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. + *

  • + *
  • + *

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

  • + *
  • + *

    A "bytes://<bytes>", in which protocol descriptors are created from {@code }, + * which is expected to be a {@code FileDescriptorSet} serialized as a string. + *

  • + *
*/ -public final class EncodeProto extends PrimitiveOp implements Operand { - +@OpMetadata( + opType = EncodeProto.OP_NAME, + inputsClass = EncodeProto.Inputs.class +) +@Operator +public final class EncodeProto extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.EncodeProto} + * The name of this op, as known by TensorFlow core engine */ - public static class Options { - - /** - * @param descriptorSource - */ - public Options descriptorSource(String descriptorSource) { - this.descriptorSource = descriptorSource; - return this; - } - - private String descriptorSource; - - private Options() { - } + public static final String OP_NAME = "EncodeProto"; + + private Output bytes; + + public EncodeProto(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + bytes = operation.output(outputIdx++); } - + /** * 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 sizes Tensor of int32 with shape {@code [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 + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static EncodeProto create(Scope scope, Operand sizes, Iterable> values, + List fieldNames, String messageType, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { + for (int i = 0 ; i < fieldNamesArray.length ; i++) { fieldNamesArray[i] = fieldNames.get(i); } opBuilder.setAttr("field_names", fieldNamesArray); @@ -124,31 +137,97 @@ public static EncodeProto create(Scope scope, Operand sizes, Iterable 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.EncodeProto} + */ + public static class Options { + private String descriptorSource; + + private Options() { + } + + /** + * Sets the descriptorSource option. + * + * @param descriptorSource the descriptorSource option + * @return this Options instance. + */ + public Options descriptorSource(String descriptorSource) { + this.descriptorSource = descriptorSource; + return this; + } + } + + @OpInputsMetadata( + outputsClass = EncodeProto.class + ) + public static class Inputs extends RawOpInputs { + /** + * Tensor of int32 with shape {@code [batch_shape, len(field_names)]}. + */ + public final Operand sizes; + + /** + * List of tensors containing values for the corresponding field. + */ + public final Iterable> values; + + /** + * List of strings containing proto field names. + */ + public final String[] fieldNames; + + /** + * Name of the proto message type to decode. + */ + public final String messageType; + + /** + * The descriptorSource attribute + */ + public final String descriptorSource; + + /** + * The input types. + */ + public final DataType[] TinputTypes; + + public Inputs(GraphOperation op) { + super(new EncodeProto(op), op, Arrays.asList("field_names", "message_type", "descriptor_source", "Tinput_types")); + int inputIndex = 0; + sizes = (Operand) op.input(inputIndex++); + int valuesLength = op.inputListLength("values"); + values = Arrays.asList((Operand[]) op.inputList(inputIndex, valuesLength)); + inputIndex += valuesLength; + fieldNames = op.attributes().getAttrStringList("field_names"); + messageType = op.attributes().getAttrString("message_type"); + descriptorSource = op.attributes().getAttrString("descriptor_source"); + TinputTypes = op.attributes().getAttrTypeList("Tinput_types"); + } } } 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 deleted file mode 100644 index eafd8f76a5c..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EnqueueTPUEmbeddingIntegerBatch.java +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt32; -import org.tensorflow.types.TString; - -/** - * 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 deleted file mode 100644 index b656d0eab37..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EnqueueTPUEmbeddingSparseBatch.java +++ /dev/null @@ -1,147 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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; -import org.tensorflow.types.TString; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index 29ae548be48..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EnqueueTPUEmbeddingSparseTensorBatch.java +++ /dev/null @@ -1,179 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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; -import org.tensorflow.types.TString; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 index 8d538b4f57d..bbada3714ac 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,60 +17,106 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.tools.Shape; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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 */ +@OpMetadata( + opType = EnsureShape.OP_NAME, + inputsClass = EnsureShape.Inputs.class +) @Operator -public final class EnsureShape extends PrimitiveOp implements Operand { - +public final class EnsureShape extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "EnsureShape"; + + private Output output; + + public EnsureShape(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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. + * @param data type for {@code EnsureShape} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static EnsureShape create(Scope scope, Operand input, + Shape shape) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "EnsureShape"); opBuilder.addInput(input.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); opBuilder.setAttr("shape", shape); - return new EnsureShape(opBuilder.build()); + return new EnsureShape<>(opBuilder.build()); } - + /** + * Gets output. * A tensor with the same shape and contents as the input tensor or value. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = EnsureShape.class + ) + public static class Inputs extends RawOpInputs> { + /** + * A tensor, whose shape is to be validated. + */ + public final Operand input; + + /** + * The expected (possibly partially specified) shape of the input tensor. + */ + public final Shape shape; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new EnsureShape<>(op), op, Arrays.asList("shape", "T")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + shape = op.attributes().getAttrShape("shape"); + T = op.attributes().getAttrType("T"); + } } } 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 index 4f26e43f7d4..309e5700eb1 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,68 +17,66 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** - * 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 + * Creates or finds a child frame, and makes {@code data} available to the child frame. + * This op is used together with {@code Exit} to create loops in the graph. + * The unique {@code frame_name} is used by the {@code Executor} to identify frames. If + * {@code is_constant} is true, {@code output} is a constant in the child frame; otherwise + * it may be changed in the child frame. At most {@code 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 { - +@OpMetadata( + opType = Enter.OP_NAME, + inputsClass = Enter.Inputs.class +) +@Operator +public final class Enter extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.Enter} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Enter"; + + private Output output; + + public Enter(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * 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 + * @param options carries optional attribute values + * @param data type for {@code Enter} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static Enter create(Scope scope, Operand data, String frameName, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Enter"); opBuilder.addInput(data.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); opBuilder.setAttr("frame_name", frameName); if (options != null) { for (Options opts : options) { @@ -90,40 +88,114 @@ public static Enter create(Scope scope, Operand data, St } } } - return new Enter(opBuilder.build()); + return new Enter<>(opBuilder.build()); } - + /** + * Sets the isConstant option. + * * @param isConstant If true, the output is constant within the child frame. + * @return this Options instance. */ public static Options isConstant(Boolean isConstant) { return new Options().isConstant(isConstant); } - + /** + * Sets the parallelIterations option. + * * @param parallelIterations The number of iterations allowed to run in parallel. + * @return this Options instance. */ public static Options parallelIterations(Long parallelIterations) { return new Options().parallelIterations(parallelIterations); } - + /** - * The same tensor as `data`. + * Gets output. + * The same tensor as {@code data}. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.Enter} + */ + public static class Options { + private Boolean isConstant; + + private Long parallelIterations; + + private Options() { + } + + /** + * Sets the isConstant option. + * + * @param isConstant If true, the output is constant within the child frame. + * @return this Options instance. + */ + public Options isConstant(Boolean isConstant) { + this.isConstant = isConstant; + return this; + } + + /** + * Sets the parallelIterations option. + * + * @param parallelIterations The number of iterations allowed to run in parallel. + * @return this Options instance. + */ + public Options parallelIterations(Long parallelIterations) { + this.parallelIterations = parallelIterations; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Enter.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensor to be made available to the child frame. + */ + public final Operand data; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The name of the child frame. + */ + public final String frameName; + + /** + * If true, the output is constant within the child frame. + */ + public final boolean isConstant; + + /** + * The number of iterations allowed to run in parallel. + */ + public final long parallelIterations; + + public Inputs(GraphOperation op) { + super(new Enter<>(op), op, Arrays.asList("T", "frame_name", "is_constant", "parallel_iterations")); + int inputIndex = 0; + data = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + frameName = op.attributes().getAttrString("frame_name"); + isConstant = op.attributes().getAttrBool("is_constant"); + parallelIterations = op.attributes().getAttrInt("parallel_iterations"); + } } } 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 deleted file mode 100644 index 6bf81fb54a7..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EuclideanNorm.java +++ /dev/null @@ -1,113 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 index 52046d4e00d..8dea6a66fe6 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,54 +17,95 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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 + * Exit makes its input {@code data} available to the parent frame. */ -public final class Exit extends PrimitiveOp implements Operand { - +@OpMetadata( + opType = Exit.OP_NAME, + inputsClass = Exit.Inputs.class +) +@Operator +public final class Exit extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Exit"; + + private Output output; + + public Exit(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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. + * @param data type for {@code Exit} output and operands * @return a new instance of Exit */ + @Endpoint( + describeByClass = true + ) public static Exit create(Scope scope, Operand data) { - OperationBuilder opBuilder = scope.env().opBuilder("Exit", scope.makeOpName("Exit")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Exit"); opBuilder.addInput(data.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new Exit(opBuilder.build()); + return new Exit<>(opBuilder.build()); } - + /** - * The same tensor as `data`. + * Gets output. + * The same tensor as {@code data}. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = Exit.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensor to be made available to the parent frame. + */ + public final Operand data; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new Exit<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + data = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index f9982c8e4f7..0f0e030b71d 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,89 +17,138 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 + * Given a tensor {@code input}, this operation inserts a dimension of 1 at the + * dimension index {@code axis} of {@code input}'s shape. The dimension index {@code axis} starts at + * zero; if you specify a negative number for {@code 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
+ * 

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 {@code [height, width, channels]}, you can make it a batch of 1 image with {@code expand_dims(image, 0)}, + * which will make the shape {@code [1, height, width, channels]}. + *

Other examples: + *

  * # '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]
- * 
+ * 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 + * 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: + *

{@code -1-input.dims() <= dim <= input.dims()} + *

This operation is related to {@code squeeze()}, which removes dimensions of * size 1. - * - * @param data type for {@code output()} output */ +@OpMetadata( + opType = ExpandDims.OP_NAME, + inputsClass = ExpandDims.Inputs.class +) @Operator -public final class ExpandDims extends PrimitiveOp implements Operand { - +public final class ExpandDims extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ExpandDims"; + + private Output output; + + public ExpandDims(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new ExpandDims operation. - * + * * @param scope current scope - * @param input + * @param input The input value * @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)]`. + * expand the shape of {@code input}. Must be in the range + * {@code [-rank(input) - 1, rank(input)]}. + * @param data type for {@code ExpandDims} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ExpandDims create(Scope scope, Operand input, + Operand axis) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ExpandDims"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new ExpandDims(opBuilder.build()); + return new ExpandDims<>(opBuilder.build()); } - + /** - * Contains the same data as `input`, but its shape has an additional + * Gets output. + * Contains the same data as {@code input}, but its shape has an additional * dimension of size 1 added. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = ExpandDims.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * 0-D (scalar). Specifies the dimension index at which to + * expand the shape of {@code input}. Must be in the range + * {@code [-rank(input) - 1, rank(input)]}. + */ + public final Operand axis; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tdim attribute + */ + public final DataType Tdim; + + public Inputs(GraphOperation op) { + super(new ExpandDims<>(op), op, Arrays.asList("T", "Tdim")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + axis = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tdim = op.attributes().getAttrType("Tdim"); + } } } 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 deleted file mode 100644 index 6f939e5bab6..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalAutoShardDataset.java +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 deleted file mode 100644 index afb711a7013..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalBytesProducedStatsDataset.java +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TString; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 deleted file mode 100644 index 24144b287f7..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalChooseFastestDataset.java +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.Operands; -import org.tensorflow.op.PrimitiveOp; -import org.tensorflow.op.Scope; -import org.tensorflow.tools.Shape; -import org.tensorflow.types.family.TType; - -/** - */ -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] = 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 deleted file mode 100644 index 91f62690849..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalDatasetCardinality.java +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt64; - -/** - * 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 deleted file mode 100644 index 2243a662b33..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalDatasetToTFRecord.java +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TString; - -/** - * 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 deleted file mode 100644 index d089d936d63..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalDenseToSparseBatchDataset.java +++ /dev/null @@ -1,89 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 deleted file mode 100644 index 96f83407deb..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalLatencyStatsDataset.java +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TString; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 deleted file mode 100644 index 0bf96e5b682..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalMatchingFilesDataset.java +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TString; -import org.tensorflow.types.family.TType; - -/** - */ -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 deleted file mode 100644 index 9f117d20523..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalMaxIntraOpParallelismDataset.java +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 deleted file mode 100644 index d2ae44a1833..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalParseExampleDataset.java +++ /dev/null @@ -1,158 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.Operands; -import org.tensorflow.op.PrimitiveOp; -import org.tensorflow.op.Scope; -import org.tensorflow.tools.Shape; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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] = 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 deleted file mode 100644 index 1394f251374..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalPrivateThreadPoolDataset.java +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 deleted file mode 100644 index b159d09dd06..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalRandomDataset.java +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 deleted file mode 100644 index 12358651c5c..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalRebatchDataset.java +++ /dev/null @@ -1,123 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 deleted file mode 100644 index cb9f3f14bf4..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalSetStatsAggregatorDataset.java +++ /dev/null @@ -1,87 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TString; -import org.tensorflow.types.family.TType; - -/** - */ -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] = 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 deleted file mode 100644 index 182b4d2b950..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalSlidingWindowDataset.java +++ /dev/null @@ -1,91 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 deleted file mode 100644 index 0802a01c588..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalSqlDataset.java +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TString; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 deleted file mode 100644 index 43dd972195b..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalStatsAggregatorHandle.java +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TType; - -/** - * 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 deleted file mode 100644 index 623b0f834b5..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalStatsAggregatorSummary.java +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TString; - -/** - * 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 deleted file mode 100644 index 8d413f145f9..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExperimentalUnbatchDataset.java +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 index 0c66ed84060..350c416e235 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,82 +17,143 @@ package org.tensorflow.op.core; +import java.util.Arrays; import java.util.List; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** - * 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 + * Extract {@code patches} from {@code input} and put them in the {@code "depth"} output dimension. 3D extension of {@code extract_image_patches}. */ +@OpMetadata( + opType = ExtractVolumePatches.OP_NAME, + inputsClass = ExtractVolumePatches.Inputs.class +) @Operator -public final class ExtractVolumePatches extends PrimitiveOp implements Operand { - +public final class ExtractVolumePatches extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ExtractVolumePatches"; + + private Output patches; + + public ExtractVolumePatches(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + patches = operation.output(outputIdx++); + } + /** * 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 input 5-D Tensor with shape {@code [batch, in_planes, in_rows, in_cols, depth]}. + * @param ksizes The size of the sliding window for each dimension of {@code 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]`. + * {@code input}. Must be: {@code [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]
-   * }
- * + *

The size-related attributes are specified as follows: + *

+   * ksizes = [1, ksize_planes, ksize_rows, ksize_cols, 1]
+   * strides = [1, stride_planes, strides_rows, strides_cols, 1]
+   * 
+ * @param data type for {@code ExtractVolumePatches} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ExtractVolumePatches create(Scope scope, Operand input, + List ksizes, List strides, String padding) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ExtractVolumePatches"); opBuilder.addInput(input.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); long[] ksizesArray = new long[ksizes.size()]; - for (int i = 0; i < ksizesArray.length; ++i) { + 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) { + 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()); + 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` + * Gets patches. + * 5-D Tensor with shape {@code [batch, out_planes, out_rows, out_cols, ksize_planes * ksize_rows * ksize_cols * depth]} containing patches + * with size {@code ksize_planes x ksize_rows x ksize_cols x depth} vectorized + * in the "depth" dimension. Note {@code out_planes}, {@code out_rows} and {@code out_cols} * are the dimensions of the output patches. + * @return 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++); + + @OpInputsMetadata( + outputsClass = ExtractVolumePatches.class + ) + public static class Inputs extends RawOpInputs> { + /** + * 5-D Tensor with shape {@code [batch, in_planes, in_rows, in_cols, depth]}. + */ + public final Operand input; + + /** + * The size of the sliding window for each dimension of {@code input}. + */ + public final long[] ksizes; + + /** + * 1-D of length 5. How far the centers of two consecutive patches are in + * {@code input}. Must be: {@code [1, stride_planes, stride_rows, stride_cols, 1]}. + */ + public final long[] strides; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The type of padding algorithm to use. + *

The size-related attributes are specified as follows: + *

+     * ksizes = [1, ksize_planes, ksize_rows, ksize_cols, 1]
+     * strides = [1, stride_planes, strides_rows, strides_cols, 1]
+     * 
+ */ + public final String padding; + + public Inputs(GraphOperation op) { + super(new ExtractVolumePatches<>(op), op, Arrays.asList("ksizes", "strides", "T", "padding")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + ksizes = op.attributes().getAttrIntList("ksizes"); + strides = op.attributes().getAttrIntList("strides"); + T = op.attributes().getAttrType("T"); + padding = op.attributes().getAttrString("padding"); + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/FakeParam.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/FakeParam.java new file mode 100644 index 00000000000..79e63958dda --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/FakeParam.java @@ -0,0 +1,125 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * This op is used as a placeholder in If branch functions. It doesn't provide a + * valid output when run, so must either be removed (e.g. replaced with a + * function input) or guaranteed not to be used (e.g. if mirroring an + * intermediate output needed for the gradient computation of the other branch). + */ +@OpMetadata( + opType = FakeParam.OP_NAME, + inputsClass = FakeParam.Inputs.class +) +@Operator +public final class FakeParam extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "FakeParam"; + + private Output output; + + public FakeParam(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new FakeParam operation. + * + * @param scope current scope + * @param dtype The type of the output. + * @param shape
+   * The purported shape of the output. This is only used for shape inference;
+   * the output will not necessarily have this shape. Can be a partial shape.
+   * 
+ * @param data type for {@code FakeParam} output and operands + * @return a new instance of FakeParam + */ + @Endpoint( + describeByClass = true + ) + public static FakeParam create(Scope scope, Class dtype, Shape shape) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "FakeParam"); + opBuilder.setAttr("dtype", Operands.toDataType(dtype)); + opBuilder.setAttr("shape", shape); + return new FakeParam<>(opBuilder.build()); + } + + /** + * Gets output. + *
+   * \"Fake\" output value. This should not be consumed by another op.
+   * 
+ * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + @OpInputsMetadata( + outputsClass = FakeParam.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The type of the output. + */ + public final DataType dtype; + + /** + *
+     * The purported shape of the output. This is only used for shape inference;
+     * the output will not necessarily have this shape. Can be a partial shape.
+     * 
+ */ + public final Shape shape; + + public Inputs(GraphOperation op) { + super(new FakeParam<>(op), op, Arrays.asList("dtype", "shape")); + int inputIndex = 0; + dtype = op.attributes().getAttrType("dtype"); + shape = op.attributes().getAttrShape("shape"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/FileSystemSetConfiguration.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/FileSystemSetConfiguration.java new file mode 100644 index 00000000000..42984c322f9 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/FileSystemSetConfiguration.java @@ -0,0 +1,100 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.TString; + +/** + * Set configuration of the file system. + */ +@OpMetadata( + opType = FileSystemSetConfiguration.OP_NAME, + inputsClass = FileSystemSetConfiguration.Inputs.class +) +@Operator +public final class FileSystemSetConfiguration extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "FileSystemSetConfiguration"; + + public FileSystemSetConfiguration(Operation operation) { + super(operation, OP_NAME); + } + + /** + * Factory method to create a class wrapping a new FileSystemSetConfiguration operation. + * + * @param scope current scope + * @param scheme File system scheme. + * @param key The name of the configuration option. + * @param value The value of the configuration option. + * @return a new instance of FileSystemSetConfiguration + */ + @Endpoint( + describeByClass = true + ) + public static FileSystemSetConfiguration create(Scope scope, Operand scheme, + Operand key, Operand value) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "FileSystemSetConfiguration"); + opBuilder.addInput(scheme.asOutput()); + opBuilder.addInput(key.asOutput()); + opBuilder.addInput(value.asOutput()); + return new FileSystemSetConfiguration(opBuilder.build()); + } + + @OpInputsMetadata( + outputsClass = FileSystemSetConfiguration.class + ) + public static class Inputs extends RawOpInputs { + /** + * File system scheme. + */ + public final Operand scheme; + + /** + * The name of the configuration option. + */ + public final Operand key; + + /** + * The value of the configuration option. + */ + public final Operand value; + + public Inputs(GraphOperation op) { + super(new FileSystemSetConfiguration(op), op, Arrays.asList()); + int inputIndex = 0; + scheme = (Operand) op.input(inputIndex++); + key = (Operand) op.input(inputIndex++); + value = (Operand) op.input(inputIndex++); + } + } +} 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 index b24f80f5f9e..8634981f57c 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,83 +17,133 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * Creates a tensor filled with a scalar value. - *

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

- * For example: - *

{@code
+ * This operation creates a tensor of shape {@code dims} and fills it with {@code value}.
+ * 

For example: + *

  * # Output tensor has shape [2, 3].
- * fill([2, 3], 9) ==> [[9, 9, 9]
+ * fill([2, 3], 9) ==> [[9, 9, 9]
  *                      [9, 9, 9]]
- * }
- * `tf.fill` differs from `tf.constant` in a few ways: + *
+ *

{@code tf.fill} differs from {@code 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 + *
  • {@code tf.fill} only supports scalar contents, whereas {@code tf.constant} supports + * Tensor values.
  • + *
  • {@code tf.fill} creates an Op in the computation graph that constructs the actual + * Tensor value at runtime. This is in contrast to {@code tf.constant} which embeds + * the entire Tensor into the graph with a {@code Const} node.
  • + *
  • Because {@code tf.fill} evaluates at graph runtime, it supports dynamic shapes + * based on other runtime Tensors, unlike {@code tf.constant}.
  • + *
*/ +@OpMetadata( + opType = Fill.OP_NAME, + inputsClass = Fill.Inputs.class +) @Operator -public final class Fill extends PrimitiveOp implements Operand { - +public final class Fill extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Fill"; + + private Output output; + + public Fill(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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) + *

{@literal @}compatibility(numpy)
* Equivalent to np.full - * @end_compatibility + *
{@literal @}end_compatibility + * @param data type for {@code Fill} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static Fill create(Scope scope, Operand dims, + Operand value) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Fill"); opBuilder.addInput(dims.asOutput()); opBuilder.addInput(value.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new Fill(opBuilder.build()); + return new Fill<>(opBuilder.build()); } - + /** + * Gets output. + * + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = Fill.class + ) + public static class Inputs extends RawOpInputs> { + /** + * 1-D. Represents the shape of the output tensor. + */ + public final Operand dims; + + /** + * 0-D (scalar). Value to fill the returned tensor. + *

{@literal @}compatibility(numpy)
+ * Equivalent to np.full + *
{@literal @}end_compatibility + */ + public final Operand value; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The indexType attribute + */ + public final DataType indexType; + + public Inputs(GraphOperation op) { + super(new Fill<>(op), op, Arrays.asList("T", "index_type")); + int inputIndex = 0; + dims = (Operand) op.input(inputIndex++); + value = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + indexType = op.attributes().getAttrType("index_type"); + } } } 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 index 848c1c4e422..54d34db0923 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,88 +17,131 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TString; -import org.tensorflow.types.TUInt8; +import org.tensorflow.types.TUint8; import org.tensorflow.types.family.TType; /** * 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 + * Generates fingerprint values of {@code data}. + *

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

Fingerprint op writes fingerprint values as byte arrays. For example, the + * default method {@code farmhash64} generates a 64-bit fingerprint value at a time. + * This 8-byte value is written out as an {@code 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 + *

For example, suppose that {@code data} has data type {@code DT_INT32} and shape (2, 3, 4), + * and that the fingerprint method is {@code farmhash64}. In this case, the output shape + * is (2, 8), where 2 is the batch dimension size of {@code data}, and 8 is the size of + * each fingerprint value in bytes. {@code output[0, :]} is generated from 12 integers in + * {@code data[0, :, :]} and similarly {@code output[1, :]} is generated from other 12 integers + * in {@code 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. + *
+ *

For string data, one should expect {@code Fingerprint(data) != Fingerprint(ReduceJoin(data))} in general. */ +@OpMetadata( + opType = Fingerprint.OP_NAME, + inputsClass = Fingerprint.Inputs.class +) @Operator -public final class Fingerprint extends PrimitiveOp implements Operand { - +public final class Fingerprint extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Fingerprint"; + + private Output fingerprint; + + public Fingerprint(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + fingerprint = operation.output(outputIdx++); + } + /** * 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`. + * {@code 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")); + @Endpoint( + describeByClass = true + ) + public static Fingerprint create(Scope scope, Operand data, + Operand method) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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 + * Gets fingerprint. + * A two-dimensional {@code Tensor} of type {@code tf.uint8}. The first dimension equals to + * {@code data}'s first dimension, and the second dimension size depends on the * fingerprint algorithm. + * @return fingerprint. */ - public Output fingerprint() { + public Output fingerprint() { return fingerprint; } - + @Override - public Output asOutput() { + public Output asOutput() { return fingerprint; } - - private Output fingerprint; - - private Fingerprint(Operation operation) { - super(operation); - int outputIdx = 0; - fingerprint = operation.output(outputIdx++); + + @OpInputsMetadata( + outputsClass = Fingerprint.class + ) + public static class Inputs extends RawOpInputs { + /** + * Must have rank 1 or higher. + */ + public final Operand data; + + /** + * Fingerprint method used by this op. Currently available method is + * {@code farmhash::fingerprint64}. + */ + public final Operand method; + + /** + * This can be a POD-type or string type. + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new Fingerprint(op), op, Arrays.asList("T")); + int inputIndex = 0; + data = (Operand) op.input(inputIndex++); + method = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/For.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/For.java new file mode 100644 index 00000000000..db91928c495 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/For.java @@ -0,0 +1,156 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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.ConcreteFunction; +import org.tensorflow.GraphOperation; +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.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TType; + +/** + * Applies a for loop. + *

+ *  output = input;
+ *  for i in range(start, limit, delta)
+ *    output = body(i, output);
+ * 
+ */ +@OpMetadata( + opType = For.OP_NAME, + inputsClass = For.Inputs.class +) +@Operator +public final class For extends RawOp implements Iterable> { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "For"; + + private List> output; + + @SuppressWarnings("unchecked") + public For(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int outputLength = operation.outputListLength("output"); + output = Arrays.asList(operation.outputList(outputIdx, outputLength)); + outputIdx += outputLength; + } + + /** + * Factory method to create a class wrapping a new For operation. + * + * @param scope current scope + * @param start The lower bound. An int32 + * @param limit The upper bound. An int32 + * @param delta The increment. An int32 + * @param input A list of input tensors whose types are T. + * @param body
+   * A function that takes a list of tensors (int32, T) and returns another
+   * list of tensors (T).
+   * 
+ * @return a new instance of For + */ + @Endpoint( + describeByClass = true, + name = "forOp" + ) + public static For create(Scope scope, Operand start, Operand limit, + Operand delta, Iterable> input, ConcreteFunction body) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "For"); + opBuilder.addInput(start.asOutput()); + opBuilder.addInput(limit.asOutput()); + opBuilder.addInput(delta.asOutput()); + opBuilder.addInputList(Operands.asOutputs(input)); + opBuilder.setAttr("body", body); + return new For(opBuilder.build()); + } + + /** + * Gets output. + * A list of output tensors whose types are T. + * @return output. + */ + public List> output() { + return output; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) output.iterator(); + } + + @OpInputsMetadata( + outputsClass = For.class + ) + public static class Inputs extends RawOpInputs { + /** + * The lower bound. An int32 + */ + public final Operand start; + + /** + * The upper bound. An int32 + */ + public final Operand limit; + + /** + * The increment. An int32 + */ + public final Operand delta; + + /** + * A list of input tensors whose types are T. + */ + public final Iterable> input; + + /** + * A list of dtypes. + */ + public final DataType[] T; + + public Inputs(GraphOperation op) { + super(new For(op), op, Arrays.asList("T")); + int inputIndex = 0; + start = (Operand) op.input(inputIndex++); + limit = (Operand) op.input(inputIndex++); + delta = (Operand) op.input(inputIndex++); + int inputLength = op.inputListLength("input"); + input = Arrays.asList((Operand[]) op.inputList(inputIndex, inputLength)); + inputIndex += inputLength; + T = op.attributes().getAttrTypeList("T"); + } + } +} 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 deleted file mode 100644 index d7b4c1a9406..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/FusedBatchNormGradV3.java +++ /dev/null @@ -1,203 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.TFloat; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index 4e852f947ff..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/FusedBatchNormV3.java +++ /dev/null @@ -1,204 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index 2beaa55f281..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GRUBlockCell.java +++ /dev/null @@ -1,142 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index 4181e84d33a..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GRUBlockCellGrad.java +++ /dev/null @@ -1,186 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 index 20d23c517e4..43e09807b66 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,87 +17,92 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * 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
+ * Gather slices from {@code params} axis {@code axis} according to {@code indices}.
+ * {@code indices} must be an integer tensor of any dimension (usually 0-D or 1-D).
+ * Produces an output tensor with shape {@code params.shape[:axis] + indices.shape[batch_dims:] + params.shape[axis + 1:]} where:
+ * 
  *     # 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. + *

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 + *

Note that on TPU, if any dimension of {@code params} is of size 0 then the output will + * be the expected shape filled with zeros. On CPU and GPU an error will be + * returned. + *

See also {@code tf.batch_gather} and {@code tf.gather_nd}. */ +@OpMetadata( + opType = Gather.OP_NAME, + inputsClass = Gather.Inputs.class +) @Operator -public final class Gather extends PrimitiveOp implements Operand { - +public final class Gather extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.Gather} + * The name of this op, as known by TensorFlow core engine */ - public static class Options { - - /** - * @param batchDims - */ - public Options batchDims(Long batchDims) { - this.batchDims = batchDims; - return this; - } - - private Long batchDims; - - private Options() { - } + public static final String OP_NAME = "GatherV2"; + + private Output output; + + public Gather(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** - * Factory method to create a class wrapping a new Gather operation. - * + * Factory method to create a class wrapping a new GatherV2 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 + * {@code axis + 1}. + * @param indices Index tensor. Must be in range {@code [0, params.shape[axis])}. + * @param axis The axis in {@code params} to gather {@code indices} from. Defaults to the first * dimension. Supports negative indexes. - * @param options carries optional attributes values + * @param options carries optional attribute values + * @param data type for {@code GatherV2} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static Gather create(Scope scope, Operand params, + Operand indices, Operand axis, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { @@ -105,34 +110,106 @@ public static Gather } } } - return new Gather(opBuilder.build()); + return new Gather<>(opBuilder.build()); } - + /** - * @param batchDims + * Sets the batchDims option. + * + * @param batchDims the batchDims option + * @return this Options instance. */ 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:]`. + * Gets output. + * Values from {@code params} gathered from indices given by {@code indices}, with + * shape {@code params.shape[:axis] + indices.shape + params.shape[axis + 1:]}. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.Gather} + */ + public static class Options { + private Long batchDims; + + private Options() { + } + + /** + * Sets the batchDims option. + * + * @param batchDims the batchDims option + * @return this Options instance. + */ + public Options batchDims(Long batchDims) { + this.batchDims = batchDims; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Gather.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensor from which to gather values. Must be at least rank + * {@code axis + 1}. + */ + public final Operand params; + + /** + * Index tensor. Must be in range {@code [0, params.shape[axis])}. + */ + public final Operand indices; + + /** + * The axis in {@code params} to gather {@code indices} from. Defaults to the first + * dimension. Supports negative indexes. + */ + public final Operand axis; + + /** + * The batchDims attribute + */ + public final long batchDims; + + /** + * The Tparams attribute + */ + public final DataType Tparams; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * The Taxis attribute + */ + public final DataType Taxis; + + public Inputs(GraphOperation op) { + super(new Gather<>(op), op, Arrays.asList("batch_dims", "Tparams", "Tindices", "Taxis")); + int inputIndex = 0; + params = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + axis = (Operand) op.input(inputIndex++); + batchDims = op.attributes().getAttrInt("batch_dims"); + Tparams = op.attributes().getAttrType("Tparams"); + Tindices = op.attributes().getAttrType("Tindices"); + Taxis = op.attributes().getAttrType("Taxis"); + } } } 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 index 516601b512f..755bf4e7905 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,151 +17,253 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * 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
+ * Gather slices from {@code params} into a Tensor with shape specified by {@code indices}.
+ * {@code indices} is a K-dimensional integer tensor, best thought of as a
+ * (K-1)-dimensional tensor of indices into {@code params}, where each element defines a
+ * slice of {@code params}:
+ * 
+ * output[\\(i_0, ..., i_{K-2}\\)] = params[indices[\\(i_0, ..., i_{K-2}\\)]]
+ * 
+ *

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

The last dimension of {@code indices} can be at most the rank of + * {@code params}: + *

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

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

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

If {@code indices} contains any out-of-bound indices, depending on + * {@code bad_indices_policy}, the op will either return an error or ignore the + * out-of-bound indices. {@code bad_indices_policy} can be one of the following values: + *

    + *
  1. "" or "DEFAULT": raises on CPU and ignore on GPU. This is because + * historically on CPU and GPU we handle errors in different ways, and for + * backward compatibility we keep the default behavior.
  2. + *
  3. "ERROR": raises error; GPU does not support this value.
  4. + *
  5. "IGNORE": ignore error and set the corresponding output to 0; + * supported on both CPU and GPU.
  6. + *
+ *

Some examples below. + *

Simple indexing into a matrix: + *

  *     indices = [[0, 0], [1, 1]]
  *     params = [['a', 'b'], ['c', 'd']]
  *     output = ['a', 'd']
- * }
- * Slice indexing into a matrix: - *
{@code
+ * 
+ *

Slice indexing into a matrix: + *

  *     indices = [[1], [0]]
  *     params = [['a', 'b'], ['c', 'd']]
  *     output = [['c', 'd'], ['a', 'b']]
- * }
- * Indexing into a 3-tensor: - *
{@code
+ * 
+ *

Indexing into a 3-tensor: + *

  *     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
+ * 
+ *

Batched indexing into a matrix: + *

  *     indices = [[[0, 0]], [[0, 1]]]
  *     params = [['a', 'b'], ['c', 'd']]
  *     output = [['a'], ['b']]
- * }
- * Batched slice indexing into a matrix: - *
{@code
+ * 
+ *

Batched slice indexing into a matrix: + *

  *     indices = [[[1]], [[0]]]
  *     params = [['a', 'b'], ['c', 'd']]
  *     output = [[['c', 'd']], [['a', 'b']]]
- * }
- * Batched indexing into a 3-tensor: - *
{@code
+ * 
+ *

Batched indexing into a 3-tensor: + *

  *     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 + *
+ *

See also {@code tf.gather} and {@code tf.batch_gather}. */ +@OpMetadata( + opType = GatherNd.OP_NAME, + inputsClass = GatherNd.Inputs.class +) @Operator -public final class GatherNd extends PrimitiveOp implements Operand { - +public final class GatherNd extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "GatherNd"; + + private Output output; + + public GatherNd(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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. + * @param options carries optional attribute values + * @param data type for {@code GatherNd} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static GatherNd create(Scope scope, Operand params, + Operand indices, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "GatherNd"); opBuilder.addInput(params.asOutput()); opBuilder.addInput(indices.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new GatherNd(opBuilder.build()); + if (options != null) { + for (Options opts : options) { + if (opts.badIndicesPolicy != null) { + opBuilder.setAttr("bad_indices_policy", opts.badIndicesPolicy); + } + } + } + return new GatherNd<>(opBuilder.build()); } - + /** - * Values from `params` gathered from indices given by `indices`, with - * shape `indices.shape[:-1] + params.shape[indices.shape[-1]:]`. + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public static Options badIndicesPolicy(String badIndicesPolicy) { + return new Options().badIndicesPolicy(badIndicesPolicy); + } + + /** + * Gets output. + * Values from {@code params} gathered from indices given by {@code indices}, with + * shape {@code indices.shape[:-1] + params.shape[indices.shape[-1]:]}. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.GatherNd} + */ + public static class Options { + private String badIndicesPolicy; + + private Options() { + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public Options badIndicesPolicy(String badIndicesPolicy) { + this.badIndicesPolicy = badIndicesPolicy; + return this; + } + } + + @OpInputsMetadata( + outputsClass = GatherNd.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensor from which to gather values. + */ + public final Operand params; + + /** + * Index tensor. + */ + public final Operand indices; + + /** + * The Tparams attribute + */ + public final DataType Tparams; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * The badIndicesPolicy attribute + */ + public final String badIndicesPolicy; + + public Inputs(GraphOperation op) { + super(new GatherNd<>(op), op, Arrays.asList("Tparams", "Tindices", "bad_indices_policy")); + int inputIndex = 0; + params = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + Tparams = op.attributes().getAttrType("Tparams"); + Tindices = op.attributes().getAttrType("Tindices"); + badIndicesPolicy = op.attributes().getAttrString("bad_indices_policy"); + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GetElementAtIndex.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GetElementAtIndex.java new file mode 100644 index 00000000000..065404e1735 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GetElementAtIndex.java @@ -0,0 +1,141 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TInt64; +import org.tensorflow.types.family.TType; + +/** + * Gets the element at the specified index in a dataset. + */ +@OpMetadata( + opType = GetElementAtIndex.OP_NAME, + inputsClass = GetElementAtIndex.Inputs.class +) +@Operator +public final class GetElementAtIndex extends RawOp implements Iterable> { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "GetElementAtIndex"; + + private List> components; + + @SuppressWarnings("unchecked") + public GetElementAtIndex(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int componentsLength = operation.outputListLength("components"); + components = Arrays.asList(operation.outputList(outputIdx, componentsLength)); + outputIdx += componentsLength; + } + + /** + * Factory method to create a class wrapping a new GetElementAtIndex operation. + * + * @param scope current scope + * @param dataset The dataset value + * @param index The index value + * @param outputTypes The value of the outputTypes attribute + * @param outputShapes The value of the outputShapes attribute + * @return a new instance of GetElementAtIndex + */ + @Endpoint( + describeByClass = true + ) + public static GetElementAtIndex create(Scope scope, Operand dataset, + Operand index, List> outputTypes, List outputShapes) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "GetElementAtIndex"); + opBuilder.addInput(dataset.asOutput()); + opBuilder.addInput(index.asOutput()); + opBuilder.setAttr("output_types", Operands.toDataTypes(outputTypes)); + 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 GetElementAtIndex(opBuilder.build()); + } + + /** + * Gets components. + * + * @return components. + */ + public List> components() { + return components; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) components.iterator(); + } + + @OpInputsMetadata( + outputsClass = GetElementAtIndex.class + ) + public static class Inputs extends RawOpInputs { + /** + * The dataset input + */ + public final Operand dataset; + + /** + * The index input + */ + public final Operand index; + + /** + * The outputTypes attribute + */ + public final DataType[] outputTypes; + + /** + * The outputShapes attribute + */ + public final Shape[] outputShapes; + + public Inputs(GraphOperation op) { + super(new GetElementAtIndex(op), op, Arrays.asList("output_types", "output_shapes")); + int inputIndex = 0; + dataset = (Operand) op.input(inputIndex++); + index = (Operand) op.input(inputIndex++); + outputTypes = op.attributes().getAttrTypeList("output_types"); + outputShapes = op.attributes().getAttrShapeList("output_shapes"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GetOptions.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GetOptions.java new file mode 100644 index 00000000000..f6c5340587d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GetOptions.java @@ -0,0 +1,103 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.TString; +import org.tensorflow.types.family.TType; + +/** + * Returns the {@code tf.data.Options} attached to {@code input_dataset}. + */ +@OpMetadata( + opType = GetOptions.OP_NAME, + inputsClass = GetOptions.Inputs.class +) +@Operator +public final class GetOptions extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "GetOptions"; + + private Output serializedOptions; + + public GetOptions(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + serializedOptions = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new GetOptions operation. + * + * @param scope current scope + * @param inputDataset A variant tensor representing the input dataset. + * @return a new instance of GetOptions + */ + @Endpoint( + describeByClass = true + ) + public static GetOptions create(Scope scope, Operand inputDataset) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "GetOptions"); + opBuilder.addInput(inputDataset.asOutput()); + return new GetOptions(opBuilder.build()); + } + + /** + * Gets serializedOptions. + * + * @return serializedOptions. + */ + public Output serializedOptions() { + return serializedOptions; + } + + @Override + public Output asOutput() { + return serializedOptions; + } + + @OpInputsMetadata( + outputsClass = GetOptions.class + ) + public static class Inputs extends RawOpInputs { + /** + * A variant tensor representing the input dataset. + */ + public final Operand inputDataset; + + public Inputs(GraphOperation op) { + super(new GetOptions(op), op, Arrays.asList()); + int inputIndex = 0; + inputDataset = (Operand) op.input(inputIndex++); + } + } +} 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 index 3f98233a91c..36f2e7a2cb5 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,54 +17,96 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * Store the input tensor in the state of the current session. */ +@OpMetadata( + opType = GetSessionHandle.OP_NAME, + inputsClass = GetSessionHandle.Inputs.class +) @Operator -public final class GetSessionHandle extends PrimitiveOp implements Operand { - +public final class GetSessionHandle extends RawOp implements Operand { /** - * Factory method to create a class wrapping a new GetSessionHandle operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "GetSessionHandleV2"; + + private Output handle; + + @SuppressWarnings("unchecked") + public GetSessionHandle(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new GetSessionHandleV2 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")); + @Endpoint( + describeByClass = true + ) + public static GetSessionHandle create(Scope scope, Operand value) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "GetSessionHandle"); opBuilder.addInput(value.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new GetSessionHandle(opBuilder.build()); } - + /** + * Gets handle. * The handle for the tensor stored in the session state, represented * as a ResourceHandle object. + * @return handle. */ - public Output handle() { + 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++); + + @OpInputsMetadata( + outputsClass = GetSessionHandle.class + ) + public static class Inputs extends RawOpInputs { + /** + * The tensor to be stored. + */ + public final Operand value; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new GetSessionHandle(op), op, Arrays.asList("T")); + int inputIndex = 0; + value = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index c84eb490c84..0cccfb42045 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,58 +17,99 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TString; import org.tensorflow.types.family.TType; /** * Get the value of the tensor specified by its handle. - * - * @param data type for {@code value()} output */ +@OpMetadata( + opType = GetSessionTensor.OP_NAME, + inputsClass = GetSessionTensor.Inputs.class +) @Operator -public final class GetSessionTensor extends PrimitiveOp implements Operand { - +public final class GetSessionTensor extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "GetSessionTensor"; + + private Output value; + + public GetSessionTensor(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + value = operation.output(outputIdx++); + } + /** * 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. + * @param data type for {@code GetSessionTensor} output and operands * @return a new instance of GetSessionTensor */ - public static GetSessionTensor create(Scope scope, Operand handle, DataType dtype) { - OperationBuilder opBuilder = scope.env().opBuilder("GetSessionTensor", scope.makeOpName("GetSessionTensor")); + @Endpoint( + describeByClass = true + ) + public static GetSessionTensor create(Scope scope, Operand handle, + Class dtype) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "GetSessionTensor"); opBuilder.addInput(handle.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("dtype", dtype); - return new GetSessionTensor(opBuilder.build()); + opBuilder.setAttr("dtype", Operands.toDataType(dtype)); + return new GetSessionTensor<>(opBuilder.build()); } - + /** + * Gets value. * The tensor for the given handle. + * @return value. */ 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++); + + @OpInputsMetadata( + outputsClass = GetSessionTensor.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The handle for a tensor stored in the session state. + */ + public final Operand handle; + + /** + * The type of the output value. + */ + public final DataType dtype; + + public Inputs(GraphOperation op) { + super(new GetSessionTensor<>(op), op, Arrays.asList("dtype")); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + dtype = op.attributes().getAttrType("dtype"); + } } } 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 index 53da78569dd..c4235de8ff2 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,60 +17,98 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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 + *

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 + *

Returns the input tensor without modification. */ +@OpMetadata( + opType = GuaranteeConst.OP_NAME, + inputsClass = GuaranteeConst.Inputs.class +) @Operator -public final class GuaranteeConst extends PrimitiveOp implements Operand { - +public final class GuaranteeConst extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "GuaranteeConst"; + + private Output output; + + public GuaranteeConst(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new GuaranteeConst operation. - * + * * @param scope current scope - * @param input + * @param input The input value + * @param data type for {@code GuaranteeConst} output and operands * @return a new instance of GuaranteeConst */ + @Endpoint( + describeByClass = true + ) public static GuaranteeConst create(Scope scope, Operand input) { - OperationBuilder opBuilder = scope.env().opBuilder("GuaranteeConst", scope.makeOpName("GuaranteeConst")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "GuaranteeConst"); opBuilder.addInput(input.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new GuaranteeConst(opBuilder.build()); + return new GuaranteeConst<>(opBuilder.build()); } - + /** + * Gets output. + * + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = GuaranteeConst.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new GuaranteeConst<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index d3558db2e94..2b635533191 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,80 +17,68 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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. */ +@OpMetadata( + opType = HashTable.OP_NAME, + inputsClass = HashTable.Inputs.class +) @Operator -public final class HashTable extends PrimitiveOp implements Operand { - +public final class HashTable extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.HashTable} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "HashTableV2"; + + private Output tableHandle; + + @SuppressWarnings("unchecked") + public HashTable(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + tableHandle = operation.output(outputIdx++); } - + /** - * Factory method to create a class wrapping a new HashTable operation. - * + * Factory method to create a class wrapping a new HashTableV2 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 + * @param options carries optional attribute values + * @param data type for {@code HashTableV2} output and operands + * @param data type for {@code HashTableV2} output and operands * @return a new instance of HashTable */ - public static HashTable create(Scope scope, DataType keyDtype, DataType valueDtype, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("HashTableV2", scope.makeOpName("HashTable")); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("key_dtype", keyDtype); - opBuilder.setAttr("value_dtype", valueDtype); + @Endpoint( + describeByClass = true + ) + public static HashTable create(Scope scope, Class keyDtype, + Class valueDtype, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "HashTable"); + opBuilder.setAttr("key_dtype", Operands.toDataType(keyDtype)); + opBuilder.setAttr("value_dtype", Operands.toDataType(valueDtype)); if (options != null) { for (Options opts : options) { if (opts.container != null) { @@ -106,49 +94,145 @@ public static HashTable create(Scope scope, D } return new HashTable(opBuilder.build()); } - + /** + * Sets the container option. + * * @param container If non-empty, this table is placed in the given container. * Otherwise, a default container is used. + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** + * Sets the sharedName option. + * * @param sharedName If non-empty, this table is shared under the given name across * multiple sessions. + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - + /** + * Sets the useNodeNameSharing option. + * * @param useNodeNameSharing If true and shared_name is empty, the table is shared * using the node name. + * @return this Options instance. */ public static Options useNodeNameSharing(Boolean useNodeNameSharing) { return new Options().useNodeNameSharing(useNodeNameSharing); } - + /** + * Gets tableHandle. * Handle to a table. + * @return tableHandle. */ - public Output tableHandle() { + 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.HashTable} + */ + public static class Options { + private String container; + + private String sharedName; + + private Boolean useNodeNameSharing; + + private Options() { + } + + /** + * Sets the container option. + * + * @param container If non-empty, this table is placed in the given container. + * Otherwise, a default container is used. + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName If non-empty, this table is shared under the given name across + * multiple sessions. + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + /** + * Sets the useNodeNameSharing option. + * + * @param useNodeNameSharing If true and shared_name is empty, the table is shared + * using the node name. + * @return this Options instance. + */ + public Options useNodeNameSharing(Boolean useNodeNameSharing) { + this.useNodeNameSharing = useNodeNameSharing; + return this; + } + } + + @OpInputsMetadata( + outputsClass = HashTable.class + ) + public static class Inputs extends RawOpInputs { + /** + * If non-empty, this table is placed in the given container. + * Otherwise, a default container is used. + */ + public final String container; + + /** + * If non-empty, this table is shared under the given name across + * multiple sessions. + */ + public final String sharedName; + + /** + * If true and shared_name is empty, the table is shared + * using the node name. + */ + public final boolean useNodeNameSharing; + + /** + * Type of the table keys. + */ + public final DataType keyDtype; + + /** + * Type of the table values. + */ + public final DataType valueDtype; + + public Inputs(GraphOperation op) { + super(new HashTable(op), op, Arrays.asList("container", "shared_name", "use_node_name_sharing", "key_dtype", "value_dtype")); + int inputIndex = 0; + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + useNodeNameSharing = op.attributes().getAttrBool("use_node_name_sharing"); + keyDtype = op.attributes().getAttrType("key_dtype"); + valueDtype = op.attributes().getAttrType("value_dtype"); + } } } 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 index f154d26aa7b..782cfc69f05 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,96 +17,160 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** * 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
+ * Given the tensor {@code values}, this operation returns a rank 1 histogram counting
+ * the number of entries in {@code values} that fall into every bin.  The bins are
+ * equal width and determined by the arguments {@code value_range} and {@code nbins}.
+ * 
  * # 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 + * sess.run(hist) => [2, 1, 1, 0, 2] + *
*/ +@OpMetadata( + opType = HistogramFixedWidth.OP_NAME, + inputsClass = HistogramFixedWidth.Inputs.class +) @Operator -public final class HistogramFixedWidth extends PrimitiveOp implements Operand { - +public final class HistogramFixedWidth extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "HistogramFixedWidth"; + + private Output out; + + public HistogramFixedWidth(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + out = operation.output(outputIdx++); + } + /** * 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 + * @param values Numeric {@code Tensor}. + * @param valueRange Shape [2] {@code Tensor} of same {@code dtype} as {@code values}. + * values <= value_range[0] will be mapped to hist[0], + * values >= value_range[1] will be mapped to hist[-1]. + * @param nbins Scalar {@code int32 Tensor}. Number of histogram bins. + * @param dtype The value of the dtype attribute + * @param data type for {@code HistogramFixedWidth} output and operands + * @param data type for {@code HistogramFixedWidth} output and operands * @return a new instance of HistogramFixedWidth */ - public static HistogramFixedWidth create(Scope scope, Operand values, Operand valueRange, Operand nbins, DataType dtype) { - OperationBuilder opBuilder = scope.env().opBuilder("HistogramFixedWidth", scope.makeOpName("HistogramFixedWidth")); + @Endpoint( + describeByClass = true + ) + public static HistogramFixedWidth create(Scope scope, + Operand values, Operand valueRange, Operand nbins, Class dtype) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "HistogramFixedWidth"); opBuilder.addInput(values.asOutput()); opBuilder.addInput(valueRange.asOutput()); opBuilder.addInput(nbins.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("dtype", dtype); - return new HistogramFixedWidth(opBuilder.build()); + opBuilder.setAttr("dtype", Operands.toDataType(dtype)); + return new HistogramFixedWidth<>(opBuilder.build()); } - + /** - * Factory method to create a class wrapping a new HistogramFixedWidth operation using default output types. - * + * Factory method to create a class wrapping a new HistogramFixedWidth operation, with the 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 + * @param values Numeric {@code Tensor}. + * @param valueRange Shape [2] {@code Tensor} of same {@code dtype} as {@code values}. + * values <= value_range[0] will be mapped to hist[0], + * values >= value_range[1] will be mapped to hist[-1]. + * @param nbins Scalar {@code int32 Tensor}. Number of histogram bins. + * @param data type for {@code HistogramFixedWidth} output and operands + * @return a new instance of HistogramFixedWidth, with default output types */ - public static HistogramFixedWidth create(Scope scope, Operand values, Operand valueRange, Operand nbins) { - return create(scope, values, valueRange, nbins, TInt32.DTYPE); + @Endpoint( + describeByClass = true + ) + public static HistogramFixedWidth create(Scope scope, + Operand values, Operand valueRange, Operand nbins) { + return create(scope, values, valueRange, nbins, TInt32.class); } - + /** - * A 1-D `Tensor` holding histogram of values. + * Gets out. + * A 1-D {@code Tensor} holding histogram of values. + * @return out. */ 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++); + + @OpInputsMetadata( + outputsClass = HistogramFixedWidth.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Numeric {@code Tensor}. + */ + public final Operand values; + + /** + * Shape [2] {@code Tensor} of same {@code dtype} as {@code values}. + * values <= value_range[0] will be mapped to hist[0], + * values >= value_range[1] will be mapped to hist[-1]. + */ + public final Operand valueRange; + + /** + * Scalar {@code int32 Tensor}. Number of histogram bins. + */ + public final Operand nbins; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The dtype attribute + */ + public final DataType dtype; + + public Inputs(GraphOperation op) { + super(new HistogramFixedWidth<>(op), op, Arrays.asList("T", "dtype")); + int inputIndex = 0; + values = (Operand) op.input(inputIndex++); + valueRange = (Operand) op.input(inputIndex++); + nbins = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + dtype = op.attributes().getAttrType("dtype"); + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/HostConst.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/HostConst.java new file mode 100644 index 00000000000..82f5ef8f295 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/HostConst.java @@ -0,0 +1,114 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.Tensor; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * Returns a constant tensor on the host. Only for writing C++ tests. + */ +@OpMetadata( + opType = HostConst.OP_NAME, + inputsClass = HostConst.Inputs.class +) +@Operator +public final class HostConst extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "HostConst"; + + private Output output; + + public HostConst(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new HostConst operation. + * + * @param scope current scope + * @param value Attr {@code value} is the tensor to return. + * @param dtype The value of the dtype attribute + * @param data type for {@code HostConst} output and operands + * @return a new instance of HostConst + */ + @Endpoint( + describeByClass = true + ) + public static HostConst create(Scope scope, Tensor value, Class dtype) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "HostConst"); + opBuilder.setAttr("value", value); + opBuilder.setAttr("dtype", Operands.toDataType(dtype)); + return new HostConst<>(opBuilder.build()); + } + + /** + * Gets output. + * + * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + @OpInputsMetadata( + outputsClass = HostConst.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Attr {@code value} is the tensor to return. + */ + public final Tensor value; + + /** + * The dtype attribute + */ + public final DataType dtype; + + public Inputs(GraphOperation op) { + super(new HostConst<>(op), op, Arrays.asList("value", "dtype")); + int inputIndex = 0; + value = op.attributes().getAttrTensor("value"); + dtype = op.attributes().getAttrType("dtype"); + } + } +} 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 index 64616238fe3..d0729ab93da 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,53 +17,94 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * Return a tensor with the same shape and contents as the input tensor or value. - * - * @param data type for {@code output()} output */ +@OpMetadata( + opType = Identity.OP_NAME, + inputsClass = Identity.Inputs.class +) @Operator -public final class Identity extends PrimitiveOp implements Operand { - +public final class Identity extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Identity"; + + private Output output; + + public Identity(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new Identity operation. - * + * * @param scope current scope - * @param input + * @param input The input value + * @param data type for {@code Identity} output and operands * @return a new instance of Identity */ + @Endpoint( + describeByClass = true + ) public static Identity create(Scope scope, Operand input) { - OperationBuilder opBuilder = scope.env().opBuilder("Identity", scope.makeOpName("Identity")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Identity"); opBuilder.addInput(input.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new Identity(opBuilder.build()); + return new Identity<>(opBuilder.build()); } - + /** + * Gets output. + * + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = Identity.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new Identity<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index 3c40fef21b7..f3f9d1a017b 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,71 +20,112 @@ import java.util.Arrays; import java.util.Iterator; import java.util.List; +import org.tensorflow.GraphOperation; 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.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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 + *

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')
+ *
+ * {@literal @}tf.RegisterGradient('OverrideGradientWithG')
  * def ApplyG(op, dy, _):
  *   return [None, g(dy)]  # Do not backprop to f(x).
- * }
- * + *
*/ +@OpMetadata( + opType = IdentityN.OP_NAME, + inputsClass = IdentityN.Inputs.class +) @Operator -public final class IdentityN extends PrimitiveOp implements Iterable> { - +public final class IdentityN extends RawOp implements Iterable> { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "IdentityN"; + + private List> output; + + @SuppressWarnings("unchecked") + public IdentityN(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int outputLength = operation.outputListLength("output"); + output = Arrays.asList(operation.outputList(outputIdx, outputLength)); + outputIdx += outputLength; + } + /** * Factory method to create a class wrapping a new IdentityN operation. - * + * * @param scope current scope - * @param input + * @param input The input value * @return a new instance of IdentityN */ + @Endpoint( + describeByClass = true + ) public static IdentityN create(Scope scope, Iterable> input) { - OperationBuilder opBuilder = scope.env().opBuilder("IdentityN", scope.makeOpName("IdentityN")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "IdentityN"); opBuilder.addInputList(Operands.asOutputs(input)); - opBuilder = scope.applyControlDependencies(opBuilder); return new IdentityN(opBuilder.build()); } - + /** + * Gets output. + * + * @return output. */ 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; + + @OpInputsMetadata( + outputsClass = IdentityN.class + ) + public static class Inputs extends RawOpInputs { + /** + * The input input + */ + public final Iterable> input; + + /** + * The T attribute + */ + public final DataType[] T; + + public Inputs(GraphOperation op) { + super(new IdentityN(op), op, Arrays.asList("T")); + int inputIndex = 0; + int inputLength = op.inputListLength("input"); + input = Arrays.asList((Operand[]) op.inputList(inputIndex, inputLength)); + inputIndex += inputLength; + T = op.attributes().getAttrTypeList("T"); + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/If.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/If.java new file mode 100644 index 00000000000..c1635ef8c06 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/If.java @@ -0,0 +1,147 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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.ConcreteFunction; +import org.tensorflow.Operand; +import org.tensorflow.Output; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.family.TType; + +/** + * output = cond ? then_branch(input) : else_branch(input) + * + *

Selects between {@link StatefulIf} and {@link StatelessIf} based on the statefulness of the function arguments. + */ +@Operator +public interface If extends Iterable> { + /** + * Factory method to create a class wrapping a new If operation. + * + * @param scope current scope + * @param cond

+   *   A Tensor. If the tensor is a scalar of non-boolean type, the
+   *   scalar is converted to a boolean according to the
+   *   following rule: if the scalar is a numerical value, non-zero means
+   *   `True` and zero means False; if the scalar is a string, non-empty
+   *   means `True` and empty means `False`. If the tensor is not a scalar,
+   *   being empty means False and being non-empty means True.
+   * 
+ * @param input A list of input tensors. + * @param Tout A list of output types. + * @param thenBranch
+   *   A function that takes 'inputs' and returns a list of tensors, whose
+   *   types are the same as what else_branch returns.
+   * 
+ * @param elseBranch
+   * A function that takes 'inputs' and returns a list of tensors, whose
+   * types are the same as what then_branch returns.
+   * 
+ * @param options carries optional attribute values + * @return a new instance of If + */ + @Endpoint( + describeByClass = true, + name = "ifOp" + ) + static If create(Scope scope, Operand cond, Iterable> input, + List> Tout, ConcreteFunction thenBranch, ConcreteFunction elseBranch, + Options... options) { + boolean isStateful = false; + if (thenBranch.isStateful()) { + isStateful = true; + } + if (elseBranch.isStateful()) { + isStateful = true; + } + if (isStateful) { + return StatefulIf.create(scope, cond, input, Tout, thenBranch, elseBranch, options); + } else { + return StatelessIf.create(scope, cond, input, Tout, thenBranch, elseBranch, options); + } + } + + /** + * Sets the outputShapes option. + * + * @param outputShapes the outputShapes option + * @return this Options instance. + */ + static Options outputShapes(List outputShapes) { + return new Options().outputShapes(outputShapes); + } + + /** + * Sets the outputShapes option. + * + * @param outputShapes the outputShapes option + * @return this Options instance. + */ + static Options outputShapes(Shape... outputShapes) { + return new Options().outputShapes(outputShapes); + } + + /** + * Gets output. + * A list of return values. + * @return output. + */ + List> output(); + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + Iterator> iterator(); + + /** + * Optional attributes for {@link org.tensorflow.op.core.If} + */ + class Options { + List outputShapes; + + private Options() { + } + + /** + * Sets the outputShapes option. + * + * @param outputShapes the outputShapes option + * @return this Options instance. + */ + public Options outputShapes(List outputShapes) { + this.outputShapes = outputShapes; + return this; + } + + /** + * Sets the outputShapes option. + * + * @param outputShapes the outputShapes option + * @return this Options instance. + */ + public Options outputShapes(Shape... outputShapes) { + this.outputShapes = Arrays.asList(outputShapes); + return this; + } + } +} 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 deleted file mode 100644 index 737b4078d7e..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IgnoreErrorsDataset.java +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 index d8ac8fee7a1..12d647268ba 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,62 +17,110 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.tools.Shape; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * Returns immutable tensor from memory region. - *

* The current implementation memmaps the tensor from a file. - * - * @param data type for {@code tensor()} output */ +@OpMetadata( + opType = ImmutableConst.OP_NAME, + inputsClass = ImmutableConst.Inputs.class +) @Operator -public final class ImmutableConst extends PrimitiveOp implements Operand { - +public final class ImmutableConst extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ImmutableConst"; + + private Output tensor; + + public ImmutableConst(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + tensor = operation.output(outputIdx++); + } + /** * 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. + * @param data type for {@code ImmutableConst} output and operands * @return a new instance of ImmutableConst */ - public static ImmutableConst create(Scope scope, DataType dtype, Shape shape, String memoryRegionName) { - OperationBuilder opBuilder = scope.env().opBuilder("ImmutableConst", scope.makeOpName("ImmutableConst")); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("dtype", dtype); + @Endpoint( + describeByClass = true + ) + public static ImmutableConst create(Scope scope, Class dtype, Shape shape, + String memoryRegionName) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ImmutableConst"); + opBuilder.setAttr("dtype", Operands.toDataType(dtype)); opBuilder.setAttr("shape", shape); opBuilder.setAttr("memory_region_name", memoryRegionName); - return new ImmutableConst(opBuilder.build()); + return new ImmutableConst<>(opBuilder.build()); } - + /** + * Gets tensor. + * + * @return tensor. */ 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++); + + @OpInputsMetadata( + outputsClass = ImmutableConst.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Type of the returned tensor. + */ + public final DataType dtype; + + /** + * Shape of the returned tensor. + */ + public final Shape shape; + + /** + * Name of readonly memory region used by the tensor, see + * NewReadOnlyMemoryRegionFromFile in tensorflow::Env. + */ + public final String memoryRegionName; + + public Inputs(GraphOperation op) { + super(new ImmutableConst<>(op), op, Arrays.asList("dtype", "shape", "memory_region_name")); + int inputIndex = 0; + dtype = op.attributes().getAttrType("dtype"); + shape = op.attributes().getAttrShape("shape"); + memoryRegionName = op.attributes().getAttrString("memory_region_name"); + } } } 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 deleted file mode 100644 index c981f2d4d79..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InfeedDequeue.java +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.tools.Shape; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType dtype, Shape shape) { - OperationBuilder opBuilder = scope.env().opBuilder("InfeedDequeue", scope.makeOpName("InfeedDequeue")); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("dtype", 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 deleted file mode 100644 index ca70b58ce3a..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InfeedDequeueTuple.java +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 deleted file mode 100644 index e0a0fe0fbe6..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InfeedEnqueue.java +++ /dev/null @@ -1,136 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.PrimitiveOp; -import org.tensorflow.op.Scope; -import org.tensorflow.tools.Shape; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index 1ad68de268e..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InfeedEnqueuePrelinearizedBuffer.java +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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 deleted file mode 100644 index 5580c60433b..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InfeedEnqueueTuple.java +++ /dev/null @@ -1,125 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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; -import org.tensorflow.tools.Shape; - -/** - * 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 index b3a382902ef..40225873359 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,40 +17,97 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * Table initializer that takes two tensors for keys and values respectively. */ +@OpMetadata( + opType = InitializeTable.OP_NAME, + inputsClass = InitializeTable.Inputs.class +) @Operator -public final class InitializeTable extends PrimitiveOp { - +public final class InitializeTable extends RawOp { /** - * Factory method to create a class wrapping a new InitializeTable operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "InitializeTableV2"; + + public InitializeTable(Operation operation) { + super(operation, OP_NAME); + } + + /** + * Factory method to create a class wrapping a new InitializeTableV2 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")); + @Endpoint( + describeByClass = true + ) + public static InitializeTable create(Scope scope, Operand tableHandle, + Operand keys, Operand values) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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); + + @OpInputsMetadata( + outputsClass = InitializeTable.class + ) + public static class Inputs extends RawOpInputs { + /** + * Handle to a table which will be initialized. + */ + public final Operand tableHandle; + + /** + * Keys of type Tkey. + */ + public final Operand keys; + + /** + * Values of type Tval. + */ + public final Operand values; + + /** + * The Tkey attribute + */ + public final DataType Tkey; + + /** + * The Tval attribute + */ + public final DataType Tval; + + public Inputs(GraphOperation op) { + super(new InitializeTable(op), op, Arrays.asList("Tkey", "Tval")); + int inputIndex = 0; + tableHandle = (Operand) op.input(inputIndex++); + keys = (Operand) op.input(inputIndex++); + values = (Operand) op.input(inputIndex++); + Tkey = op.attributes().getAttrType("Tkey"); + Tval = op.attributes().getAttrType("Tval"); + } } } 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 index db2ca0cb283..d8a78e24266 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,76 +17,71 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; import org.tensorflow.types.TString; +import org.tensorflow.types.family.TType; /** * 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`. + * split line based on {@code delimiter} or the line number (starting from zero). + * Where to extract the key and value from a line is specified by {@code key_index} and + * {@code value_index}. + *

    + *
  • A value of -1 means use the line number(starting from zero), expects {@code int64}.
  • + *
  • A value of -2 means use the whole line content, expects {@code string}.
  • + *
  • A value >= 0 means use the index (starting at zero) of the split line based + * on {@code delimiter}.
  • + *
*/ +@OpMetadata( + opType = InitializeTableFromTextFile.OP_NAME, + inputsClass = InitializeTableFromTextFile.Inputs.class +) @Operator -public final class InitializeTableFromTextFile extends PrimitiveOp { - +public final class InitializeTableFromTextFile extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.InitializeTableFromTextFile} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "InitializeTableFromTextFileV2"; + + public InitializeTableFromTextFile(Operation operation) { + super(operation, OP_NAME); } - + /** - * Factory method to create a class wrapping a new InitializeTableFromTextFile operation. - * + * Factory method to create a class wrapping a new InitializeTableFromTextFileV2 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 keyIndex Column index in a line to get the table {@code 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 + * {@code value} values from. + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static InitializeTableFromTextFile create(Scope scope, + Operand tableHandle, Operand filename, Long keyIndex, + Long valueIndex, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { @@ -97,27 +92,141 @@ public static InitializeTableFromTextFile create(Scope scope, Operand tableHa if (opts.delimiter != null) { opBuilder.setAttr("delimiter", opts.delimiter); } + if (opts.offset != null) { + opBuilder.setAttr("offset", opts.offset); + } } } return new InitializeTableFromTextFile(opBuilder.build()); } - + /** + * Sets the vocabSize option. + * * @param vocabSize Number of elements of the file, use -1 if unknown. + * @return this Options instance. */ public static Options vocabSize(Long vocabSize) { return new Options().vocabSize(vocabSize); } - + /** + * Sets the delimiter option. + * * @param delimiter Delimiter to separate fields in a line. + * @return this Options instance. */ public static Options delimiter(String delimiter) { return new Options().delimiter(delimiter); } - - - private InitializeTableFromTextFile(Operation operation) { - super(operation); + + /** + * Sets the offset option. + * + * @param offset the offset option + * @return this Options instance. + */ + public static Options offset(Long offset) { + return new Options().offset(offset); + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.InitializeTableFromTextFile} + */ + public static class Options { + private Long vocabSize; + + private String delimiter; + + private Long offset; + + private Options() { + } + + /** + * Sets the vocabSize option. + * + * @param vocabSize Number of elements of the file, use -1 if unknown. + * @return this Options instance. + */ + public Options vocabSize(Long vocabSize) { + this.vocabSize = vocabSize; + return this; + } + + /** + * Sets the delimiter option. + * + * @param delimiter Delimiter to separate fields in a line. + * @return this Options instance. + */ + public Options delimiter(String delimiter) { + this.delimiter = delimiter; + return this; + } + + /** + * Sets the offset option. + * + * @param offset the offset option + * @return this Options instance. + */ + public Options offset(Long offset) { + this.offset = offset; + return this; + } + } + + @OpInputsMetadata( + outputsClass = InitializeTableFromTextFile.class + ) + public static class Inputs extends RawOpInputs { + /** + * Handle to a table which will be initialized. + */ + public final Operand tableHandle; + + /** + * Filename of a vocabulary text file. + */ + public final Operand filename; + + /** + * Column index in a line to get the table {@code key} values from. + */ + public final long keyIndex; + + /** + * Column index that represents information of a line to get the table + * {@code value} values from. + */ + public final long valueIndex; + + /** + * Number of elements of the file, use -1 if unknown. + */ + public final long vocabSize; + + /** + * Delimiter to separate fields in a line. + */ + public final String delimiter; + + /** + * The offset attribute + */ + public final long offset; + + public Inputs(GraphOperation op) { + super(new InitializeTableFromTextFile(op), op, Arrays.asList("key_index", "value_index", "vocab_size", "delimiter", "offset")); + int inputIndex = 0; + tableHandle = (Operand) op.input(inputIndex++); + filename = (Operand) op.input(inputIndex++); + keyIndex = op.attributes().getAttrInt("key_index"); + valueIndex = op.attributes().getAttrInt("value_index"); + vocabSize = op.attributes().getAttrInt("vocab_size"); + delimiter = op.attributes().getAttrString("delimiter"); + offset = op.attributes().getAttrInt("offset"); + } } } 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 index eed30e18eff..78f37851589 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,61 +17,115 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** - * Adds v into specified rows of x. - *

- * Computes y = x; y[i, :] += v; return y. - * - * @param data type for {@code y()} output + * Adds v into specified rows of x. + *

+ * Computes y = x; y[i, :] += v; return y.
+ * 
*/ +@OpMetadata( + opType = InplaceAdd.OP_NAME, + inputsClass = InplaceAdd.Inputs.class +) @Operator -public final class InplaceAdd extends PrimitiveOp implements Operand { - +public final class InplaceAdd extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "InplaceAdd"; + + private Output y; + + public InplaceAdd(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + y = operation.output(outputIdx++); + } + /** * 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. + * @param x A {@code Tensor} of type T. + * @param i A vector. Indices into the left-most dimension of {@code x}. + * @param v A {@code Tensor} of type T. Same dimension sizes as x except the first dimension, which must be the same as i's size. + * @param data type for {@code InplaceAdd} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static InplaceAdd create(Scope scope, Operand x, Operand i, + Operand v) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "InplaceAdd"); opBuilder.addInput(x.asOutput()); opBuilder.addInput(i.asOutput()); opBuilder.addInput(v.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new InplaceAdd(opBuilder.build()); + 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`. + * Gets y. + * A {@code Tensor} of type T. An alias of {@code x}. The content of {@code y} is undefined if there are duplicates in {@code i}. + * @return y. */ 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++); + + @OpInputsMetadata( + outputsClass = InplaceAdd.class + ) + public static class Inputs extends RawOpInputs> { + /** + * A {@code Tensor} of type T. + */ + public final Operand x; + + /** + * A vector. Indices into the left-most dimension of {@code x}. + */ + public final Operand i; + + /** + * A {@code Tensor} of type T. Same dimension sizes as x except the first dimension, which must be the same as i's size. + */ + public final Operand v; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new InplaceAdd<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + x = (Operand) op.input(inputIndex++); + i = (Operand) op.input(inputIndex++); + v = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index 1436913a1d6..31d0287aab2 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,61 +17,116 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** - * Subtracts `v` into specified rows of `x`. - *

- * Computes y = x; y[i, :] -= v; return y. - * - * @param data type for {@code y()} output + *

+ * Subtracts `v` into specified rows of `x`.
+ *
+ * Computes y = x; y[i, :] -= v; return y.
+ * 
*/ +@OpMetadata( + opType = InplaceSub.OP_NAME, + inputsClass = InplaceSub.Inputs.class +) @Operator -public final class InplaceSub extends PrimitiveOp implements Operand { - +public final class InplaceSub extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "InplaceSub"; + + private Output y; + + public InplaceSub(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + y = operation.output(outputIdx++); + } + /** * 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. + * @param x A {@code Tensor} of type T. + * @param i A vector. Indices into the left-most dimension of {@code x}. + * @param v A {@code Tensor} of type T. Same dimension sizes as x except the first dimension, which must be the same as i's size. + * @param data type for {@code InplaceSub} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static InplaceSub create(Scope scope, Operand x, Operand i, + Operand v) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "InplaceSub"); opBuilder.addInput(x.asOutput()); opBuilder.addInput(i.asOutput()); opBuilder.addInput(v.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new InplaceSub(opBuilder.build()); + 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`. + * Gets y. + * A {@code Tensor} of type T. An alias of {@code x}. The content of {@code y} is undefined if there are duplicates in {@code i}. + * @return y. */ 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++); + + @OpInputsMetadata( + outputsClass = InplaceSub.class + ) + public static class Inputs extends RawOpInputs> { + /** + * A {@code Tensor} of type T. + */ + public final Operand x; + + /** + * A vector. Indices into the left-most dimension of {@code x}. + */ + public final Operand i; + + /** + * A {@code Tensor} of type T. Same dimension sizes as x except the first dimension, which must be the same as i's size. + */ + public final Operand v; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new InplaceSub<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + x = (Operand) op.input(inputIndex++); + i = (Operand) op.input(inputIndex++); + v = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index b317bb12936..d34e0f15011 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,61 +17,115 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** - * Updates specified rows with values in `v`. - *

- * Computes `x[i, :] = v; return x`. - * - * @param data type for {@code y()} output + * Updates specified rows 'i' with values 'v'. + * Computes {@code x[i, :] = v; return x}. + *

Originally this function is mutative however for compilation we make this + * operation create / operate on a copy of {@code x}. */ +@OpMetadata( + opType = InplaceUpdate.OP_NAME, + inputsClass = InplaceUpdate.Inputs.class +) @Operator -public final class InplaceUpdate extends PrimitiveOp implements Operand { - +public final class InplaceUpdate extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "InplaceUpdate"; + + private Output y; + + public InplaceUpdate(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + y = operation.output(outputIdx++); + } + /** * 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. + * @param x A tensor of type {@code T}. + * @param i A vector. Indices into the left-most dimension of {@code x}. + * @param v A {@code Tensor} of type T. Same dimension sizes as x except the first dimension, which must be the same as i's size. + * @param data type for {@code InplaceUpdate} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static InplaceUpdate create(Scope scope, Operand x, + Operand i, Operand v) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "InplaceUpdate"); opBuilder.addInput(x.asOutput()); opBuilder.addInput(i.asOutput()); opBuilder.addInput(v.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new InplaceUpdate(opBuilder.build()); + 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`. + * Gets y. + * A {@code Tensor} of type T. An alias of {@code x}. The content of {@code y} is undefined if there are duplicates in {@code i}. + * @return y. */ 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++); + + @OpInputsMetadata( + outputsClass = InplaceUpdate.class + ) + public static class Inputs extends RawOpInputs> { + /** + * A tensor of type {@code T}. + */ + public final Operand x; + + /** + * A vector. Indices into the left-most dimension of {@code x}. + */ + public final Operand i; + + /** + * A {@code Tensor} of type T. Same dimension sizes as x except the first dimension, which must be the same as i's size. + */ + public final Operand v; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new InplaceUpdate<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + x = (Operand) op.input(inputIndex++); + i = (Operand) op.input(inputIndex++); + v = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 deleted file mode 100644 index 6b764d2475c..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IsBoostedTreesEnsembleInitialized.java +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TBool; - -/** - * 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 deleted file mode 100644 index 5b287ae41eb..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IsBoostedTreesQuantileStreamResourceInitialized.java +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TBool; - -/** - * 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 index 6ca11650f57..c4519eb940e 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,54 +17,95 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TBool; import org.tensorflow.types.family.TType; /** * Checks whether a tensor has been initialized. - *

* Outputs boolean scalar indicating whether the tensor has been initialized. */ +@OpMetadata( + opType = IsVariableInitialized.OP_NAME, + inputsClass = IsVariableInitialized.Inputs.class +) @Operator -public final class IsVariableInitialized extends PrimitiveOp implements Operand { - +public final class IsVariableInitialized extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "IsVariableInitialized"; + + private Output isInitialized; + + public IsVariableInitialized(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + isInitialized = operation.output(outputIdx++); + } + /** * 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. + * @param ref Should be from a {@code 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")); + @Endpoint( + describeByClass = true + ) + public static IsVariableInitialized create(Scope scope, Operand ref) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "IsVariableInitialized"); opBuilder.addInput(ref.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new IsVariableInitialized(opBuilder.build()); } - + /** + * Gets isInitialized. + * + * @return isInitialized. */ 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++); + + @OpInputsMetadata( + outputsClass = IsVariableInitialized.class + ) + public static class Inputs extends RawOpInputs { + /** + * Should be from a {@code Variable} node. May be uninitialized. + */ + public final Operand ref; + + /** + * The type of elements in the variable tensor. + */ + public final DataType dtype; + + public Inputs(GraphOperation op) { + super(new IsVariableInitialized(op), op, Arrays.asList("dtype")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + dtype = op.attributes().getAttrType("dtype"); + } } } 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 deleted file mode 100644 index 7ec76ed7e37..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IteratorGetDevice.java +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TString; - -/** - * 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 deleted file mode 100644 index 27882ba4b2f..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/KMC2ChainInitialization.java +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; -import org.tensorflow.types.TInt64; - -/** - * 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 deleted file mode 100644 index 23fde1a4b99..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/KmeansPlusPlusInitialization.java +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; -import org.tensorflow.types.TInt64; - -/** - * 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/KthOrderStatistic.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/KthOrderStatistic.java new file mode 100644 index 00000000000..41f2ee0be06 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/KthOrderStatistic.java @@ -0,0 +1,124 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.TFloat32; + +/** + * Computes the Kth order statistic of a data set. The current + * implementation uses a binary search requiring exactly 32 passes over + * the input data. The running time is linear with respect to input + * size. The median-of-medians algorithm is probably faster, but is + * difficult to implement efficiently in XLA. The implementation imposes + * a total ordering on floats. The ordering is consistent with the usual + * partial order. Positive NaNs are greater than positive + * infinity. Negative NaNs are less than negative infinity. NaNs with + * distinct payloads are treated as distinct. Subnormal numbers are + * preserved (not flushed to zero). Positive infinity is greater than all + * numbers. Negative infinity is less than all numbers. Positive is + * greater than negative zero. There are less than k values greater than + * the kth order statistic. There are at least k values greater than or + * equal to the Kth order statistic. The semantics are not the same as + * top_k_unique. + */ +@OpMetadata( + opType = KthOrderStatistic.OP_NAME, + inputsClass = KthOrderStatistic.Inputs.class +) +@Operator +public final class KthOrderStatistic extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "KthOrderStatistic"; + + private Output output; + + public KthOrderStatistic(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new KthOrderStatistic operation. + * + * @param scope current scope + * @param input The input value + * @param k The value of the k attribute + * @return a new instance of KthOrderStatistic + */ + @Endpoint( + describeByClass = true + ) + public static KthOrderStatistic create(Scope scope, Operand input, Long k) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "KthOrderStatistic"); + opBuilder.addInput(input.asOutput()); + opBuilder.setAttr("k", k); + return new KthOrderStatistic(opBuilder.build()); + } + + /** + * Gets output. + * + * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + @OpInputsMetadata( + outputsClass = KthOrderStatistic.class + ) + public static class Inputs extends RawOpInputs { + /** + * The input input + */ + public final Operand input; + + /** + * The k attribute + */ + public final long k; + + public Inputs(GraphOperation op) { + super(new KthOrderStatistic(op), op, Arrays.asList("k")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + k = op.attributes().getAttrInt("k"); + } + } +} 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 deleted file mode 100644 index 60586148324..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LMDBDataset.java +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TString; -import org.tensorflow.types.family.TType; - -/** - */ -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] = 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 deleted file mode 100644 index d58d0774842..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LSTMBlockCell.java +++ /dev/null @@ -1,229 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index 4a08ea46136..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LSTMBlockCellGrad.java +++ /dev/null @@ -1,134 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 index 5cc880af2b9..317eb054e29 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,69 +17,124 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** * 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 + * A sequence of {@code num} evenly-spaced values are generated beginning at {@code start}. + * If {@code num > 1}, the values in the sequence increase by + * {@code (stop - start) / (num - 1)}, so that the last one is exactly {@code stop}. + *

For example: + *

+ * tf.linspace(10.0, 12.0, 3, name="linspace") => [ 10.0  11.0  12.0]
+ * 
*/ +@OpMetadata( + opType = LinSpace.OP_NAME, + inputsClass = LinSpace.Inputs.class +) @Operator -public final class LinSpace extends PrimitiveOp implements Operand { - +public final class LinSpace extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "LinSpace"; + + private Output output; + + public LinSpace(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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. + * @param data type for {@code LinSpace} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static LinSpace create(Scope scope, Operand start, + Operand stop, Operand num) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "LinSpace"); opBuilder.addInput(start.asOutput()); opBuilder.addInput(stop.asOutput()); opBuilder.addInput(num.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new LinSpace(opBuilder.build()); + return new LinSpace<>(opBuilder.build()); } - + /** + * Gets output. * 1-D. The generated values. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = LinSpace.class + ) + public static class Inputs extends RawOpInputs> { + /** + * 0-D tensor. First entry in the range. + */ + public final Operand start; + + /** + * 0-D tensor. Last entry in the range. + */ + public final Operand stop; + + /** + * 0-D tensor. Number of values to generate. + */ + public final Operand num; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tidx attribute + */ + public final DataType Tidx; + + public Inputs(GraphOperation op) { + super(new LinSpace<>(op), op, Arrays.asList("T", "Tidx")); + int inputIndex = 0; + start = (Operand) op.input(inputIndex++); + stop = (Operand) op.input(inputIndex++); + num = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tidx = op.attributes().getAttrType("Tidx"); + } } } 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 deleted file mode 100644 index b6e4fd0fcac..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingADAMParameters.java +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 5bfa7517eac..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingADAMParametersGradAccumDebug.java +++ /dev/null @@ -1,119 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 8651c2e7039..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingAdadeltaParameters.java +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index edb262f7ab6..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingAdadeltaParametersGradAccumDebug.java +++ /dev/null @@ -1,119 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 925d12cd38b..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingAdagradParameters.java +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index f0f5beb2c54..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingAdagradParametersGradAccumDebug.java +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index daa6bf81f6b..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingCenteredRMSPropParameters.java +++ /dev/null @@ -1,119 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 97e6ad050f6..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingFTRLParameters.java +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 4f336388828..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingFTRLParametersGradAccumDebug.java +++ /dev/null @@ -1,119 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 1749e34446f..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingMDLAdagradLightParameters.java +++ /dev/null @@ -1,119 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index bb43b57a0c9..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingMomentumParameters.java +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 4ac4933de50..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingMomentumParametersGradAccumDebug.java +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 5c1208b863e..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingProximalAdagradParameters.java +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 732623f5944..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug.java +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index cf62e37c0be..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingRMSPropParameters.java +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index b7e77d2468e..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingRMSPropParametersGradAccumDebug.java +++ /dev/null @@ -1,119 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 9015494b7ae..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LoadTPUEmbeddingStochasticGradientDescentParameters.java +++ /dev/null @@ -1,113 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 index 9a3c7f0e6ea..7546b26f8f4 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,64 +17,114 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * Outputs all keys and values in the table. - * - * @param data type for {@code keys()} output - * @param data type for {@code values()} output */ +@OpMetadata( + opType = LookupTableExport.OP_NAME, + inputsClass = LookupTableExport.Inputs.class +) @Operator -public final class LookupTableExport extends PrimitiveOp { - +public final class LookupTableExport extends RawOp { /** - * Factory method to create a class wrapping a new LookupTableExport operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "LookupTableExportV2"; + + private Output keys; + + private Output values; + + public LookupTableExport(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + keys = operation.output(outputIdx++); + values = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new LookupTableExportV2 operation. + * * @param scope current scope * @param tableHandle Handle to the table. - * @param Tkeys - * @param Tvalues + * @param Tkeys The value of the Tkeys attribute + * @param Tvalues The value of the Tvalues attribute + * @param data type for {@code LookupTableExportV2} output and operands + * @param data type for {@code LookupTableExportV2} output and operands * @return a new instance of LookupTableExport */ - public static LookupTableExport create(Scope scope, Operand tableHandle, DataType Tkeys, DataType Tvalues) { - OperationBuilder opBuilder = scope.env().opBuilder("LookupTableExportV2", scope.makeOpName("LookupTableExport")); + @Endpoint( + describeByClass = true + ) + public static LookupTableExport create(Scope scope, + Operand tableHandle, Class Tkeys, Class Tvalues) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "LookupTableExport"); opBuilder.addInput(tableHandle.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("Tkeys", Tkeys); - opBuilder.setAttr("Tvalues", Tvalues); - return new LookupTableExport(opBuilder.build()); + opBuilder.setAttr("Tkeys", Operands.toDataType(Tkeys)); + opBuilder.setAttr("Tvalues", Operands.toDataType(Tvalues)); + return new LookupTableExport<>(opBuilder.build()); } - + /** + * Gets keys. * Vector of all keys present in the table. + * @return keys. */ public Output keys() { return keys; } - + /** - * Tensor of all values in the table. Indexed in parallel with `keys`. + * Gets values. + * Tensor of all values in the table. Indexed in parallel with {@code keys}. + * @return values. */ 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++); + + @OpInputsMetadata( + outputsClass = LookupTableExport.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Handle to the table. + */ + public final Operand tableHandle; + + /** + * The Tkeys attribute + */ + public final DataType Tkeys; + + /** + * The Tvalues attribute + */ + public final DataType Tvalues; + + public Inputs(GraphOperation op) { + super(new LookupTableExport<>(op), op, Arrays.asList("Tkeys", "Tvalues")); + int inputIndex = 0; + tableHandle = (Operand) op.input(inputIndex++); + Tkeys = op.attributes().getAttrType("Tkeys"); + Tvalues = op.attributes().getAttrType("Tvalues"); + } } } 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 index 1cab15dd12f..1155c94662f 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,65 +17,123 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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 + * The tensor {@code keys} must of the same type as the keys of the table. + * The output {@code values} is of the type of the table values. + *

The scalar {@code 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 */ +@OpMetadata( + opType = LookupTableFind.OP_NAME, + inputsClass = LookupTableFind.Inputs.class +) @Operator -public final class LookupTableFind extends PrimitiveOp implements Operand { - +public final class LookupTableFind extends RawOp implements Operand { /** - * Factory method to create a class wrapping a new LookupTableFind operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "LookupTableFindV2"; + + private Output values; + + public LookupTableFind(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + values = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new LookupTableFindV2 operation. + * * @param scope current scope * @param tableHandle Handle to the table. * @param keys Any shape. Keys to look up. - * @param defaultValue + * @param defaultValue The defaultValue value + * @param data type for {@code LookupTableFindV2} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static LookupTableFind create(Scope scope, + Operand tableHandle, Operand keys, + Operand defaultValue) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "LookupTableFind"); opBuilder.addInput(tableHandle.asOutput()); opBuilder.addInput(keys.asOutput()); opBuilder.addInput(defaultValue.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new LookupTableFind(opBuilder.build()); + return new LookupTableFind<>(opBuilder.build()); } - + /** - * Same shape as `keys`. Values found in the table, or `default_values` + * Gets values. + * Same shape as {@code keys}. Values found in the table, or {@code default_values} * for missing keys. + * @return values. */ 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++); + + @OpInputsMetadata( + outputsClass = LookupTableFind.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Handle to the table. + */ + public final Operand tableHandle; + + /** + * Any shape. Keys to look up. + */ + public final Operand keys; + + /** + * The defaultValue input + */ + public final Operand defaultValue; + + /** + * The Tin attribute + */ + public final DataType Tin; + + /** + * The Tout attribute + */ + public final DataType Tout; + + public Inputs(GraphOperation op) { + super(new LookupTableFind<>(op), op, Arrays.asList("Tin", "Tout")); + int inputIndex = 0; + tableHandle = (Operand) op.input(inputIndex++); + keys = (Operand) op.input(inputIndex++); + defaultValue = (Operand) op.input(inputIndex++); + Tin = op.attributes().getAttrType("Tin"); + Tout = op.attributes().getAttrType("Tout"); + } } } 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 index 3407640cd53..b2297992969 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,43 +17,99 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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. + * The tensor {@code keys} must be of the same type as the keys of the table. + * The tensor {@code values} must be of the type of the table values. */ +@OpMetadata( + opType = LookupTableImport.OP_NAME, + inputsClass = LookupTableImport.Inputs.class +) @Operator -public final class LookupTableImport extends PrimitiveOp { - +public final class LookupTableImport extends RawOp { /** - * Factory method to create a class wrapping a new LookupTableImport operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "LookupTableImportV2"; + + public LookupTableImport(Operation operation) { + super(operation, OP_NAME); + } + + /** + * Factory method to create a class wrapping a new LookupTableImportV2 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")); + @Endpoint( + describeByClass = true + ) + public static LookupTableImport create(Scope scope, Operand tableHandle, + Operand keys, Operand values) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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); + + @OpInputsMetadata( + outputsClass = LookupTableImport.class + ) + public static class Inputs extends RawOpInputs { + /** + * Handle to the table. + */ + public final Operand tableHandle; + + /** + * Any shape. Keys to look up. + */ + public final Operand keys; + + /** + * Values to associate with keys. + */ + public final Operand values; + + /** + * The Tin attribute + */ + public final DataType Tin; + + /** + * The Tout attribute + */ + public final DataType Tout; + + public Inputs(GraphOperation op) { + super(new LookupTableImport(op), op, Arrays.asList("Tin", "Tout")); + int inputIndex = 0; + tableHandle = (Operand) op.input(inputIndex++); + keys = (Operand) op.input(inputIndex++); + values = (Operand) op.input(inputIndex++); + Tin = op.attributes().getAttrType("Tin"); + Tout = op.attributes().getAttrType("Tout"); + } } } 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 index 191501bdd0d..37533b9501d 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,43 +17,99 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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. + * The tensor {@code keys} must be of the same type as the keys of the table. + * The tensor {@code values} must be of the type of the table values. */ +@OpMetadata( + opType = LookupTableInsert.OP_NAME, + inputsClass = LookupTableInsert.Inputs.class +) @Operator -public final class LookupTableInsert extends PrimitiveOp { - +public final class LookupTableInsert extends RawOp { /** - * Factory method to create a class wrapping a new LookupTableInsert operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "LookupTableInsertV2"; + + public LookupTableInsert(Operation operation) { + super(operation, OP_NAME); + } + + /** + * Factory method to create a class wrapping a new LookupTableInsertV2 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")); + @Endpoint( + describeByClass = true + ) + public static LookupTableInsert create(Scope scope, Operand tableHandle, + Operand keys, Operand values) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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); + + @OpInputsMetadata( + outputsClass = LookupTableInsert.class + ) + public static class Inputs extends RawOpInputs { + /** + * Handle to the table. + */ + public final Operand tableHandle; + + /** + * Any shape. Keys to look up. + */ + public final Operand keys; + + /** + * Values to associate with keys. + */ + public final Operand values; + + /** + * The Tin attribute + */ + public final DataType Tin; + + /** + * The Tout attribute + */ + public final DataType Tout; + + public Inputs(GraphOperation op) { + super(new LookupTableInsert(op), op, Arrays.asList("Tin", "Tout")); + int inputIndex = 0; + tableHandle = (Operand) op.input(inputIndex++); + keys = (Operand) op.input(inputIndex++); + values = (Operand) op.input(inputIndex++); + Tin = op.attributes().getAttrType("Tin"); + Tout = op.attributes().getAttrType("Tout"); + } } } 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 index 63347f02411..9d52aae0ff8 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,39 +17,85 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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 + * The tensor {@code 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 { - +@OpMetadata( + opType = LookupTableRemove.OP_NAME, + inputsClass = LookupTableRemove.Inputs.class +) +@Operator +public final class LookupTableRemove extends RawOp { /** - * Factory method to create a class wrapping a new LookupTableRemove operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "LookupTableRemoveV2"; + + public LookupTableRemove(Operation operation) { + super(operation, OP_NAME); + } + + /** + * Factory method to create a class wrapping a new LookupTableRemoveV2 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")); + @Endpoint( + describeByClass = true + ) + public static LookupTableRemove create(Scope scope, Operand tableHandle, + Operand keys) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "LookupTableRemove"); opBuilder.addInput(tableHandle.asOutput()); opBuilder.addInput(keys.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new LookupTableRemove(opBuilder.build()); } - - - private LookupTableRemove(Operation operation) { - super(operation); + + @OpInputsMetadata( + outputsClass = LookupTableRemove.class + ) + public static class Inputs extends RawOpInputs { + /** + * Handle to the table. + */ + public final Operand tableHandle; + + /** + * Any shape. Keys of the elements to remove. + */ + public final Operand keys; + + /** + * The Tin attribute + */ + public final DataType Tin; + + public Inputs(GraphOperation op) { + super(new LookupTableRemove(op), op, Arrays.asList("Tin")); + int inputIndex = 0; + tableHandle = (Operand) op.input(inputIndex++); + keys = (Operand) op.input(inputIndex++); + Tin = op.attributes().getAttrType("Tin"); + } } } 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 index 9516edfbfd6..d5109600e72 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,52 +17,87 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; import org.tensorflow.types.TInt64; +import org.tensorflow.types.family.TType; /** * Computes the number of elements in the given table. */ +@OpMetadata( + opType = LookupTableSize.OP_NAME, + inputsClass = LookupTableSize.Inputs.class +) @Operator -public final class LookupTableSize extends PrimitiveOp implements Operand { - +public final class LookupTableSize extends RawOp implements Operand { /** - * Factory method to create a class wrapping a new LookupTableSize operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "LookupTableSizeV2"; + + private Output output; + + public LookupTableSize(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new LookupTableSizeV2 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")); + @Endpoint( + describeByClass = true + ) + public static LookupTableSize create(Scope scope, Operand tableHandle) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "LookupTableSize"); opBuilder.addInput(tableHandle.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new LookupTableSize(opBuilder.build()); } - + /** + * Gets output. * Scalar that contains number of elements in the table. + * @return output. */ - public Output size() { - return size; + public Output output() { + return output; } - + @Override public Output asOutput() { - return size; + return output; } - - private Output size; - - private LookupTableSize(Operation operation) { - super(operation); - int outputIdx = 0; - size = operation.output(outputIdx++); + + @OpInputsMetadata( + outputsClass = LookupTableSize.class + ) + public static class Inputs extends RawOpInputs { + /** + * Handle to the table. + */ + public final Operand tableHandle; + + public Inputs(GraphOperation op) { + super(new LookupTableSize(op), op, Arrays.asList()); + int inputIndex = 0; + tableHandle = (Operand) op.input(inputIndex++); + } } } 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 index 7a18737817b..a2e558f17a1 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,55 +17,88 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; import org.tensorflow.types.TBool; /** * Forwards the input to the output. - *

* This operator represents the loop termination condition used by the - * "pivot" switches of a loop. + * "pivot" switches of a loop. */ +@OpMetadata( + opType = LoopCond.OP_NAME, + inputsClass = LoopCond.Inputs.class +) @Operator -public final class LoopCond extends PrimitiveOp implements Operand { - +public final class LoopCond extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "LoopCond"; + + private Output output; + + public LoopCond(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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 */ + @Endpoint( + describeByClass = true + ) public static LoopCond create(Scope scope, Operand input) { - OperationBuilder opBuilder = scope.env().opBuilder("LoopCond", scope.makeOpName("LoopCond")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "LoopCond"); opBuilder.addInput(input.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new LoopCond(opBuilder.build()); } - + /** - * The same tensor as `input`. + * Gets output. + * The same tensor as {@code input}. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = LoopCond.class + ) + public static class Inputs extends RawOpInputs { + /** + * A boolean scalar, representing the branch predicate of the Switch op. + */ + public final Operand input; + + public Inputs(GraphOperation op) { + super(new LoopCond(op), op, Arrays.asList()); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + } } } 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 index 43c7177dc54..2a4b761a8fd 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,93 +17,150 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 + * {@code np.searchsorted(sorted_inputs, values, side='left')}. + *

The result is not a global index to the entire + * {@code 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]] */ -public final class LowerBound extends PrimitiveOp implements Operand { - +@OpMetadata( + opType = LowerBound.OP_NAME, + inputsClass = LowerBound.Inputs.class +) +@Operator +public final class LowerBound extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "LowerBound"; + + private Output output; + + public LowerBound(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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 + * @param values 2-D Tensor with the same numbers of rows as {@code sorted_search_values}. Contains + * the values that will be searched for in {@code sorted_search_values}. + * @param outType The value of the outType attribute + * @param data type for {@code LowerBound} output and operands + * @param data type for {@code LowerBound} output and operands * @return a new instance of LowerBound */ - public static LowerBound create(Scope scope, Operand sortedInputs, Operand values, DataType outType) { - OperationBuilder opBuilder = scope.env().opBuilder("LowerBound", scope.makeOpName("LowerBound")); + @Endpoint( + describeByClass = true + ) + public static LowerBound create(Scope scope, + Operand sortedInputs, Operand values, Class outType) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "LowerBound"); opBuilder.addInput(sortedInputs.asOutput()); opBuilder.addInput(values.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("out_type", outType); - return new LowerBound(opBuilder.build()); + opBuilder.setAttr("out_type", Operands.toDataType(outType)); + return new LowerBound<>(opBuilder.build()); } - + /** - * Factory method to create a class wrapping a new LowerBound operation using default output types. - * + * Factory method to create a class wrapping a new LowerBound operation, with the 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 + * @param values 2-D Tensor with the same numbers of rows as {@code sorted_search_values}. Contains + * the values that will be searched for in {@code sorted_search_values}. + * @param data type for {@code LowerBound} output and operands + * @return a new instance of LowerBound, with default output types */ - public static LowerBound create(Scope scope, Operand sortedInputs, Operand values) { - return create(scope, sortedInputs, values, TInt32.DTYPE); + @Endpoint( + describeByClass = true + ) + public static LowerBound create(Scope scope, Operand sortedInputs, + Operand values) { + return create(scope, sortedInputs, values, TInt32.class); } - + /** - * A `Tensor` with the same shape as `values`. It contains the first scalar index + * Gets output. + * A {@code Tensor} with the same shape as {@code values}. It contains the first scalar index * into the last dimension where values can be inserted without changing the * ordered property. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = LowerBound.class + ) + public static class Inputs extends RawOpInputs> { + /** + * 2-D Tensor where each row is ordered. + */ + public final Operand sortedInputs; + + /** + * 2-D Tensor with the same numbers of rows as {@code sorted_search_values}. Contains + * the values that will be searched for in {@code sorted_search_values}. + */ + public final Operand values; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The outType attribute + */ + public final DataType outType; + + public Inputs(GraphOperation op) { + super(new LowerBound<>(op), op, Arrays.asList("T", "out_type")); + int inputIndex = 0; + sortedInputs = (Operand) op.input(inputIndex++); + values = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + outType = op.attributes().getAttrType("out_type"); + } } } 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 deleted file mode 100644 index d62605e5667..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Lu.java +++ /dev/null @@ -1,120 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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; -import org.tensorflow.types.TInt32; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType outputIdxType) { - OperationBuilder opBuilder = scope.env().opBuilder("Lu", scope.makeOpName("Lu")); - opBuilder.addInput(input.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("output_idx_type", 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, TInt32.DTYPE); - } - - /** - * 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/MakeUnique.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MakeUnique.java new file mode 100644 index 00000000000..a769abd1d5a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MakeUnique.java @@ -0,0 +1,106 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.TFloat32; + +/** + * Make all elements in the non-Batch dimension unique, but "close" to + * their initial value. Never returns a sub-normal number. Never returns + * zero. The sign of each input element is always identical to the sign + * of the corresponding output element. Behavior for infinite elements is + * undefined. Behavior for subnormal elements is undefined. + */ +@OpMetadata( + opType = MakeUnique.OP_NAME, + inputsClass = MakeUnique.Inputs.class +) +@Operator +public final class MakeUnique extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "MakeUnique"; + + private Output output; + + public MakeUnique(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new MakeUnique operation. + * + * @param scope current scope + * @param input The input value + * @return a new instance of MakeUnique + */ + @Endpoint( + describeByClass = true + ) + public static MakeUnique create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "MakeUnique"); + opBuilder.addInput(input.asOutput()); + return new MakeUnique(opBuilder.build()); + } + + /** + * Gets output. + * + * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + @OpInputsMetadata( + outputsClass = MakeUnique.class + ) + public static class Inputs extends RawOpInputs { + /** + * The input input + */ + public final Operand input; + + public Inputs(GraphOperation op) { + super(new MakeUnique(op), op, Arrays.asList()); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + } + } +} 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 index df9044b1fa9..ddde416f94f 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,82 +17,55 @@ package org.tensorflow.op.core; +import java.util.Arrays; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.GraphOperation; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; /** * Op removes all elements in the underlying container. */ +@OpMetadata( + opType = MapClear.OP_NAME, + inputsClass = MapClear.Inputs.class +) @Operator -public final class MapClear extends PrimitiveOp { - +public final class MapClear extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.MapClear} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "MapClear"; + + public MapClear(Operation operation) { + super(operation, OP_NAME); } - + /** * Factory method to create a class wrapping a new MapClear operation. - * + * * @param scope current scope - * @param dtypes - * @param options carries optional attributes values + * @param dtypes The value of the dtypes attribute + * @param options carries optional attribute 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] = dtypes.get(i); - } - opBuilder.setAttr("dtypes", dtypesArray); + @Endpoint( + describeByClass = true + ) + public static MapClear create(Scope scope, List> dtypes, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "MapClear"); + opBuilder.setAttr("dtypes", Operands.toDataTypes(dtypes)); if (options != null) { for (Options opts : options) { if (opts.capacity != null) { @@ -111,37 +84,144 @@ public static MapClear create(Scope scope, List> dtypes, Options... } return new MapClear(opBuilder.build()); } - + /** - * @param capacity + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. */ public static Options capacity(Long capacity) { return new Options().capacity(capacity); } - + /** - * @param memoryLimit + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. */ public static Options memoryLimit(Long memoryLimit) { return new Options().memoryLimit(memoryLimit); } - + /** - * @param container + * Sets the container option. + * + * @param container the container option + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** - * @param sharedName + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - - - private MapClear(Operation operation) { - super(operation); + + /** + * Optional attributes for {@link org.tensorflow.op.core.MapClear} + */ + public static class Options { + private Long capacity; + + private Long memoryLimit; + + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * Sets the container option. + * + * @param container the container option + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = MapClear.class + ) + public static class Inputs extends RawOpInputs { + /** + * The capacity attribute + */ + public final long capacity; + + /** + * The memoryLimit attribute + */ + public final long memoryLimit; + + /** + * The dtypes attribute + */ + public final DataType[] dtypes; + + /** + * The container attribute + */ + public final String container; + + /** + * The sharedName attribute + */ + public final String sharedName; + + public Inputs(GraphOperation op) { + super(new MapClear(op), op, Arrays.asList("capacity", "memory_limit", "dtypes", "container", "shared_name")); + int inputIndex = 0; + capacity = op.attributes().getAttrInt("capacity"); + memoryLimit = op.attributes().getAttrInt("memory_limit"); + dtypes = op.attributes().getAttrTypeList("dtypes"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapDefun.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapDefun.java new file mode 100644 index 00000000000..5c91ffea662 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MapDefun.java @@ -0,0 +1,230 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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.ConcreteFunction; +import org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * Maps a function on the list of tensors unpacked from arguments on dimension 0. + * The function given by {@code f} is assumed to be stateless, and is executed + * concurrently on all the slices; up to batch_size (i.e. the size of the 0th + * dimension of each argument) functions will be scheduled at once. + *

The {@code max_intra_op_parallelism} attr, which defaults to 1, can be used to + * limit the intra op parallelism. To limit inter-op parallelism, a user can + * set a private threadpool on the dataset using {@code tf.data.Options}'s + * {@code ThreadingOptions}. + *

Note that this op is not exposed to users directly, but is invoked in tf.data + * rewrites. + */ +@OpMetadata( + opType = MapDefun.OP_NAME, + inputsClass = MapDefun.Inputs.class +) +@Operator +public final class MapDefun extends RawOp implements Iterable> { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "MapDefun"; + + private List> output; + + @SuppressWarnings("unchecked") + public MapDefun(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int outputLength = operation.outputListLength("output"); + output = Arrays.asList(operation.outputList(outputIdx, outputLength)); + outputIdx += outputLength; + } + + /** + * Factory method to create a class wrapping a new MapDefun operation. + * + * @param scope current scope + * @param arguments

+   * A list of tensors whose types are `Targuments`, corresponding to the inputs
+   * the function should be mapped over.
+   * 
+ * @param capturedInputs
+   * A list of tensors whose types are `Tcaptured`, corresponding to the captured
+   * inputs of the defun.
+   * 
+ * @param outputTypes A list of types. + * @param outputShapes A list of shapes. + * @param f The value of the f attribute + * @param options carries optional attribute values + * @return a new instance of MapDefun + */ + @Endpoint( + describeByClass = true + ) + public static MapDefun create(Scope scope, Iterable> arguments, + Iterable> capturedInputs, List> outputTypes, + List outputShapes, ConcreteFunction f, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "MapDefun"); + opBuilder.addInputList(Operands.asOutputs(arguments)); + opBuilder.addInputList(Operands.asOutputs(capturedInputs)); + opBuilder.setAttr("output_types", Operands.toDataTypes(outputTypes)); + Shape[] outputShapesArray = new Shape[outputShapes.size()]; + for (int i = 0 ; i < outputShapesArray.length ; i++) { + outputShapesArray[i] = outputShapes.get(i); + } + opBuilder.setAttr("output_shapes", outputShapesArray); + opBuilder.setAttr("f", f); + if (options != null) { + for (Options opts : options) { + if (opts.maxIntraOpParallelism != null) { + opBuilder.setAttr("max_intra_op_parallelism", opts.maxIntraOpParallelism); + } + } + } + return new MapDefun(opBuilder.build()); + } + + /** + * Sets the maxIntraOpParallelism option. + * + * @param maxIntraOpParallelism the maxIntraOpParallelism option + * @return this Options instance. + */ + public static Options maxIntraOpParallelism(Long maxIntraOpParallelism) { + return new Options().maxIntraOpParallelism(maxIntraOpParallelism); + } + + /** + * Gets output. + *
+   * A list of output tensors whose types are `output_types` and whose dimensions
+   * 0 are the same as the dimensions 0 of the tensors in `arguments`, and whose
+   * remaining dimensions correspond to those in `output_shapes`.
+   * 
+ * @return output. + */ + public List> output() { + return output; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) output.iterator(); + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.MapDefun} + */ + public static class Options { + private Long maxIntraOpParallelism; + + private Options() { + } + + /** + * Sets the maxIntraOpParallelism option. + * + * @param maxIntraOpParallelism the maxIntraOpParallelism option + * @return this Options instance. + */ + public Options maxIntraOpParallelism(Long maxIntraOpParallelism) { + this.maxIntraOpParallelism = maxIntraOpParallelism; + return this; + } + } + + @OpInputsMetadata( + outputsClass = MapDefun.class + ) + public static class Inputs extends RawOpInputs { + /** + *
+     * A list of tensors whose types are `Targuments`, corresponding to the inputs
+     * the function should be mapped over.
+     * 
+ */ + public final Iterable> arguments; + + /** + *
+     * A list of tensors whose types are `Tcaptured`, corresponding to the captured
+     * inputs of the defun.
+     * 
+ */ + public final Iterable> capturedInputs; + + /** + * A list of types. + */ + public final DataType[] Targuments; + + /** + * A list of types. + */ + public final DataType[] Tcaptured; + + /** + * A list of types. + */ + public final DataType[] outputTypes; + + /** + * A list of shapes. + */ + public final Shape[] outputShapes; + + /** + * The maxIntraOpParallelism attribute + */ + public final long maxIntraOpParallelism; + + public Inputs(GraphOperation op) { + super(new MapDefun(op), op, Arrays.asList("Targuments", "Tcaptured", "output_types", "output_shapes", "max_intra_op_parallelism")); + int inputIndex = 0; + int argumentsLength = op.inputListLength("arguments"); + arguments = Arrays.asList((Operand[]) op.inputList(inputIndex, argumentsLength)); + inputIndex += argumentsLength; + int capturedInputsLength = op.inputListLength("captured_inputs"); + capturedInputs = Arrays.asList((Operand[]) op.inputList(inputIndex, capturedInputsLength)); + inputIndex += capturedInputsLength; + Targuments = op.attributes().getAttrTypeList("Targuments"); + Tcaptured = op.attributes().getAttrTypeList("Tcaptured"); + outputTypes = op.attributes().getAttrTypeList("output_types"); + outputShapes = op.attributes().getAttrShapeList("output_shapes"); + maxIntraOpParallelism = op.attributes().getAttrInt("max_intra_op_parallelism"); + } + } +} 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 index 07f086fbd68..5229601cc82 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,85 +17,62 @@ package org.tensorflow.op.core; +import java.util.Arrays; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TType; /** * Op returns the number of incomplete elements in the underlying container. */ +@OpMetadata( + opType = MapIncompleteSize.OP_NAME, + inputsClass = MapIncompleteSize.Inputs.class +) @Operator -public final class MapIncompleteSize extends PrimitiveOp implements Operand { - +public final class MapIncompleteSize extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.MapIncompleteSize} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "MapIncompleteSize"; + + private Output output; + + public MapIncompleteSize(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * Factory method to create a class wrapping a new MapIncompleteSize operation. - * + * * @param scope current scope - * @param dtypes - * @param options carries optional attributes values + * @param dtypes The value of the dtypes attribute + * @param options carries optional attribute 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] = dtypes.get(i); - } - opBuilder.setAttr("dtypes", dtypesArray); + @Endpoint( + describeByClass = true + ) + public static MapIncompleteSize create(Scope scope, List> dtypes, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "MapIncompleteSize"); + opBuilder.setAttr("dtypes", Operands.toDataTypes(dtypes)); if (options != null) { for (Options opts : options) { if (opts.capacity != null) { @@ -114,51 +91,158 @@ public static MapIncompleteSize create(Scope scope, List> dtypes, Op } return new MapIncompleteSize(opBuilder.build()); } - + /** - * @param capacity + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. */ public static Options capacity(Long capacity) { return new Options().capacity(capacity); } - + /** - * @param memoryLimit + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. */ public static Options memoryLimit(Long memoryLimit) { return new Options().memoryLimit(memoryLimit); } - + /** - * @param container + * Sets the container option. + * + * @param container the container option + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** - * @param sharedName + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - + /** + * Gets output. + * + * @return output. */ - public Output size() { - return size; + public Output output() { + return output; } - + @Override public Output asOutput() { - return size; + return output; } - - private Output size; - - private MapIncompleteSize(Operation operation) { - super(operation); - int outputIdx = 0; - size = operation.output(outputIdx++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.MapIncompleteSize} + */ + public static class Options { + private Long capacity; + + private Long memoryLimit; + + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * Sets the container option. + * + * @param container the container option + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = MapIncompleteSize.class + ) + public static class Inputs extends RawOpInputs { + /** + * The capacity attribute + */ + public final long capacity; + + /** + * The memoryLimit attribute + */ + public final long memoryLimit; + + /** + * The dtypes attribute + */ + public final DataType[] dtypes; + + /** + * The container attribute + */ + public final String container; + + /** + * The sharedName attribute + */ + public final String sharedName; + + public Inputs(GraphOperation op) { + super(new MapIncompleteSize(op), op, Arrays.asList("capacity", "memory_limit", "dtypes", "container", "shared_name")); + int inputIndex = 0; + capacity = op.attributes().getAttrInt("capacity"); + memoryLimit = op.attributes().getAttrInt("memory_limit"); + dtypes = op.attributes().getAttrTypeList("dtypes"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + } } } 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 index 96b7a8c52b6..1c97902548a 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,93 +20,70 @@ import java.util.Arrays; import java.util.Iterator; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.TInt64; import org.tensorflow.types.family.TType; /** * 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. */ +@OpMetadata( + opType = MapPeek.OP_NAME, + inputsClass = MapPeek.Inputs.class +) @Operator -public final class MapPeek extends PrimitiveOp implements Iterable> { - +public final class MapPeek extends RawOp implements Iterable> { /** - * Optional attributes for {@link org.tensorflow.op.core.MapPeek} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "MapPeek"; + + private List> values; + + @SuppressWarnings("unchecked") + public MapPeek(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int valuesLength = operation.outputListLength("values"); + values = Arrays.asList(operation.outputList(outputIdx, valuesLength)); + outputIdx += valuesLength; } - + /** * 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 + * @param key The key value + * @param indices The indices value + * @param dtypes The value of the dtypes attribute + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static MapPeek create(Scope scope, Operand key, Operand indices, + List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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] = dtypes.get(i); - } - opBuilder.setAttr("dtypes", dtypesArray); + opBuilder.setAttr("dtypes", Operands.toDataTypes(dtypes)); if (options != null) { for (Options opts : options) { if (opts.capacity != null) { @@ -125,54 +102,171 @@ public static MapPeek create(Scope scope, Operand key, Operand i } return new MapPeek(opBuilder.build()); } - + /** - * @param capacity + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. */ public static Options capacity(Long capacity) { return new Options().capacity(capacity); } - + /** - * @param memoryLimit + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. */ public static Options memoryLimit(Long memoryLimit) { return new Options().memoryLimit(memoryLimit); } - + /** - * @param container + * Sets the container option. + * + * @param container the container option + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** - * @param sharedName + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - + /** + * Gets values. + * + * @return values. */ 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; + + /** + * Optional attributes for {@link org.tensorflow.op.core.MapPeek} + */ + public static class Options { + private Long capacity; + + private Long memoryLimit; + + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * Sets the container option. + * + * @param container the container option + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = MapPeek.class + ) + public static class Inputs extends RawOpInputs { + /** + * The key input + */ + public final Operand key; + + /** + * The indices input + */ + public final Operand indices; + + /** + * The capacity attribute + */ + public final long capacity; + + /** + * The memoryLimit attribute + */ + public final long memoryLimit; + + /** + * The dtypes attribute + */ + public final DataType[] dtypes; + + /** + * The container attribute + */ + public final String container; + + /** + * The sharedName attribute + */ + public final String sharedName; + + public Inputs(GraphOperation op) { + super(new MapPeek(op), op, Arrays.asList("capacity", "memory_limit", "dtypes", "container", "shared_name")); + int inputIndex = 0; + key = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + capacity = op.attributes().getAttrInt("capacity"); + memoryLimit = op.attributes().getAttrInt("memory_limit"); + dtypes = op.attributes().getAttrTypeList("dtypes"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + } } } 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 index 44b4aacdba4..b1ccfb83c75 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,85 +17,62 @@ package org.tensorflow.op.core; +import java.util.Arrays; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TType; /** * Op returns the number of elements in the underlying container. */ +@OpMetadata( + opType = MapSize.OP_NAME, + inputsClass = MapSize.Inputs.class +) @Operator -public final class MapSize extends PrimitiveOp implements Operand { - +public final class MapSize extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.MapSize} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "MapSize"; + + private Output output; + + public MapSize(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * Factory method to create a class wrapping a new MapSize operation. - * + * * @param scope current scope - * @param dtypes - * @param options carries optional attributes values + * @param dtypes The value of the dtypes attribute + * @param options carries optional attribute 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] = dtypes.get(i); - } - opBuilder.setAttr("dtypes", dtypesArray); + @Endpoint( + describeByClass = true + ) + public static MapSize create(Scope scope, List> dtypes, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "MapSize"); + opBuilder.setAttr("dtypes", Operands.toDataTypes(dtypes)); if (options != null) { for (Options opts : options) { if (opts.capacity != null) { @@ -114,51 +91,158 @@ public static MapSize create(Scope scope, List> dtypes, Options... o } return new MapSize(opBuilder.build()); } - + /** - * @param capacity + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. */ public static Options capacity(Long capacity) { return new Options().capacity(capacity); } - + /** - * @param memoryLimit + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. */ public static Options memoryLimit(Long memoryLimit) { return new Options().memoryLimit(memoryLimit); } - + /** - * @param container + * Sets the container option. + * + * @param container the container option + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** - * @param sharedName + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - + /** + * Gets output. + * + * @return output. */ - public Output size() { - return size; + public Output output() { + return output; } - + @Override public Output asOutput() { - return size; + return output; } - - private Output size; - - private MapSize(Operation operation) { - super(operation); - int outputIdx = 0; - size = operation.output(outputIdx++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.MapSize} + */ + public static class Options { + private Long capacity; + + private Long memoryLimit; + + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * Sets the container option. + * + * @param container the container option + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = MapSize.class + ) + public static class Inputs extends RawOpInputs { + /** + * The capacity attribute + */ + public final long capacity; + + /** + * The memoryLimit attribute + */ + public final long memoryLimit; + + /** + * The dtypes attribute + */ + public final DataType[] dtypes; + + /** + * The container attribute + */ + public final String container; + + /** + * The sharedName attribute + */ + public final String sharedName; + + public Inputs(GraphOperation op) { + super(new MapSize(op), op, Arrays.asList("capacity", "memory_limit", "dtypes", "container", "shared_name")); + int inputIndex = 0; + capacity = op.attributes().getAttrInt("capacity"); + memoryLimit = op.attributes().getAttrInt("memory_limit"); + dtypes = op.attributes().getAttrTypeList("dtypes"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + } } } 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 index 6b51660063c..19d9c0e99f9 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,95 +17,65 @@ package org.tensorflow.op.core; +import java.util.Arrays; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.GraphOperation; 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.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.TInt64; +import org.tensorflow.types.family.TType; /** * Stage (key, values) in the underlying container which behaves like a hashtable. */ +@OpMetadata( + opType = MapStage.OP_NAME, + inputsClass = MapStage.Inputs.class +) @Operator -public final class MapStage extends PrimitiveOp { - +public final class MapStage extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.MapStage} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "MapStage"; + + public MapStage(Operation operation) { + super(operation, OP_NAME); } - + /** * Factory method to create a class wrapping a new MapStage operation. - * + * * @param scope current scope * @param key int64 - * @param indices + * @param indices The indices value * @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 + * @param dtypes The value of the dtypes attribute + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static MapStage create(Scope scope, Operand key, Operand indices, + Iterable> values, List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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] = dtypes.get(i); - } - opBuilder.setAttr("dtypes", dtypesArray); + opBuilder.setAttr("dtypes", Operands.toDataTypes(dtypes)); if (options != null) { for (Options opts : options) { if (opts.capacity != null) { @@ -124,39 +94,177 @@ public static MapStage create(Scope scope, Operand key, Operand } return new MapStage(opBuilder.build()); } - + /** - * @param capacity Maximum number of elements in the Staging Area. If > 0, inserts + * Sets the capacity option. + * + * @param capacity Maximum number of elements in the Staging Area. If > 0, inserts * on the container will block when the capacity is reached. + * @return this Options instance. */ public static Options capacity(Long capacity) { return new Options().capacity(capacity); } - + /** - * @param memoryLimit + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. */ public static Options memoryLimit(Long memoryLimit) { return new Options().memoryLimit(memoryLimit); } - + /** + * Sets the container option. + * * @param container If non-empty, this queue is placed in the given container. Otherwise, * a default container is used. + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** + * Sets the sharedName option. + * * @param sharedName It is necessary to match this name to the matching Unstage Op. + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - - - private MapStage(Operation operation) { - super(operation); + + /** + * Optional attributes for {@link org.tensorflow.op.core.MapStage} + */ + public static class Options { + private Long capacity; + + private Long memoryLimit; + + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the capacity option. + * + * @param capacity Maximum number of elements in the Staging Area. If > 0, inserts + * on the container will block when the capacity is reached. + * @return this Options instance. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * Sets the container option. + * + * @param container If non-empty, this queue is placed in the given container. Otherwise, + * a default container is used. + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName It is necessary to match this name to the matching Unstage Op. + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = MapStage.class + ) + public static class Inputs extends RawOpInputs { + /** + * int64 + */ + public final Operand key; + + /** + * The indices input + */ + public final Operand indices; + + /** + * a list of tensors + * dtypes A list of data types that inserted values should adhere to. + */ + public final Iterable> values; + + /** + * Maximum number of elements in the Staging Area. If > 0, inserts + * on the container will block when the capacity is reached. + */ + public final long capacity; + + /** + * The memoryLimit attribute + */ + public final long memoryLimit; + + /** + * The dtypes attribute + */ + public final DataType[] dtypes; + + /** + * The fakeDtypes attribute + */ + public final DataType[] fakeDtypes; + + /** + * If non-empty, this queue is placed in the given container. Otherwise, + * a default container is used. + */ + public final String container; + + /** + * It is necessary to match this name to the matching Unstage Op. + */ + public final String sharedName; + + public Inputs(GraphOperation op) { + super(new MapStage(op), op, Arrays.asList("capacity", "memory_limit", "dtypes", "fake_dtypes", "container", "shared_name")); + int inputIndex = 0; + key = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + int valuesLength = op.inputListLength("values"); + values = Arrays.asList((Operand[]) op.inputList(inputIndex, valuesLength)); + inputIndex += valuesLength; + capacity = op.attributes().getAttrInt("capacity"); + memoryLimit = op.attributes().getAttrInt("memory_limit"); + dtypes = op.attributes().getAttrTypeList("dtypes"); + fakeDtypes = op.attributes().getAttrTypeList("fake_dtypes"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + } } } 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 index 8659a5a63c1..f96989e592e 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,93 +20,70 @@ import java.util.Arrays; import java.util.Iterator; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.TInt64; import org.tensorflow.types.family.TType; /** * 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. */ +@OpMetadata( + opType = MapUnstage.OP_NAME, + inputsClass = MapUnstage.Inputs.class +) @Operator -public final class MapUnstage extends PrimitiveOp implements Iterable> { - +public final class MapUnstage extends RawOp implements Iterable> { /** - * Optional attributes for {@link org.tensorflow.op.core.MapUnstage} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "MapUnstage"; + + private List> values; + + @SuppressWarnings("unchecked") + public MapUnstage(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int valuesLength = operation.outputListLength("values"); + values = Arrays.asList(operation.outputList(outputIdx, valuesLength)); + outputIdx += valuesLength; } - + /** * 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 + * @param key The key value + * @param indices The indices value + * @param dtypes The value of the dtypes attribute + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static MapUnstage create(Scope scope, Operand key, Operand indices, + List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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] = dtypes.get(i); - } - opBuilder.setAttr("dtypes", dtypesArray); + opBuilder.setAttr("dtypes", Operands.toDataTypes(dtypes)); if (options != null) { for (Options opts : options) { if (opts.capacity != null) { @@ -125,54 +102,171 @@ public static MapUnstage create(Scope scope, Operand key, Operand> 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; + + /** + * Optional attributes for {@link org.tensorflow.op.core.MapUnstage} + */ + public static class Options { + private Long capacity; + + private Long memoryLimit; + + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * Sets the container option. + * + * @param container the container option + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = MapUnstage.class + ) + public static class Inputs extends RawOpInputs { + /** + * The key input + */ + public final Operand key; + + /** + * The indices input + */ + public final Operand indices; + + /** + * The capacity attribute + */ + public final long capacity; + + /** + * The memoryLimit attribute + */ + public final long memoryLimit; + + /** + * The dtypes attribute + */ + public final DataType[] dtypes; + + /** + * The container attribute + */ + public final String container; + + /** + * The sharedName attribute + */ + public final String sharedName; + + public Inputs(GraphOperation op) { + super(new MapUnstage(op), op, Arrays.asList("capacity", "memory_limit", "dtypes", "container", "shared_name")); + int inputIndex = 0; + key = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + capacity = op.attributes().getAttrInt("capacity"); + memoryLimit = op.attributes().getAttrInt("memory_limit"); + dtypes = op.attributes().getAttrTypeList("dtypes"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + } } } 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 index 9e95fd7a736..7126cc62c2e 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,90 +19,71 @@ import java.util.Arrays; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.TInt64; +import org.tensorflow.types.family.TType; /** * 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. */ +@OpMetadata( + opType = MapUnstageNoKey.OP_NAME, + inputsClass = MapUnstageNoKey.Inputs.class +) @Operator -public final class MapUnstageNoKey extends PrimitiveOp { - +public final class MapUnstageNoKey extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.MapUnstageNoKey} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "MapUnstageNoKey"; + + private Output key; + + private List> values; + + @SuppressWarnings("unchecked") + public MapUnstageNoKey(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + key = operation.output(outputIdx++); + int valuesLength = operation.outputListLength("values"); + values = Arrays.asList(operation.outputList(outputIdx, valuesLength)); + outputIdx += valuesLength; } - + /** * 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 + * @param indices The indices value + * @param dtypes The value of the dtypes attribute + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static MapUnstageNoKey create(Scope scope, Operand indices, + List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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] = dtypes.get(i); - } - opBuilder.setAttr("dtypes", dtypesArray); + opBuilder.setAttr("dtypes", Operands.toDataTypes(dtypes)); if (options != null) { for (Options opts : options) { if (opts.capacity != null) { @@ -121,56 +102,168 @@ public static MapUnstageNoKey create(Scope scope, Operand indices, List< } return new MapUnstageNoKey(opBuilder.build()); } - + /** - * @param capacity + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. */ public static Options capacity(Long capacity) { return new Options().capacity(capacity); } - + /** - * @param memoryLimit + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. */ public static Options memoryLimit(Long memoryLimit) { return new Options().memoryLimit(memoryLimit); } - + /** - * @param container + * Sets the container option. + * + * @param container the container option + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** - * @param sharedName + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - + /** + * Gets key. + * + * @return key. */ public Output key() { return key; } - + /** + * Gets values. + * + * @return values. */ 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; + + /** + * Optional attributes for {@link org.tensorflow.op.core.MapUnstageNoKey} + */ + public static class Options { + private Long capacity; + + private Long memoryLimit; + + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * Sets the container option. + * + * @param container the container option + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = MapUnstageNoKey.class + ) + public static class Inputs extends RawOpInputs { + /** + * The indices input + */ + public final Operand indices; + + /** + * The capacity attribute + */ + public final long capacity; + + /** + * The memoryLimit attribute + */ + public final long memoryLimit; + + /** + * The dtypes attribute + */ + public final DataType[] dtypes; + + /** + * The container attribute + */ + public final String container; + + /** + * The sharedName attribute + */ + public final String sharedName; + + public Inputs(GraphOperation op) { + super(new MapUnstageNoKey(op), op, Arrays.asList("capacity", "memory_limit", "dtypes", "container", "shared_name")); + int inputIndex = 0; + indices = (Operand) op.input(inputIndex++); + capacity = op.attributes().getAttrInt("capacity"); + memoryLimit = op.attributes().getAttrInt("memory_limit"); + dtypes = op.attributes().getAttrTypeList("dtypes"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + } } } 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 deleted file mode 100644 index d54ecc0b782..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MatrixDiagPartV2.java +++ /dev/null @@ -1,146 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.TInt32; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index fcf022950c3..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MatrixDiagV2.java +++ /dev/null @@ -1,172 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.TInt32; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index be4f49924b3..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MatrixSetDiagV2.java +++ /dev/null @@ -1,148 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.TInt32; -import org.tensorflow.types.family.TType; - -/** - * 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 index d1e723e30a8..04c4f1481d3 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,63 +17,67 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** * 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 + * Reduces {@code input} along the dimensions given in {@code axis}. Unless + * {@code keep_dims} is true, the rank of the tensor is reduced by 1 for each entry in + * {@code axis}. If {@code keep_dims} is true, the reduced dimensions are * retained with length 1. - * - * @param data type for {@code output()} output */ +@OpMetadata( + opType = Max.OP_NAME, + inputsClass = Max.Inputs.class +) @Operator -public final class Max extends PrimitiveOp implements Operand { - +public final class Max extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.Max} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Max"; + + private Output output; + + public Max(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * 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 + * {@code [-rank(input), rank(input))}. + * @param options carries optional attribute values + * @param data type for {@code Max} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static Max create(Scope scope, Operand input, + Operand axis, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Max"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.keepDims != null) { @@ -81,33 +85,92 @@ public static Max create(Scope scope, Op } } } - return new Max(opBuilder.build()); + return new Max<>(opBuilder.build()); } - + /** + * Sets the keepDims option. + * * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. */ public static Options keepDims(Boolean keepDims) { return new Options().keepDims(keepDims); } - + /** + * Gets output. * The reduced tensor. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.Max} + */ + public static class Options { + private Boolean keepDims; + + private Options() { + } + + /** + * Sets the keepDims option. + * + * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Max.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensor to reduce. + */ + public final Operand input; + + /** + * The dimensions to reduce. Must be in the range + * {@code [-rank(input), rank(input))}. + */ + public final Operand axis; + + /** + * If true, retain reduced dimensions with length 1. + */ + public final boolean keepDims; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tidx attribute + */ + public final DataType Tidx; + + public Inputs(GraphOperation op) { + super(new Max<>(op), op, Arrays.asList("keep_dims", "T", "Tidx")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + axis = (Operand) op.input(inputIndex++); + keepDims = op.attributes().getAttrBool("keep_dims"); + T = op.attributes().getAttrType("T"); + Tidx = op.attributes().getAttrType("Tidx"); + } } } 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 deleted file mode 100644 index 0acc24c91e7..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MaxIntraOpParallelismDataset.java +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 index 7c9f7248cfc..f5a189c9c58 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,66 +17,109 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; 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.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** - * 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 + * Forwards the value of an available tensor from {@code inputs} to {@code output}. + * {@code Merge} waits for at least one of the tensors in {@code inputs} to become available. + * It is usually combined with {@code Switch} to implement branching. + *

{@code Merge} forwards the first tensor to become available to {@code output}, and sets + * {@code value_index} to its index in {@code inputs}. */ +@OpMetadata( + opType = Merge.OP_NAME, + inputsClass = Merge.Inputs.class +) @Operator -public final class Merge extends PrimitiveOp { - +public final class Merge extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Merge"; + + private Output output; + + private Output valueIndex; + + public Merge(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + valueIndex = operation.output(outputIdx++); + } + /** * 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. + * @param data type for {@code Merge} output and operands * @return a new instance of Merge */ + @Endpoint( + describeByClass = true + ) public static Merge create(Scope scope, Iterable> inputs) { - OperationBuilder opBuilder = scope.env().opBuilder("Merge", scope.makeOpName("Merge")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Merge"); opBuilder.addInputList(Operands.asOutputs(inputs)); - opBuilder = scope.applyControlDependencies(opBuilder); - return new Merge(opBuilder.build()); + return new Merge<>(opBuilder.build()); } - + /** + * Gets output. * Will be set to the available input tensor. + * @return output. */ public Output output() { return output; } - + /** - * The index of the chosen input tensor in `inputs`. + * Gets valueIndex. + * The index of the chosen input tensor in {@code inputs}. + * @return valueIndex. */ 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++); + + @OpInputsMetadata( + outputsClass = Merge.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input tensors, exactly one of which will become available. + */ + public final Iterable> inputs; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new Merge<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + int inputsLength = op.inputListLength("inputs"); + inputs = Arrays.asList((Operand[]) op.inputList(inputIndex, inputsLength)); + inputIndex += inputsLength; + T = op.attributes().getAttrType("T"); + } } } 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 index 3b37c6ca1c9..89ac31b5854 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,63 +17,67 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** * 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 + * Reduces {@code input} along the dimensions given in {@code axis}. Unless + * {@code keep_dims} is true, the rank of the tensor is reduced by 1 for each entry in + * {@code axis}. If {@code keep_dims} is true, the reduced dimensions are * retained with length 1. - * - * @param data type for {@code output()} output */ +@OpMetadata( + opType = Min.OP_NAME, + inputsClass = Min.Inputs.class +) @Operator -public final class Min extends PrimitiveOp implements Operand { - +public final class Min extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.Min} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Min"; + + private Output output; + + public Min(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * 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 + * {@code [-rank(input), rank(input))}. + * @param options carries optional attribute values + * @param data type for {@code Min} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static Min create(Scope scope, Operand input, + Operand axis, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Min"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.keepDims != null) { @@ -81,33 +85,92 @@ public static Min create(Scope scope, Op } } } - return new Min(opBuilder.build()); + return new Min<>(opBuilder.build()); } - + /** + * Sets the keepDims option. + * * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. */ public static Options keepDims(Boolean keepDims) { return new Options().keepDims(keepDims); } - + /** + * Gets output. * The reduced tensor. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.Min} + */ + public static class Options { + private Boolean keepDims; + + private Options() { + } + + /** + * Sets the keepDims option. + * + * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Min.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensor to reduce. + */ + public final Operand input; + + /** + * The dimensions to reduce. Must be in the range + * {@code [-rank(input), rank(input))}. + */ + public final Operand axis; + + /** + * If true, retain reduced dimensions with length 1. + */ + public final boolean keepDims; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tidx attribute + */ + public final DataType Tidx; + + public Inputs(GraphOperation op) { + super(new Min<>(op), op, Arrays.asList("keep_dims", "T", "Tidx")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + axis = (Operand) op.input(inputIndex++); + keepDims = op.attributes().getAttrBool("keep_dims"); + T = op.attributes().getAttrType("T"); + Tidx = op.attributes().getAttrType("Tidx"); + } } } 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 index 8787017151c..751bec8fd66 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,90 +17,149 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 + * This operation pads a {@code input} with mirrored values according to the {@code paddings} + * you specify. {@code paddings} is an integer tensor with shape {@code [n, 2]}, where n is + * the rank of {@code input}. For each dimension D of {@code input}, {@code paddings[D, 0]} indicates + * how many values to add before the contents of {@code input} in that dimension, and + * {@code paddings[D, 1]} indicates how many values to add after the contents of {@code input} + * in that dimension. Both {@code paddings[D, 0]} and {@code paddings[D, 1]} must be no greater + * than {@code input.dim_size(D)} (or {@code input.dim_size(D) - 1}) if {@code 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
+ * 

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

{@code paddings(D, 0) + input.dim_size(D) + paddings(D, 1)} + *

For example: + *

  * # '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]
+ * 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 + *
*/ +@OpMetadata( + opType = MirrorPad.OP_NAME, + inputsClass = MirrorPad.Inputs.class +) @Operator -public final class MirrorPad extends PrimitiveOp implements Operand { - +public final class MirrorPad extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "MirrorPad"; + + private Output output; + + public MirrorPad(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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 + * rows must be the same as the rank of {@code input}. + * @param mode Either {@code REFLECT} or {@code 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. + * do include the borders. For example, if {@code input} is {@code [1, 2, 3]} and {@code paddings} + * is {@code [0, 2]}, then the output is {@code [1, 2, 3, 2, 1]} in reflect mode, and + * it is {@code [1, 2, 3, 3, 2]} in symmetric mode. + * @param data type for {@code MirrorPad} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static MirrorPad create(Scope scope, Operand input, + Operand paddings, String mode) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "MirrorPad"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(paddings.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); opBuilder.setAttr("mode", mode); - return new MirrorPad(opBuilder.build()); + return new MirrorPad<>(opBuilder.build()); } - + /** + * Gets output. * The padded tensor. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = MirrorPad.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input tensor to be padded. + */ + public final Operand input; + + /** + * A two-column matrix specifying the padding sizes. The number of + * rows must be the same as the rank of {@code input}. + */ + public final Operand paddings; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tpaddings attribute + */ + public final DataType Tpaddings; + + /** + * Either {@code REFLECT} or {@code 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 {@code input} is {@code [1, 2, 3]} and {@code paddings} + * is {@code [0, 2]}, then the output is {@code [1, 2, 3, 2, 1]} in reflect mode, and + * it is {@code [1, 2, 3, 3, 2]} in symmetric mode. + */ + public final String mode; + + public Inputs(GraphOperation op) { + super(new MirrorPad<>(op), op, Arrays.asList("T", "Tpaddings", "mode")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + paddings = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tpaddings = op.attributes().getAttrType("Tpaddings"); + mode = op.attributes().getAttrString("mode"); + } } } 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 index 733d183e0a9..d1286e4bd89 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,77 +17,134 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * 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
+ * Gradient op for {@code MirrorPad} op. This op folds a mirror-padded tensor.
+ * This operation folds the padded areas of {@code input} by {@code MirrorPad} according to the
+ * {@code paddings} you specify. {@code paddings} must be the same as {@code paddings} argument
+ * given to the corresponding {@code MirrorPad} op.
+ * 

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

{@code input.dim_size(D) - paddings(D, 0) - paddings(D, 1)} + *

For example: + *

  * # '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]
+ * pad(t, paddings) ==> [[ 1,  5]
  *                       [11, 28]]
- * }
- * - * - * @param data type for {@code output()} output + *
*/ -public final class MirrorPadGrad extends PrimitiveOp implements Operand { - +@OpMetadata( + opType = MirrorPadGrad.OP_NAME, + inputsClass = MirrorPadGrad.Inputs.class +) +@Operator +public final class MirrorPadGrad extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "MirrorPadGrad"; + + private Output output; + + public MirrorPadGrad(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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. + * rows must be the same as the rank of {@code input}. + * @param mode The mode used in the {@code MirrorPad} op. + * @param data type for {@code MirrorPadGrad} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static MirrorPadGrad create(Scope scope, Operand input, + Operand paddings, String mode) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "MirrorPadGrad"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(paddings.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); opBuilder.setAttr("mode", mode); - return new MirrorPadGrad(opBuilder.build()); + return new MirrorPadGrad<>(opBuilder.build()); } - + /** + * Gets output. * The folded tensor. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = MirrorPadGrad.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input tensor to be folded. + */ + public final Operand input; + + /** + * A two-column matrix specifying the padding sizes. The number of + * rows must be the same as the rank of {@code input}. + */ + public final Operand paddings; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tpaddings attribute + */ + public final DataType Tpaddings; + + /** + * The mode used in the {@code MirrorPad} op. + */ + public final String mode; + + public Inputs(GraphOperation op) { + super(new MirrorPadGrad<>(op), op, Arrays.asList("T", "Tpaddings", "mode")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + paddings = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tpaddings = op.attributes().getAttrType("Tpaddings"); + mode = op.attributes().getAttrString("mode"); + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MlirPassthroughOp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MlirPassthroughOp.java new file mode 100644 index 00000000000..6991e280241 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MlirPassthroughOp.java @@ -0,0 +1,163 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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.GraphOperation; +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.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * Wraps an arbitrary MLIR computation expressed as a module with a main() function. + * This operation does not have an associated kernel and is not intended to be + * executed in a regular TensorFlow session. Instead it is intended to be used for + * testing or for special case where a user intends to pass custom MLIR computation + * through a TensorFlow graph with the intent of having custom tooling processing + * it downstream (when targeting a different environment, like TensorFlow lite for + * example). + * The MLIR module is expected to have a main() function that will be used as an + * entry point. The inputs to the operations will be passed as argument to the + * main() function and the returned values of the main function mapped to the + * outputs. + * Example usage: + *
+ * import tensorflow as tf
+ * from tensorflow.compiler.mlir.tensorflow.gen_mlir_passthrough_op import mlir_passthrough_op
+ *
+ * mlir_module = '''python
+ * func {@literal @}main(%arg0 : tensor<10xf32>, %arg1 : tensor<10xf32>) -> tensor<10x10xf32> {
+ *    %add = "magic.op"(%arg0, %arg1) : (tensor<10xf32>, tensor<10xf32>) -> tensor<10x10xf32>
+ *    return %ret : tensor<10x10xf32>
+ * }
+ * '''
+ *
+ * {@literal @}tf.function
+ * def foo(x, y):
+ *   return mlir_passthrough_op([x, y], mlir_module, Toutputs=[tf.float32])
+ *
+ * graph_def = foo.get_concrete_function(tf.TensorSpec([10], tf.float32), tf.TensorSpec([10], tf.float32)).graph.as_graph_def()
+ * 
+ */ +@OpMetadata( + opType = MlirPassthroughOp.OP_NAME, + inputsClass = MlirPassthroughOp.Inputs.class +) +@Operator +public final class MlirPassthroughOp extends RawOp implements Iterable> { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "MlirPassthroughOp"; + + private List> outputs; + + @SuppressWarnings("unchecked") + public MlirPassthroughOp(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int outputsLength = operation.outputListLength("outputs"); + outputs = Arrays.asList(operation.outputList(outputIdx, outputsLength)); + outputIdx += outputsLength; + } + + /** + * Factory method to create a class wrapping a new MlirPassthroughOp operation. + * + * @param scope current scope + * @param inputs The inputs value + * @param mlirModule The value of the mlirModule attribute + * @param Toutputs The value of the Toutputs attribute + * @return a new instance of MlirPassthroughOp + */ + @Endpoint( + describeByClass = true + ) + public static MlirPassthroughOp create(Scope scope, Iterable> inputs, + String mlirModule, List> Toutputs) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "MlirPassthroughOp"); + opBuilder.addInputList(Operands.asOutputs(inputs)); + opBuilder.setAttr("mlir_module", mlirModule); + opBuilder.setAttr("Toutputs", Operands.toDataTypes(Toutputs)); + return new MlirPassthroughOp(opBuilder.build()); + } + + /** + * Gets outputs. + * + * @return outputs. + */ + public List> outputs() { + return outputs; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) outputs.iterator(); + } + + @OpInputsMetadata( + outputsClass = MlirPassthroughOp.class + ) + public static class Inputs extends RawOpInputs { + /** + * The inputs input + */ + public final Iterable> inputs; + + /** + * The mlirModule attribute + */ + public final String mlirModule; + + /** + * The Tinputs attribute + */ + public final DataType[] Tinputs; + + /** + * The Toutputs attribute + */ + public final DataType[] Toutputs; + + public Inputs(GraphOperation op) { + super(new MlirPassthroughOp(op), op, Arrays.asList("mlir_module", "Tinputs", "Toutputs")); + int inputIndex = 0; + int inputsLength = op.inputListLength("inputs"); + inputs = Arrays.asList((Operand[]) op.inputList(inputIndex, inputsLength)); + inputIndex += inputsLength; + mlirModule = op.attributes().getAttrString("mlir_module"); + Tinputs = op.attributes().getAttrTypeList("Tinputs"); + Toutputs = op.attributes().getAttrTypeList("Toutputs"); + } + } +} 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 deleted file mode 100644 index eb876691c4f..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MulNoNan.java +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.family.TType; - -/** - * 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 index beb6d42ae0b..5c0f4f2c38a 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,115 +17,74 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.tools.Shape; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * Creates an empty hash table that uses tensors as the backing store. - *

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

- * This op creates a mutable hash table, specifying the type of its keys and + *

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. */ +@OpMetadata( + opType = MutableDenseHashTable.OP_NAME, + inputsClass = MutableDenseHashTable.Inputs.class +) @Operator -public final class MutableDenseHashTable extends PrimitiveOp implements Operand { - +public final class MutableDenseHashTable extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.MutableDenseHashTable} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "MutableDenseHashTableV2"; + + private Output tableHandle; + + @SuppressWarnings("unchecked") + public MutableDenseHashTable(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + tableHandle = operation.output(outputIdx++); } - + /** - * Factory method to create a class wrapping a new MutableDenseHashTable operation. - * + * Factory method to create a class wrapping a new MutableDenseHashTableV2 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 deletedKey The deletedKey value * @param valueDtype Type of the table values. - * @param options carries optional attributes values + * @param options carries optional attribute values + * @param data type for {@code MutableDenseHashTableV2} output and operands + * @param data type for {@code MutableDenseHashTableV2} output and operands * @return a new instance of MutableDenseHashTable */ - public static MutableDenseHashTable create(Scope scope, Operand emptyKey, Operand deletedKey, DataType valueDtype, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("MutableDenseHashTableV2", scope.makeOpName("MutableDenseHashTable")); + @Endpoint( + describeByClass = true + ) + public static MutableDenseHashTable create(Scope scope, + Operand emptyKey, Operand deletedKey, Class valueDtype, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "MutableDenseHashTable"); opBuilder.addInput(emptyKey.asOutput()); opBuilder.addInput(deletedKey.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("value_dtype", valueDtype); + opBuilder.setAttr("value_dtype", Operands.toDataType(valueDtype)); if (options != null) { for (Options opts : options) { if (opts.container != null) { @@ -150,71 +109,248 @@ public static MutableDenseHashTable create(Sc } return new MutableDenseHashTable(opBuilder.build()); } - + /** + * Sets the container option. + * * @param container If non-empty, this table is placed in the given container. * Otherwise, a default container is used. + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** + * Sets the sharedName option. + * * @param sharedName If non-empty, this table is shared under the given name across * multiple sessions. + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - + /** - * @param useNodeNameSharing + * Sets the useNodeNameSharing option. + * + * @param useNodeNameSharing the useNodeNameSharing option + * @return this Options instance. */ public static Options useNodeNameSharing(Boolean useNodeNameSharing) { return new Options().useNodeNameSharing(useNodeNameSharing); } - + /** + * Sets the valueShape option. + * * @param valueShape The shape of each value. + * @return this Options instance. */ public static Options valueShape(Shape valueShape) { return new Options().valueShape(valueShape); } - + /** + * Sets the initialNumBuckets option. + * * @param initialNumBuckets The initial number of hash table buckets. Must be a power * to 2. + * @return this Options instance. */ public static Options initialNumBuckets(Long initialNumBuckets) { return new Options().initialNumBuckets(initialNumBuckets); } - + /** + * Sets the maxLoadFactor option. + * * @param maxLoadFactor The maximum ratio between number of entries and number of * buckets before growing the table. Must be between 0 and 1. + * @return this Options instance. */ public static Options maxLoadFactor(Float maxLoadFactor) { return new Options().maxLoadFactor(maxLoadFactor); } - + /** + * Gets tableHandle. * Handle to a table. + * @return tableHandle. */ - public Output tableHandle() { + 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.MutableDenseHashTable} + */ + public static class Options { + private String container; + + private String sharedName; + + private Boolean useNodeNameSharing; + + private Shape valueShape; + + private Long initialNumBuckets; + + private Float maxLoadFactor; + + private Options() { + } + + /** + * Sets the container option. + * + * @param container If non-empty, this table is placed in the given container. + * Otherwise, a default container is used. + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName If non-empty, this table is shared under the given name across + * multiple sessions. + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + /** + * Sets the useNodeNameSharing option. + * + * @param useNodeNameSharing the useNodeNameSharing option + * @return this Options instance. + */ + public Options useNodeNameSharing(Boolean useNodeNameSharing) { + this.useNodeNameSharing = useNodeNameSharing; + return this; + } + + /** + * Sets the valueShape option. + * + * @param valueShape The shape of each value. + * @return this Options instance. + */ + public Options valueShape(Shape valueShape) { + this.valueShape = valueShape; + return this; + } + + /** + * Sets the initialNumBuckets option. + * + * @param initialNumBuckets The initial number of hash table buckets. Must be a power + * to 2. + * @return this Options instance. + */ + public Options initialNumBuckets(Long initialNumBuckets) { + this.initialNumBuckets = initialNumBuckets; + return this; + } + + /** + * Sets the maxLoadFactor option. + * + * @param maxLoadFactor The maximum ratio between number of entries and number of + * buckets before growing the table. Must be between 0 and 1. + * @return this Options instance. + */ + public Options maxLoadFactor(Float maxLoadFactor) { + this.maxLoadFactor = maxLoadFactor; + return this; + } + } + + @OpInputsMetadata( + outputsClass = MutableDenseHashTable.class + ) + public static class Inputs extends RawOpInputs { + /** + * The key used to represent empty key buckets internally. Must not + * be used in insert or lookup operations. + */ + public final Operand emptyKey; + + /** + * The deletedKey input + */ + public final Operand deletedKey; + + /** + * If non-empty, this table is placed in the given container. + * Otherwise, a default container is used. + */ + public final String container; + + /** + * If non-empty, this table is shared under the given name across + * multiple sessions. + */ + public final String sharedName; + + /** + * The useNodeNameSharing attribute + */ + public final boolean useNodeNameSharing; + + /** + * Type of the table keys. + */ + public final DataType keyDtype; + + /** + * Type of the table values. + */ + public final DataType valueDtype; + + /** + * The shape of each value. + */ + public final Shape valueShape; + + /** + * The initial number of hash table buckets. Must be a power + * to 2. + */ + public final long initialNumBuckets; + + /** + * The maximum ratio between number of entries and number of + * buckets before growing the table. Must be between 0 and 1. + */ + public final float maxLoadFactor; + + public Inputs(GraphOperation op) { + super(new MutableDenseHashTable(op), op, Arrays.asList("container", "shared_name", "use_node_name_sharing", "key_dtype", "value_dtype", "value_shape", "initial_num_buckets", "max_load_factor")); + int inputIndex = 0; + emptyKey = (Operand) op.input(inputIndex++); + deletedKey = (Operand) op.input(inputIndex++); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + useNodeNameSharing = op.attributes().getAttrBool("use_node_name_sharing"); + keyDtype = op.attributes().getAttrType("key_dtype"); + valueDtype = op.attributes().getAttrType("value_dtype"); + valueShape = op.attributes().getAttrShape("value_shape"); + initialNumBuckets = op.attributes().getAttrInt("initial_num_buckets"); + maxLoadFactor = op.attributes().getAttrFloat("max_load_factor"); + } } } 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 index a40049d7479..2d903a7b2d9 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,80 +17,68 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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. */ +@OpMetadata( + opType = MutableHashTable.OP_NAME, + inputsClass = MutableHashTable.Inputs.class +) @Operator -public final class MutableHashTable extends PrimitiveOp implements Operand { - +public final class MutableHashTable extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.MutableHashTable} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "MutableHashTableV2"; + + private Output tableHandle; + + @SuppressWarnings("unchecked") + public MutableHashTable(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + tableHandle = operation.output(outputIdx++); } - + /** - * Factory method to create a class wrapping a new MutableHashTable operation. - * + * Factory method to create a class wrapping a new MutableHashTableV2 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 + * @param options carries optional attribute values + * @param data type for {@code MutableHashTableV2} output and operands + * @param data type for {@code MutableHashTableV2} output and operands * @return a new instance of MutableHashTable */ - public static MutableHashTable create(Scope scope, DataType keyDtype, DataType valueDtype, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("MutableHashTableV2", scope.makeOpName("MutableHashTable")); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("key_dtype", keyDtype); - opBuilder.setAttr("value_dtype", valueDtype); + @Endpoint( + describeByClass = true + ) + public static MutableHashTable create(Scope scope, + Class keyDtype, Class valueDtype, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "MutableHashTable"); + opBuilder.setAttr("key_dtype", Operands.toDataType(keyDtype)); + opBuilder.setAttr("value_dtype", Operands.toDataType(valueDtype)); if (options != null) { for (Options opts : options) { if (opts.container != null) { @@ -106,49 +94,145 @@ public static MutableHashTable create(Scope s } return new MutableHashTable(opBuilder.build()); } - + /** + * Sets the container option. + * * @param container If non-empty, this table is placed in the given container. * Otherwise, a default container is used. + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** + * Sets the sharedName option. + * * @param sharedName If non-empty, this table is shared under the given name across * multiple sessions. + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - + /** + * Sets the useNodeNameSharing option. + * * @param useNodeNameSharing If true and shared_name is empty, the table is shared * using the node name. + * @return this Options instance. */ public static Options useNodeNameSharing(Boolean useNodeNameSharing) { return new Options().useNodeNameSharing(useNodeNameSharing); } - + /** + * Gets tableHandle. * Handle to a table. + * @return tableHandle. */ - public Output tableHandle() { + 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.MutableHashTable} + */ + public static class Options { + private String container; + + private String sharedName; + + private Boolean useNodeNameSharing; + + private Options() { + } + + /** + * Sets the container option. + * + * @param container If non-empty, this table is placed in the given container. + * Otherwise, a default container is used. + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName If non-empty, this table is shared under the given name across + * multiple sessions. + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + /** + * Sets the useNodeNameSharing option. + * + * @param useNodeNameSharing If true and shared_name is empty, the table is shared + * using the node name. + * @return this Options instance. + */ + public Options useNodeNameSharing(Boolean useNodeNameSharing) { + this.useNodeNameSharing = useNodeNameSharing; + return this; + } + } + + @OpInputsMetadata( + outputsClass = MutableHashTable.class + ) + public static class Inputs extends RawOpInputs { + /** + * If non-empty, this table is placed in the given container. + * Otherwise, a default container is used. + */ + public final String container; + + /** + * If non-empty, this table is shared under the given name across + * multiple sessions. + */ + public final String sharedName; + + /** + * If true and shared_name is empty, the table is shared + * using the node name. + */ + public final boolean useNodeNameSharing; + + /** + * Type of the table keys. + */ + public final DataType keyDtype; + + /** + * Type of the table values. + */ + public final DataType valueDtype; + + public Inputs(GraphOperation op) { + super(new MutableHashTable(op), op, Arrays.asList("container", "shared_name", "use_node_name_sharing", "key_dtype", "value_dtype")); + int inputIndex = 0; + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + useNodeNameSharing = op.attributes().getAttrBool("use_node_name_sharing"); + keyDtype = op.attributes().getAttrType("key_dtype"); + valueDtype = op.attributes().getAttrType("value_dtype"); + } } } 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 index 24fe42d2a6f..83a79519dc9 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,89 +17,69 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.tools.Shape; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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. */ +@OpMetadata( + opType = MutableHashTableOfTensors.OP_NAME, + inputsClass = MutableHashTableOfTensors.Inputs.class +) @Operator -public final class MutableHashTableOfTensors extends PrimitiveOp implements Operand { - +public final class MutableHashTableOfTensors extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.MutableHashTableOfTensors} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "MutableHashTableOfTensorsV2"; + + private Output tableHandle; + + @SuppressWarnings("unchecked") + public MutableHashTableOfTensors(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + tableHandle = operation.output(outputIdx++); } - + /** - * Factory method to create a class wrapping a new MutableHashTableOfTensors operation. - * + * Factory method to create a class wrapping a new MutableHashTableOfTensorsV2 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 + * @param options carries optional attribute values + * @param data type for {@code MutableHashTableOfTensorsV2} output and operands + * @param data type for {@code MutableHashTableOfTensorsV2} output and operands * @return a new instance of MutableHashTableOfTensors */ - public static MutableHashTableOfTensors create(Scope scope, DataType keyDtype, DataType valueDtype, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("MutableHashTableOfTensorsV2", scope.makeOpName("MutableHashTableOfTensors")); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("key_dtype", keyDtype); - opBuilder.setAttr("value_dtype", valueDtype); + @Endpoint( + describeByClass = true + ) + public static MutableHashTableOfTensors create(Scope scope, + Class keyDtype, Class valueDtype, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "MutableHashTableOfTensors"); + opBuilder.setAttr("key_dtype", Operands.toDataType(keyDtype)); + opBuilder.setAttr("value_dtype", Operands.toDataType(valueDtype)); if (options != null) { for (Options opts : options) { if (opts.container != null) { @@ -118,55 +98,171 @@ public static MutableHashTableOfTensors creat } return new MutableHashTableOfTensors(opBuilder.build()); } - + /** + * Sets the container option. + * * @param container If non-empty, this table is placed in the given container. * Otherwise, a default container is used. + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** + * Sets the sharedName option. + * * @param sharedName If non-empty, this table is shared under the given name across * multiple sessions. + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - + /** - * @param useNodeNameSharing + * Sets the useNodeNameSharing option. + * + * @param useNodeNameSharing the useNodeNameSharing option + * @return this Options instance. */ public static Options useNodeNameSharing(Boolean useNodeNameSharing) { return new Options().useNodeNameSharing(useNodeNameSharing); } - + /** - * @param valueShape + * Sets the valueShape option. + * + * @param valueShape the valueShape option + * @return this Options instance. */ public static Options valueShape(Shape valueShape) { return new Options().valueShape(valueShape); } - + /** + * Gets tableHandle. * Handle to a table. + * @return tableHandle. */ - public Output tableHandle() { + 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.MutableHashTableOfTensors} + */ + public static class Options { + private String container; + + private String sharedName; + + private Boolean useNodeNameSharing; + + private Shape valueShape; + + private Options() { + } + + /** + * Sets the container option. + * + * @param container If non-empty, this table is placed in the given container. + * Otherwise, a default container is used. + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName If non-empty, this table is shared under the given name across + * multiple sessions. + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + + /** + * Sets the useNodeNameSharing option. + * + * @param useNodeNameSharing the useNodeNameSharing option + * @return this Options instance. + */ + public Options useNodeNameSharing(Boolean useNodeNameSharing) { + this.useNodeNameSharing = useNodeNameSharing; + return this; + } + + /** + * Sets the valueShape option. + * + * @param valueShape the valueShape option + * @return this Options instance. + */ + public Options valueShape(Shape valueShape) { + this.valueShape = valueShape; + return this; + } + } + + @OpInputsMetadata( + outputsClass = MutableHashTableOfTensors.class + ) + public static class Inputs extends RawOpInputs { + /** + * If non-empty, this table is placed in the given container. + * Otherwise, a default container is used. + */ + public final String container; + + /** + * If non-empty, this table is shared under the given name across + * multiple sessions. + */ + public final String sharedName; + + /** + * The useNodeNameSharing attribute + */ + public final boolean useNodeNameSharing; + + /** + * Type of the table keys. + */ + public final DataType keyDtype; + + /** + * Type of the table values. + */ + public final DataType valueDtype; + + /** + * The valueShape attribute + */ + public final Shape valueShape; + + public Inputs(GraphOperation op) { + super(new MutableHashTableOfTensors(op), op, Arrays.asList("container", "shared_name", "use_node_name_sharing", "key_dtype", "value_dtype", "value_shape")); + int inputIndex = 0; + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + useNodeNameSharing = op.attributes().getAttrBool("use_node_name_sharing"); + keyDtype = op.attributes().getAttrType("key_dtype"); + valueDtype = op.attributes().getAttrType("value_dtype"); + valueShape = op.attributes().getAttrShape("value_shape"); + } } } 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 index 6a8a772963c..7c582226e61 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,61 +17,56 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; import org.tensorflow.types.family.TType; /** - * Creates a Mutex resource that can be locked by `MutexLock`. + * Creates a Mutex resource that can be locked by {@code MutexLock}. */ +@OpMetadata( + opType = Mutex.OP_NAME, + inputsClass = Mutex.Inputs.class +) @Operator -public final class Mutex extends PrimitiveOp implements Operand { - +public final class Mutex extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.Mutex} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "MutexV2"; + + private Output resource; + + @SuppressWarnings("unchecked") + public Mutex(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + resource = operation.output(outputIdx++); } - + /** - * Factory method to create a class wrapping a new Mutex operation. - * + * Factory method to create a class wrapping a new MutexV2 operation. + * * @param scope current scope - * @param options carries optional attributes values + * @param options carries optional attribute values * @return a new instance of Mutex */ + @Endpoint( + describeByClass = true + ) public static Mutex create(Scope scope, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("MutexV2", scope.makeOpName("Mutex")); - opBuilder = scope.applyControlDependencies(opBuilder); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Mutex"); if (options != null) { for (Options opts : options) { if (opts.container != null) { @@ -84,41 +79,101 @@ public static Mutex create(Scope scope, Options... options) { } return new Mutex(opBuilder.build()); } - + /** + * Sets the container option. + * * @param container If non-empty, this variable is placed in the given container. * Otherwise, a default container is used. + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** + * Sets the sharedName option. + * * @param sharedName If non-empty, this variable is named in the given bucket * with this shared_name. Otherwise, the node name is used instead. + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - + /** + * Gets resource. * The mutex resource. + * @return resource. */ - public Output 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.Mutex} + */ + public static class Options { + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the container option. + * + * @param container If non-empty, this variable is placed in the given container. + * Otherwise, a default container is used. + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName If non-empty, this variable is named in the given bucket + * with this shared_name. Otherwise, the node name is used instead. + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Mutex.class + ) + public static class Inputs extends RawOpInputs { + /** + * If non-empty, this variable is placed in the given container. + * Otherwise, a default container is used. + */ + public final String container; + + /** + * If non-empty, this variable is named in the given bucket + * with this shared_name. Otherwise, the node name is used instead. + */ + public final String sharedName; + + public Inputs(GraphOperation op) { + super(new Mutex(op), op, Arrays.asList("container", "shared_name")); + int inputIndex = 0; + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + } } } 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 index 4e3ade48b8d..acfe74ccd98 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,91 +17,123 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; import org.tensorflow.types.family.TType; /** * 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
+ * is alive, any other request to use {@code MutexLock} with this mutex will wait.
+ * 

This is particularly useful for creating a critical section when used in + * conjunction with {@code MutexLockIdentity}: + *

+ *
  * 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 + *
+ *

While {@code 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 + *

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

- * It is also useful if two separate functions must share a resource, but we + *

It is also useful if two separate functions must share a resource, but we * wish to ensure the usage is exclusive. */ +@OpMetadata( + opType = MutexLock.OP_NAME, + inputsClass = MutexLock.Inputs.class +) @Operator -public final class MutexLock extends PrimitiveOp implements Operand { - +public final class MutexLock extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "MutexLock"; + + private Output mutexLock; + + @SuppressWarnings("unchecked") + public MutexLock(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + mutexLock = operation.output(outputIdx++); + } + /** * 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")); + @Endpoint( + describeByClass = true + ) + public static MutexLock create(Scope scope, Operand mutex) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "MutexLock"); opBuilder.addInput(mutex.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new MutexLock(opBuilder.build()); } - + /** + * Gets mutexLock. * 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. + * @return mutexLock. */ - public Output mutexLock() { + 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++); + + @OpInputsMetadata( + outputsClass = MutexLock.class + ) + public static class Inputs extends RawOpInputs { + /** + * The mutex resource to lock. + */ + public final Operand mutex; + + public Inputs(GraphOperation op) { + super(new MutexLock(op), op, Arrays.asList()); + int inputIndex = 0; + mutex = (Operand) op.input(inputIndex++); + } } } 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 index a40b45db628..5e8f5709b65 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,71 +17,132 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** * 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 + *

The graph should be constructed so if one op runs with shared_name value {@code c}, + * then {@code num_devices} ops will run with shared_name value {@code 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. + *

input: the input to the reduction + * data: the value of the reduction across all {@code 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 output()} output + * + * @deprecated use {@link org.tensorflow.op.distribute.NcclAllReduce} instead */ -public final class NcclAllReduce extends PrimitiveOp implements Operand { - +@OpMetadata( + opType = NcclAllReduce.OP_NAME, + inputsClass = NcclAllReduce.Inputs.class +) +@Deprecated +@Operator +public final class NcclAllReduce extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "NcclAllReduce"; + + private Output data; + + public NcclAllReduce(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + data = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new NcclAllReduce operation. - * + * * @param scope current scope - * @param input - * @param reduction - * @param numDevices - * @param sharedName + * @param input The input value + * @param reduction The value of the reduction attribute + * @param numDevices The value of the numDevices attribute + * @param sharedName The value of the sharedName attribute + * @param data type for {@code NcclAllReduce} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static NcclAllReduce create(Scope scope, Operand input, + String reduction, Long numDevices, String sharedName) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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()); + return new NcclAllReduce<>(opBuilder.build()); } - + /** + * Gets data. + * + * @return data. */ - public Output output() { - return output; + public Output data() { + return data; } - + @Override public Output asOutput() { - return output; + return data; } - - private Output output; - - private NcclAllReduce(Operation operation) { - super(operation); - int outputIdx = 0; - output = operation.output(outputIdx++); + + @OpInputsMetadata( + outputsClass = NcclAllReduce.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * The reduction attribute + */ + public final String reduction; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The numDevices attribute + */ + public final long numDevices; + + /** + * The sharedName attribute + */ + public final String sharedName; + + public Inputs(GraphOperation op) { + super(new NcclAllReduce<>(op), op, Arrays.asList("reduction", "T", "num_devices", "shared_name")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + reduction = op.attributes().getAttrString("reduction"); + T = op.attributes().getAttrType("T"); + numDevices = op.attributes().getAttrInt("num_devices"); + sharedName = op.attributes().getAttrString("shared_name"); + } } } 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 index a470a1f3e12..5e6c2a583ef 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,65 +17,113 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; -import org.tensorflow.tools.Shape; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** - * 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 + * Sends {@code input} to all devices that are connected to the output. + * Sends {@code 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. + *

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 + * + * @deprecated use {@link org.tensorflow.op.distribute.NcclBroadcast} instead */ -public final class NcclBroadcast extends PrimitiveOp implements Operand { - +@OpMetadata( + opType = NcclBroadcast.OP_NAME, + inputsClass = NcclBroadcast.Inputs.class +) +@Deprecated +@Operator +public final class NcclBroadcast extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "NcclBroadcast"; + + private Output output; + + public NcclBroadcast(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new NcclBroadcast operation. - * + * * @param scope current scope - * @param input - * @param shape + * @param input The input value + * @param shape The value of the shape attribute + * @param data type for {@code NcclBroadcast} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static NcclBroadcast create(Scope scope, Operand input, + Shape shape) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "NcclBroadcast"); opBuilder.addInput(input.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); opBuilder.setAttr("shape", shape); - return new NcclBroadcast(opBuilder.build()); + return new NcclBroadcast<>(opBuilder.build()); } - + /** + * Gets output. + * + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = NcclBroadcast.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The shape attribute + */ + public final Shape shape; + + public Inputs(GraphOperation op) { + super(new NcclBroadcast<>(op), op, Arrays.asList("T", "shape")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + shape = op.attributes().getAttrShape("shape"); + } } } 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 index feb7bb9f470..cd3dea3af6f 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,64 +17,115 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; 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.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** - * 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 + * Reduces {@code input} from {@code num_devices} using {@code reduction} to a single device. + * Reduces {@code input} from {@code num_devices} using {@code 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. + *

input: The input to the reduction. + * data: the value of the reduction across all {@code num_devices} devices. * reduction: the reduction operation to perform. - * - * @param data type for {@code output()} output + * + * @deprecated use {@link org.tensorflow.op.distribute.NcclReduce} instead */ -public final class NcclReduce extends PrimitiveOp implements Operand { - +@OpMetadata( + opType = NcclReduce.OP_NAME, + inputsClass = NcclReduce.Inputs.class +) +@Deprecated +@Operator +public final class NcclReduce extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "NcclReduce"; + + private Output data; + + public NcclReduce(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + data = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new NcclReduce operation. - * + * * @param scope current scope - * @param input - * @param reduction + * @param input The input value + * @param reduction The value of the reduction attribute + * @param data type for {@code NcclReduce} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static NcclReduce create(Scope scope, Iterable> input, + String reduction) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "NcclReduce"); opBuilder.addInputList(Operands.asOutputs(input)); - opBuilder = scope.applyControlDependencies(opBuilder); opBuilder.setAttr("reduction", reduction); - return new NcclReduce(opBuilder.build()); + return new NcclReduce<>(opBuilder.build()); } - + /** + * Gets data. + * + * @return data. */ - public Output output() { - return output; + public Output data() { + return data; } - + @Override public Output asOutput() { - return output; + return data; } - - private Output output; - - private NcclReduce(Operation operation) { - super(operation); - int outputIdx = 0; - output = operation.output(outputIdx++); + + @OpInputsMetadata( + outputsClass = NcclReduce.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Iterable> input; + + /** + * The reduction attribute + */ + public final String reduction; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new NcclReduce<>(op), op, Arrays.asList("reduction", "T")); + int inputIndex = 0; + int inputLength = op.inputListLength("input"); + input = Arrays.asList((Operand[]) op.inputList(inputIndex, inputLength)); + inputIndex += inputLength; + reduction = op.attributes().getAttrString("reduction"); + T = op.attributes().getAttrType("T"); + } } } 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 deleted file mode 100644 index c3b2b0615f4..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NearestNeighbors.java +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; -import org.tensorflow.types.TInt64; - -/** - * 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 deleted file mode 100644 index 1434ca77136..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NextAfter.java +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 index d650516d8ea..1f0f73c672f 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,54 +17,94 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * Makes its input available to the next iteration. - * - * @param data type for {@code output()} output */ +@OpMetadata( + opType = NextIteration.OP_NAME, + inputsClass = NextIteration.Inputs.class +) @Operator -public final class NextIteration extends PrimitiveOp implements Operand { - +public final class NextIteration extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "NextIteration"; + + private Output output; + + public NextIteration(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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. + * @param data type for {@code NextIteration} output and operands * @return a new instance of NextIteration */ + @Endpoint( + describeByClass = true + ) public static NextIteration create(Scope scope, Operand data) { - OperationBuilder opBuilder = scope.env().opBuilder("NextIteration", scope.makeOpName("NextIteration")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "NextIteration"); opBuilder.addInput(data.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new NextIteration(opBuilder.build()); + return new NextIteration<>(opBuilder.build()); } - + /** - * The same tensor as `data`. + * Gets output. + * The same tensor as {@code data}. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = NextIteration.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensor to be made available to the next iteration. + */ + public final Operand data; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new NextIteration<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + data = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index 7b95dd4f421..fa32a327305 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,32 +17,57 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; /** * Does nothing. Only useful as a placeholder for control edges. */ +@OpMetadata( + opType = NoOp.OP_NAME, + inputsClass = NoOp.Inputs.class +) @Operator -public final class NoOp extends PrimitiveOp { - +public final class NoOp extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "NoOp"; + + public NoOp(Operation operation) { + super(operation, OP_NAME); + } + /** * Factory method to create a class wrapping a new NoOp operation. - * + * * @param scope current scope * @return a new instance of NoOp */ + @Endpoint( + describeByClass = true + ) public static NoOp create(Scope scope) { - OperationBuilder opBuilder = scope.env().opBuilder("NoOp", scope.makeOpName("NoOp")); - opBuilder = scope.applyControlDependencies(opBuilder); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "NoOp"); return new NoOp(opBuilder.build()); } - - - private NoOp(Operation operation) { - super(operation); + + @OpInputsMetadata( + outputsClass = NoOp.class + ) + public static class Inputs extends RawOpInputs { + public Inputs(GraphOperation op) { + super(new NoOp(op), op, Arrays.asList()); + int inputIndex = 0; + } } } 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 deleted file mode 100644 index 16a08a25fe0..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NonDeterministicInts.java +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType dtype) { - OperationBuilder opBuilder = scope.env().opBuilder("NonDeterministicInts", scope.makeOpName("NonDeterministicInts")); - opBuilder.addInput(shape.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("dtype", 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, TInt64.DTYPE); - } - - /** - * 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 deleted file mode 100644 index 00f4ba9582f..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NonMaxSuppressionV5.java +++ /dev/null @@ -1,165 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.TInt32; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index 544d3b7d792..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/NonSerializableDataset.java +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.family.TType; - -/** - */ -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] = 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 index f441d2427d4..8ed3c25bd8e 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,70 +17,71 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 + * The locations represented by indices in {@code indices} take value {@code on_value}, + * while all other locations take value {@code off_value}. + *

If the input {@code indices} is rank {@code N}, the output will have rank {@code N+1}, + * The new axis is created at dimension {@code 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
+ * 

If {@code indices} is a scalar the output shape will be a vector of length {@code depth}. + *

If {@code indices} is a vector of length {@code features}, the output shape will be: + *

  *   features x depth if axis == -1
  *   depth x features if axis == 0
- * }
- * If `indices` is a matrix (batch) with shape `[batch, features]`, + *
+ *

If {@code indices} is a matrix (batch) with shape {@code [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
+ * 
+ * Examples
+ *

Suppose that + *

  *   indices = [0, 2, -1, 1]
  *   depth = 3
  *   on_value = 5.0
  *   off_value = 0.0
  *   axis = -1
- * }
- * Then output is `[4 x 3]`: - *
{@code
+ * 
+ *

Then output is {@code [4 x 3]}: + *

  * 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
+ * 
+ *

Suppose that + *

  *   indices = [0, 2, -1, 1]
  *   depth = 3
  *   on_value = 0.0
  *   off_value = 3.0
  *   axis = 0
- * }
- * Then output is `[3 x 4]`: - *
{@code
+ * 
+ *

Then output is {@code [3 x 4]}: + *

  * output =
  *   [0.0 3.0 3.0 3.0]
  *   [3.0 3.0 3.0 0.0]
@@ -90,17 +91,17 @@
  * //      ^            one_hot(2)
  * //          ^        one_hot(-1)
  * //              ^    one_hot(1)
- * }
- * Suppose that - *
{@code
+ * 
+ *

Suppose that + *

  *   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
+ * 
+ *

Then output is {@code [2 x 2 x 3]}: + *

  * output =
  *   [
  *     [1.0, 0.0, 0.0]  // one_hot(0)
@@ -109,51 +110,49 @@
  *     [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 + *
*/ +@OpMetadata( + opType = OneHot.OP_NAME, + inputsClass = OneHot.Inputs.class +) @Operator -public final class OneHot extends PrimitiveOp implements Operand { - +public final class OneHot extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.OneHot} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "OneHot"; + + private Output output; + + public OneHot(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * 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 + * @param onValue A scalar defining the value to fill in output when {@code indices[j] = i}. + * @param offValue A scalar defining the value to fill in output when {@code indices[j] != i}. + * @param options carries optional attribute values + * @param data type for {@code OneHot} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static OneHot create(Scope scope, Operand indices, + Operand depth, Operand onValue, Operand offValue, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { @@ -161,33 +160,103 @@ public static OneHot create(Scope scope, } } } - return new OneHot(opBuilder.build()); + return new OneHot<>(opBuilder.build()); } - + /** + * Sets the axis option. + * * @param axis The axis to fill (default: -1, a new inner-most axis). + * @return this Options instance. */ public static Options axis(Long axis) { return new Options().axis(axis); } - + /** + * Gets output. * The one-hot tensor. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.OneHot} + */ + public static class Options { + private Long axis; + + private Options() { + } + + /** + * Sets the axis option. + * + * @param axis The axis to fill (default: -1, a new inner-most axis). + * @return this Options instance. + */ + public Options axis(Long axis) { + this.axis = axis; + return this; + } + } + + @OpInputsMetadata( + outputsClass = OneHot.class + ) + public static class Inputs extends RawOpInputs> { + /** + * A tensor of indices. + */ + public final Operand indices; + + /** + * A scalar defining the depth of the one hot dimension. + */ + public final Operand depth; + + /** + * A scalar defining the value to fill in output when {@code indices[j] = i}. + */ + public final Operand onValue; + + /** + * A scalar defining the value to fill in output when {@code indices[j] != i}. + */ + public final Operand offValue; + + /** + * The axis to fill (default: -1, a new inner-most axis). + */ + public final long axis; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The TI attribute + */ + public final DataType TI; + + public Inputs(GraphOperation op) { + super(new OneHot<>(op), op, Arrays.asList("axis", "T", "TI")); + int inputIndex = 0; + indices = (Operand) op.input(inputIndex++); + depth = (Operand) op.input(inputIndex++); + onValue = (Operand) op.input(inputIndex++); + offValue = (Operand) op.input(inputIndex++); + axis = op.attributes().getAttrInt("axis"); + T = op.attributes().getAttrType("T"); + TI = op.attributes().getAttrType("TI"); + } } } 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 index 7f40b39c9de..51178e062f4 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,54 +17,94 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * Returns a tensor of ones with the same shape and type as x. - * - * @param data type for {@code y()} output */ +@OpMetadata( + opType = OnesLike.OP_NAME, + inputsClass = OnesLike.Inputs.class +) @Operator -public final class OnesLike extends PrimitiveOp implements Operand { - +public final class OnesLike extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "OnesLike"; + + private Output y; + + public OnesLike(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + y = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new OnesLike operation. - * + * * @param scope current scope * @param x a tensor of type T. + * @param data type for {@code OnesLike} output and operands * @return a new instance of OnesLike */ + @Endpoint( + describeByClass = true + ) public static OnesLike create(Scope scope, Operand x) { - OperationBuilder opBuilder = scope.env().opBuilder("OnesLike", scope.makeOpName("OnesLike")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "OnesLike"); opBuilder.addInput(x.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new OnesLike(opBuilder.build()); + return new OnesLike<>(opBuilder.build()); } - + /** + * Gets y. * a tensor of the same shape and type as x but filled with ones. + * @return y. */ 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++); + + @OpInputsMetadata( + outputsClass = OnesLike.class + ) + public static class Inputs extends RawOpInputs> { + /** + * a tensor of type T. + */ + public final Operand x; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new OnesLike<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + x = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index 6053386e175..49bf9d12367 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,82 +17,55 @@ package org.tensorflow.op.core; +import java.util.Arrays; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.GraphOperation; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; /** * Op removes all elements in the underlying container. */ +@OpMetadata( + opType = OrderedMapClear.OP_NAME, + inputsClass = OrderedMapClear.Inputs.class +) @Operator -public final class OrderedMapClear extends PrimitiveOp { - +public final class OrderedMapClear extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.OrderedMapClear} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "OrderedMapClear"; + + public OrderedMapClear(Operation operation) { + super(operation, OP_NAME); } - + /** * Factory method to create a class wrapping a new OrderedMapClear operation. - * + * * @param scope current scope - * @param dtypes - * @param options carries optional attributes values + * @param dtypes The value of the dtypes attribute + * @param options carries optional attribute 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] = dtypes.get(i); - } - opBuilder.setAttr("dtypes", dtypesArray); + @Endpoint( + describeByClass = true + ) + public static OrderedMapClear create(Scope scope, List> dtypes, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "OrderedMapClear"); + opBuilder.setAttr("dtypes", Operands.toDataTypes(dtypes)); if (options != null) { for (Options opts : options) { if (opts.capacity != null) { @@ -111,37 +84,144 @@ public static OrderedMapClear create(Scope scope, List> dtypes, Opti } return new OrderedMapClear(opBuilder.build()); } - + /** - * @param capacity + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. */ public static Options capacity(Long capacity) { return new Options().capacity(capacity); } - + /** - * @param memoryLimit + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. */ public static Options memoryLimit(Long memoryLimit) { return new Options().memoryLimit(memoryLimit); } - + /** - * @param container + * Sets the container option. + * + * @param container the container option + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** - * @param sharedName + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - - - private OrderedMapClear(Operation operation) { - super(operation); + + /** + * Optional attributes for {@link org.tensorflow.op.core.OrderedMapClear} + */ + public static class Options { + private Long capacity; + + private Long memoryLimit; + + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * Sets the container option. + * + * @param container the container option + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = OrderedMapClear.class + ) + public static class Inputs extends RawOpInputs { + /** + * The capacity attribute + */ + public final long capacity; + + /** + * The memoryLimit attribute + */ + public final long memoryLimit; + + /** + * The dtypes attribute + */ + public final DataType[] dtypes; + + /** + * The container attribute + */ + public final String container; + + /** + * The sharedName attribute + */ + public final String sharedName; + + public Inputs(GraphOperation op) { + super(new OrderedMapClear(op), op, Arrays.asList("capacity", "memory_limit", "dtypes", "container", "shared_name")); + int inputIndex = 0; + capacity = op.attributes().getAttrInt("capacity"); + memoryLimit = op.attributes().getAttrInt("memory_limit"); + dtypes = op.attributes().getAttrTypeList("dtypes"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + } } } 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 index 8993afee755..15bedf39cb3 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,85 +17,62 @@ package org.tensorflow.op.core; +import java.util.Arrays; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TType; /** * Op returns the number of incomplete elements in the underlying container. */ +@OpMetadata( + opType = OrderedMapIncompleteSize.OP_NAME, + inputsClass = OrderedMapIncompleteSize.Inputs.class +) @Operator -public final class OrderedMapIncompleteSize extends PrimitiveOp implements Operand { - +public final class OrderedMapIncompleteSize extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.OrderedMapIncompleteSize} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "OrderedMapIncompleteSize"; + + private Output output; + + public OrderedMapIncompleteSize(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * Factory method to create a class wrapping a new OrderedMapIncompleteSize operation. - * + * * @param scope current scope - * @param dtypes - * @param options carries optional attributes values + * @param dtypes The value of the dtypes attribute + * @param options carries optional attribute 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] = dtypes.get(i); - } - opBuilder.setAttr("dtypes", dtypesArray); + @Endpoint( + describeByClass = true + ) + public static OrderedMapIncompleteSize create(Scope scope, List> dtypes, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "OrderedMapIncompleteSize"); + opBuilder.setAttr("dtypes", Operands.toDataTypes(dtypes)); if (options != null) { for (Options opts : options) { if (opts.capacity != null) { @@ -114,51 +91,158 @@ public static OrderedMapIncompleteSize create(Scope scope, List> dty } return new OrderedMapIncompleteSize(opBuilder.build()); } - + /** - * @param capacity + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. */ public static Options capacity(Long capacity) { return new Options().capacity(capacity); } - + /** - * @param memoryLimit + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. */ public static Options memoryLimit(Long memoryLimit) { return new Options().memoryLimit(memoryLimit); } - + /** - * @param container + * Sets the container option. + * + * @param container the container option + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** - * @param sharedName + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - + /** + * Gets output. + * + * @return output. */ - public Output size() { - return size; + public Output output() { + return output; } - + @Override public Output asOutput() { - return size; + return output; } - - private Output size; - - private OrderedMapIncompleteSize(Operation operation) { - super(operation); - int outputIdx = 0; - size = operation.output(outputIdx++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.OrderedMapIncompleteSize} + */ + public static class Options { + private Long capacity; + + private Long memoryLimit; + + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * Sets the container option. + * + * @param container the container option + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = OrderedMapIncompleteSize.class + ) + public static class Inputs extends RawOpInputs { + /** + * The capacity attribute + */ + public final long capacity; + + /** + * The memoryLimit attribute + */ + public final long memoryLimit; + + /** + * The dtypes attribute + */ + public final DataType[] dtypes; + + /** + * The container attribute + */ + public final String container; + + /** + * The sharedName attribute + */ + public final String sharedName; + + public Inputs(GraphOperation op) { + super(new OrderedMapIncompleteSize(op), op, Arrays.asList("capacity", "memory_limit", "dtypes", "container", "shared_name")); + int inputIndex = 0; + capacity = op.attributes().getAttrInt("capacity"); + memoryLimit = op.attributes().getAttrInt("memory_limit"); + dtypes = op.attributes().getAttrTypeList("dtypes"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + } } } 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 index d282cf03243..0108d6ead56 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,94 +20,71 @@ import java.util.Arrays; import java.util.Iterator; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.TInt64; import org.tensorflow.types.family.TType; /** * 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. */ +@OpMetadata( + opType = OrderedMapPeek.OP_NAME, + inputsClass = OrderedMapPeek.Inputs.class +) @Operator -public final class OrderedMapPeek extends PrimitiveOp implements Iterable> { - +public final class OrderedMapPeek extends RawOp implements Iterable> { /** - * Optional attributes for {@link org.tensorflow.op.core.OrderedMapPeek} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "OrderedMapPeek"; + + private List> values; + + @SuppressWarnings("unchecked") + public OrderedMapPeek(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int valuesLength = operation.outputListLength("values"); + values = Arrays.asList(operation.outputList(outputIdx, valuesLength)); + outputIdx += valuesLength; } - + /** * 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 + * @param key The key value + * @param indices The indices value + * @param dtypes The value of the dtypes attribute + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static OrderedMapPeek create(Scope scope, Operand key, Operand indices, + List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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] = dtypes.get(i); - } - opBuilder.setAttr("dtypes", dtypesArray); + opBuilder.setAttr("dtypes", Operands.toDataTypes(dtypes)); if (options != null) { for (Options opts : options) { if (opts.capacity != null) { @@ -126,54 +103,171 @@ public static OrderedMapPeek create(Scope scope, Operand key, Operand> 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; + + /** + * Optional attributes for {@link org.tensorflow.op.core.OrderedMapPeek} + */ + public static class Options { + private Long capacity; + + private Long memoryLimit; + + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * Sets the container option. + * + * @param container the container option + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = OrderedMapPeek.class + ) + public static class Inputs extends RawOpInputs { + /** + * The key input + */ + public final Operand key; + + /** + * The indices input + */ + public final Operand indices; + + /** + * The capacity attribute + */ + public final long capacity; + + /** + * The memoryLimit attribute + */ + public final long memoryLimit; + + /** + * The dtypes attribute + */ + public final DataType[] dtypes; + + /** + * The container attribute + */ + public final String container; + + /** + * The sharedName attribute + */ + public final String sharedName; + + public Inputs(GraphOperation op) { + super(new OrderedMapPeek(op), op, Arrays.asList("capacity", "memory_limit", "dtypes", "container", "shared_name")); + int inputIndex = 0; + key = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + capacity = op.attributes().getAttrInt("capacity"); + memoryLimit = op.attributes().getAttrInt("memory_limit"); + dtypes = op.attributes().getAttrTypeList("dtypes"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + } } } 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 index ada4ac290aa..02582eef02e 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,85 +17,62 @@ package org.tensorflow.op.core; +import java.util.Arrays; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TType; /** * Op returns the number of elements in the underlying container. */ +@OpMetadata( + opType = OrderedMapSize.OP_NAME, + inputsClass = OrderedMapSize.Inputs.class +) @Operator -public final class OrderedMapSize extends PrimitiveOp implements Operand { - +public final class OrderedMapSize extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.OrderedMapSize} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "OrderedMapSize"; + + private Output output; + + public OrderedMapSize(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * Factory method to create a class wrapping a new OrderedMapSize operation. - * + * * @param scope current scope - * @param dtypes - * @param options carries optional attributes values + * @param dtypes The value of the dtypes attribute + * @param options carries optional attribute 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] = dtypes.get(i); - } - opBuilder.setAttr("dtypes", dtypesArray); + @Endpoint( + describeByClass = true + ) + public static OrderedMapSize create(Scope scope, List> dtypes, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "OrderedMapSize"); + opBuilder.setAttr("dtypes", Operands.toDataTypes(dtypes)); if (options != null) { for (Options opts : options) { if (opts.capacity != null) { @@ -114,51 +91,158 @@ public static OrderedMapSize create(Scope scope, List> dtypes, Optio } return new OrderedMapSize(opBuilder.build()); } - + /** - * @param capacity + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. */ public static Options capacity(Long capacity) { return new Options().capacity(capacity); } - + /** - * @param memoryLimit + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. */ public static Options memoryLimit(Long memoryLimit) { return new Options().memoryLimit(memoryLimit); } - + /** - * @param container + * Sets the container option. + * + * @param container the container option + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** - * @param sharedName + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - + /** + * Gets output. + * + * @return output. */ - public Output size() { - return size; + public Output output() { + return output; } - + @Override public Output asOutput() { - return size; + return output; } - - private Output size; - - private OrderedMapSize(Operation operation) { - super(operation); - int outputIdx = 0; - size = operation.output(outputIdx++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.OrderedMapSize} + */ + public static class Options { + private Long capacity; + + private Long memoryLimit; + + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * Sets the container option. + * + * @param container the container option + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = OrderedMapSize.class + ) + public static class Inputs extends RawOpInputs { + /** + * The capacity attribute + */ + public final long capacity; + + /** + * The memoryLimit attribute + */ + public final long memoryLimit; + + /** + * The dtypes attribute + */ + public final DataType[] dtypes; + + /** + * The container attribute + */ + public final String container; + + /** + * The sharedName attribute + */ + public final String sharedName; + + public Inputs(GraphOperation op) { + super(new OrderedMapSize(op), op, Arrays.asList("capacity", "memory_limit", "dtypes", "container", "shared_name")); + int inputIndex = 0; + capacity = op.attributes().getAttrInt("capacity"); + memoryLimit = op.attributes().getAttrInt("memory_limit"); + dtypes = op.attributes().getAttrTypeList("dtypes"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + } } } 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 index c136bdd0aba..cd5c7dfdec3 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,97 +17,66 @@ package org.tensorflow.op.core; +import java.util.Arrays; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.GraphOperation; 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.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.TInt64; +import org.tensorflow.types.family.TType; /** * Stage (key, values) in the underlying container which behaves like a ordered - *

* associative container. Elements are ordered by key. */ +@OpMetadata( + opType = OrderedMapStage.OP_NAME, + inputsClass = OrderedMapStage.Inputs.class +) @Operator -public final class OrderedMapStage extends PrimitiveOp { - +public final class OrderedMapStage extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.OrderedMapStage} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "OrderedMapStage"; + + public OrderedMapStage(Operation operation) { + super(operation, OP_NAME); } - + /** * Factory method to create a class wrapping a new OrderedMapStage operation. - * + * * @param scope current scope * @param key int64 - * @param indices + * @param indices The indices value * @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 + * @param dtypes The value of the dtypes attribute + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static OrderedMapStage create(Scope scope, Operand key, Operand indices, + Iterable> values, List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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] = dtypes.get(i); - } - opBuilder.setAttr("dtypes", dtypesArray); + opBuilder.setAttr("dtypes", Operands.toDataTypes(dtypes)); if (options != null) { for (Options opts : options) { if (opts.capacity != null) { @@ -126,39 +95,177 @@ public static OrderedMapStage create(Scope scope, Operand key, Operand 0, inserts + * Sets the capacity option. + * + * @param capacity Maximum number of elements in the Staging Area. If > 0, inserts * on the container will block when the capacity is reached. + * @return this Options instance. */ public static Options capacity(Long capacity) { return new Options().capacity(capacity); } - + /** - * @param memoryLimit + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. */ public static Options memoryLimit(Long memoryLimit) { return new Options().memoryLimit(memoryLimit); } - + /** + * Sets the container option. + * * @param container If non-empty, this queue is placed in the given container. Otherwise, * a default container is used. + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** + * Sets the sharedName option. + * * @param sharedName It is necessary to match this name to the matching Unstage Op. + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - - - private OrderedMapStage(Operation operation) { - super(operation); + + /** + * Optional attributes for {@link org.tensorflow.op.core.OrderedMapStage} + */ + public static class Options { + private Long capacity; + + private Long memoryLimit; + + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the capacity option. + * + * @param capacity Maximum number of elements in the Staging Area. If > 0, inserts + * on the container will block when the capacity is reached. + * @return this Options instance. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * Sets the container option. + * + * @param container If non-empty, this queue is placed in the given container. Otherwise, + * a default container is used. + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName It is necessary to match this name to the matching Unstage Op. + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = OrderedMapStage.class + ) + public static class Inputs extends RawOpInputs { + /** + * int64 + */ + public final Operand key; + + /** + * The indices input + */ + public final Operand indices; + + /** + * a list of tensors + * dtypes A list of data types that inserted values should adhere to. + */ + public final Iterable> values; + + /** + * Maximum number of elements in the Staging Area. If > 0, inserts + * on the container will block when the capacity is reached. + */ + public final long capacity; + + /** + * The memoryLimit attribute + */ + public final long memoryLimit; + + /** + * The dtypes attribute + */ + public final DataType[] dtypes; + + /** + * The fakeDtypes attribute + */ + public final DataType[] fakeDtypes; + + /** + * If non-empty, this queue is placed in the given container. Otherwise, + * a default container is used. + */ + public final String container; + + /** + * It is necessary to match this name to the matching Unstage Op. + */ + public final String sharedName; + + public Inputs(GraphOperation op) { + super(new OrderedMapStage(op), op, Arrays.asList("capacity", "memory_limit", "dtypes", "fake_dtypes", "container", "shared_name")); + int inputIndex = 0; + key = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + int valuesLength = op.inputListLength("values"); + values = Arrays.asList((Operand[]) op.inputList(inputIndex, valuesLength)); + inputIndex += valuesLength; + capacity = op.attributes().getAttrInt("capacity"); + memoryLimit = op.attributes().getAttrInt("memory_limit"); + dtypes = op.attributes().getAttrTypeList("dtypes"); + fakeDtypes = op.attributes().getAttrTypeList("fake_dtypes"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + } } } 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 index 26df05b1689..15794430c34 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,93 +20,70 @@ import java.util.Arrays; import java.util.Iterator; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.TInt64; import org.tensorflow.types.family.TType; /** * 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. */ +@OpMetadata( + opType = OrderedMapUnstage.OP_NAME, + inputsClass = OrderedMapUnstage.Inputs.class +) @Operator -public final class OrderedMapUnstage extends PrimitiveOp implements Iterable> { - +public final class OrderedMapUnstage extends RawOp implements Iterable> { /** - * Optional attributes for {@link org.tensorflow.op.core.OrderedMapUnstage} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "OrderedMapUnstage"; + + private List> values; + + @SuppressWarnings("unchecked") + public OrderedMapUnstage(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int valuesLength = operation.outputListLength("values"); + values = Arrays.asList(operation.outputList(outputIdx, valuesLength)); + outputIdx += valuesLength; } - + /** * 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 + * @param key The key value + * @param indices The indices value + * @param dtypes The value of the dtypes attribute + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static OrderedMapUnstage create(Scope scope, Operand key, Operand indices, + List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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] = dtypes.get(i); - } - opBuilder.setAttr("dtypes", dtypesArray); + opBuilder.setAttr("dtypes", Operands.toDataTypes(dtypes)); if (options != null) { for (Options opts : options) { if (opts.capacity != null) { @@ -125,54 +102,171 @@ public static OrderedMapUnstage create(Scope scope, Operand key, Operand } return new OrderedMapUnstage(opBuilder.build()); } - + /** - * @param capacity + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. */ public static Options capacity(Long capacity) { return new Options().capacity(capacity); } - + /** - * @param memoryLimit + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. */ public static Options memoryLimit(Long memoryLimit) { return new Options().memoryLimit(memoryLimit); } - + /** - * @param container + * Sets the container option. + * + * @param container the container option + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** - * @param sharedName + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - + /** + * Gets values. + * + * @return values. */ 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; + + /** + * Optional attributes for {@link org.tensorflow.op.core.OrderedMapUnstage} + */ + public static class Options { + private Long capacity; + + private Long memoryLimit; + + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * Sets the container option. + * + * @param container the container option + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = OrderedMapUnstage.class + ) + public static class Inputs extends RawOpInputs { + /** + * The key input + */ + public final Operand key; + + /** + * The indices input + */ + public final Operand indices; + + /** + * The capacity attribute + */ + public final long capacity; + + /** + * The memoryLimit attribute + */ + public final long memoryLimit; + + /** + * The dtypes attribute + */ + public final DataType[] dtypes; + + /** + * The container attribute + */ + public final String container; + + /** + * The sharedName attribute + */ + public final String sharedName; + + public Inputs(GraphOperation op) { + super(new OrderedMapUnstage(op), op, Arrays.asList("capacity", "memory_limit", "dtypes", "container", "shared_name")); + int inputIndex = 0; + key = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + capacity = op.attributes().getAttrInt("capacity"); + memoryLimit = op.attributes().getAttrInt("memory_limit"); + dtypes = op.attributes().getAttrTypeList("dtypes"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + } } } 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 index ecff3c7435f..b849306633d 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,90 +19,71 @@ import java.util.Arrays; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.TInt64; +import org.tensorflow.types.family.TType; /** * 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. */ +@OpMetadata( + opType = OrderedMapUnstageNoKey.OP_NAME, + inputsClass = OrderedMapUnstageNoKey.Inputs.class +) @Operator -public final class OrderedMapUnstageNoKey extends PrimitiveOp { - +public final class OrderedMapUnstageNoKey extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.OrderedMapUnstageNoKey} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "OrderedMapUnstageNoKey"; + + private Output key; + + private List> values; + + @SuppressWarnings("unchecked") + public OrderedMapUnstageNoKey(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + key = operation.output(outputIdx++); + int valuesLength = operation.outputListLength("values"); + values = Arrays.asList(operation.outputList(outputIdx, valuesLength)); + outputIdx += valuesLength; } - + /** * 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 + * @param indices The indices value + * @param dtypes The value of the dtypes attribute + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static OrderedMapUnstageNoKey create(Scope scope, Operand indices, + List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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] = dtypes.get(i); - } - opBuilder.setAttr("dtypes", dtypesArray); + opBuilder.setAttr("dtypes", Operands.toDataTypes(dtypes)); if (options != null) { for (Options opts : options) { if (opts.capacity != null) { @@ -121,56 +102,168 @@ public static OrderedMapUnstageNoKey create(Scope scope, Operand indices } return new OrderedMapUnstageNoKey(opBuilder.build()); } - + /** - * @param capacity + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. */ public static Options capacity(Long capacity) { return new Options().capacity(capacity); } - + /** - * @param memoryLimit + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. */ public static Options memoryLimit(Long memoryLimit) { return new Options().memoryLimit(memoryLimit); } - + /** - * @param container + * Sets the container option. + * + * @param container the container option + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** - * @param sharedName + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - + /** + * Gets key. + * + * @return key. */ public Output key() { return key; } - + /** + * Gets values. + * + * @return values. */ 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; + + /** + * Optional attributes for {@link org.tensorflow.op.core.OrderedMapUnstageNoKey} + */ + public static class Options { + private Long capacity; + + private Long memoryLimit; + + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * Sets the container option. + * + * @param container the container option + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = OrderedMapUnstageNoKey.class + ) + public static class Inputs extends RawOpInputs { + /** + * The indices input + */ + public final Operand indices; + + /** + * The capacity attribute + */ + public final long capacity; + + /** + * The memoryLimit attribute + */ + public final long memoryLimit; + + /** + * The dtypes attribute + */ + public final DataType[] dtypes; + + /** + * The container attribute + */ + public final String container; + + /** + * The sharedName attribute + */ + public final String sharedName; + + public Inputs(GraphOperation op) { + super(new OrderedMapUnstageNoKey(op), op, Arrays.asList("capacity", "memory_limit", "dtypes", "container", "shared_name")); + int inputIndex = 0; + indices = (Operand) op.input(inputIndex++); + capacity = op.attributes().getAttrInt("capacity"); + memoryLimit = op.attributes().getAttrInt("memory_limit"); + dtypes = op.attributes().getAttrTypeList("dtypes"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + } } } 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 deleted file mode 100644 index 12f18169064..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OutfeedDequeue.java +++ /dev/null @@ -1,112 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.tools.Shape; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType dtype, Shape shape, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("OutfeedDequeue", scope.makeOpName("OutfeedDequeue")); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("dtype", 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 deleted file mode 100644 index d3eaf4078d3..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OutfeedDequeueTuple.java +++ /dev/null @@ -1,125 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 deleted file mode 100644 index 5442b4c4be4..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OutfeedEnqueue.java +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TType; - -/** - * 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 deleted file mode 100644 index 53093469d5c..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OutfeedEnqueueTuple.java +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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 index c24c4ee95f6..60ddbcf6817 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,83 +17,138 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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
+ * This operation pads {@code input} according to the {@code paddings} and {@code constant_values}
+ * you specify. {@code paddings} is an integer tensor with shape {@code [Dn, 2]}, where n is
+ * the rank of {@code input}. For each dimension D of {@code input}, {@code paddings[D, 0]} indicates
+ * how many padding values to add before the contents of {@code input} in that dimension,
+ * and {@code paddings[D, 1]} indicates how many padding values to add after the contents
+ * of {@code input} in that dimension. {@code constant_values} is a scalar tensor of the same
+ * type as {@code input} that indicates the value to use for padding {@code input}.
+ * 

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

{@code paddings(D, 0) + input.dim_size(D) + paddings(D, 1)} + *

For example: + *

  * # '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]
+ * 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 + *
*/ +@OpMetadata( + opType = Pad.OP_NAME, + inputsClass = Pad.Inputs.class +) @Operator -public final class Pad extends PrimitiveOp implements Operand { - +public final class Pad extends RawOp implements Operand { /** - * Factory method to create a class wrapping a new Pad operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "PadV2"; + + private Output output; + + public Pad(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new PadV2 operation. + * * @param scope current scope - * @param input - * @param paddings - * @param constantValues + * @param input The input value + * @param paddings The paddings value + * @param constantValues The constantValues value + * @param data type for {@code PadV2} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static Pad create(Scope scope, Operand input, + Operand paddings, Operand constantValues) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Pad"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(paddings.asOutput()); opBuilder.addInput(constantValues.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new Pad(opBuilder.build()); + return new Pad<>(opBuilder.build()); } - + /** + * Gets output. + * + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = Pad.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * The paddings input + */ + public final Operand paddings; + + /** + * The constantValues input + */ + public final Operand constantValues; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tpaddings attribute + */ + public final DataType Tpaddings; + + public Inputs(GraphOperation op) { + super(new Pad<>(op), op, Arrays.asList("T", "Tpaddings")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + paddings = (Operand) op.input(inputIndex++); + constantValues = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tpaddings = op.attributes().getAttrType("Tpaddings"); + } } } 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 index 31eb16ce5db..b12c3b896aa 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,75 +17,124 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; +import org.tensorflow.ndarray.Shape; import org.tensorflow.op.Operands; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.tools.Shape; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** - * Concatenates a list of `N` tensors along the first dimension. - *

+ * Concatenates a list of {@code N} tensors along the first dimension. * The input tensors are all required to have size 1 in the first dimension. - *

- * For example: - *

{@code
+ * 

For example: + *

  * # '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 + * 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 */ +@OpMetadata( + opType = ParallelConcat.OP_NAME, + inputsClass = ParallelConcat.Inputs.class +) @Operator -public final class ParallelConcat extends PrimitiveOp implements Operand { - +public final class ParallelConcat extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ParallelConcat"; + + private Output output; + + public ParallelConcat(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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. + * @param data type for {@code ParallelConcat} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ParallelConcat create(Scope scope, Iterable> values, + Shape shape) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ParallelConcat"); opBuilder.addInputList(Operands.asOutputs(values)); - opBuilder = scope.applyControlDependencies(opBuilder); opBuilder.setAttr("shape", shape); - return new ParallelConcat(opBuilder.build()); + return new ParallelConcat<>(opBuilder.build()); } - + /** + * Gets output. * The concatenated tensor. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = ParallelConcat.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Tensors to be concatenated. All must have size 1 in the first dimension + * and same shape. + */ + public final Iterable> values; + + /** + * The T attribute + */ + public final DataType T; + + /** + * 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. + */ + public final Shape shape; + + public Inputs(GraphOperation op) { + super(new ParallelConcat<>(op), op, Arrays.asList("T", "shape")); + int inputIndex = 0; + int valuesLength = op.inputListLength("values"); + values = Arrays.asList((Operand[]) op.inputList(inputIndex, valuesLength)); + inputIndex += valuesLength; + T = op.attributes().getAttrType("T"); + shape = op.attributes().getAttrShape("shape"); + } } } 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 index d9bfda85a9b..c9fd16880ca 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,45 +17,50 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; 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.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** - * Interleave the values from the `data` tensors into a single tensor. - *

+ * Interleave the values from the {@code 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
+ * 
+ *

For example, if each {@code indices[m]} is scalar or vector, we have + *

  *     # 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 + *

+ *

Each {@code data[i].shape} must start with the corresponding {@code indices[i].shape}, + * and the rest of {@code data[i].shape} must be constant w.r.t. {@code i}. That is, we + * must have {@code data[i].shape = indices[i].shape + constant}. In terms of this + * {@code constant}, the output shape is + *

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

Values may be merged in parallel, so if an index appears in both {@code indices[m][i]} + * and {@code 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
+ * 

For example: + *

  *     indices[0] = 6
  *     indices[1] = [4, 1]
  *     indices[2] = [[5, 2], [0, 3]]
@@ -64,10 +69,10 @@
  *     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` + *
+ *

This method can be used to merge partitions created by {@code 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])
@@ -80,48 +85,93 @@
  *     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 */ +@OpMetadata( + opType = ParallelDynamicStitch.OP_NAME, + inputsClass = ParallelDynamicStitch.Inputs.class +) @Operator -public final class ParallelDynamicStitch extends PrimitiveOp implements Operand { - +public final class ParallelDynamicStitch extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ParallelDynamicStitch"; + + private Output merged; + + public ParallelDynamicStitch(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + merged = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new ParallelDynamicStitch operation. - * + * * @param scope current scope - * @param indices - * @param data + * @param indices The indices value + * @param data The data value + * @param data type for {@code ParallelDynamicStitch} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ParallelDynamicStitch create(Scope scope, + Iterable> indices, Iterable> data) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ParallelDynamicStitch"); opBuilder.addInputList(Operands.asOutputs(indices)); opBuilder.addInputList(Operands.asOutputs(data)); - opBuilder = scope.applyControlDependencies(opBuilder); - return new ParallelDynamicStitch(opBuilder.build()); + return new ParallelDynamicStitch<>(opBuilder.build()); } - + /** + * Gets merged. + * + * @return merged. */ 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++); + + @OpInputsMetadata( + outputsClass = ParallelDynamicStitch.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The indices input + */ + public final Iterable> indices; + + /** + * The data input + */ + public final Iterable> data; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new ParallelDynamicStitch<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + int indicesLength = op.inputListLength("indices"); + indices = Arrays.asList((Operand[]) op.inputList(inputIndex, indicesLength)); + inputIndex += indicesLength; + int dataLength = op.inputListLength("data"); + data = Arrays.asList((Operand[]) op.inputList(inputIndex, dataLength)); + inputIndex += dataLength; + T = op.attributes().getAttrType("T"); + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/PartitionedCall.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/PartitionedCall.java new file mode 100644 index 00000000000..08b8952e099 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/PartitionedCall.java @@ -0,0 +1,247 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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.ConcreteFunction; +import org.tensorflow.GraphOperation; +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.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * returns {@code f(inputs)}, where {@code f}'s body is placed and partitioned. + * Asynchronously executes a function, potentially across multiple devices but + * within a single process. The kernel places and partitions a given function's + * underlying graph, and executes each of the partitioned subgraphs as a function. + */ +@OpMetadata( + opType = PartitionedCall.OP_NAME, + inputsClass = PartitionedCall.Inputs.class +) +@Operator +public final class PartitionedCall extends RawOp implements Iterable> { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "PartitionedCall"; + + private List> output; + + @SuppressWarnings("unchecked") + public PartitionedCall(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int outputLength = operation.outputListLength("output"); + output = Arrays.asList(operation.outputList(outputIdx, outputLength)); + outputIdx += outputLength; + } + + /** + * Factory method to create a class wrapping a new PartitionedCall operation. + * + * @param scope current scope + * @param args A list of input tensors. + * @param Tout A list of output types. + * @param f
+   *   A function that takes 'args', a list of tensors, and returns 'output',
+   *   another list of tensors. Input and output types are specified by 'Tin'
+   *   and 'Tout'. The function body of f will be placed and partitioned across
+   *   devices, setting this op apart from the regular Call op.
+   * 
+ * @param options carries optional attribute values + * @return a new instance of PartitionedCall + */ + @Endpoint( + describeByClass = true + ) + public static PartitionedCall create(Scope scope, Iterable> args, + List> Tout, ConcreteFunction f, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "PartitionedCall"); + opBuilder.addInputList(Operands.asOutputs(args)); + opBuilder.setAttr("Tout", Operands.toDataTypes(Tout)); + opBuilder.setAttr("f", f); + if (options != null) { + for (Options opts : options) { + if (opts.config != null) { + opBuilder.setAttr("config", opts.config); + } + if (opts.configProto != null) { + opBuilder.setAttr("config_proto", opts.configProto); + } + if (opts.executorType != null) { + opBuilder.setAttr("executor_type", opts.executorType); + } + } + } + return new PartitionedCall(opBuilder.build()); + } + + /** + * Sets the config option. + * + * @param config the config option + * @return this Options instance. + */ + public static Options config(String config) { + return new Options().config(config); + } + + /** + * Sets the configProto option. + * + * @param configProto the configProto option + * @return this Options instance. + */ + public static Options configProto(String configProto) { + return new Options().configProto(configProto); + } + + /** + * Sets the executorType option. + * + * @param executorType the executorType option + * @return this Options instance. + */ + public static Options executorType(String executorType) { + return new Options().executorType(executorType); + } + + /** + * Gets output. + * A list of return values. + * @return output. + */ + public List> output() { + return output; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) output.iterator(); + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.PartitionedCall} + */ + public static class Options { + private String config; + + private String configProto; + + private String executorType; + + private Options() { + } + + /** + * Sets the config option. + * + * @param config the config option + * @return this Options instance. + */ + public Options config(String config) { + this.config = config; + return this; + } + + /** + * Sets the configProto option. + * + * @param configProto the configProto option + * @return this Options instance. + */ + public Options configProto(String configProto) { + this.configProto = configProto; + return this; + } + + /** + * Sets the executorType option. + * + * @param executorType the executorType option + * @return this Options instance. + */ + public Options executorType(String executorType) { + this.executorType = executorType; + return this; + } + } + + @OpInputsMetadata( + outputsClass = PartitionedCall.class + ) + public static class Inputs extends RawOpInputs { + /** + * A list of input tensors. + */ + public final Iterable> args; + + /** + * A list of input types. + */ + public final DataType[] Tin; + + /** + * A list of output types. + */ + public final DataType[] Tout; + + /** + * The config attribute + */ + public final String config; + + /** + * The configProto attribute + */ + public final String configProto; + + /** + * The executorType attribute + */ + public final String executorType; + + public Inputs(GraphOperation op) { + super(new PartitionedCall(op), op, Arrays.asList("Tin", "Tout", "config", "config_proto", "executor_type")); + int inputIndex = 0; + int argsLength = op.inputListLength("args"); + args = Arrays.asList((Operand[]) op.inputList(inputIndex, argsLength)); + inputIndex += argsLength; + Tin = op.attributes().getAttrTypeList("Tin"); + Tout = op.attributes().getAttrTypeList("Tout"); + config = op.attributes().getAttrString("config"); + configProto = op.attributes().getAttrString("config_proto"); + executorType = op.attributes().getAttrString("executor_type"); + } + } +} 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 index 0176f9cc862..f4c450973da 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,61 +17,65 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.tools.Shape; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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 */ +@OpMetadata( + opType = Placeholder.OP_NAME, + inputsClass = Placeholder.Inputs.class +) @Operator -public final class Placeholder extends PrimitiveOp implements Operand { - +public final class Placeholder extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.Placeholder} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Placeholder"; + + private Output output; + + public Placeholder(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * 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 + * @param options carries optional attribute values + * @param data type for {@code Placeholder} output and operands * @return a new instance of Placeholder */ - public static Placeholder create(Scope scope, DataType dtype, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("Placeholder", scope.makeOpName("Placeholder")); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("dtype", dtype); + @Endpoint( + describeByClass = true + ) + public static Placeholder create(Scope scope, Class dtype, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Placeholder"); + opBuilder.setAttr("dtype", Operands.toDataType(dtype)); if (options != null) { for (Options opts : options) { if (opts.shape != null) { @@ -79,34 +83,76 @@ public static Placeholder create(Scope scope, DataType d } } } - return new Placeholder(opBuilder.build()); + return new Placeholder<>(opBuilder.build()); } - + /** + * Sets the shape option. + * * @param shape (Optional) The shape of the tensor. If the shape has 0 dimensions, the * shape is unconstrained. + * @return this Options instance. */ public static Options shape(Shape shape) { return new Options().shape(shape); } - + /** + * Gets output. * A placeholder tensor that must be replaced using the feed mechanism. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.Placeholder} + */ + public static class Options { + private Shape shape; + + private Options() { + } + + /** + * Sets the shape option. + * + * @param shape (Optional) The shape of the tensor. If the shape has 0 dimensions, the + * shape is unconstrained. + * @return this Options instance. + */ + public Options shape(Shape shape) { + this.shape = shape; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Placeholder.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The type of elements in the tensor. + */ + public final DataType dtype; + + /** + * (Optional) The shape of the tensor. If the shape has 0 dimensions, the + * shape is unconstrained. + */ + public final Shape shape; + + public Inputs(GraphOperation op) { + super(new Placeholder<>(op), op, Arrays.asList("dtype", "shape")); + int inputIndex = 0; + dtype = op.attributes().getAttrType("dtype"); + shape = op.attributes().getAttrShape("shape"); + } } } 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 index b75a0a7e8e7..202d4cc476c 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,57 +17,104 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.tools.Shape; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** - * A placeholder op that passes through `input` when its output is not fed. - * - * @param data type for {@code output()} output + * A placeholder op that passes through {@code input} when its output is not fed. */ +@OpMetadata( + opType = PlaceholderWithDefault.OP_NAME, + inputsClass = PlaceholderWithDefault.Inputs.class +) @Operator -public final class PlaceholderWithDefault extends PrimitiveOp implements Operand { - +public final class PlaceholderWithDefault extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "PlaceholderWithDefault"; + + private Output output; + + public PlaceholderWithDefault(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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 input The default value to produce when {@code output} is not fed. * @param shape The (possibly partial) shape of the tensor. + * @param data type for {@code PlaceholderWithDefault} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static PlaceholderWithDefault create(Scope scope, Operand input, + Shape shape) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "PlaceholderWithDefault"); opBuilder.addInput(input.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); opBuilder.setAttr("shape", shape); - return new PlaceholderWithDefault(opBuilder.build()); + return new PlaceholderWithDefault<>(opBuilder.build()); } - + /** - * A placeholder tensor that defaults to `input` if it is not fed. + * Gets output. + * A placeholder tensor that defaults to {@code input} if it is not fed. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = PlaceholderWithDefault.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The default value to produce when {@code output} is not fed. + */ + public final Operand input; + + /** + * The type of elements in the tensor. + */ + public final DataType dtype; + + /** + * The (possibly partial) shape of the tensor. + */ + public final Shape shape; + + public Inputs(GraphOperation op) { + super(new PlaceholderWithDefault<>(op), op, Arrays.asList("dtype", "shape")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + dtype = op.attributes().getAttrType("dtype"); + shape = op.attributes().getAttrShape("shape"); + } } } 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 deleted file mode 100644 index 736a24fa23b..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Prelinearize.java +++ /dev/null @@ -1,129 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index 345f098d469..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/PrelinearizeTuple.java +++ /dev/null @@ -1,119 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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; -import org.tensorflow.tools.Shape; -import org.tensorflow.types.family.TType; - -/** - * 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 index e1fe600afe7..d856d0224ac 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,62 +17,53 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; import org.tensorflow.types.TString; /** * Prints a string scalar. - *

* Prints a string scalar to the desired output_stream. */ +@OpMetadata( + opType = Print.OP_NAME, + inputsClass = Print.Inputs.class +) @Operator -public final class Print extends PrimitiveOp { - +public final class Print extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.Print} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "PrintV2"; + + public Print(Operation operation) { + super(operation, OP_NAME); } - + /** - * Factory method to create a class wrapping a new Print operation. - * + * Factory method to create a class wrapping a new PrintV2 operation. + * * @param scope current scope * @param input The string scalar to print. - * @param options carries optional attributes values + * @param options carries optional attribute values * @return a new instance of Print */ + @Endpoint( + describeByClass = true + ) public static Print create(Scope scope, Operand input, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("PrintV2", scope.makeOpName("Print")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Print"); opBuilder.addInput(input.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.outputStream != null) { @@ -85,23 +76,86 @@ public static Print create(Scope scope, Operand input, Options... optio } return new Print(opBuilder.build()); } - + /** + * Sets the outputStream option. + * * @param outputStream A string specifying the output stream or logging level to print to. + * @return this Options instance. */ public static Options outputStream(String outputStream) { return new Options().outputStream(outputStream); } - + /** - * @param end + * Sets the end option. + * + * @param end the end option + * @return this Options instance. */ public static Options end(String end) { return new Options().end(end); } - - - private Print(Operation operation) { - super(operation); + + /** + * Optional attributes for {@link org.tensorflow.op.core.Print} + */ + public static class Options { + private String outputStream; + + private String end; + + private Options() { + } + + /** + * Sets the outputStream option. + * + * @param outputStream A string specifying the output stream or logging level to print to. + * @return this Options instance. + */ + public Options outputStream(String outputStream) { + this.outputStream = outputStream; + return this; + } + + /** + * Sets the end option. + * + * @param end the end option + * @return this Options instance. + */ + public Options end(String end) { + this.end = end; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Print.class + ) + public static class Inputs extends RawOpInputs { + /** + * The string scalar to print. + */ + public final Operand input; + + /** + * A string specifying the output stream or logging level to print to. + */ + public final String outputStream; + + /** + * The end attribute + */ + public final String end; + + public Inputs(GraphOperation op) { + super(new Print(op), op, Arrays.asList("output_stream", "end")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + outputStream = op.attributes().getAttrString("output_stream"); + end = op.attributes().getAttrString("end"); + } } } 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 deleted file mode 100644 index 44c7214fed3..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/PrivateThreadPoolDataset.java +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 index 81167c9fa73..3f1c696a0bc 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,63 +17,68 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 + * Reduces {@code input} along the dimensions given in {@code axis}. Unless + * {@code keep_dims} is true, the rank of the tensor is reduced by 1 for each entry in + * {@code axis}. If {@code keep_dims} is true, the reduced dimensions are * retained with length 1. - * - * @param data type for {@code output()} output */ +@OpMetadata( + opType = Prod.OP_NAME, + inputsClass = Prod.Inputs.class +) @Operator -public final class Prod extends PrimitiveOp implements Operand { - +public final class Prod extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.Prod} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Prod"; + + private Output output; + + public Prod(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * 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 + * {@code [-rank(input), rank(input))}. + * @param options carries optional attribute values + * @param data type for {@code Prod} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static Prod create(Scope scope, Operand input, + Operand axis, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Prod"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.keepDims != null) { @@ -81,33 +86,92 @@ public static Prod create(Scope scope, O } } } - return new Prod(opBuilder.build()); + return new Prod<>(opBuilder.build()); } - + /** + * Sets the keepDims option. + * * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. */ public static Options keepDims(Boolean keepDims) { return new Options().keepDims(keepDims); } - + /** + * Gets output. * The reduced tensor. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.Prod} + */ + public static class Options { + private Boolean keepDims; + + private Options() { + } + + /** + * Sets the keepDims option. + * + * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Prod.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensor to reduce. + */ + public final Operand input; + + /** + * The dimensions to reduce. Must be in the range + * {@code [-rank(input), rank(input))}. + */ + public final Operand axis; + + /** + * If true, retain reduced dimensions with length 1. + */ + public final boolean keepDims; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tidx attribute + */ + public final DataType Tidx; + + public Inputs(GraphOperation op) { + super(new Prod<>(op), op, Arrays.asList("keep_dims", "T", "Tidx")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + axis = (Operand) op.input(inputIndex++); + keepDims = op.attributes().getAttrBool("keep_dims"); + T = op.attributes().getAttrType("T"); + Tidx = op.attributes().getAttrType("Tidx"); + } } } 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 deleted file mode 100644 index a1c34b2d57f..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConcat.java +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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; -import org.tensorflow.types.TFloat; -import org.tensorflow.types.TInt32; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index c97509bd314..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConcatV2.java +++ /dev/null @@ -1,87 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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; -import org.tensorflow.types.TFloat; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * @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 deleted file mode 100644 index a9da308cc7a..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DAndRelu.java +++ /dev/null @@ -1,160 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.TFloat; -import org.tensorflow.types.family.TType; - -/** - * @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, DataType 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", 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 deleted file mode 100644 index 4c1aa980e93..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DAndReluAndRequantize.java +++ /dev/null @@ -1,164 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.TFloat; -import org.tensorflow.types.family.TType; - -/** - * @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, DataType 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", 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 deleted file mode 100644 index bb7024f5f1f..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DAndRequantize.java +++ /dev/null @@ -1,164 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.TFloat; -import org.tensorflow.types.family.TType; - -/** - * @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, DataType 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", 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 deleted file mode 100644 index 09afb1c4201..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DPerChannel.java +++ /dev/null @@ -1,142 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.TFloat; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType 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", 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 deleted file mode 100644 index 90f5085052c..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBias.java +++ /dev/null @@ -1,162 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.TFloat; -import org.tensorflow.types.family.TType; - -/** - * @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, DataType 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", 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 deleted file mode 100644 index abe58d0278a..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasAndRelu.java +++ /dev/null @@ -1,162 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.TFloat; -import org.tensorflow.types.family.TType; - -/** - * @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, DataType 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", 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 deleted file mode 100644 index 883b714a5fb..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasAndReluAndRequantize.java +++ /dev/null @@ -1,166 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.TFloat; -import org.tensorflow.types.family.TType; - -/** - * @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, DataType 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", 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 deleted file mode 100644 index ae9e5793888..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasAndRequantize.java +++ /dev/null @@ -1,166 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.TFloat; -import org.tensorflow.types.family.TType; - -/** - * @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, DataType 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", 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 deleted file mode 100644 index d2e5862d5b2..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasSignedSumAndReluAndRequantize.java +++ /dev/null @@ -1,172 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.TFloat; -import org.tensorflow.types.family.TType; - -/** - * @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, DataType 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", 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 deleted file mode 100644 index cdb2683baef..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasSumAndRelu.java +++ /dev/null @@ -1,164 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.TFloat; -import org.tensorflow.types.family.TType; - -/** - * @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, DataType 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", 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 deleted file mode 100644 index b7ded5433bd..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedConv2DWithBiasSumAndReluAndRequantize.java +++ /dev/null @@ -1,172 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.TFloat; -import org.tensorflow.types.family.TType; - -/** - * @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, DataType 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", 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 deleted file mode 100644 index 44e80a06c45..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedDepthwiseConv2D.java +++ /dev/null @@ -1,142 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.TFloat; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType 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", 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 deleted file mode 100644 index dbaf14883f8..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedDepthwiseConv2DWithBias.java +++ /dev/null @@ -1,144 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.TFloat; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType 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", 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 deleted file mode 100644 index bfed3d13b65..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedDepthwiseConv2DWithBiasAndRelu.java +++ /dev/null @@ -1,144 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.TFloat; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType 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", 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 deleted file mode 100644 index 514de1229a9..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize.java +++ /dev/null @@ -1,148 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.TFloat; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType 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", 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 deleted file mode 100644 index 66e10dd23ac..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedMatMulWithBias.java +++ /dev/null @@ -1,176 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType 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", 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 deleted file mode 100644 index e42e0ee6a24..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedMatMulWithBiasAndRelu.java +++ /dev/null @@ -1,177 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType 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", 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 deleted file mode 100644 index 3ffe5b4720f..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedMatMulWithBiasAndReluAndRequantize.java +++ /dev/null @@ -1,182 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType 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", 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 index e01dd849f40..84816c6893f 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,76 +17,146 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.types.TFloat; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TFloat32; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * Reshapes a quantized tensor as per the Reshape op. - *

- * ``` - * - * @param data type for {@code output()} output */ +@OpMetadata( + opType = QuantizedReshape.OP_NAME, + inputsClass = QuantizedReshape.Inputs.class +) @Operator -public final class QuantizedReshape extends PrimitiveOp { - +public final class QuantizedReshape extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "QuantizedReshape"; + + private Output output; + + private Output outputMin; + + private Output outputMax; + + public QuantizedReshape(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + outputMin = operation.output(outputIdx++); + outputMax = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new QuantizedReshape operation. - * + * * @param scope current scope - * @param tensor + * @param tensor The tensor value * @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. + * @param data type for {@code QuantizedReshape} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static QuantizedReshape create(Scope scope, Operand tensor, + Operand shape, Operand inputMin, Operand inputMax) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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()); + return new QuantizedReshape<>(opBuilder.build()); } - + /** + * Gets output. + * + * @return output. */ public Output output() { return output; } - + /** + * Gets outputMin. * This value is copied from input_min. + * @return outputMin. */ - public Output outputMin() { + public Output outputMin() { return outputMin; } - + /** + * Gets outputMax. * This value is copied from input_max. + * @return outputMax. */ - public Output outputMax() { + 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++); + + @OpInputsMetadata( + outputsClass = QuantizedReshape.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensor input + */ + public final Operand tensor; + + /** + * Defines the shape of the output tensor. + */ + public final Operand shape; + + /** + * The minimum value of the input. + */ + public final Operand inputMin; + + /** + * The maximum value of the input. + */ + public final Operand inputMax; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tshape attribute + */ + public final DataType Tshape; + + public Inputs(GraphOperation op) { + super(new QuantizedReshape<>(op), op, Arrays.asList("T", "Tshape")); + int inputIndex = 0; + tensor = (Operand) op.input(inputIndex++); + shape = (Operand) op.input(inputIndex++); + inputMin = (Operand) op.input(inputIndex++); + inputMax = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tshape = op.attributes().getAttrType("Tshape"); + } } } 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 deleted file mode 100644 index 67a052d7a14..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RaggedGather.java +++ /dev/null @@ -1,121 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index a4ed6c0ae92..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RaggedRange.java +++ /dev/null @@ -1,112 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TInt64; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType 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", 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, TInt64.DTYPE); - } - - /** - * 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 deleted file mode 100644 index 0d81dee81b4..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RaggedTensorFromVariant.java +++ /dev/null @@ -1,104 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType Tvalues, DataType 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", Tvalues); - opBuilder.setAttr("Tsplits", 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 deleted file mode 100644 index 996928c9061..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RaggedTensorToSparse.java +++ /dev/null @@ -1,90 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt64; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index e04a2ec6f22..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RaggedTensorToVariant.java +++ /dev/null @@ -1,87 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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/RandomIndexShuffle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RandomIndexShuffle.java new file mode 100644 index 00000000000..76538abf9cb --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RandomIndexShuffle.java @@ -0,0 +1,182 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TNumber; + +/** + * Outputs the position of {@code value} in a permutation of [0, ..., max_index]. + * Output values are a bijection of the {@code index} for any combination and {@code seed} and {@code max_index}. + *

If multiple inputs are vectors (matrix in case of seed) then the size of the + * first dimension must match. + *

The outputs are deterministic. + */ +@OpMetadata( + opType = RandomIndexShuffle.OP_NAME, + inputsClass = RandomIndexShuffle.Inputs.class +) +@Operator +public final class RandomIndexShuffle extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "RandomIndexShuffle"; + + private Output output; + + public RandomIndexShuffle(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new RandomIndexShuffle operation. + * + * @param scope current scope + * @param index A scalar tensor or a vector of dtype {@code dtype}. The index (or indices) to be shuffled. Must be within [0, max_index]. + * @param seed A tensor of dtype {@code Tseed} and shape [3] or [n, 3]. The random seed. + * @param maxIndex A scalar tensor or vector of dtype {@code dtype}. The upper bound(s) of the interval (inclusive). + * @param options carries optional attribute values + * @param data type for {@code RandomIndexShuffle} output and operands + * @return a new instance of RandomIndexShuffle + */ + @Endpoint( + describeByClass = true + ) + public static RandomIndexShuffle create(Scope scope, Operand index, + Operand seed, Operand maxIndex, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "RandomIndexShuffle"); + opBuilder.addInput(index.asOutput()); + opBuilder.addInput(seed.asOutput()); + opBuilder.addInput(maxIndex.asOutput()); + if (options != null) { + for (Options opts : options) { + if (opts.rounds != null) { + opBuilder.setAttr("rounds", opts.rounds); + } + } + } + return new RandomIndexShuffle<>(opBuilder.build()); + } + + /** + * Sets the rounds option. + * + * @param rounds The number of rounds to use the in block cipher. + * @return this Options instance. + */ + public static Options rounds(Long rounds) { + return new Options().rounds(rounds); + } + + /** + * Gets output. + * A scalar tensor of dtype {@code dtype}, within [0, max_index]. The randomly shuffled index. + * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.RandomIndexShuffle} + */ + public static class Options { + private Long rounds; + + private Options() { + } + + /** + * Sets the rounds option. + * + * @param rounds The number of rounds to use the in block cipher. + * @return this Options instance. + */ + public Options rounds(Long rounds) { + this.rounds = rounds; + return this; + } + } + + @OpInputsMetadata( + outputsClass = RandomIndexShuffle.class + ) + public static class Inputs extends RawOpInputs> { + /** + * A scalar tensor or a vector of dtype {@code dtype}. The index (or indices) to be shuffled. Must be within [0, max_index]. + */ + public final Operand index; + + /** + * A tensor of dtype {@code Tseed} and shape [3] or [n, 3]. The random seed. + */ + public final Operand seed; + + /** + * A scalar tensor or vector of dtype {@code dtype}. The upper bound(s) of the interval (inclusive). + */ + public final Operand maxIndex; + + /** + * The number of rounds to use the in block cipher. + */ + public final long rounds; + + /** + * The dtype of the input and output. + */ + public final DataType dtype; + + /** + * The type of {@code seed}. + */ + public final DataType Tseed; + + public Inputs(GraphOperation op) { + super(new RandomIndexShuffle<>(op), op, Arrays.asList("rounds", "dtype", "Tseed")); + int inputIndex = 0; + index = (Operand) op.input(inputIndex++); + seed = (Operand) op.input(inputIndex++); + maxIndex = (Operand) op.input(inputIndex++); + rounds = op.attributes().getAttrInt("rounds"); + dtype = op.attributes().getAttrType("dtype"); + Tseed = op.attributes().getAttrType("Tseed"); + } + } +} 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 index a78a308f769..702214095a5 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,71 +17,120 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** * 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
+ * This operation creates a sequence of numbers that begins at {@code start} and
+ * extends by increments of {@code delta} up to but not including {@code limit}.
+ * 

For example: + *

  * # '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 + * tf.range(start, limit, delta) ==> [3, 6, 9, 12, 15] + *
*/ +@OpMetadata( + opType = Range.OP_NAME, + inputsClass = Range.Inputs.class +) @Operator -public final class Range extends PrimitiveOp implements Operand { - +public final class Range extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Range"; + + private Output output; + + public Range(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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`. + * @param delta 0-D (scalar). Optional. Default is 1. Number that increments {@code start}. + * @param data type for {@code Range} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static Range create(Scope scope, Operand start, Operand limit, + Operand delta) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Range"); opBuilder.addInput(start.asOutput()); opBuilder.addInput(limit.asOutput()); opBuilder.addInput(delta.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new Range(opBuilder.build()); + return new Range<>(opBuilder.build()); } - + /** + * Gets output. * 1-D. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = Range.class + ) + public static class Inputs extends RawOpInputs> { + /** + * 0-D (scalar). First entry in the sequence. + */ + public final Operand start; + + /** + * 0-D (scalar). Upper limit of sequence, exclusive. + */ + public final Operand limit; + + /** + * 0-D (scalar). Optional. Default is 1. Number that increments {@code start}. + */ + public final Operand delta; + + /** + * The Tidx attribute + */ + public final DataType Tidx; + + public Inputs(GraphOperation op) { + super(new Range<>(op), op, Arrays.asList("Tidx")); + int inputIndex = 0; + start = (Operand) op.input(inputIndex++); + limit = (Operand) op.input(inputIndex++); + delta = (Operand) op.input(inputIndex++); + Tidx = op.attributes().getAttrType("Tidx"); + } } } 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 index e1e7041387a..0de92672581 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,64 +17,104 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** * Returns the rank of a tensor. - *

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

- * For example: - *

{@code
+ * This operation returns an integer representing the rank of {@code input}.
+ * 

For example: + *

  * # '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 + * 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." + * of the tensor. Rank is also known as "order", "degree", or "ndims." */ +@OpMetadata( + opType = Rank.OP_NAME, + inputsClass = Rank.Inputs.class +) @Operator -public final class Rank extends PrimitiveOp implements Operand { - +public final class Rank extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Rank"; + + private Output output; + + public Rank(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new Rank operation. - * + * * @param scope current scope - * @param input + * @param input The input value * @return a new instance of Rank */ - public static Rank create(Scope scope, Operand input) { - OperationBuilder opBuilder = scope.env().opBuilder("Rank", scope.makeOpName("Rank")); + @Endpoint( + describeByClass = true + ) + public static Rank create(Scope scope, Operand input) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Rank"); opBuilder.addInput(input.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new Rank(opBuilder.build()); } - + /** + * Gets output. + * + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = Rank.class + ) + public static class Inputs extends RawOpInputs { + /** + * The input input + */ + public final Operand input; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new Rank(op), op, Arrays.asList("T")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index 3db1f095837..f57c2781c3f 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,63 +17,103 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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 + *

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 */ +@OpMetadata( + opType = ReadVariableOp.OP_NAME, + inputsClass = ReadVariableOp.Inputs.class +) @Operator -public final class ReadVariableOp extends PrimitiveOp implements Operand { - +public final class ReadVariableOp extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ReadVariableOp"; + + private Output value; + + public ReadVariableOp(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + value = operation.output(outputIdx++); + } + /** * 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. + * @param data type for {@code ReadVariableOp} output and operands * @return a new instance of ReadVariableOp */ - public static ReadVariableOp create(Scope scope, Operand resource, DataType dtype) { - OperationBuilder opBuilder = scope.env().opBuilder("ReadVariableOp", scope.makeOpName("ReadVariableOp")); + @Endpoint( + describeByClass = true + ) + public static ReadVariableOp create(Scope scope, + Operand resource, Class dtype) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ReadVariableOp"); opBuilder.addInput(resource.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("dtype", dtype); - return new ReadVariableOp(opBuilder.build()); + opBuilder.setAttr("dtype", Operands.toDataType(dtype)); + return new ReadVariableOp<>(opBuilder.build()); } - + /** + * Gets value. + * + * @return value. */ 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++); + + @OpInputsMetadata( + outputsClass = ReadVariableOp.class + ) + public static class Inputs extends RawOpInputs> { + /** + * handle to the resource in which to store the variable. + */ + public final Operand resource; + + /** + * the dtype of the value. + */ + public final DataType dtype; + + public Inputs(GraphOperation op) { + super(new ReadVariableOp<>(op), op, Arrays.asList("dtype")); + int inputIndex = 0; + resource = (Operand) op.input(inputIndex++); + dtype = op.attributes().getAttrType("dtype"); + } } } 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 deleted file mode 100644 index 6fd78fe8555..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RebatchDataset.java +++ /dev/null @@ -1,123 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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/Recv.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Recv.java new file mode 100644 index 00000000000..5b3caab37b8 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Recv.java @@ -0,0 +1,193 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +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.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * Receives the named tensor from send_device on recv_device. + */ +@OpMetadata( + opType = Recv.OP_NAME, + inputsClass = Recv.Inputs.class +) +@Operator +public final class Recv extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Recv"; + + private Output tensor; + + public Recv(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + tensor = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new Recv operation. + * + * @param scope current scope + * @param tensorType The value of the tensorType attribute + * @param tensorName The name of the tensor to receive. + * @param sendDevice The name of the device sending the tensor. + * @param sendDeviceIncarnation The current incarnation of send_device. + * @param recvDevice The name of the device receiving the tensor. + * @param options carries optional attribute values + * @param data type for {@code Recv} output and operands + * @return a new instance of Recv + */ + @Endpoint( + describeByClass = true + ) + public static Recv create(Scope scope, Class tensorType, + String tensorName, String sendDevice, Long sendDeviceIncarnation, String recvDevice, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Recv"); + opBuilder.setAttr("tensor_type", Operands.toDataType(tensorType)); + opBuilder.setAttr("tensor_name", tensorName); + opBuilder.setAttr("send_device", sendDevice); + opBuilder.setAttr("send_device_incarnation", sendDeviceIncarnation); + opBuilder.setAttr("recv_device", recvDevice); + if (options != null) { + for (Options opts : options) { + if (opts.clientTerminated != null) { + opBuilder.setAttr("client_terminated", opts.clientTerminated); + } + } + } + return new Recv<>(opBuilder.build()); + } + + /** + * Sets the clientTerminated option. + * + * @param clientTerminated If set to true, this indicates that the node was added + * to the graph as a result of a client-side feed or fetch of Tensor data, + * in which case the corresponding send or recv is expected to be managed + * locally by the caller. + * @return this Options instance. + */ + public static Options clientTerminated(Boolean clientTerminated) { + return new Options().clientTerminated(clientTerminated); + } + + /** + * Gets tensor. + * The tensor to receive. + * @return tensor. + */ + public Output tensor() { + return tensor; + } + + @Override + public Output asOutput() { + return tensor; + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.Recv} + */ + public static class Options { + private Boolean clientTerminated; + + private Options() { + } + + /** + * Sets the clientTerminated option. + * + * @param clientTerminated If set to true, this indicates that the node was added + * to the graph as a result of a client-side feed or fetch of Tensor data, + * in which case the corresponding send or recv is expected to be managed + * locally by the caller. + * @return this Options instance. + */ + public Options clientTerminated(Boolean clientTerminated) { + this.clientTerminated = clientTerminated; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Recv.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensorType attribute + */ + public final DataType tensorType; + + /** + * The name of the tensor to receive. + */ + public final String tensorName; + + /** + * The name of the device sending the tensor. + */ + public final String sendDevice; + + /** + * The current incarnation of send_device. + */ + public final long sendDeviceIncarnation; + + /** + * The name of the device receiving the tensor. + */ + public final String recvDevice; + + /** + * If set to true, this indicates that the node was added + * to the graph as a result of a client-side feed or fetch of Tensor data, + * in which case the corresponding send or recv is expected to be managed + * locally by the caller. + */ + public final boolean clientTerminated; + + public Inputs(GraphOperation op) { + super(new Recv<>(op), op, Arrays.asList("tensor_type", "tensor_name", "send_device", "send_device_incarnation", "recv_device", "client_terminated")); + int inputIndex = 0; + tensorType = op.attributes().getAttrType("tensor_type"); + tensorName = op.attributes().getAttrString("tensor_name"); + sendDevice = op.attributes().getAttrString("send_device"); + sendDeviceIncarnation = op.attributes().getAttrInt("send_device_incarnation"); + recvDevice = op.attributes().getAttrString("recv_device"); + clientTerminated = op.attributes().getAttrBool("client_terminated"); + } + } +} 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 deleted file mode 100644 index 2a67a9700cf..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RecvTPUEmbeddingActivations.java +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.TFloat; - -/** - * 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 index b7bbecb4f57..22746fae83c 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,62 +17,67 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TBool; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** - * 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 + * Computes the "logical and" of elements across dimensions of a tensor. + * Reduces {@code input} along the dimensions given in {@code axis}. Unless + * {@code keep_dims} is true, the rank of the tensor is reduced by 1 for each entry in + * {@code axis}. If {@code keep_dims} is true, the reduced dimensions are * retained with length 1. */ +@OpMetadata( + opType = ReduceAll.OP_NAME, + inputsClass = ReduceAll.Inputs.class +) @Operator -public final class ReduceAll extends PrimitiveOp implements Operand { - +public final class ReduceAll extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.ReduceAll} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "All"; + + private Output output; + + public ReduceAll(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** - * Factory method to create a class wrapping a new ReduceAll operation. - * + * 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 + * {@code [-rank(input), rank(input))}. + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static ReduceAll create(Scope scope, Operand input, Operand axis, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ReduceAll"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.keepDims != null) { @@ -82,31 +87,84 @@ public static ReduceAll create(Scope scope, Operand i } return new ReduceAll(opBuilder.build()); } - + /** + * Sets the keepDims option. + * * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. */ public static Options keepDims(Boolean keepDims) { return new Options().keepDims(keepDims); } - + /** + * Gets output. * The reduced tensor. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.ReduceAll} + */ + public static class Options { + private Boolean keepDims; + + private Options() { + } + + /** + * Sets the keepDims option. + * + * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ReduceAll.class + ) + public static class Inputs extends RawOpInputs { + /** + * The tensor to reduce. + */ + public final Operand input; + + /** + * The dimensions to reduce. Must be in the range + * {@code [-rank(input), rank(input))}. + */ + public final Operand axis; + + /** + * If true, retain reduced dimensions with length 1. + */ + public final boolean keepDims; + + /** + * The Tidx attribute + */ + public final DataType Tidx; + + public Inputs(GraphOperation op) { + super(new ReduceAll(op), op, Arrays.asList("keep_dims", "Tidx")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + axis = (Operand) op.input(inputIndex++); + keepDims = op.attributes().getAttrBool("keep_dims"); + Tidx = op.attributes().getAttrType("Tidx"); + } } } 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 index 5f4d94ab5c1..b9f571672ed 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,62 +17,67 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TBool; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** - * 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 + * Computes the "logical or" of elements across dimensions of a tensor. + * Reduces {@code input} along the dimensions given in {@code axis}. Unless + * {@code keep_dims} is true, the rank of the tensor is reduced by 1 for each entry in + * {@code axis}. If {@code keep_dims} is true, the reduced dimensions are * retained with length 1. */ +@OpMetadata( + opType = ReduceAny.OP_NAME, + inputsClass = ReduceAny.Inputs.class +) @Operator -public final class ReduceAny extends PrimitiveOp implements Operand { - +public final class ReduceAny extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.ReduceAny} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Any"; + + private Output output; + + public ReduceAny(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** - * Factory method to create a class wrapping a new ReduceAny operation. - * + * 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 + * {@code [-rank(input), rank(input))}. + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static ReduceAny create(Scope scope, Operand input, Operand axis, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ReduceAny"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.keepDims != null) { @@ -82,31 +87,84 @@ public static ReduceAny create(Scope scope, Operand i } return new ReduceAny(opBuilder.build()); } - + /** + * Sets the keepDims option. + * * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. */ public static Options keepDims(Boolean keepDims) { return new Options().keepDims(keepDims); } - + /** + * Gets output. * The reduced tensor. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.ReduceAny} + */ + public static class Options { + private Boolean keepDims; + + private Options() { + } + + /** + * Sets the keepDims option. + * + * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ReduceAny.class + ) + public static class Inputs extends RawOpInputs { + /** + * The tensor to reduce. + */ + public final Operand input; + + /** + * The dimensions to reduce. Must be in the range + * {@code [-rank(input), rank(input))}. + */ + public final Operand axis; + + /** + * If true, retain reduced dimensions with length 1. + */ + public final boolean keepDims; + + /** + * The Tidx attribute + */ + public final DataType Tidx; + + public Inputs(GraphOperation op) { + super(new ReduceAny(op), op, Arrays.asList("keep_dims", "Tidx")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + axis = (Operand) op.input(inputIndex++); + keepDims = op.attributes().getAttrBool("keep_dims"); + Tidx = op.attributes().getAttrType("Tidx"); + } } } 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 index a674ad4be28..dca6c6a5ffc 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,63 +17,67 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** * 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 + * Reduces {@code input} along the dimensions given in {@code axis}. Unless + * {@code keep_dims} is true, the rank of the tensor is reduced by 1 for each entry in + * {@code axis}. If {@code keep_dims} is true, the reduced dimensions are * retained with length 1. - * - * @param data type for {@code output()} output */ +@OpMetadata( + opType = ReduceMax.OP_NAME, + inputsClass = ReduceMax.Inputs.class +) @Operator -public final class ReduceMax extends PrimitiveOp implements Operand { - +public final class ReduceMax extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.ReduceMax} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Max"; + + private Output output; + + public ReduceMax(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** - * Factory method to create a class wrapping a new ReduceMax operation. - * + * 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 + * {@code [-rank(input), rank(input))}. + * @param options carries optional attribute values + * @param data type for {@code Max} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ReduceMax create(Scope scope, Operand input, + Operand axis, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ReduceMax"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.keepDims != null) { @@ -81,33 +85,92 @@ public static ReduceMax create(Scope sco } } } - return new ReduceMax(opBuilder.build()); + return new ReduceMax<>(opBuilder.build()); } - + /** + * Sets the keepDims option. + * * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. */ public static Options keepDims(Boolean keepDims) { return new Options().keepDims(keepDims); } - + /** + * Gets output. * The reduced tensor. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.ReduceMax} + */ + public static class Options { + private Boolean keepDims; + + private Options() { + } + + /** + * Sets the keepDims option. + * + * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ReduceMax.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensor to reduce. + */ + public final Operand input; + + /** + * The dimensions to reduce. Must be in the range + * {@code [-rank(input), rank(input))}. + */ + public final Operand axis; + + /** + * If true, retain reduced dimensions with length 1. + */ + public final boolean keepDims; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tidx attribute + */ + public final DataType Tidx; + + public Inputs(GraphOperation op) { + super(new ReduceMax<>(op), op, Arrays.asList("keep_dims", "T", "Tidx")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + axis = (Operand) op.input(inputIndex++); + keepDims = op.attributes().getAttrBool("keep_dims"); + T = op.attributes().getAttrType("T"); + Tidx = op.attributes().getAttrType("Tidx"); + } } } 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 index 29e2ad78252..a7e544cfaab 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,63 +17,67 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** * 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 + * Reduces {@code input} along the dimensions given in {@code axis}. Unless + * {@code keep_dims} is true, the rank of the tensor is reduced by 1 for each entry in + * {@code axis}. If {@code keep_dims} is true, the reduced dimensions are * retained with length 1. - * - * @param data type for {@code output()} output */ +@OpMetadata( + opType = ReduceMin.OP_NAME, + inputsClass = ReduceMin.Inputs.class +) @Operator -public final class ReduceMin extends PrimitiveOp implements Operand { - +public final class ReduceMin extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.ReduceMin} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Min"; + + private Output output; + + public ReduceMin(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** - * Factory method to create a class wrapping a new ReduceMin operation. - * + * 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 + * {@code [-rank(input), rank(input))}. + * @param options carries optional attribute values + * @param data type for {@code Min} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ReduceMin create(Scope scope, Operand input, + Operand axis, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ReduceMin"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.keepDims != null) { @@ -81,33 +85,92 @@ public static ReduceMin create(Scope sco } } } - return new ReduceMin(opBuilder.build()); + return new ReduceMin<>(opBuilder.build()); } - + /** + * Sets the keepDims option. + * * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. */ public static Options keepDims(Boolean keepDims) { return new Options().keepDims(keepDims); } - + /** + * Gets output. * The reduced tensor. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.ReduceMin} + */ + public static class Options { + private Boolean keepDims; + + private Options() { + } + + /** + * Sets the keepDims option. + * + * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ReduceMin.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensor to reduce. + */ + public final Operand input; + + /** + * The dimensions to reduce. Must be in the range + * {@code [-rank(input), rank(input))}. + */ + public final Operand axis; + + /** + * If true, retain reduced dimensions with length 1. + */ + public final boolean keepDims; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tidx attribute + */ + public final DataType Tidx; + + public Inputs(GraphOperation op) { + super(new ReduceMin<>(op), op, Arrays.asList("keep_dims", "T", "Tidx")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + axis = (Operand) op.input(inputIndex++); + keepDims = op.attributes().getAttrBool("keep_dims"); + T = op.attributes().getAttrType("T"); + Tidx = op.attributes().getAttrType("Tidx"); + } } } 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 index 3de9a7ca094..3dc53ad9c58 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,63 +17,68 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 + * Reduces {@code input} along the dimensions given in {@code axis}. Unless + * {@code keep_dims} is true, the rank of the tensor is reduced by 1 for each entry in + * {@code axis}. If {@code keep_dims} is true, the reduced dimensions are * retained with length 1. - * - * @param data type for {@code output()} output */ +@OpMetadata( + opType = ReduceProd.OP_NAME, + inputsClass = ReduceProd.Inputs.class +) @Operator -public final class ReduceProd extends PrimitiveOp implements Operand { - +public final class ReduceProd extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.ReduceProd} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Prod"; + + private Output output; + + public ReduceProd(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** - * Factory method to create a class wrapping a new ReduceProd operation. - * + * 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 + * {@code [-rank(input), rank(input))}. + * @param options carries optional attribute values + * @param data type for {@code Prod} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ReduceProd create(Scope scope, Operand input, + Operand axis, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ReduceProd"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.keepDims != null) { @@ -81,33 +86,92 @@ public static ReduceProd create(Scope sc } } } - return new ReduceProd(opBuilder.build()); + return new ReduceProd<>(opBuilder.build()); } - + /** + * Sets the keepDims option. + * * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. */ public static Options keepDims(Boolean keepDims) { return new Options().keepDims(keepDims); } - + /** + * Gets output. * The reduced tensor. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.ReduceProd} + */ + public static class Options { + private Boolean keepDims; + + private Options() { + } + + /** + * Sets the keepDims option. + * + * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ReduceProd.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensor to reduce. + */ + public final Operand input; + + /** + * The dimensions to reduce. Must be in the range + * {@code [-rank(input), rank(input))}. + */ + public final Operand axis; + + /** + * If true, retain reduced dimensions with length 1. + */ + public final boolean keepDims; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tidx attribute + */ + public final DataType Tidx; + + public Inputs(GraphOperation op) { + super(new ReduceProd<>(op), op, Arrays.asList("keep_dims", "T", "Tidx")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + axis = (Operand) op.input(inputIndex++); + keepDims = op.attributes().getAttrBool("keep_dims"); + T = op.attributes().getAttrType("T"); + Tidx = op.attributes().getAttrType("Tidx"); + } } } 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 index 6dfc4313728..bbe161f9210 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,63 +17,68 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 + * Reduces {@code input} along the dimensions given in {@code axis}. Unless + * {@code keep_dims} is true, the rank of the tensor is reduced by 1 for each entry in + * {@code axis}. If {@code keep_dims} is true, the reduced dimensions are * retained with length 1. - * - * @param data type for {@code output()} output */ +@OpMetadata( + opType = ReduceSum.OP_NAME, + inputsClass = ReduceSum.Inputs.class +) @Operator -public final class ReduceSum extends PrimitiveOp implements Operand { - +public final class ReduceSum extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.ReduceSum} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Sum"; + + private Output output; + + public ReduceSum(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** - * Factory method to create a class wrapping a new ReduceSum operation. - * + * 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 + * {@code [-rank(input), rank(input))}. + * @param options carries optional attribute values + * @param data type for {@code Sum} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ReduceSum create(Scope scope, Operand input, + Operand axis, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ReduceSum"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.keepDims != null) { @@ -81,33 +86,92 @@ public static ReduceSum create(Scope sco } } } - return new ReduceSum(opBuilder.build()); + return new ReduceSum<>(opBuilder.build()); } - + /** + * Sets the keepDims option. + * * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. */ public static Options keepDims(Boolean keepDims) { return new Options().keepDims(keepDims); } - + /** + * Gets output. * The reduced tensor. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.ReduceSum} + */ + public static class Options { + private Boolean keepDims; + + private Options() { + } + + /** + * Sets the keepDims option. + * + * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ReduceSum.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensor to reduce. + */ + public final Operand input; + + /** + * The dimensions to reduce. Must be in the range + * {@code [-rank(input), rank(input))}. + */ + public final Operand axis; + + /** + * If true, retain reduced dimensions with length 1. + */ + public final boolean keepDims; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tidx attribute + */ + public final DataType Tidx; + + public Inputs(GraphOperation op) { + super(new ReduceSum<>(op), op, Arrays.asList("keep_dims", "T", "Tidx")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + axis = (Operand) op.input(inputIndex++); + keepDims = op.attributes().getAttrBool("keep_dims"); + T = op.attributes().getAttrType("T"); + Tidx = op.attributes().getAttrType("Tidx"); + } } } 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 index 763acedfb18..218092a2563 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,67 +17,65 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** - * 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 + * Creates or finds a child frame, and makes {@code data} available to the child frame. + * The unique {@code frame_name} is used by the {@code Executor} to identify frames. If + * {@code is_constant} is true, {@code output} is a constant in the child frame; otherwise + * it may be changed in the child frame. At most {@code 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 { - +@OpMetadata( + opType = RefEnter.OP_NAME, + inputsClass = RefEnter.Inputs.class +) +@Operator +public final class RefEnter extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.RefEnter} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "RefEnter"; + + private Output output; + + public RefEnter(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * 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 + * @param options carries optional attribute values + * @param data type for {@code RefEnter} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static RefEnter create(Scope scope, Operand data, String frameName, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "RefEnter"); opBuilder.addInput(data.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); opBuilder.setAttr("frame_name", frameName); if (options != null) { for (Options opts : options) { @@ -89,40 +87,114 @@ public static RefEnter create(Scope scope, Operand data, } } } - return new RefEnter(opBuilder.build()); + return new RefEnter<>(opBuilder.build()); } - + /** + * Sets the isConstant option. + * * @param isConstant If true, the output is constant within the child frame. + * @return this Options instance. */ public static Options isConstant(Boolean isConstant) { return new Options().isConstant(isConstant); } - + /** + * Sets the parallelIterations option. + * * @param parallelIterations The number of iterations allowed to run in parallel. + * @return this Options instance. */ public static Options parallelIterations(Long parallelIterations) { return new Options().parallelIterations(parallelIterations); } - + /** - * The same tensor as `data`. + * Gets output. + * The same tensor as {@code data}. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.RefEnter} + */ + public static class Options { + private Boolean isConstant; + + private Long parallelIterations; + + private Options() { + } + + /** + * Sets the isConstant option. + * + * @param isConstant If true, the output is constant within the child frame. + * @return this Options instance. + */ + public Options isConstant(Boolean isConstant) { + this.isConstant = isConstant; + return this; + } + + /** + * Sets the parallelIterations option. + * + * @param parallelIterations The number of iterations allowed to run in parallel. + * @return this Options instance. + */ + public Options parallelIterations(Long parallelIterations) { + this.parallelIterations = parallelIterations; + return this; + } + } + + @OpInputsMetadata( + outputsClass = RefEnter.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensor to be made available to the child frame. + */ + public final Operand data; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The name of the child frame. + */ + public final String frameName; + + /** + * If true, the output is constant within the child frame. + */ + public final boolean isConstant; + + /** + * The number of iterations allowed to run in parallel. + */ + public final long parallelIterations; + + public Inputs(GraphOperation op) { + super(new RefEnter<>(op), op, Arrays.asList("T", "frame_name", "is_constant", "parallel_iterations")); + int inputIndex = 0; + data = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + frameName = op.attributes().getAttrString("frame_name"); + isConstant = op.attributes().getAttrBool("is_constant"); + parallelIterations = op.attributes().getAttrInt("parallel_iterations"); + } } } 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 index fe8dfa6cc1d..9a840da2c3d 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,54 +17,95 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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 + * Exit makes its input {@code data} available to the parent frame. */ -public final class RefExit extends PrimitiveOp implements Operand { - +@OpMetadata( + opType = RefExit.OP_NAME, + inputsClass = RefExit.Inputs.class +) +@Operator +public final class RefExit extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "RefExit"; + + private Output output; + + public RefExit(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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. + * @param data type for {@code RefExit} output and operands * @return a new instance of RefExit */ + @Endpoint( + describeByClass = true + ) public static RefExit create(Scope scope, Operand data) { - OperationBuilder opBuilder = scope.env().opBuilder("RefExit", scope.makeOpName("RefExit")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "RefExit"); opBuilder.addInput(data.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new RefExit(opBuilder.build()); + return new RefExit<>(opBuilder.build()); } - + /** - * The same tensor as `data`. + * Gets output. + * The same tensor as {@code data}. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = RefExit.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensor to be made available to the parent frame. + */ + public final Operand data; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new RefExit<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + data = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index f3c23f64625..c3bb004b548 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,51 +17,94 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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 { - +@OpMetadata( + opType = RefIdentity.OP_NAME, + inputsClass = RefIdentity.Inputs.class +) +@Operator +public final class RefIdentity extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "RefIdentity"; + + private Output output; + + public RefIdentity(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new RefIdentity operation. - * + * * @param scope current scope - * @param input + * @param input The input value + * @param data type for {@code RefIdentity} output and operands * @return a new instance of RefIdentity */ + @Endpoint( + describeByClass = true + ) public static RefIdentity create(Scope scope, Operand input) { - OperationBuilder opBuilder = scope.env().opBuilder("RefIdentity", scope.makeOpName("RefIdentity")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "RefIdentity"); opBuilder.addInput(input.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new RefIdentity(opBuilder.build()); + return new RefIdentity<>(opBuilder.build()); } - + /** + * Gets output. + * + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = RefIdentity.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new RefIdentity<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index d0ba1c93ca3..4baf6cc6260 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,64 +17,109 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; 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.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** - * 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 + * Forwards the value of an available tensor from {@code inputs} to {@code output}. + * {@code Merge} waits for at least one of the tensors in {@code inputs} to become available. + * It is usually combined with {@code Switch} to implement branching. + *

{@code Merge} forwards the first tensor for become available to {@code output}, and sets + * {@code value_index} to its index in {@code inputs}. */ -public final class RefMerge extends PrimitiveOp { - +@OpMetadata( + opType = RefMerge.OP_NAME, + inputsClass = RefMerge.Inputs.class +) +@Operator +public final class RefMerge extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "RefMerge"; + + private Output output; + + private Output valueIndex; + + public RefMerge(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + valueIndex = operation.output(outputIdx++); + } + /** * 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. + * @param data type for {@code RefMerge} output and operands * @return a new instance of RefMerge */ + @Endpoint( + describeByClass = true + ) public static RefMerge create(Scope scope, Iterable> inputs) { - OperationBuilder opBuilder = scope.env().opBuilder("RefMerge", scope.makeOpName("RefMerge")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "RefMerge"); opBuilder.addInputList(Operands.asOutputs(inputs)); - opBuilder = scope.applyControlDependencies(opBuilder); - return new RefMerge(opBuilder.build()); + return new RefMerge<>(opBuilder.build()); } - + /** + * Gets output. * Will be set to the available input tensor. + * @return output. */ public Output output() { return output; } - + /** - * The index of the chosen input tensor in `inputs`. + * Gets valueIndex. + * The index of the chosen input tensor in {@code inputs}. + * @return valueIndex. */ 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++); + + @OpInputsMetadata( + outputsClass = RefMerge.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input tensors, exactly one of which will become available. + */ + public final Iterable> inputs; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new RefMerge<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + int inputsLength = op.inputListLength("inputs"); + inputs = Arrays.asList((Operand[]) op.inputList(inputIndex, inputsLength)); + inputIndex += inputsLength; + T = op.attributes().getAttrType("T"); + } } } 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 index d49390c218d..ef647c70cd6 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,54 +17,94 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * Makes its input available to the next iteration. - * - * @param data type for {@code output()} output */ +@OpMetadata( + opType = RefNextIteration.OP_NAME, + inputsClass = RefNextIteration.Inputs.class +) @Operator -public final class RefNextIteration extends PrimitiveOp implements Operand { - +public final class RefNextIteration extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "RefNextIteration"; + + private Output output; + + public RefNextIteration(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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. + * @param data type for {@code RefNextIteration} output and operands * @return a new instance of RefNextIteration */ + @Endpoint( + describeByClass = true + ) public static RefNextIteration create(Scope scope, Operand data) { - OperationBuilder opBuilder = scope.env().opBuilder("RefNextIteration", scope.makeOpName("RefNextIteration")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "RefNextIteration"); opBuilder.addInput(data.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new RefNextIteration(opBuilder.build()); + return new RefNextIteration<>(opBuilder.build()); } - + /** - * The same tensor as `data`. + * Gets output. + * The same tensor as {@code data}. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = RefNextIteration.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensor to be made available to the next iteration. + */ + public final Operand data; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new RefNextIteration<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + data = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index 61a48903dcd..d7ffa33956e 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,58 +17,107 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; 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.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** - * Forwards the `index`th element of `inputs` to `output`. - * - * @param data type for {@code output()} output + * Forwards the {@code index}th element of {@code inputs} to {@code output}. */ +@OpMetadata( + opType = RefSelect.OP_NAME, + inputsClass = RefSelect.Inputs.class +) @Operator -public final class RefSelect extends PrimitiveOp implements Operand { - +public final class RefSelect extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "RefSelect"; + + private Output output; + + public RefSelect(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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`. + * @param inputs A list of ref tensors, one of which will be forwarded to {@code output}. + * @param data type for {@code RefSelect} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static RefSelect create(Scope scope, Operand index, + Iterable> inputs) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "RefSelect"); opBuilder.addInput(index.asOutput()); opBuilder.addInputList(Operands.asOutputs(inputs)); - opBuilder = scope.applyControlDependencies(opBuilder); - return new RefSelect(opBuilder.build()); + return new RefSelect<>(opBuilder.build()); } - + /** + * Gets output. * The forwarded tensor. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = RefSelect.class + ) + public static class Inputs extends RawOpInputs> { + /** + * A scalar that determines the input that gets selected. + */ + public final Operand index; + + /** + * A list of ref tensors, one of which will be forwarded to {@code output}. + */ + public final Iterable> inputs; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new RefSelect<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + index = (Operand) op.input(inputIndex++); + int inputsLength = op.inputListLength("inputs"); + inputs = Arrays.asList((Operand[]) op.inputList(inputIndex, inputsLength)); + inputIndex += inputsLength; + T = op.attributes().getAttrType("T"); + } } } 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 index 0c24c9a55bd..2e97b2bbcad 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,66 +17,114 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TBool; import org.tensorflow.types.family.TType; /** - * 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 + * Forwards the ref tensor {@code data} to the output port determined by {@code pred}. + * If {@code pred} is true, the {@code data} input is forwarded to {@code output_true}. Otherwise, + * the data goes to {@code output_false}. + *

See also {@code Switch} and {@code Merge}. */ +@OpMetadata( + opType = RefSwitch.OP_NAME, + inputsClass = RefSwitch.Inputs.class +) @Operator -public final class RefSwitch extends PrimitiveOp { - +public final class RefSwitch extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "RefSwitch"; + + private Output outputFalse; + + private Output outputTrue; + + public RefSwitch(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputFalse = operation.output(outputIdx++); + outputTrue = operation.output(outputIdx++); + } + /** * 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. + * @param data type for {@code RefSwitch} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static RefSwitch create(Scope scope, Operand data, + Operand pred) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "RefSwitch"); opBuilder.addInput(data.asOutput()); opBuilder.addInput(pred.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new RefSwitch(opBuilder.build()); + return new RefSwitch<>(opBuilder.build()); } - + /** - * If `pred` is false, data will be forwarded to this output. + * Gets outputFalse. + * If {@code pred} is false, data will be forwarded to this output. + * @return outputFalse. */ public Output outputFalse() { return outputFalse; } - + /** - * If `pred` is true, data will be forwarded to this output. + * Gets outputTrue. + * If {@code pred} is true, data will be forwarded to this output. + * @return outputTrue. */ 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++); + + @OpInputsMetadata( + outputsClass = RefSwitch.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The ref tensor to be forwarded to the appropriate output. + */ + public final Operand data; + + /** + * A scalar that specifies which output port will receive data. + */ + public final Operand pred; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new RefSwitch<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + data = (Operand) op.input(inputIndex++); + pred = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Relayout.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Relayout.java new file mode 100644 index 00000000000..503d3cfe42a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Relayout.java @@ -0,0 +1,118 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * The Relayout operation + */ +@OpMetadata( + opType = Relayout.OP_NAME, + inputsClass = Relayout.Inputs.class +) +@Operator +public final class Relayout extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Relayout"; + + private Output output; + + public Relayout(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new Relayout operation. + * + * @param scope current scope + * @param input The input value + * @param layout The value of the layout attribute + * @param data type for {@code Relayout} output and operands + * @return a new instance of Relayout + */ + @Endpoint( + describeByClass = true + ) + public static Relayout create(Scope scope, Operand input, String layout) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Relayout"); + opBuilder.addInput(input.asOutput()); + opBuilder.setAttr("layout", layout); + return new Relayout<>(opBuilder.build()); + } + + /** + * Gets output. + * + * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + @OpInputsMetadata( + outputsClass = Relayout.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * The layout attribute + */ + public final String layout; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new Relayout<>(op), op, Arrays.asList("layout", "T")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + layout = op.attributes().getAttrString("layout"); + T = op.attributes().getAttrType("T"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RelayoutLike.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RelayoutLike.java new file mode 100644 index 00000000000..499cb8d6c72 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RelayoutLike.java @@ -0,0 +1,125 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * The RelayoutLike operation + */ +@OpMetadata( + opType = RelayoutLike.OP_NAME, + inputsClass = RelayoutLike.Inputs.class +) +@Operator +public final class RelayoutLike extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "RelayoutLike"; + + private Output output; + + public RelayoutLike(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new RelayoutLike operation. + * + * @param scope current scope + * @param input The input value + * @param layoutInput The layoutInput value + * @param data type for {@code RelayoutLike} output and operands + * @return a new instance of RelayoutLike + */ + @Endpoint( + describeByClass = true + ) + public static RelayoutLike create(Scope scope, Operand input, + Operand layoutInput) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "RelayoutLike"); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(layoutInput.asOutput()); + return new RelayoutLike<>(opBuilder.build()); + } + + /** + * Gets output. + * + * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + @OpInputsMetadata( + outputsClass = RelayoutLike.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * The layoutInput input + */ + public final Operand layoutInput; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The U attribute + */ + public final DataType U; + + public Inputs(GraphOperation op) { + super(new RelayoutLike<>(op), op, Arrays.asList("T", "U")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + layoutInput = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + U = op.attributes().getAttrType("U"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RemoteCall.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RemoteCall.java new file mode 100644 index 00000000000..7613a302dbe --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RemoteCall.java @@ -0,0 +1,139 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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.ConcreteFunction; +import org.tensorflow.GraphOperation; +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.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TString; +import org.tensorflow.types.family.TType; + +/** + * Runs function {@code f} on a remote device indicated by {@code target}. + */ +@OpMetadata( + opType = RemoteCall.OP_NAME, + inputsClass = RemoteCall.Inputs.class +) +@Operator +public final class RemoteCall extends RawOp implements Iterable> { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "RemoteCall"; + + private List> output; + + @SuppressWarnings("unchecked") + public RemoteCall(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int outputLength = operation.outputListLength("output"); + output = Arrays.asList(operation.outputList(outputIdx, outputLength)); + outputIdx += outputLength; + } + + /** + * Factory method to create a class wrapping a new RemoteCall operation. + * + * @param scope current scope + * @param target A fully specified device name where we want to run the function. + * @param args A list of arguments for the function. + * @param Tout The type list for the return values. + * @param f The function to run remotely. + * @return a new instance of RemoteCall + */ + @Endpoint( + describeByClass = true + ) + public static RemoteCall create(Scope scope, Operand target, Iterable> args, + List> Tout, ConcreteFunction f) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "RemoteCall"); + opBuilder.addInput(target.asOutput()); + opBuilder.addInputList(Operands.asOutputs(args)); + opBuilder.setAttr("Tout", Operands.toDataTypes(Tout)); + opBuilder.setAttr("f", f); + return new RemoteCall(opBuilder.build()); + } + + /** + * Gets output. + * A list of return values. + * @return output. + */ + public List> output() { + return output; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) output.iterator(); + } + + @OpInputsMetadata( + outputsClass = RemoteCall.class + ) + public static class Inputs extends RawOpInputs { + /** + * A fully specified device name where we want to run the function. + */ + public final Operand target; + + /** + * A list of arguments for the function. + */ + public final Iterable> args; + + /** + * The type list for the arguments. + */ + public final DataType[] Tin; + + /** + * The type list for the return values. + */ + public final DataType[] Tout; + + public Inputs(GraphOperation op) { + super(new RemoteCall(op), op, Arrays.asList("Tin", "Tout")); + int inputIndex = 0; + target = (Operand) op.input(inputIndex++); + int argsLength = op.inputListLength("args"); + args = Arrays.asList((Operand[]) op.inputList(inputIndex, argsLength)); + inputIndex += argsLength; + Tin = op.attributes().getAttrTypeList("Tin"); + Tout = op.attributes().getAttrTypeList("Tout"); + } + } +} 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 deleted file mode 100644 index 86af7d79e7b..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RemoteFusedGraphExecute.java +++ /dev/null @@ -1,93 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 deleted file mode 100644 index c7c336b26d3..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RequantizationRangePerChannel.java +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index 34941f3b84a..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RequantizePerChannel.java +++ /dev/null @@ -1,93 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType 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", 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 index 5146030a1b0..54c0aba057e 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,44 +17,49 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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
+ * Given {@code tensor}, this operation returns a tensor that has the same values
+ * as {@code tensor} with shape {@code shape}.
+ * 

If one component of 1-D tensor {@code shape} is the special value -1, the size of that + * dimension is computed so that the total size remains constant. In particular, a + * {@code shape} of {@code [-1]} flattens into 1-D. At most one component of {@code shape} may be + * unknown. + *

The {@code shape} must be 1-D and the operation returns a tensor with shape + * {@code shape} filled with the values of {@code tensor}. In this case, the number of elements + * implied by {@code shape} must be the same as the number of elements in {@code tensor}. + *

It is an error if {@code shape} is not 1-D. + *

For example: + *

  * # tensor 't' is [1, 2, 3, 4, 5, 6, 7, 8, 9]
  * # tensor 't' has shape [9]
- * reshape(t, [3, 3]) ==> [[1, 2, 3],
+ * 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],
+ * reshape(t, [2, 4]) ==> [[1, 1, 2, 2],
  *                         [3, 3, 4, 4]]
- * 
+ *
  * # tensor 't' is [[[1, 1, 1],
  * #                 [2, 2, 2]],
  * #                [[3, 3, 3],
@@ -63,67 +68,113 @@
  * #                 [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]
- * 
+ * 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],
+ * 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],
+ * 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],
+ * 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 + * reshape(t, []) ==> 7 + *
*/ +@OpMetadata( + opType = Reshape.OP_NAME, + inputsClass = Reshape.Inputs.class +) @Operator -public final class Reshape extends PrimitiveOp implements Operand { - +public final class Reshape extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Reshape"; + + private Output output; + + public Reshape(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new Reshape operation. - * + * * @param scope current scope - * @param tensor + * @param tensor The tensor value * @param shape Defines the shape of the output tensor. + * @param data type for {@code Reshape} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static Reshape create(Scope scope, Operand tensor, + Operand shape) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Reshape"); opBuilder.addInput(tensor.asOutput()); opBuilder.addInput(shape.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new Reshape(opBuilder.build()); + return new Reshape<>(opBuilder.build()); } - + /** + * Gets output. + * + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = Reshape.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensor input + */ + public final Operand tensor; + + /** + * Defines the shape of the output tensor. + */ + public final Operand shape; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tshape attribute + */ + public final DataType Tshape; + + public Inputs(GraphOperation op) { + super(new Reshape<>(op), op, Arrays.asList("T", "Tshape")); + int inputIndex = 0; + tensor = (Operand) op.input(inputIndex++); + shape = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tshape = op.attributes().getAttrType("Tshape"); + } } } 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 deleted file mode 100644 index 5a9556cea3b..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceAccumulatorApplyGradient.java +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index 947a7545b0f..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceAccumulatorNumAccumulated.java +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt32; - -/** - * 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 deleted file mode 100644 index c4e6240a192..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceAccumulatorSetGlobalStep.java +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt64; - -/** - * 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 deleted file mode 100644 index 396ac2a07e3..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceAccumulatorTakeGradient.java +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TInt32; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType 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", 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 deleted file mode 100644 index 51ca6876e45..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceApplyAdagradV2.java +++ /dev/null @@ -1,118 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TType; - -/** - * 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 deleted file mode 100644 index ab574a98386..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceApplyAdamWithAmsgrad.java +++ /dev/null @@ -1,116 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index d7bc8f845ae..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceApplyKerasMomentum.java +++ /dev/null @@ -1,126 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index f8a1db1f93b..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceConditionalAccumulator.java +++ /dev/null @@ -1,156 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.tools.Shape; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType dtype, Shape shape, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("ResourceConditionalAccumulator", scope.makeOpName("ResourceConditionalAccumulator")); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("dtype", 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 index 342c761b54b..0ca0faa179e 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,62 +17,110 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * Increments variable pointed to by 'resource' until it reaches 'limit'. - * - * @param data type for {@code output()} output */ +@OpMetadata( + opType = ResourceCountUpTo.OP_NAME, + inputsClass = ResourceCountUpTo.Inputs.class +) @Operator -public final class ResourceCountUpTo extends PrimitiveOp implements Operand { - +public final class ResourceCountUpTo extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ResourceCountUpTo"; + + private Output output; + + public ResourceCountUpTo(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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 resource Should be from a scalar {@code Variable} node. * @param limit If incrementing ref would bring it above limit, instead generates an * 'OutOfRange' error. - * @param T + * @param T The value of the T attribute + * @param data type for {@code ResourceCountUpTo} output and operands * @return a new instance of ResourceCountUpTo */ - public static ResourceCountUpTo create(Scope scope, Operand resource, Long limit, DataType T) { - OperationBuilder opBuilder = scope.env().opBuilder("ResourceCountUpTo", scope.makeOpName("ResourceCountUpTo")); + @Endpoint( + describeByClass = true + ) + public static ResourceCountUpTo create(Scope scope, + Operand resource, Long limit, Class T) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ResourceCountUpTo"); opBuilder.addInput(resource.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); opBuilder.setAttr("limit", limit); - opBuilder.setAttr("T", T); - return new ResourceCountUpTo(opBuilder.build()); + opBuilder.setAttr("T", Operands.toDataType(T)); + return new ResourceCountUpTo<>(opBuilder.build()); } - + /** + * Gets output. * A copy of the input before increment. If nothing else modifies the * input, the values produced will all be distinct. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = ResourceCountUpTo.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Should be from a scalar {@code Variable} node. + */ + public final Operand resource; + + /** + * If incrementing ref would bring it above limit, instead generates an + * 'OutOfRange' error. + */ + public final long limit; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new ResourceCountUpTo<>(op), op, Arrays.asList("limit", "T")); + int inputIndex = 0; + resource = (Operand) op.input(inputIndex++); + limit = op.attributes().getAttrInt("limit"); + T = op.attributes().getAttrType("T"); + } } } 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 index a0b093e9f7b..c458bacea4c 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,83 +17,79 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * 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
+ * Gather slices from the variable pointed to by {@code resource} according to {@code indices}.
+ * {@code indices} must be an integer tensor of any dimension (usually 0-D or 1-D).
+ * Produces an output tensor with shape {@code indices.shape + params.shape[1:]} where:
+ * 
  *     # 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 + *
*/ +@OpMetadata( + opType = ResourceGather.OP_NAME, + inputsClass = ResourceGather.Inputs.class +) @Operator -public final class ResourceGather extends PrimitiveOp implements Operand { - +public final class ResourceGather extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.ResourceGather} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "ResourceGather"; + + private Output output; + + public ResourceGather(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * 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 + * @param resource The resource value + * @param indices The indices value + * @param dtype The value of the dtype attribute + * @param options carries optional attribute values + * @param data type for {@code ResourceGather} output and operands * @return a new instance of ResourceGather */ - public static ResourceGather create(Scope scope, Operand resource, Operand indices, DataType dtype, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("ResourceGather", scope.makeOpName("ResourceGather")); + @Endpoint( + describeByClass = true + ) + public static ResourceGather create(Scope scope, + Operand resource, Operand indices, Class dtype, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ResourceGather"); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(indices.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("dtype", dtype); + opBuilder.setAttr("dtype", Operands.toDataType(dtype)); if (options != null) { for (Options opts : options) { if (opts.batchDims != null) { @@ -104,39 +100,120 @@ public static ResourceGather create(Scop } } } - return new ResourceGather(opBuilder.build()); + return new ResourceGather<>(opBuilder.build()); } - + /** - * @param batchDims + * Sets the batchDims option. + * + * @param batchDims the batchDims option + * @return this Options instance. */ public static Options batchDims(Long batchDims) { return new Options().batchDims(batchDims); } - + /** - * @param validateIndices + * Sets the validateIndices option. + * + * @param validateIndices the validateIndices option + * @return this Options instance. */ public static Options validateIndices(Boolean validateIndices) { return new Options().validateIndices(validateIndices); } - + /** + * Gets output. + * + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.ResourceGather} + */ + public static class Options { + private Long batchDims; + + private Boolean validateIndices; + + private Options() { + } + + /** + * Sets the batchDims option. + * + * @param batchDims the batchDims option + * @return this Options instance. + */ + public Options batchDims(Long batchDims) { + this.batchDims = batchDims; + return this; + } + + /** + * Sets the validateIndices option. + * + * @param validateIndices the validateIndices option + * @return this Options instance. + */ + public Options validateIndices(Boolean validateIndices) { + this.validateIndices = validateIndices; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ResourceGather.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The resource input + */ + public final Operand resource; + + /** + * The indices input + */ + public final Operand indices; + + /** + * The batchDims attribute + */ + public final long batchDims; + + /** + * The validateIndices attribute + */ + public final boolean validateIndices; + + /** + * The dtype attribute + */ + public final DataType dtype; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + public Inputs(GraphOperation op) { + super(new ResourceGather<>(op), op, Arrays.asList("batch_dims", "validate_indices", "dtype", "Tindices")); + int inputIndex = 0; + resource = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + batchDims = op.attributes().getAttrInt("batch_dims"); + validateIndices = op.attributes().getAttrBool("validate_indices"); + dtype = op.attributes().getAttrType("dtype"); + Tindices = op.attributes().getAttrType("Tindices"); + } } } 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 index b71d677f989..f9c6b72b544 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,57 +17,113 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * @param data type for {@code output()} output + * The ResourceGatherNd operation */ +@OpMetadata( + opType = ResourceGatherNd.OP_NAME, + inputsClass = ResourceGatherNd.Inputs.class +) @Operator -public final class ResourceGatherNd extends PrimitiveOp implements Operand { - +public final class ResourceGatherNd extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ResourceGatherNd"; + + private Output output; + + public ResourceGatherNd(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new ResourceGatherNd operation. - * + * * @param scope current scope - * @param resource - * @param indices - * @param dtype + * @param resource The resource value + * @param indices The indices value + * @param dtype The value of the dtype attribute + * @param data type for {@code ResourceGatherNd} output and operands * @return a new instance of ResourceGatherNd */ - public static ResourceGatherNd create(Scope scope, Operand resource, Operand indices, DataType dtype) { - OperationBuilder opBuilder = scope.env().opBuilder("ResourceGatherNd", scope.makeOpName("ResourceGatherNd")); + @Endpoint( + describeByClass = true + ) + public static ResourceGatherNd create(Scope scope, + Operand resource, Operand indices, Class dtype) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ResourceGatherNd"); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(indices.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("dtype", dtype); - return new ResourceGatherNd(opBuilder.build()); + opBuilder.setAttr("dtype", Operands.toDataType(dtype)); + return new ResourceGatherNd<>(opBuilder.build()); } - + /** + * Gets output. + * + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = ResourceGatherNd.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The resource input + */ + public final Operand resource; + + /** + * The indices input + */ + public final Operand indices; + + /** + * The dtype attribute + */ + public final DataType dtype; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + public Inputs(GraphOperation op) { + super(new ResourceGatherNd<>(op), op, Arrays.asList("dtype", "Tindices")); + int inputIndex = 0; + resource = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + dtype = op.attributes().getAttrType("dtype"); + Tindices = op.attributes().getAttrType("Tindices"); + } } } 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 index 29354a7aec9..349b50a440f 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,61 +17,115 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * Adds sparse updates to the variable referenced by `resource`. - *

+ * Adds sparse updates to the variable referenced by {@code 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 + *

+ * # 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 {@code indices} reference * the same location, their contributions add. - *

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

+ *

Requires {@code updates.shape = indices.shape + ref.shape[1:]} or {@code updates.shape = []}. *

* *
*/ +@OpMetadata( + opType = ResourceScatterAdd.OP_NAME, + inputsClass = ResourceScatterAdd.Inputs.class +) @Operator -public final class ResourceScatterAdd extends PrimitiveOp { - +public final class ResourceScatterAdd extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ResourceScatterAdd"; + + public ResourceScatterAdd(Operation operation) { + super(operation, OP_NAME); + } + /** * 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`. + * @param resource Should be from a {@code Variable} node. + * @param indices A tensor of indices into the first dimension of {@code ref}. + * @param updates A tensor of updated values to add to {@code 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")); + @Endpoint( + describeByClass = true + ) + public static ResourceScatterAdd create(Scope scope, Operand resource, + Operand indices, Operand updates) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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); + + @OpInputsMetadata( + outputsClass = ResourceScatterAdd.class + ) + public static class Inputs extends RawOpInputs { + /** + * Should be from a {@code Variable} node. + */ + public final Operand resource; + + /** + * A tensor of indices into the first dimension of {@code ref}. + */ + public final Operand indices; + + /** + * A tensor of updated values to add to {@code ref}. + */ + public final Operand updates; + + /** + * The dtype attribute + */ + public final DataType dtype; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + public Inputs(GraphOperation op) { + super(new ResourceScatterAdd(op), op, Arrays.asList("dtype", "Tindices")); + int inputIndex = 0; + resource = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + dtype = op.attributes().getAttrType("dtype"); + Tindices = op.attributes().getAttrType("Tindices"); + } } } 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 index 52fce6ffc67..107a14eb110 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,61 +17,115 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * Divides sparse updates into the variable referenced by `resource`. - *

+ * Divides sparse updates into the variable referenced by {@code 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 + *

+ * # 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 {@code indices} reference * the same location, their contributions multiply. - *

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

+ *

Requires {@code updates.shape = indices.shape + ref.shape[1:]} or {@code updates.shape = []}. *

* *
*/ +@OpMetadata( + opType = ResourceScatterDiv.OP_NAME, + inputsClass = ResourceScatterDiv.Inputs.class +) @Operator -public final class ResourceScatterDiv extends PrimitiveOp { - +public final class ResourceScatterDiv extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ResourceScatterDiv"; + + public ResourceScatterDiv(Operation operation) { + super(operation, OP_NAME); + } + /** * 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`. + * @param resource Should be from a {@code Variable} node. + * @param indices A tensor of indices into the first dimension of {@code ref}. + * @param updates A tensor of updated values to add to {@code 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")); + @Endpoint( + describeByClass = true + ) + public static ResourceScatterDiv create(Scope scope, Operand resource, + Operand indices, Operand updates) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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); + + @OpInputsMetadata( + outputsClass = ResourceScatterDiv.class + ) + public static class Inputs extends RawOpInputs { + /** + * Should be from a {@code Variable} node. + */ + public final Operand resource; + + /** + * A tensor of indices into the first dimension of {@code ref}. + */ + public final Operand indices; + + /** + * A tensor of updated values to add to {@code ref}. + */ + public final Operand updates; + + /** + * The dtype attribute + */ + public final DataType dtype; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + public Inputs(GraphOperation op) { + super(new ResourceScatterDiv(op), op, Arrays.asList("dtype", "Tindices")); + int inputIndex = 0; + resource = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + dtype = op.attributes().getAttrType("dtype"); + Tindices = op.attributes().getAttrType("Tindices"); + } } } 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 index b7d3d7dd5da..38401cd418c 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,61 +17,115 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * Reduces sparse updates into the variable referenced by `resource` using the `max` operation. - *

+ * Reduces sparse updates into the variable referenced by {@code resource} using the {@code 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 + *

+ * # 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 {@code indices} reference * the same location, their contributions are combined. - *

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

+ *

Requires {@code updates.shape = indices.shape + ref.shape[1:]} or {@code updates.shape = []}. *

* *
*/ +@OpMetadata( + opType = ResourceScatterMax.OP_NAME, + inputsClass = ResourceScatterMax.Inputs.class +) @Operator -public final class ResourceScatterMax extends PrimitiveOp { - +public final class ResourceScatterMax extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ResourceScatterMax"; + + public ResourceScatterMax(Operation operation) { + super(operation, OP_NAME); + } + /** * 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`. + * @param resource Should be from a {@code Variable} node. + * @param indices A tensor of indices into the first dimension of {@code ref}. + * @param updates A tensor of updated values to add to {@code 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")); + @Endpoint( + describeByClass = true + ) + public static ResourceScatterMax create(Scope scope, Operand resource, + Operand indices, Operand updates) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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); + + @OpInputsMetadata( + outputsClass = ResourceScatterMax.class + ) + public static class Inputs extends RawOpInputs { + /** + * Should be from a {@code Variable} node. + */ + public final Operand resource; + + /** + * A tensor of indices into the first dimension of {@code ref}. + */ + public final Operand indices; + + /** + * A tensor of updated values to add to {@code ref}. + */ + public final Operand updates; + + /** + * The dtype attribute + */ + public final DataType dtype; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + public Inputs(GraphOperation op) { + super(new ResourceScatterMax(op), op, Arrays.asList("dtype", "Tindices")); + int inputIndex = 0; + resource = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + dtype = op.attributes().getAttrType("dtype"); + Tindices = op.attributes().getAttrType("Tindices"); + } } } 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 index 343dd1988a5..cf1c36e2ec7 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,61 +17,115 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * Reduces sparse updates into the variable referenced by `resource` using the `min` operation. - *

+ * Reduces sparse updates into the variable referenced by {@code resource} using the {@code 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 + *

+ * # 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 {@code indices} reference * the same location, their contributions are combined. - *

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

+ *

Requires {@code updates.shape = indices.shape + ref.shape[1:]} or {@code updates.shape = []}. *

* *
*/ +@OpMetadata( + opType = ResourceScatterMin.OP_NAME, + inputsClass = ResourceScatterMin.Inputs.class +) @Operator -public final class ResourceScatterMin extends PrimitiveOp { - +public final class ResourceScatterMin extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ResourceScatterMin"; + + public ResourceScatterMin(Operation operation) { + super(operation, OP_NAME); + } + /** * 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`. + * @param resource Should be from a {@code Variable} node. + * @param indices A tensor of indices into the first dimension of {@code ref}. + * @param updates A tensor of updated values to add to {@code 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")); + @Endpoint( + describeByClass = true + ) + public static ResourceScatterMin create(Scope scope, Operand resource, + Operand indices, Operand updates) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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); + + @OpInputsMetadata( + outputsClass = ResourceScatterMin.class + ) + public static class Inputs extends RawOpInputs { + /** + * Should be from a {@code Variable} node. + */ + public final Operand resource; + + /** + * A tensor of indices into the first dimension of {@code ref}. + */ + public final Operand indices; + + /** + * A tensor of updated values to add to {@code ref}. + */ + public final Operand updates; + + /** + * The dtype attribute + */ + public final DataType dtype; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + public Inputs(GraphOperation op) { + super(new ResourceScatterMin(op), op, Arrays.asList("dtype", "Tindices")); + int inputIndex = 0; + resource = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + dtype = op.attributes().getAttrType("dtype"); + Tindices = op.attributes().getAttrType("Tindices"); + } } } 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 index 4c46348f8c7..a659eee9979 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,61 +17,115 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * Multiplies sparse updates into the variable referenced by `resource`. - *

+ * Multiplies sparse updates into the variable referenced by {@code 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 + *

+ * # 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 {@code indices} reference * the same location, their contributions multiply. - *

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

+ *

Requires {@code updates.shape = indices.shape + ref.shape[1:]} or {@code updates.shape = []}. *

* *
*/ +@OpMetadata( + opType = ResourceScatterMul.OP_NAME, + inputsClass = ResourceScatterMul.Inputs.class +) @Operator -public final class ResourceScatterMul extends PrimitiveOp { - +public final class ResourceScatterMul extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ResourceScatterMul"; + + public ResourceScatterMul(Operation operation) { + super(operation, OP_NAME); + } + /** * 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`. + * @param resource Should be from a {@code Variable} node. + * @param indices A tensor of indices into the first dimension of {@code ref}. + * @param updates A tensor of updated values to add to {@code 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")); + @Endpoint( + describeByClass = true + ) + public static ResourceScatterMul create(Scope scope, Operand resource, + Operand indices, Operand updates) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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); + + @OpInputsMetadata( + outputsClass = ResourceScatterMul.class + ) + public static class Inputs extends RawOpInputs { + /** + * Should be from a {@code Variable} node. + */ + public final Operand resource; + + /** + * A tensor of indices into the first dimension of {@code ref}. + */ + public final Operand indices; + + /** + * A tensor of updated values to add to {@code ref}. + */ + public final Operand updates; + + /** + * The dtype attribute + */ + public final DataType dtype; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + public Inputs(GraphOperation op) { + super(new ResourceScatterMul(op), op, Arrays.asList("dtype", "Tindices")); + int inputIndex = 0; + resource = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + dtype = op.attributes().getAttrType("dtype"); + Tindices = op.attributes().getAttrType("Tindices"); + } } } 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 index 76b3f31df6f..ee6c1cf7d61 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,111 +17,211 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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
+ * {@code ref} is a {@code Tensor} with rank {@code P} and {@code indices} is a {@code Tensor} of rank {@code Q}.
+ * 

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

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

{@code updates} is {@code Tensor} of rank {@code Q-1+P-K} with shape: + *

  * [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 + *
+ *

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 + *

+ *

The resulting update to ref would look like this: + *

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

See {@code tf.scatter_nd} for more details about how to make updates to * slices. */ +@OpMetadata( + opType = ResourceScatterNdAdd.OP_NAME, + inputsClass = ResourceScatterNdAdd.Inputs.class +) @Operator -public final class ResourceScatterNdAdd extends PrimitiveOp { - +public final class ResourceScatterNdAdd extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.ResourceScatterNdAdd} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "ResourceScatterNdAdd"; + + public ResourceScatterNdAdd(Operation operation) { + super(operation, OP_NAME); } - + /** * 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 + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static ResourceScatterNdAdd create(Scope scope, Operand ref, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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); } + if (opts.badIndicesPolicy != null) { + opBuilder.setAttr("bad_indices_policy", opts.badIndicesPolicy); + } } } return new ResourceScatterNdAdd(opBuilder.build()); } - + /** + * Sets the useLocking option. + * * @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. + * @return this Options instance. */ public static Options useLocking(Boolean useLocking) { return new Options().useLocking(useLocking); } - - - private ResourceScatterNdAdd(Operation operation) { - super(operation); + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public static Options badIndicesPolicy(String badIndicesPolicy) { + return new Options().badIndicesPolicy(badIndicesPolicy); + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.ResourceScatterNdAdd} + */ + public static class Options { + private Boolean useLocking; + + private String badIndicesPolicy; + + private Options() { + } + + /** + * Sets the useLocking option. + * + * @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. + * @return this Options instance. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public Options badIndicesPolicy(String badIndicesPolicy) { + this.badIndicesPolicy = badIndicesPolicy; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ResourceScatterNdAdd.class + ) + public static class Inputs extends RawOpInputs { + /** + * A resource handle. Must be from a VarHandleOp. + */ + public final Operand ref; + + /** + * A Tensor. Must be one of the following types: int32, int64. + * A tensor of indices into ref. + */ + public final Operand indices; + + /** + * A Tensor. Must have the same type as ref. A tensor of + * values to add to ref. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * 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 final boolean useLocking; + + /** + * The badIndicesPolicy attribute + */ + public final String badIndicesPolicy; + + public Inputs(GraphOperation op) { + super(new ResourceScatterNdAdd(op), op, Arrays.asList("T", "Tindices", "use_locking", "bad_indices_policy")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + useLocking = op.attributes().getAttrBool("use_locking"); + badIndicesPolicy = op.attributes().getAttrString("bad_indices_policy"); + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdMax.java new file mode 100644 index 00000000000..379843a67c7 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdMax.java @@ -0,0 +1,201 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TNumber; +import org.tensorflow.types.family.TType; + +/** + * The ResourceScatterNdMax operation + */ +@OpMetadata( + opType = ResourceScatterNdMax.OP_NAME, + inputsClass = ResourceScatterNdMax.Inputs.class +) +@Operator +public final class ResourceScatterNdMax extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ResourceScatterNdMax"; + + public ResourceScatterNdMax(Operation operation) { + super(operation, OP_NAME); + } + + /** + * Factory method to create a class wrapping a new ResourceScatterNdMax 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 whose element wise max is taken with ref + * @param options carries optional attribute values + * @return a new instance of ResourceScatterNdMax + */ + @Endpoint( + describeByClass = true + ) + public static ResourceScatterNdMax create(Scope scope, Operand ref, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ResourceScatterNdMax"); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + if (opts.badIndicesPolicy != null) { + opBuilder.setAttr("bad_indices_policy", opts.badIndicesPolicy); + } + } + } + return new ResourceScatterNdMax(opBuilder.build()); + } + + /** + * Sets the useLocking option. + * + * @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. + * @return this Options instance. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public static Options badIndicesPolicy(String badIndicesPolicy) { + return new Options().badIndicesPolicy(badIndicesPolicy); + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.ResourceScatterNdMax} + */ + public static class Options { + private Boolean useLocking; + + private String badIndicesPolicy; + + private Options() { + } + + /** + * Sets the useLocking option. + * + * @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. + * @return this Options instance. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public Options badIndicesPolicy(String badIndicesPolicy) { + this.badIndicesPolicy = badIndicesPolicy; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ResourceScatterNdMax.class + ) + public static class Inputs extends RawOpInputs { + /** + * A resource handle. Must be from a VarHandleOp. + */ + public final Operand ref; + + /** + * A Tensor. Must be one of the following types: int32, int64. + * A tensor of indices into ref. + */ + public final Operand indices; + + /** + * A Tensor. Must have the same type as ref. A tensor of + * values whose element wise max is taken with ref + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * 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 final boolean useLocking; + + /** + * The badIndicesPolicy attribute + */ + public final String badIndicesPolicy; + + public Inputs(GraphOperation op) { + super(new ResourceScatterNdMax(op), op, Arrays.asList("T", "Tindices", "use_locking", "bad_indices_policy")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + useLocking = op.attributes().getAttrBool("use_locking"); + badIndicesPolicy = op.attributes().getAttrString("bad_indices_policy"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdMin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdMin.java new file mode 100644 index 00000000000..ba46417abba --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdMin.java @@ -0,0 +1,201 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TNumber; +import org.tensorflow.types.family.TType; + +/** + * The ResourceScatterNdMin operation + */ +@OpMetadata( + opType = ResourceScatterNdMin.OP_NAME, + inputsClass = ResourceScatterNdMin.Inputs.class +) +@Operator +public final class ResourceScatterNdMin extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ResourceScatterNdMin"; + + public ResourceScatterNdMin(Operation operation) { + super(operation, OP_NAME); + } + + /** + * Factory method to create a class wrapping a new ResourceScatterNdMin 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 whose element wise min is taken with ref. + * @param options carries optional attribute values + * @return a new instance of ResourceScatterNdMin + */ + @Endpoint( + describeByClass = true + ) + public static ResourceScatterNdMin create(Scope scope, Operand ref, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ResourceScatterNdMin"); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + if (opts.badIndicesPolicy != null) { + opBuilder.setAttr("bad_indices_policy", opts.badIndicesPolicy); + } + } + } + return new ResourceScatterNdMin(opBuilder.build()); + } + + /** + * Sets the useLocking option. + * + * @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. + * @return this Options instance. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public static Options badIndicesPolicy(String badIndicesPolicy) { + return new Options().badIndicesPolicy(badIndicesPolicy); + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.ResourceScatterNdMin} + */ + public static class Options { + private Boolean useLocking; + + private String badIndicesPolicy; + + private Options() { + } + + /** + * Sets the useLocking option. + * + * @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. + * @return this Options instance. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public Options badIndicesPolicy(String badIndicesPolicy) { + this.badIndicesPolicy = badIndicesPolicy; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ResourceScatterNdMin.class + ) + public static class Inputs extends RawOpInputs { + /** + * A resource handle. Must be from a VarHandleOp. + */ + public final Operand ref; + + /** + * A Tensor. Must be one of the following types: int32, int64. + * A tensor of indices into ref. + */ + public final Operand indices; + + /** + * A Tensor. Must have the same type as ref. A tensor of + * values whose element wise min is taken with ref. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * 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 final boolean useLocking; + + /** + * The badIndicesPolicy attribute + */ + public final String badIndicesPolicy; + + public Inputs(GraphOperation op) { + super(new ResourceScatterNdMin(op), op, Arrays.asList("T", "Tindices", "use_locking", "bad_indices_policy")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + useLocking = op.attributes().getAttrBool("use_locking"); + badIndicesPolicy = op.attributes().getAttrString("bad_indices_policy"); + } + } +} 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 index 960eb8b1d20..f39e42e742b 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,111 +17,211 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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
+ * {@code ref} is a {@code Tensor} with rank {@code P} and {@code indices} is a {@code Tensor} of rank {@code Q}.
+ * 

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

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

{@code updates} is {@code Tensor} of rank {@code Q-1+P-K} with shape: + *

  * [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 + *
+ *

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 + *

+ *

The resulting update to ref would look like this: + *

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

See {@code tf.scatter_nd} for more details about how to make updates to * slices. */ +@OpMetadata( + opType = ResourceScatterNdSub.OP_NAME, + inputsClass = ResourceScatterNdSub.Inputs.class +) @Operator -public final class ResourceScatterNdSub extends PrimitiveOp { - +public final class ResourceScatterNdSub extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.ResourceScatterNdSub} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "ResourceScatterNdSub"; + + public ResourceScatterNdSub(Operation operation) { + super(operation, OP_NAME); } - + /** * 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 + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static ResourceScatterNdSub create(Scope scope, Operand ref, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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); } + if (opts.badIndicesPolicy != null) { + opBuilder.setAttr("bad_indices_policy", opts.badIndicesPolicy); + } } } return new ResourceScatterNdSub(opBuilder.build()); } - + /** + * Sets the useLocking option. + * * @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. + * @return this Options instance. */ public static Options useLocking(Boolean useLocking) { return new Options().useLocking(useLocking); } - - - private ResourceScatterNdSub(Operation operation) { - super(operation); + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public static Options badIndicesPolicy(String badIndicesPolicy) { + return new Options().badIndicesPolicy(badIndicesPolicy); + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.ResourceScatterNdSub} + */ + public static class Options { + private Boolean useLocking; + + private String badIndicesPolicy; + + private Options() { + } + + /** + * Sets the useLocking option. + * + * @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. + * @return this Options instance. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public Options badIndicesPolicy(String badIndicesPolicy) { + this.badIndicesPolicy = badIndicesPolicy; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ResourceScatterNdSub.class + ) + public static class Inputs extends RawOpInputs { + /** + * A resource handle. Must be from a VarHandleOp. + */ + public final Operand ref; + + /** + * A Tensor. Must be one of the following types: int32, int64. + * A tensor of indices into ref. + */ + public final Operand indices; + + /** + * A Tensor. Must have the same type as ref. A tensor of + * values to add to ref. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * 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 final boolean useLocking; + + /** + * The badIndicesPolicy attribute + */ + public final String badIndicesPolicy; + + public Inputs(GraphOperation op) { + super(new ResourceScatterNdSub(op), op, Arrays.asList("T", "Tindices", "use_locking", "bad_indices_policy")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + useLocking = op.attributes().getAttrBool("use_locking"); + badIndicesPolicy = op.attributes().getAttrString("bad_indices_policy"); + } } } 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 index fa1614ce3f9..588d923c05a 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,113 +17,212 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * 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
+ * Applies sparse {@code updates} to individual values or slices within a given
+ * variable according to {@code indices}.
+ * 

{@code ref} is a {@code Tensor} with rank {@code P} and {@code indices} is a {@code Tensor} of rank {@code Q}. + *

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

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

{@code updates} is {@code Tensor} of rank {@code 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 + *
+ *

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 + *

+ *

The resulting update to ref would look like this: + *

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

See {@code tf.scatter_nd} for more details about how to make updates to * slices. */ +@OpMetadata( + opType = ResourceScatterNdUpdate.OP_NAME, + inputsClass = ResourceScatterNdUpdate.Inputs.class +) @Operator -public final class ResourceScatterNdUpdate extends PrimitiveOp { - +public final class ResourceScatterNdUpdate extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.ResourceScatterNdUpdate} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "ResourceScatterNdUpdate"; + + public ResourceScatterNdUpdate(Operation operation) { + super(operation, OP_NAME); } - + /** * 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 + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static ResourceScatterNdUpdate create(Scope scope, Operand ref, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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); } + if (opts.badIndicesPolicy != null) { + opBuilder.setAttr("bad_indices_policy", opts.badIndicesPolicy); + } } } return new ResourceScatterNdUpdate(opBuilder.build()); } - + /** + * Sets the useLocking option. + * * @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. + * @return this Options instance. */ public static Options useLocking(Boolean useLocking) { return new Options().useLocking(useLocking); } - - - private ResourceScatterNdUpdate(Operation operation) { - super(operation); + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public static Options badIndicesPolicy(String badIndicesPolicy) { + return new Options().badIndicesPolicy(badIndicesPolicy); + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.ResourceScatterNdUpdate} + */ + public static class Options { + private Boolean useLocking; + + private String badIndicesPolicy; + + private Options() { + } + + /** + * Sets the useLocking option. + * + * @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. + * @return this Options instance. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public Options badIndicesPolicy(String badIndicesPolicy) { + this.badIndicesPolicy = badIndicesPolicy; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ResourceScatterNdUpdate.class + ) + public static class Inputs extends RawOpInputs { + /** + * A resource handle. Must be from a VarHandleOp. + */ + public final Operand ref; + + /** + * A Tensor. Must be one of the following types: int32, int64. + * A tensor of indices into ref. + */ + public final Operand indices; + + /** + * A Tensor. Must have the same type as ref. A tensor of updated + * values to add to ref. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * 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 final boolean useLocking; + + /** + * The badIndicesPolicy attribute + */ + public final String badIndicesPolicy; + + public Inputs(GraphOperation op) { + super(new ResourceScatterNdUpdate(op), op, Arrays.asList("T", "Tindices", "use_locking", "bad_indices_policy")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + useLocking = op.attributes().getAttrBool("use_locking"); + badIndicesPolicy = op.attributes().getAttrString("bad_indices_policy"); + } } } 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 index 0d3248f25ce..52f5e1414a6 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,61 +17,115 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * Subtracts sparse updates from the variable referenced by `resource`. - *

+ * Subtracts sparse updates from the variable referenced by {@code 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 + *

+ * # 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 {@code indices} reference * the same location, their contributions add. - *

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

+ *

Requires {@code updates.shape = indices.shape + ref.shape[1:]} or {@code updates.shape = []}. *

* *
*/ +@OpMetadata( + opType = ResourceScatterSub.OP_NAME, + inputsClass = ResourceScatterSub.Inputs.class +) @Operator -public final class ResourceScatterSub extends PrimitiveOp { - +public final class ResourceScatterSub extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ResourceScatterSub"; + + public ResourceScatterSub(Operation operation) { + super(operation, OP_NAME); + } + /** * 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`. + * @param resource Should be from a {@code Variable} node. + * @param indices A tensor of indices into the first dimension of {@code ref}. + * @param updates A tensor of updated values to add to {@code 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")); + @Endpoint( + describeByClass = true + ) + public static ResourceScatterSub create(Scope scope, Operand resource, + Operand indices, Operand updates) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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); + + @OpInputsMetadata( + outputsClass = ResourceScatterSub.class + ) + public static class Inputs extends RawOpInputs { + /** + * Should be from a {@code Variable} node. + */ + public final Operand resource; + + /** + * A tensor of indices into the first dimension of {@code ref}. + */ + public final Operand indices; + + /** + * A tensor of updated values to add to {@code ref}. + */ + public final Operand updates; + + /** + * The dtype attribute + */ + public final DataType dtype; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + public Inputs(GraphOperation op) { + super(new ResourceScatterSub(op), op, Arrays.asList("dtype", "Tindices")); + int inputIndex = 0; + resource = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + dtype = op.attributes().getAttrType("dtype"); + Tindices = op.attributes().getAttrType("Tindices"); + } } } 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 index c2af6f4da5c..67dfa05354e 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,52 +17,109 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * Assigns sparse updates to the variable referenced by `resource`. - *

+ * Assigns sparse updates to the variable referenced by {@code 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, ...] + *

+ * # 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, ...]
+ * 
*/ +@OpMetadata( + opType = ResourceScatterUpdate.OP_NAME, + inputsClass = ResourceScatterUpdate.Inputs.class +) @Operator -public final class ResourceScatterUpdate extends PrimitiveOp { - +public final class ResourceScatterUpdate extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ResourceScatterUpdate"; + + public ResourceScatterUpdate(Operation operation) { + super(operation, OP_NAME); + } + /** * 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`. + * @param resource Should be from a {@code Variable} node. + * @param indices A tensor of indices into the first dimension of {@code ref}. + * @param updates A tensor of updated values to add to {@code 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")); + @Endpoint( + describeByClass = true + ) + public static ResourceScatterUpdate create(Scope scope, Operand resource, + Operand indices, Operand updates) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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); + + @OpInputsMetadata( + outputsClass = ResourceScatterUpdate.class + ) + public static class Inputs extends RawOpInputs { + /** + * Should be from a {@code Variable} node. + */ + public final Operand resource; + + /** + * A tensor of indices into the first dimension of {@code ref}. + */ + public final Operand indices; + + /** + * A tensor of updated values to add to {@code ref}. + */ + public final Operand updates; + + /** + * The dtype attribute + */ + public final DataType dtype; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + public Inputs(GraphOperation op) { + super(new ResourceScatterUpdate(op), op, Arrays.asList("dtype", "Tindices")); + int inputIndex = 0; + resource = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + dtype = op.attributes().getAttrType("dtype"); + Tindices = op.attributes().getAttrType("Tindices"); + } } } 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 deleted file mode 100644 index 78986ed19b2..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceSparseApplyAdagradV2.java +++ /dev/null @@ -1,122 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index 8e51c1ab179..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceSparseApplyKerasMomentum.java +++ /dev/null @@ -1,131 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 index aa14e070bf0..c7450648c27 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,103 +17,70 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * 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`. + * Assign {@code value} to the sliced l-value reference of {@code ref}. + * The values of {@code value} are assigned to the positions in the variable + * {@code ref} that are selected by the slice parameters. The slice parameters + * {@code begin, }end{@code , }strides{@code , etc. work exactly as in }StridedSlice`. + *

NOTE this op currently does not support broadcasting and so {@code value}'s + * shape must be exactly the shape produced by the slice of {@code ref}. */ +@OpMetadata( + opType = ResourceStridedSliceAssign.OP_NAME, + inputsClass = ResourceStridedSliceAssign.Inputs.class +) @Operator -public final class ResourceStridedSliceAssign extends PrimitiveOp { - +public final class ResourceStridedSliceAssign extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.ResourceStridedSliceAssign} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "ResourceStridedSliceAssign"; + + public ResourceStridedSliceAssign(Operation operation) { + super(operation, OP_NAME); } - + /** * 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 + * @param ref The ref value + * @param begin The begin value + * @param end The end value + * @param strides The strides value + * @param value The value value + * @param options carries optional attribute values + * @param data type for {@code ResourceStridedSliceAssign} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ResourceStridedSliceAssign create(Scope scope, + Operand ref, Operand begin, Operand end, Operand strides, + Operand value, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { @@ -135,44 +102,209 @@ public static ResourceStridedSliceAssign cr } return new ResourceStridedSliceAssign(opBuilder.build()); } - + /** - * @param beginMask + * Sets the beginMask option. + * + * @param beginMask the beginMask option + * @return this Options instance. */ public static Options beginMask(Long beginMask) { return new Options().beginMask(beginMask); } - + /** - * @param endMask + * Sets the endMask option. + * + * @param endMask the endMask option + * @return this Options instance. */ public static Options endMask(Long endMask) { return new Options().endMask(endMask); } - + /** - * @param ellipsisMask + * Sets the ellipsisMask option. + * + * @param ellipsisMask the ellipsisMask option + * @return this Options instance. */ public static Options ellipsisMask(Long ellipsisMask) { return new Options().ellipsisMask(ellipsisMask); } - + /** - * @param newAxisMask + * Sets the newAxisMask option. + * + * @param newAxisMask the newAxisMask option + * @return this Options instance. */ public static Options newAxisMask(Long newAxisMask) { return new Options().newAxisMask(newAxisMask); } - + /** - * @param shrinkAxisMask + * Sets the shrinkAxisMask option. + * + * @param shrinkAxisMask the shrinkAxisMask option + * @return this Options instance. */ public static Options shrinkAxisMask(Long shrinkAxisMask) { return new Options().shrinkAxisMask(shrinkAxisMask); } - - - private ResourceStridedSliceAssign(Operation operation) { - super(operation); + + /** + * Optional attributes for {@link org.tensorflow.op.core.ResourceStridedSliceAssign} + */ + public static class Options { + private Long beginMask; + + private Long endMask; + + private Long ellipsisMask; + + private Long newAxisMask; + + private Long shrinkAxisMask; + + private Options() { + } + + /** + * Sets the beginMask option. + * + * @param beginMask the beginMask option + * @return this Options instance. + */ + public Options beginMask(Long beginMask) { + this.beginMask = beginMask; + return this; + } + + /** + * Sets the endMask option. + * + * @param endMask the endMask option + * @return this Options instance. + */ + public Options endMask(Long endMask) { + this.endMask = endMask; + return this; + } + + /** + * Sets the ellipsisMask option. + * + * @param ellipsisMask the ellipsisMask option + * @return this Options instance. + */ + public Options ellipsisMask(Long ellipsisMask) { + this.ellipsisMask = ellipsisMask; + return this; + } + + /** + * Sets the newAxisMask option. + * + * @param newAxisMask the newAxisMask option + * @return this Options instance. + */ + public Options newAxisMask(Long newAxisMask) { + this.newAxisMask = newAxisMask; + return this; + } + + /** + * Sets the shrinkAxisMask option. + * + * @param shrinkAxisMask the shrinkAxisMask option + * @return this Options instance. + */ + public Options shrinkAxisMask(Long shrinkAxisMask) { + this.shrinkAxisMask = shrinkAxisMask; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ResourceStridedSliceAssign.class + ) + public static class Inputs extends RawOpInputs { + /** + * The ref input + */ + public final Operand ref; + + /** + * The begin input + */ + public final Operand begin; + + /** + * The end input + */ + public final Operand end; + + /** + * The strides input + */ + public final Operand strides; + + /** + * The value input + */ + public final Operand value; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Index attribute + */ + public final DataType Index; + + /** + * The beginMask attribute + */ + public final long beginMask; + + /** + * The endMask attribute + */ + public final long endMask; + + /** + * The ellipsisMask attribute + */ + public final long ellipsisMask; + + /** + * The newAxisMask attribute + */ + public final long newAxisMask; + + /** + * The shrinkAxisMask attribute + */ + public final long shrinkAxisMask; + + public Inputs(GraphOperation op) { + super(new ResourceStridedSliceAssign(op), op, Arrays.asList("T", "Index", "begin_mask", "end_mask", "ellipsis_mask", "new_axis_mask", "shrink_axis_mask")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + begin = (Operand) op.input(inputIndex++); + end = (Operand) op.input(inputIndex++); + strides = (Operand) op.input(inputIndex++); + value = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Index = op.attributes().getAttrType("Index"); + beginMask = op.attributes().getAttrInt("begin_mask"); + endMask = op.attributes().getAttrInt("end_mask"); + ellipsisMask = op.attributes().getAttrInt("ellipsis_mask"); + newAxisMask = op.attributes().getAttrInt("new_axis_mask"); + shrinkAxisMask = op.attributes().getAttrInt("shrink_axis_mask"); + } } } 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 deleted file mode 100644 index a6d5f856026..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingADAMParameters.java +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 040adf32ee7..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingADAMParametersGradAccumDebug.java +++ /dev/null @@ -1,147 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 74dbebd1a67..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingAdadeltaParameters.java +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index e0c20e01f3f..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug.java +++ /dev/null @@ -1,147 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 4731b432cab..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingAdagradParameters.java +++ /dev/null @@ -1,129 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 8dddf6e9d6d..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingAdagradParametersGradAccumDebug.java +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index ed3b32a7d59..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingCenteredRMSPropParameters.java +++ /dev/null @@ -1,147 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 54c5241a0a1..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingFTRLParameters.java +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index f7264fcf8e3..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingFTRLParametersGradAccumDebug.java +++ /dev/null @@ -1,147 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 796171a08e6..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingMDLAdagradLightParameters.java +++ /dev/null @@ -1,147 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 4b5bb17bd4a..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingMomentumParameters.java +++ /dev/null @@ -1,129 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index c9017b8c1ce..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingMomentumParametersGradAccumDebug.java +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index a4c0d307590..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingProximalAdagradParameters.java +++ /dev/null @@ -1,129 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 7af385f0145..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug.java +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 33551f49b5c..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingRMSPropParameters.java +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index ee4454c29af..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug.java +++ /dev/null @@ -1,147 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 834caa3bc3b..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RetrieveTPUEmbeddingStochasticGradientDescentParameters.java +++ /dev/null @@ -1,126 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 index de9d3f0e21e..711b7148209 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,32 +17,33 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 + * Given a {@code tensor}, and a {@code int32} tensor {@code axis} representing the set of + * dimensions of {@code tensor} to reverse. This operation reverses each dimension + * {@code i} for which there exists {@code j} s.t. {@code axis[j] == i}. + *

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

- * For example: - *

{@code
+ * 

For example: + *

  * # tensor 't' is [[[[ 0,  1,  2,  3],
  * #                  [ 4,  5,  6,  7],
  * #                  [ 8,  9, 10, 11]],
@@ -50,72 +51,118 @@
  * #                  [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],
+ * 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],
+ * 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],
+ * 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 + *
*/ +@OpMetadata( + opType = Reverse.OP_NAME, + inputsClass = Reverse.Inputs.class +) @Operator -public final class Reverse extends PrimitiveOp implements Operand { - +public final class Reverse extends RawOp implements Operand { /** - * Factory method to create a class wrapping a new Reverse operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ReverseV2"; + + private Output output; + + public Reverse(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new ReverseV2 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))`. + * {@code [-rank(tensor), rank(tensor))}. + * @param data type for {@code ReverseV2} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static Reverse create(Scope scope, Operand tensor, + Operand axis) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Reverse"); opBuilder.addInput(tensor.asOutput()); opBuilder.addInput(axis.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new Reverse(opBuilder.build()); + return new Reverse<>(opBuilder.build()); } - + /** - * The same shape as `tensor`. + * Gets output. + * The same shape as {@code tensor}. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = Reverse.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Up to 8-D. + */ + public final Operand tensor; + + /** + * 1-D. The indices of the dimensions to reverse. Must be in the range + * {@code [-rank(tensor), rank(tensor))}. + */ + public final Operand axis; + + /** + * The Tidx attribute + */ + public final DataType Tidx; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new Reverse<>(op), op, Arrays.asList("Tidx", "T")); + int inputIndex = 0; + tensor = (Operand) op.input(inputIndex++); + axis = (Operand) op.input(inputIndex++); + Tidx = op.attributes().getAttrType("Tidx"); + T = op.attributes().getAttrType("T"); + } } } 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 index 2ef13ca136b..e18f16874f0 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,112 +17,113 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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
+ * This op first slices {@code input} along the dimension {@code batch_dim}, and for each
+ * slice {@code i}, reverses the first {@code seq_lengths[i]} elements along
+ * the dimension {@code seq_dim}.
+ * 

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

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

For example: + *

  * # 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
+ * 
+ *

In contrast, if: + *

  * # 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 + *
*/ +@OpMetadata( + opType = ReverseSequence.OP_NAME, + inputsClass = ReverseSequence.Inputs.class +) @Operator -public final class ReverseSequence extends PrimitiveOp implements Operand { - +public final class ReverseSequence extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.ReverseSequence} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "ReverseSequence"; + + private Output output; + + public ReverseSequence(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * 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 seqLengths 1-D with length {@code input.dims(batch_dim)} and + * {@code max(seq_lengths) <= input.dims(seq_dim)} * @param seqDim The dimension which is partially reversed. - * @param options carries optional attributes values + * @param options carries optional attribute values + * @param data type for {@code ReverseSequence} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ReverseSequence create(Scope scope, Operand input, + Operand seqLengths, Long seqDim, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { @@ -131,33 +132,98 @@ public static ReverseSequence create(Sco } } } - return new ReverseSequence(opBuilder.build()); + return new ReverseSequence<>(opBuilder.build()); } - + /** + * Sets the batchDim option. + * * @param batchDim The dimension along which reversal is performed. + * @return this Options instance. */ public static Options batchDim(Long batchDim) { return new Options().batchDim(batchDim); } - + /** - * The partially reversed input. It has the same shape as `input`. + * Gets output. + * The partially reversed input. It has the same shape as {@code input}. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.ReverseSequence} + */ + public static class Options { + private Long batchDim; + + private Options() { + } + + /** + * Sets the batchDim option. + * + * @param batchDim The dimension along which reversal is performed. + * @return this Options instance. + */ + public Options batchDim(Long batchDim) { + this.batchDim = batchDim; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ReverseSequence.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input to reverse. + */ + public final Operand input; + + /** + * 1-D with length {@code input.dims(batch_dim)} and + * {@code max(seq_lengths) <= input.dims(seq_dim)} + */ + public final Operand seqLengths; + + /** + * The dimension which is partially reversed. + */ + public final long seqDim; + + /** + * The dimension along which reversal is performed. + */ + public final long batchDim; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tlen attribute + */ + public final DataType Tlen; + + public Inputs(GraphOperation op) { + super(new ReverseSequence<>(op), op, Arrays.asList("seq_dim", "batch_dim", "T", "Tlen")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + seqLengths = (Operand) op.input(inputIndex++); + seqDim = op.attributes().getAttrInt("seq_dim"); + batchDim = op.attributes().getAttrInt("batch_dim"); + T = op.attributes().getAttrType("T"); + Tlen = op.attributes().getAttrType("Tlen"); + } } } 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 deleted file mode 100644 index df092de6c8e..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/RngSkip.java +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt64; - -/** - * 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 index f9a1b3e9fac..e190730b970 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,88 +17,156 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 + * {@code shift} along the dimension of {@code axis}. Negative {@code 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
+ * 

For example: + *

  * # 't' is [0, 1, 2, 3, 4]
- * roll(t, shift=2, axis=0) ==> [3, 4, 0, 1, 2]
- * 
+ * 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]]
- * 
+ * 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 + * roll(t, shift=[2, -3], axis=[1, 1]) ==> [[1, 2, 3, 4, 0], [6, 7, 8, 9, 5]] + *
*/ +@OpMetadata( + opType = Roll.OP_NAME, + inputsClass = Roll.Inputs.class +) @Operator -public final class Roll extends PrimitiveOp implements Operand { - +public final class Roll extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Roll"; + + private Output output; + + public Roll(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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 + * @param input The input value + * @param shift Dimension must be 0-D or 1-D. {@code 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 + * specified by {@code 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 + * @param axis Dimension must be 0-D or 1-D. {@code axis[i]} specifies the dimension that the shift + * {@code 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. + * @param data type for {@code Roll} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static Roll create(Scope scope, Operand input, + Operand shift, Operand axis) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Roll"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(shift.asOutput()); opBuilder.addInput(axis.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new Roll(opBuilder.build()); + return new Roll<>(opBuilder.build()); } - + /** + * Gets output. * 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`. + * positively (towards larger indices) by the offsets of {@code shift} along the + * dimensions of {@code axis}. + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = Roll.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * Dimension must be 0-D or 1-D. {@code shift[i]} specifies the number of places by which + * elements are shifted positively (towards larger indices) along the dimension + * specified by {@code axis[i]}. Negative shifts will roll the elements in the opposite + * direction. + */ + public final Operand shift; + + /** + * Dimension must be 0-D or 1-D. {@code axis[i]} specifies the dimension that the shift + * {@code 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. + */ + public final Operand axis; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tshift attribute + */ + public final DataType Tshift; + + /** + * The Taxis attribute + */ + public final DataType Taxis; + + public Inputs(GraphOperation op) { + super(new Roll<>(op), op, Arrays.asList("T", "Tshift", "Taxis")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + shift = (Operand) op.input(inputIndex++); + axis = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tshift = op.attributes().getAttrType("Tshift"); + Taxis = op.attributes().getAttrType("Taxis"); + } } } 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 deleted file mode 100644 index 441553da5f4..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Rpc.java +++ /dev/null @@ -1,204 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.TString; - -/** - * 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 deleted file mode 100644 index b1af2df5130..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SamplingDataset.java +++ /dev/null @@ -1,90 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TFloat; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 deleted file mode 100644 index 8434089d91e..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScaleAndTranslate.java +++ /dev/null @@ -1,128 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.TFloat; -import org.tensorflow.types.TInt32; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - */ -@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 deleted file mode 100644 index adcf3f11318..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScaleAndTranslateGrad.java +++ /dev/null @@ -1,126 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * @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 index 41ee92a33be..9f0bc6a526f 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,83 +17,84 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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. + *

+ * # 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 {@code 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 + *

Duplicate entries are handled correctly: if multiple {@code indices} reference * the same location, their contributions add. - *

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

+ *

Requires {@code updates.shape = indices.shape + ref.shape[1:]} or {@code updates.shape = []}. *

* *
- * - * @param data type for {@code outputRef()} output */ +@OpMetadata( + opType = ScatterAdd.OP_NAME, + inputsClass = ScatterAdd.Inputs.class +) @Operator -public final class ScatterAdd extends PrimitiveOp implements Operand { - +public final class ScatterAdd extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.ScatterAdd} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "ScatterAdd"; + + private Output outputRef; + + public ScatterAdd(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); } - + /** * 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 + * @param ref Should be from a {@code Variable} node. + * @param indices A tensor of indices into the first dimension of {@code ref}. + * @param updates A tensor of updated values to add to {@code ref}. + * @param options carries optional attribute values + * @param data type for {@code ScatterAdd} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ScatterAdd create(Scope scope, Operand ref, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { @@ -101,35 +102,101 @@ public static ScatterAdd create(Scope sc } } } - return new ScatterAdd(opBuilder.build()); + return new ScatterAdd<>(opBuilder.build()); } - + /** + * Sets the useLocking option. + * * @param useLocking If True, the addition will be protected by a lock; * otherwise the behavior is undefined, but may exhibit less contention. + * @return this Options instance. */ public static Options useLocking(Boolean useLocking) { return new Options().useLocking(useLocking); } - + /** - * = Same as `ref`. Returned as a convenience for operations that want + * Gets outputRef. + * = Same as {@code ref}. Returned as a convenience for operations that want * to use the updated values after the update is done. + * @return outputRef. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterAdd} + */ + public static class Options { + private Boolean useLocking; + + private Options() { + } + + /** + * Sets the useLocking option. + * + * @param useLocking If True, the addition will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + * @return this Options instance. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ScatterAdd.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Should be from a {@code Variable} node. + */ + public final Operand ref; + + /** + * A tensor of indices into the first dimension of {@code ref}. + */ + public final Operand indices; + + /** + * A tensor of updated values to add to {@code ref}. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * If True, the addition will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public final boolean useLocking; + + public Inputs(GraphOperation op) { + super(new ScatterAdd<>(op), op, Arrays.asList("T", "Tindices", "use_locking")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + useLocking = op.attributes().getAttrBool("use_locking"); + } } } 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 index a1713d52593..902d11400e5 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,79 +17,81 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 operation outputs {@code 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 + *

Duplicate entries are handled correctly: if multiple {@code 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 + *

Requires {@code updates.shape = indices.shape + ref.shape[1:]} or {@code updates.shape = []}. */ +@OpMetadata( + opType = ScatterDiv.OP_NAME, + inputsClass = ScatterDiv.Inputs.class +) @Operator -public final class ScatterDiv extends PrimitiveOp implements Operand { - +public final class ScatterDiv extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.ScatterDiv} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "ScatterDiv"; + + private Output outputRef; + + public ScatterDiv(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); } - + /** * 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 + * @param ref Should be from a {@code Variable} node. + * @param indices A tensor of indices into the first dimension of {@code ref}. + * @param updates A tensor of values that {@code ref} is divided by. + * @param options carries optional attribute values + * @param data type for {@code ScatterDiv} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ScatterDiv create(Scope scope, Operand ref, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { @@ -97,35 +99,101 @@ public static ScatterDiv create(Scope sc } } } - return new ScatterDiv(opBuilder.build()); + return new ScatterDiv<>(opBuilder.build()); } - + /** + * Sets the useLocking option. + * * @param useLocking If True, the operation will be protected by a lock; * otherwise the behavior is undefined, but may exhibit less contention. + * @return this Options instance. */ public static Options useLocking(Boolean useLocking) { return new Options().useLocking(useLocking); } - + /** - * = Same as `ref`. Returned as a convenience for operations that want + * Gets outputRef. + * = Same as {@code ref}. Returned as a convenience for operations that want * to use the updated values after the update is done. + * @return outputRef. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterDiv} + */ + public static class Options { + private Boolean useLocking; + + private Options() { + } + + /** + * Sets the useLocking option. + * + * @param useLocking If True, the operation will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + * @return this Options instance. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ScatterDiv.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Should be from a {@code Variable} node. + */ + public final Operand ref; + + /** + * A tensor of indices into the first dimension of {@code ref}. + */ + public final Operand indices; + + /** + * A tensor of values that {@code ref} is divided by. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * If True, the operation will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public final boolean useLocking; + + public Inputs(GraphOperation op) { + super(new ScatterDiv<>(op), op, Arrays.asList("T", "Tindices", "use_locking")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + useLocking = op.attributes().getAttrBool("use_locking"); + } } } 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 index 1f7cbe8c513..9b761e52419 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,83 +17,83 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** - * Reduces sparse updates into a variable reference using the `max` operation. - *

+ * Reduces sparse updates into a variable reference using the {@code 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. + *

+ * # 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 {@code 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 + *

Duplicate entries are handled correctly: if multiple {@code indices} reference * the same location, their contributions combine. - *

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

+ *

Requires {@code updates.shape = indices.shape + ref.shape[1:]} or {@code updates.shape = []}. *

* *
- * - * @param data type for {@code outputRef()} output */ +@OpMetadata( + opType = ScatterMax.OP_NAME, + inputsClass = ScatterMax.Inputs.class +) @Operator -public final class ScatterMax extends PrimitiveOp implements Operand { - +public final class ScatterMax extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.ScatterMax} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "ScatterMax"; + + private Output outputRef; + + public ScatterMax(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); } - + /** * 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 + * @param ref Should be from a {@code Variable} node. + * @param indices A tensor of indices into the first dimension of {@code ref}. + * @param updates A tensor of updated values to reduce into {@code ref}. + * @param options carries optional attribute values + * @param data type for {@code ScatterMax} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ScatterMax create(Scope scope, Operand ref, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { @@ -101,35 +101,101 @@ public static ScatterMax create(Scope } } } - return new ScatterMax(opBuilder.build()); + return new ScatterMax<>(opBuilder.build()); } - + /** + * Sets the useLocking option. + * * @param useLocking If True, the update will be protected by a lock; * otherwise the behavior is undefined, but may exhibit less contention. + * @return this Options instance. */ public static Options useLocking(Boolean useLocking) { return new Options().useLocking(useLocking); } - + /** - * = Same as `ref`. Returned as a convenience for operations that want + * Gets outputRef. + * = Same as {@code ref}. Returned as a convenience for operations that want * to use the updated values after the update is done. + * @return outputRef. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterMax} + */ + public static class Options { + private Boolean useLocking; + + private Options() { + } + + /** + * Sets the useLocking option. + * + * @param useLocking If True, the update will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + * @return this Options instance. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ScatterMax.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Should be from a {@code Variable} node. + */ + public final Operand ref; + + /** + * A tensor of indices into the first dimension of {@code ref}. + */ + public final Operand indices; + + /** + * A tensor of updated values to reduce into {@code ref}. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * If True, the update will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public final boolean useLocking; + + public Inputs(GraphOperation op) { + super(new ScatterMax<>(op), op, Arrays.asList("T", "Tindices", "use_locking")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + useLocking = op.attributes().getAttrBool("use_locking"); + } } } 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 index fee972dca37..7f725ad19d0 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,83 +17,83 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; /** - * Reduces sparse updates into a variable reference using the `min` operation. - *

+ * Reduces sparse updates into a variable reference using the {@code 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. + *

+ * # 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 {@code 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 + *

Duplicate entries are handled correctly: if multiple {@code indices} reference * the same location, their contributions combine. - *

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

+ *

Requires {@code updates.shape = indices.shape + ref.shape[1:]} or {@code updates.shape = []}. *

* *
- * - * @param data type for {@code outputRef()} output */ +@OpMetadata( + opType = ScatterMin.OP_NAME, + inputsClass = ScatterMin.Inputs.class +) @Operator -public final class ScatterMin extends PrimitiveOp implements Operand { - +public final class ScatterMin extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.ScatterMin} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "ScatterMin"; + + private Output outputRef; + + public ScatterMin(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); } - + /** * 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 + * @param ref Should be from a {@code Variable} node. + * @param indices A tensor of indices into the first dimension of {@code ref}. + * @param updates A tensor of updated values to reduce into {@code ref}. + * @param options carries optional attribute values + * @param data type for {@code ScatterMin} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ScatterMin create(Scope scope, Operand ref, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { @@ -101,35 +101,101 @@ public static ScatterMin create(Scope } } } - return new ScatterMin(opBuilder.build()); + return new ScatterMin<>(opBuilder.build()); } - + /** + * Sets the useLocking option. + * * @param useLocking If True, the update will be protected by a lock; * otherwise the behavior is undefined, but may exhibit less contention. + * @return this Options instance. */ public static Options useLocking(Boolean useLocking) { return new Options().useLocking(useLocking); } - + /** - * = Same as `ref`. Returned as a convenience for operations that want + * Gets outputRef. + * = Same as {@code ref}. Returned as a convenience for operations that want * to use the updated values after the update is done. + * @return outputRef. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterMin} + */ + public static class Options { + private Boolean useLocking; + + private Options() { + } + + /** + * Sets the useLocking option. + * + * @param useLocking If True, the update will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + * @return this Options instance. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ScatterMin.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Should be from a {@code Variable} node. + */ + public final Operand ref; + + /** + * A tensor of indices into the first dimension of {@code ref}. + */ + public final Operand indices; + + /** + * A tensor of updated values to reduce into {@code ref}. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * If True, the update will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public final boolean useLocking; + + public Inputs(GraphOperation op) { + super(new ScatterMin<>(op), op, Arrays.asList("T", "Tindices", "use_locking")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + useLocking = op.attributes().getAttrBool("use_locking"); + } } } 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 index b55aa0f5aff..ae8bbca9670 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,79 +17,81 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 operation outputs {@code 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 + *

Duplicate entries are handled correctly: if multiple {@code 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 + *

Requires {@code updates.shape = indices.shape + ref.shape[1:]} or {@code updates.shape = []}. */ +@OpMetadata( + opType = ScatterMul.OP_NAME, + inputsClass = ScatterMul.Inputs.class +) @Operator -public final class ScatterMul extends PrimitiveOp implements Operand { - +public final class ScatterMul extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.ScatterMul} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "ScatterMul"; + + private Output outputRef; + + public ScatterMul(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); } - + /** * 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 + * @param ref Should be from a {@code Variable} node. + * @param indices A tensor of indices into the first dimension of {@code ref}. + * @param updates A tensor of updated values to multiply to {@code ref}. + * @param options carries optional attribute values + * @param data type for {@code ScatterMul} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ScatterMul create(Scope scope, Operand ref, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { @@ -97,35 +99,101 @@ public static ScatterMul create(Scope sc } } } - return new ScatterMul(opBuilder.build()); + return new ScatterMul<>(opBuilder.build()); } - + /** + * Sets the useLocking option. + * * @param useLocking If True, the operation will be protected by a lock; * otherwise the behavior is undefined, but may exhibit less contention. + * @return this Options instance. */ public static Options useLocking(Boolean useLocking) { return new Options().useLocking(useLocking); } - + /** - * = Same as `ref`. Returned as a convenience for operations that want + * Gets outputRef. + * = Same as {@code ref}. Returned as a convenience for operations that want * to use the updated values after the update is done. + * @return outputRef. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterMul} + */ + public static class Options { + private Boolean useLocking; + + private Options() { + } + + /** + * Sets the useLocking option. + * + * @param useLocking If True, the operation will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + * @return this Options instance. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ScatterMul.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Should be from a {@code Variable} node. + */ + public final Operand ref; + + /** + * A tensor of indices into the first dimension of {@code ref}. + */ + public final Operand indices; + + /** + * A tensor of updated values to multiply to {@code ref}. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * If True, the operation will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public final boolean useLocking; + + public Inputs(GraphOperation op) { + super(new ScatterMul<>(op), op, Arrays.asList("T", "Tindices", "use_locking")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + useLocking = op.attributes().getAttrBool("use_locking"); + } } } 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 index d7d1de93937..ad6bcd00a16 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,139 +17,246 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * 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. - *

+ * Scatters {@code updates} into a tensor of shape {@code shape} according to {@code indices}. + * Scatter sparse {@code updates} according to individual values at the specified + * {@code indices}. This op returns an output tensor with the {@code shape} you specify. This + * op is the inverse of the {@code tf.gather_nd} operator which extracts values or slices + * from a given tensor. + *

This operation is similar to {@code tf.tensor_scatter_nd_add}, except that the tensor + * is zero-initialized. Calling {@code tf.scatter_nd(indices, updates, shape)} + * is identical to calling + * {@code tf.tensor_scatter_nd_add(tf.zeros(shape, updates.dtype), indices, updates)} + *

If {@code indices} contains duplicates, the associated {@code updates} are accumulated + * (summed) into the output tensor. + *

WARNING: For floating-point data types, the output may be nondeterministic. + * This is because the order in which the updates are applied is nondeterministic + * and when floating-point numbers are added in different orders the resulting + * numerical approximation error can be slightly different. However, the output + * will be deterministic if op determinism is enabled via + * {@code tf.config.experimental.enable_op_determinism}. + *

{@code indices} is an integer tensor containing indices into the output tensor. The + * last dimension of {@code indices} can be at most the rank of {@code shape}: + *

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

The last dimension of {@code indices} corresponds to indices of elements + * (if {@code indices.shape[-1] = shape.rank}) or slices + * (if {@code indices.shape[-1] < shape.rank}) along dimension {@code indices.shape[-1]} of + * {@code shape}. + *

{@code updates} is a tensor with shape: + *

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

The simplest form of the scatter op is to insert individual elements in + * a tensor by index. Consider an example where you want to insert 4 scattered + * elements in a rank-1 tensor with 8 elements. *

* *
- *

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

{@code
+ * 

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

  *     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. - *

+ * print(scatter) + *

+ *

The resulting tensor would look like this: + *

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

You can also insert entire slices of a higher rank tensor all at once. For + * example, you can 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]])
+ * 

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

+ *     indices = tf.constant([[1], [3]])
  *     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 + * print(scatter) + *

+ *

The resulting tensor would look like this: + *

+ * [[[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]],
+ *  [[5, 5, 5, 5], [6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8]]]
+ * 
+ *

If {@code indices} contains any out-of-bound indices, depending on + * {@code bad_indices_policy}, the op will either return an error or ignore the + * out-of-bound indices. {@code bad_indices_policy} can be one of the following values: + *

    + *
  1. "" or "DEFAULT": raises on CPU and ignore on GPU. This is because + * historically on CPU and GPU we handle errors in different ways, and for + * backward compatibility we keep the default behavior.
  2. + *
  3. "ERROR": raises error; GPU does not support this value.
  4. + *
  5. "IGNORE": ignore the bad indices; supported on both CPU and GPU.
  6. + *
*/ +@OpMetadata( + opType = ScatterNd.OP_NAME, + inputsClass = ScatterNd.Inputs.class +) @Operator -public final class ScatterNd extends PrimitiveOp implements Operand { - +public final class ScatterNd extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ScatterNd"; + + private Output output; + + public ScatterNd(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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. + * @param indices Tensor of indices. + * @param updates Values to scatter into the output tensor. + * @param shape 1-D. The shape of the output tensor. + * @param options carries optional attribute values + * @param data type for {@code ScatterNd} output and operands + * @param data type for {@code ScatterNd} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ScatterNd create(Scope scope, + Operand indices, Operand updates, Operand shape, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ScatterNd"); opBuilder.addInput(indices.asOutput()); opBuilder.addInput(updates.asOutput()); opBuilder.addInput(shape.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new ScatterNd(opBuilder.build()); + if (options != null) { + for (Options opts : options) { + if (opts.badIndicesPolicy != null) { + opBuilder.setAttr("bad_indices_policy", opts.badIndicesPolicy); + } + } + } + return new ScatterNd<>(opBuilder.build()); + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public static Options badIndicesPolicy(String badIndicesPolicy) { + return new Options().badIndicesPolicy(badIndicesPolicy); } - + /** + * Gets output. * A new tensor with the given shape and updates applied according * to the indices. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterNd} + */ + public static class Options { + private String badIndicesPolicy; + + private Options() { + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public Options badIndicesPolicy(String badIndicesPolicy) { + this.badIndicesPolicy = badIndicesPolicy; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ScatterNd.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Tensor of indices. + */ + public final Operand indices; + + /** + * Values to scatter into the output tensor. + */ + public final Operand updates; + + /** + * 1-D. The shape of the output tensor. + */ + public final Operand shape; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * The badIndicesPolicy attribute + */ + public final String badIndicesPolicy; + + public Inputs(GraphOperation op) { + super(new ScatterNd<>(op), op, Arrays.asList("T", "Tindices", "bad_indices_policy")); + int inputIndex = 0; + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + shape = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + badIndicesPolicy = op.attributes().getAttrString("bad_indices_policy"); + } } } 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 index 6825eda3789..257dce25682 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,130 +17,232 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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
+ * {@code ref} is a {@code Tensor} with rank {@code P} and {@code indices} is a {@code Tensor} of rank {@code Q}.
+ * 

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

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

{@code updates} is {@code Tensor} of rank {@code Q-1+P-K} with shape: + *

  * [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 + *
+ *

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 + *

+ *

The resulting update to ref would look like this: + *

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

See {@code tf.scatter_nd} for more details about how to make updates to * slices. - * - * @param data type for {@code outputRef()} output */ +@OpMetadata( + opType = ScatterNdAdd.OP_NAME, + inputsClass = ScatterNdAdd.Inputs.class +) @Operator -public final class ScatterNdAdd extends PrimitiveOp implements Operand { - +public final class ScatterNdAdd extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.ScatterNdAdd} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "ScatterNdAdd"; + + private Output outputRef; + + public ScatterNdAdd(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); } - + /** * 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 + * @param options carries optional attribute values + * @param data type for {@code ScatterNdAdd} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ScatterNdAdd create(Scope scope, Operand ref, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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); } + if (opts.badIndicesPolicy != null) { + opBuilder.setAttr("bad_indices_policy", opts.badIndicesPolicy); + } } } - return new ScatterNdAdd(opBuilder.build()); + return new ScatterNdAdd<>(opBuilder.build()); } - + /** + * Sets the useLocking option. + * * @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. + * @return this Options instance. */ public static Options useLocking(Boolean useLocking) { return new Options().useLocking(useLocking); } - + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public static Options badIndicesPolicy(String badIndicesPolicy) { + return new Options().badIndicesPolicy(badIndicesPolicy); + } + /** + * Gets outputRef. * Same as ref. Returned as a convenience for operations that want * to use the updated values after the update is done. + * @return outputRef. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterNdAdd} + */ + public static class Options { + private Boolean useLocking; + + private String badIndicesPolicy; + + private Options() { + } + + /** + * Sets the useLocking option. + * + * @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. + * @return this Options instance. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public Options badIndicesPolicy(String badIndicesPolicy) { + this.badIndicesPolicy = badIndicesPolicy; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ScatterNdAdd.class + ) + public static class Inputs extends RawOpInputs> { + /** + * A mutable Tensor. Should be from a Variable node. + */ + public final Operand ref; + + /** + * A Tensor. Must be one of the following types: int32, int64. + * A tensor of indices into ref. + */ + public final Operand indices; + + /** + * A Tensor. Must have the same type as ref. A tensor of updated values + * to add to ref. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * 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 final boolean useLocking; + + /** + * The badIndicesPolicy attribute + */ + public final String badIndicesPolicy; + + public Inputs(GraphOperation op) { + super(new ScatterNdAdd<>(op), op, Arrays.asList("T", "Tindices", "use_locking", "bad_indices_policy")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + useLocking = op.attributes().getAttrBool("use_locking"); + badIndicesPolicy = op.attributes().getAttrString("bad_indices_policy"); + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdMax.java new file mode 100644 index 00000000000..a7ebdf162d6 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdMax.java @@ -0,0 +1,222 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TNumber; +import org.tensorflow.types.family.TType; + +/** + * Computes element-wise maximum. + */ +@OpMetadata( + opType = ScatterNdMax.OP_NAME, + inputsClass = ScatterNdMax.Inputs.class +) +@Operator +public final class ScatterNdMax extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ScatterNdMax"; + + private Output outputRef; + + public ScatterNdMax(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new ScatterNdMax 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 attribute values + * @param data type for {@code ScatterNdMax} output and operands + * @return a new instance of ScatterNdMax + */ + @Endpoint( + describeByClass = true + ) + public static ScatterNdMax create(Scope scope, Operand ref, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ScatterNdMax"); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + if (opts.badIndicesPolicy != null) { + opBuilder.setAttr("bad_indices_policy", opts.badIndicesPolicy); + } + } + } + return new ScatterNdMax<>(opBuilder.build()); + } + + /** + * Sets the useLocking option. + * + * @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. + * @return this Options instance. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public static Options badIndicesPolicy(String badIndicesPolicy) { + return new Options().badIndicesPolicy(badIndicesPolicy); + } + + /** + * Gets outputRef. + * Same as ref. Returned as a convenience for operations that want + * to use the updated values after the update is done. + * @return outputRef. + */ + public Output outputRef() { + return outputRef; + } + + @Override + public Output asOutput() { + return outputRef; + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterNdMax} + */ + public static class Options { + private Boolean useLocking; + + private String badIndicesPolicy; + + private Options() { + } + + /** + * Sets the useLocking option. + * + * @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. + * @return this Options instance. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public Options badIndicesPolicy(String badIndicesPolicy) { + this.badIndicesPolicy = badIndicesPolicy; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ScatterNdMax.class + ) + public static class Inputs extends RawOpInputs> { + /** + * A mutable Tensor. Should be from a Variable node. + */ + public final Operand ref; + + /** + * A Tensor. Must be one of the following types: int32, int64. + * A tensor of indices into ref. + */ + public final Operand indices; + + /** + * A Tensor. Must have the same type as ref. A tensor of updated values + * to add to ref. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * 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 final boolean useLocking; + + /** + * The badIndicesPolicy attribute + */ + public final String badIndicesPolicy; + + public Inputs(GraphOperation op) { + super(new ScatterNdMax<>(op), op, Arrays.asList("T", "Tindices", "use_locking", "bad_indices_policy")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + useLocking = op.attributes().getAttrBool("use_locking"); + badIndicesPolicy = op.attributes().getAttrString("bad_indices_policy"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdMin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdMin.java new file mode 100644 index 00000000000..3ade02671ed --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdMin.java @@ -0,0 +1,222 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TNumber; +import org.tensorflow.types.family.TType; + +/** + * Computes element-wise minimum. + */ +@OpMetadata( + opType = ScatterNdMin.OP_NAME, + inputsClass = ScatterNdMin.Inputs.class +) +@Operator +public final class ScatterNdMin extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ScatterNdMin"; + + private Output outputRef; + + public ScatterNdMin(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new ScatterNdMin 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 attribute values + * @param data type for {@code ScatterNdMin} output and operands + * @return a new instance of ScatterNdMin + */ + @Endpoint( + describeByClass = true + ) + public static ScatterNdMin create(Scope scope, Operand ref, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ScatterNdMin"); + opBuilder.addInput(ref.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + if (options != null) { + for (Options opts : options) { + if (opts.useLocking != null) { + opBuilder.setAttr("use_locking", opts.useLocking); + } + if (opts.badIndicesPolicy != null) { + opBuilder.setAttr("bad_indices_policy", opts.badIndicesPolicy); + } + } + } + return new ScatterNdMin<>(opBuilder.build()); + } + + /** + * Sets the useLocking option. + * + * @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. + * @return this Options instance. + */ + public static Options useLocking(Boolean useLocking) { + return new Options().useLocking(useLocking); + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public static Options badIndicesPolicy(String badIndicesPolicy) { + return new Options().badIndicesPolicy(badIndicesPolicy); + } + + /** + * Gets outputRef. + * Same as ref. Returned as a convenience for operations that want + * to use the updated values after the update is done. + * @return outputRef. + */ + public Output outputRef() { + return outputRef; + } + + @Override + public Output asOutput() { + return outputRef; + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterNdMin} + */ + public static class Options { + private Boolean useLocking; + + private String badIndicesPolicy; + + private Options() { + } + + /** + * Sets the useLocking option. + * + * @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. + * @return this Options instance. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public Options badIndicesPolicy(String badIndicesPolicy) { + this.badIndicesPolicy = badIndicesPolicy; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ScatterNdMin.class + ) + public static class Inputs extends RawOpInputs> { + /** + * A mutable Tensor. Should be from a Variable node. + */ + public final Operand ref; + + /** + * A Tensor. Must be one of the following types: int32, int64. + * A tensor of indices into ref. + */ + public final Operand indices; + + /** + * A Tensor. Must have the same type as ref. A tensor of updated values + * to add to ref. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * 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 final boolean useLocking; + + /** + * The badIndicesPolicy attribute + */ + public final String badIndicesPolicy; + + public Inputs(GraphOperation op) { + super(new ScatterNdMin<>(op), op, Arrays.asList("T", "Tindices", "use_locking", "bad_indices_policy")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + useLocking = op.attributes().getAttrBool("use_locking"); + badIndicesPolicy = op.attributes().getAttrString("bad_indices_policy"); + } + } +} 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 index 83ed3e2811e..c152dadc35e 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,96 +17,195 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * 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 + * Applies sparse addition to {@code input} using individual values or slices + * from {@code updates} according to indices {@code indices}. The updates are non-aliasing: + * {@code input} is only modified in-place if no other operations will use it. + * Otherwise, a copy of {@code input} is made. This operation has a gradient with + * respect to both {@code input} and {@code updates}. + *

{@code input} is a {@code Tensor} with rank {@code P} and {@code indices} is a {@code Tensor} of rank {@code Q}. + *

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

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

{@code updates} is {@code Tensor} of rank {@code 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 + *

+ * 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 {@code output} would look like this: + *

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

See {@code tf.scatter_nd} for more details about how to make updates to slices. */ +@OpMetadata( + opType = ScatterNdNonAliasingAdd.OP_NAME, + inputsClass = ScatterNdNonAliasingAdd.Inputs.class +) @Operator -public final class ScatterNdNonAliasingAdd extends PrimitiveOp implements Operand { - +public final class ScatterNdNonAliasingAdd extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ScatterNdNonAliasingAdd"; + + private Output output; + + public ScatterNdNonAliasingAdd(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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 indices A Tensor. Must be one of the following types: {@code int32}, {@code int64}. + * A tensor of indices into {@code input}. * @param updates A Tensor. Must have the same type as ref. A tensor of updated values - * to add to `input`. + * to add to {@code input}. + * @param options carries optional attribute values + * @param data type for {@code ScatterNdNonAliasingAdd} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ScatterNdNonAliasingAdd create(Scope scope, Operand input, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ScatterNdNonAliasingAdd"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(indices.asOutput()); opBuilder.addInput(updates.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new ScatterNdNonAliasingAdd(opBuilder.build()); + if (options != null) { + for (Options opts : options) { + if (opts.badIndicesPolicy != null) { + opBuilder.setAttr("bad_indices_policy", opts.badIndicesPolicy); + } + } + } + return new ScatterNdNonAliasingAdd<>(opBuilder.build()); + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public static Options badIndicesPolicy(String badIndicesPolicy) { + return new Options().badIndicesPolicy(badIndicesPolicy); } - + /** - * A `Tensor` with the same shape as `input`, containing values of `input` - * updated with `updates`. + * Gets output. + * A {@code Tensor} with the same shape as {@code input}, containing values of {@code input} + * updated with {@code updates}. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterNdNonAliasingAdd} + */ + public static class Options { + private String badIndicesPolicy; + + private Options() { + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public Options badIndicesPolicy(String badIndicesPolicy) { + this.badIndicesPolicy = badIndicesPolicy; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ScatterNdNonAliasingAdd.class + ) + public static class Inputs extends RawOpInputs> { + /** + * A Tensor. + */ + public final Operand input; + + /** + * A Tensor. Must be one of the following types: {@code int32}, {@code int64}. + * A tensor of indices into {@code input}. + */ + public final Operand indices; + + /** + * A Tensor. Must have the same type as ref. A tensor of updated values + * to add to {@code input}. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * The badIndicesPolicy attribute + */ + public final String badIndicesPolicy; + + public Inputs(GraphOperation op) { + super(new ScatterNdNonAliasingAdd<>(op), op, Arrays.asList("T", "Tindices", "bad_indices_policy")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + badIndicesPolicy = op.attributes().getAttrString("bad_indices_policy"); + } } } 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 index e2875e8af3c..21654611e88 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,132 +17,233 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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
+ * within a given variable according to {@code indices}.
+ * 

{@code ref} is a {@code Tensor} with rank {@code P} and {@code indices} is a {@code Tensor} of rank {@code Q}. + *

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

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

{@code updates} is {@code Tensor} of rank {@code Q-1+P-K} with shape: + *

  * [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 + *
+ *

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 + *

+ *

The resulting update to ref would look like this: + *

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

See {@code tf.scatter_nd} for more details about how to make updates to * slices. - * - * @param data type for {@code outputRef()} output */ +@OpMetadata( + opType = ScatterNdSub.OP_NAME, + inputsClass = ScatterNdSub.Inputs.class +) @Operator -public final class ScatterNdSub extends PrimitiveOp implements Operand { - +public final class ScatterNdSub extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.ScatterNdSub} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "ScatterNdSub"; + + private Output outputRef; + + public ScatterNdSub(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); } - + /** * 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 + * @param options carries optional attribute values + * @param data type for {@code ScatterNdSub} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ScatterNdSub create(Scope scope, Operand ref, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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); } + if (opts.badIndicesPolicy != null) { + opBuilder.setAttr("bad_indices_policy", opts.badIndicesPolicy); + } } } - return new ScatterNdSub(opBuilder.build()); + return new ScatterNdSub<>(opBuilder.build()); } - + /** + * Sets the useLocking option. + * * @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. + * @return this Options instance. */ public static Options useLocking(Boolean useLocking) { return new Options().useLocking(useLocking); } - + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public static Options badIndicesPolicy(String badIndicesPolicy) { + return new Options().badIndicesPolicy(badIndicesPolicy); + } + /** + * Gets outputRef. * Same as ref. Returned as a convenience for operations that want * to use the updated values after the update is done. + * @return outputRef. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterNdSub} + */ + public static class Options { + private Boolean useLocking; + + private String badIndicesPolicy; + + private Options() { + } + + /** + * Sets the useLocking option. + * + * @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. + * @return this Options instance. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public Options badIndicesPolicy(String badIndicesPolicy) { + this.badIndicesPolicy = badIndicesPolicy; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ScatterNdSub.class + ) + public static class Inputs extends RawOpInputs> { + /** + * A mutable Tensor. Should be from a Variable node. + */ + public final Operand ref; + + /** + * A Tensor. Must be one of the following types: int32, int64. + * A tensor of indices into ref. + */ + public final Operand indices; + + /** + * A Tensor. Must have the same type as ref. A tensor of updated values + * to subtract from ref. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * 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 final boolean useLocking; + + /** + * The badIndicesPolicy attribute + */ + public final String badIndicesPolicy; + + public Inputs(GraphOperation op) { + super(new ScatterNdSub<>(op), op, Arrays.asList("T", "Tindices", "use_locking", "bad_indices_policy")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + useLocking = op.attributes().getAttrBool("use_locking"); + badIndicesPolicy = op.attributes().getAttrString("bad_indices_policy"); + } } } 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 index c1ca318bc0b..5bf1e30fe35 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,134 +17,232 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * 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 + * Applies sparse {@code updates} to individual values or slices within a given + * variable according to {@code indices}. + *

{@code ref} is a {@code Tensor} with rank {@code P} and {@code indices} is a {@code Tensor} of rank {@code Q}. + *

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

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

{@code updates} is {@code Tensor} of rank {@code 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 + *

+ *

The resulting update to ref would look like this: + *

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

See {@code 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 + *

See also {@code tf.scatter_update} and {@code tf.batch_scatter_update}. */ +@OpMetadata( + opType = ScatterNdUpdate.OP_NAME, + inputsClass = ScatterNdUpdate.Inputs.class +) @Operator -public final class ScatterNdUpdate extends PrimitiveOp implements Operand { - +public final class ScatterNdUpdate extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.ScatterNdUpdate} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "ScatterNdUpdate"; + + private Output outputRef; + + public ScatterNdUpdate(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); } - + /** * 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 + * @param options carries optional attribute values + * @param data type for {@code ScatterNdUpdate} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ScatterNdUpdate create(Scope scope, Operand ref, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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); } + if (opts.badIndicesPolicy != null) { + opBuilder.setAttr("bad_indices_policy", opts.badIndicesPolicy); + } } } - return new ScatterNdUpdate(opBuilder.build()); + return new ScatterNdUpdate<>(opBuilder.build()); } - + /** + * Sets the useLocking option. + * * @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. + * @return this Options instance. */ public static Options useLocking(Boolean useLocking) { return new Options().useLocking(useLocking); } - + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public static Options badIndicesPolicy(String badIndicesPolicy) { + return new Options().badIndicesPolicy(badIndicesPolicy); + } + /** + * Gets outputRef. * Same as ref. Returned as a convenience for operations that want to * use the updated values after the update is done. + * @return outputRef. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterNdUpdate} + */ + public static class Options { + private Boolean useLocking; + + private String badIndicesPolicy; + + private Options() { + } + + /** + * Sets the useLocking option. + * + * @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. + * @return this Options instance. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public Options badIndicesPolicy(String badIndicesPolicy) { + this.badIndicesPolicy = badIndicesPolicy; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ScatterNdUpdate.class + ) + public static class Inputs extends RawOpInputs> { + /** + * A mutable Tensor. Should be from a Variable node. + */ + public final Operand ref; + + /** + * A Tensor. Must be one of the following types: int32, int64. + * A tensor of indices into ref. + */ + public final Operand indices; + + /** + * A Tensor. Must have the same type as ref. A tensor of updated + * values to add to ref. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * 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 final boolean useLocking; + + /** + * The badIndicesPolicy attribute + */ + public final String badIndicesPolicy; + + public Inputs(GraphOperation op) { + super(new ScatterNdUpdate<>(op), op, Arrays.asList("T", "Tindices", "use_locking", "bad_indices_policy")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + useLocking = op.attributes().getAttrBool("use_locking"); + badIndicesPolicy = op.attributes().getAttrString("bad_indices_policy"); + } } } 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 index aadb6f5af22..4686a81470f 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,82 +17,83 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 operation outputs {@code 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 + *

Duplicate entries are handled correctly: if multiple {@code indices} reference * the same location, their (negated) contributions add. - *

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

+ *

Requires {@code updates.shape = indices.shape + ref.shape[1:]} or {@code updates.shape = []}. *

* *
- * - * @param data type for {@code outputRef()} output */ +@OpMetadata( + opType = ScatterSub.OP_NAME, + inputsClass = ScatterSub.Inputs.class +) @Operator -public final class ScatterSub extends PrimitiveOp implements Operand { - +public final class ScatterSub extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.ScatterSub} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "ScatterSub"; + + private Output outputRef; + + public ScatterSub(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); } - + /** * 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 + * @param ref Should be from a {@code Variable} node. + * @param indices A tensor of indices into the first dimension of {@code ref}. + * @param updates A tensor of updated values to subtract from {@code ref}. + * @param options carries optional attribute values + * @param data type for {@code ScatterSub} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ScatterSub create(Scope scope, Operand ref, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { @@ -100,35 +101,101 @@ public static ScatterSub create(Scope sc } } } - return new ScatterSub(opBuilder.build()); + return new ScatterSub<>(opBuilder.build()); } - + /** + * Sets the useLocking option. + * * @param useLocking If True, the subtraction will be protected by a lock; * otherwise the behavior is undefined, but may exhibit less contention. + * @return this Options instance. */ public static Options useLocking(Boolean useLocking) { return new Options().useLocking(useLocking); } - + /** - * = Same as `ref`. Returned as a convenience for operations that want + * Gets outputRef. + * = Same as {@code ref}. Returned as a convenience for operations that want * to use the updated values after the update is done. + * @return outputRef. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterSub} + */ + public static class Options { + private Boolean useLocking; + + private Options() { + } + + /** + * Sets the useLocking option. + * + * @param useLocking If True, the subtraction will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + * @return this Options instance. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ScatterSub.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Should be from a {@code Variable} node. + */ + public final Operand ref; + + /** + * A tensor of indices into the first dimension of {@code ref}. + */ + public final Operand indices; + + /** + * A tensor of updated values to subtract from {@code ref}. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * If True, the subtraction will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public final boolean useLocking; + + public Inputs(GraphOperation op) { + super(new ScatterSub<>(op), op, Arrays.asList("T", "Tindices", "use_locking")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + useLocking = op.attributes().getAttrBool("use_locking"); + } } } 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 index 8898e370382..60e22039589 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,86 +17,86 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 operation outputs {@code 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 + *

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

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

+ *

Requires {@code updates.shape = indices.shape + ref.shape[1:]} or {@code updates.shape = []}. *

* *
- *

- * See also `tf.batch_scatter_update` and `tf.scatter_nd_update`. - * - * @param data type for {@code outputRef()} output + *

See also {@code tf.batch_scatter_update} and {@code tf.scatter_nd_update}. */ +@OpMetadata( + opType = ScatterUpdate.OP_NAME, + inputsClass = ScatterUpdate.Inputs.class +) @Operator -public final class ScatterUpdate extends PrimitiveOp implements Operand { - +public final class ScatterUpdate extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.ScatterUpdate} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "ScatterUpdate"; + + private Output outputRef; + + public ScatterUpdate(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); } - + /** * 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 + * @param ref Should be from a {@code Variable} node. + * @param indices A tensor of indices into the first dimension of {@code ref}. + * @param updates A tensor of updated values to store in {@code ref}. + * @param options carries optional attribute values + * @param data type for {@code ScatterUpdate} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static ScatterUpdate create(Scope scope, Operand ref, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { @@ -104,35 +104,101 @@ public static ScatterUpdate create(Scope } } } - return new ScatterUpdate(opBuilder.build()); + return new ScatterUpdate<>(opBuilder.build()); } - + /** + * Sets the useLocking option. + * * @param useLocking If True, the assignment will be protected by a lock; * otherwise the behavior is undefined, but may exhibit less contention. + * @return this Options instance. */ public static Options useLocking(Boolean useLocking) { return new Options().useLocking(useLocking); } - + /** - * = Same as `ref`. Returned as a convenience for operations that want + * Gets outputRef. + * = Same as {@code ref}. Returned as a convenience for operations that want * to use the updated values after the update is done. + * @return outputRef. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.ScatterUpdate} + */ + public static class Options { + private Boolean useLocking; + + private Options() { + } + + /** + * Sets the useLocking option. + * + * @param useLocking If True, the assignment will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + * @return this Options instance. + */ + public Options useLocking(Boolean useLocking) { + this.useLocking = useLocking; + return this; + } + } + + @OpInputsMetadata( + outputsClass = ScatterUpdate.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Should be from a {@code Variable} node. + */ + public final Operand ref; + + /** + * A tensor of indices into the first dimension of {@code ref}. + */ + public final Operand indices; + + /** + * A tensor of updated values to store in {@code ref}. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * If True, the assignment will be protected by a lock; + * otherwise the behavior is undefined, but may exhibit less contention. + */ + public final boolean useLocking; + + public Inputs(GraphOperation op) { + super(new ScatterUpdate<>(op), op, Arrays.asList("T", "Tindices", "use_locking")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + useLocking = op.attributes().getAttrBool("use_locking"); + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Select.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Select.java new file mode 100644 index 00000000000..c88ea468f39 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Select.java @@ -0,0 +1,128 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TBool; +import org.tensorflow.types.family.TType; + +/** + * The SelectV2 operation + */ +@OpMetadata( + opType = Select.OP_NAME, + inputsClass = Select.Inputs.class +) +@Operator +public final class Select extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "SelectV2"; + + private Output output; + + public Select(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new SelectV2 operation. + * + * @param scope current scope + * @param condition The condition value + * @param t The t value + * @param e The e value + * @param data type for {@code SelectV2} output and operands + * @return a new instance of Select + */ + @Endpoint( + describeByClass = true + ) + public static Select create(Scope scope, Operand condition, + Operand t, Operand e) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Select"); + opBuilder.addInput(condition.asOutput()); + opBuilder.addInput(t.asOutput()); + opBuilder.addInput(e.asOutput()); + return new Select<>(opBuilder.build()); + } + + /** + * Gets output. + * + * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + @OpInputsMetadata( + outputsClass = Select.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The condition input + */ + public final Operand condition; + + /** + * The t input + */ + public final Operand t; + + /** + * The e input + */ + public final Operand e; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new Select<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + condition = (Operand) op.input(inputIndex++); + t = (Operand) op.input(inputIndex++); + e = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } + } +} 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 deleted file mode 100644 index a1f14881901..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SelectV2.java +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.TBool; -import org.tensorflow.types.family.TType; - -/** - * @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/Send.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Send.java new file mode 100644 index 00000000000..e722ace450a --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Send.java @@ -0,0 +1,177 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * Sends the named tensor from send_device to recv_device. + */ +@OpMetadata( + opType = Send.OP_NAME, + inputsClass = Send.Inputs.class +) +@Operator +public final class Send extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Send"; + + public Send(Operation operation) { + super(operation, OP_NAME); + } + + /** + * Factory method to create a class wrapping a new Send operation. + * + * @param scope current scope + * @param tensor The tensor to send. + * @param tensorName The name of the tensor to send. + * @param sendDevice The name of the device sending the tensor. + * @param sendDeviceIncarnation The current incarnation of send_device. + * @param recvDevice The name of the device receiving the tensor. + * @param options carries optional attribute values + * @return a new instance of Send + */ + @Endpoint( + describeByClass = true + ) + public static Send create(Scope scope, Operand tensor, String tensorName, + String sendDevice, Long sendDeviceIncarnation, String recvDevice, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Send"); + opBuilder.addInput(tensor.asOutput()); + opBuilder.setAttr("tensor_name", tensorName); + opBuilder.setAttr("send_device", sendDevice); + opBuilder.setAttr("send_device_incarnation", sendDeviceIncarnation); + opBuilder.setAttr("recv_device", recvDevice); + if (options != null) { + for (Options opts : options) { + if (opts.clientTerminated != null) { + opBuilder.setAttr("client_terminated", opts.clientTerminated); + } + } + } + return new Send(opBuilder.build()); + } + + /** + * Sets the clientTerminated option. + * + * @param clientTerminated If set to true, this indicates that the node was added + * to the graph as a result of a client-side feed or fetch of Tensor data, + * in which case the corresponding send or recv is expected to be managed + * locally by the caller. + * @return this Options instance. + */ + public static Options clientTerminated(Boolean clientTerminated) { + return new Options().clientTerminated(clientTerminated); + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.Send} + */ + public static class Options { + private Boolean clientTerminated; + + private Options() { + } + + /** + * Sets the clientTerminated option. + * + * @param clientTerminated If set to true, this indicates that the node was added + * to the graph as a result of a client-side feed or fetch of Tensor data, + * in which case the corresponding send or recv is expected to be managed + * locally by the caller. + * @return this Options instance. + */ + public Options clientTerminated(Boolean clientTerminated) { + this.clientTerminated = clientTerminated; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Send.class + ) + public static class Inputs extends RawOpInputs { + /** + * The tensor to send. + */ + public final Operand tensor; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The name of the tensor to send. + */ + public final String tensorName; + + /** + * The name of the device sending the tensor. + */ + public final String sendDevice; + + /** + * The current incarnation of send_device. + */ + public final long sendDeviceIncarnation; + + /** + * The name of the device receiving the tensor. + */ + public final String recvDevice; + + /** + * If set to true, this indicates that the node was added + * to the graph as a result of a client-side feed or fetch of Tensor data, + * in which case the corresponding send or recv is expected to be managed + * locally by the caller. + */ + public final boolean clientTerminated; + + public Inputs(GraphOperation op) { + super(new Send(op), op, Arrays.asList("T", "tensor_name", "send_device", "send_device_incarnation", "recv_device", "client_terminated")); + int inputIndex = 0; + tensor = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + tensorName = op.attributes().getAttrString("tensor_name"); + sendDevice = op.attributes().getAttrString("send_device"); + sendDeviceIncarnation = op.attributes().getAttrInt("send_device_incarnation"); + recvDevice = op.attributes().getAttrString("recv_device"); + clientTerminated = op.attributes().getAttrBool("client_terminated"); + } + } +} 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 deleted file mode 100644 index d103ecb1164..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SendTPUEmbeddingGradients.java +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 index 5d914620f1b..562b2088b93 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,98 +17,155 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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
+ * Given a list {@code x} and a list {@code y}, this operation returns a list {@code out} that
+ * represents all values that are in {@code x} but not in {@code y}. The returned list {@code out}
+ * is sorted in the same order that the numbers appear in {@code x} (duplicates are
+ * preserved). This operation also returns a list {@code idx} that represents the
+ * position of each {@code out} element in {@code x}. In other words:
+ * 

{@code out[i] = x[idx[i]] for i in [0, 1, ..., len(out) - 1]} + *

For example, given this input: + *

  * 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 + *
+ *

This operation would return: + *

+ * out ==> [2, 4, 6]
+ * idx ==> [1, 3, 5]
+ * 
*/ +@OpMetadata( + opType = SetDiff1d.OP_NAME, + inputsClass = SetDiff1d.Inputs.class +) @Operator -public final class SetDiff1d extends PrimitiveOp { - +public final class SetDiff1d extends RawOp { /** - * Factory method to create a class wrapping a new SetDiff1d operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ListDiff"; + + private Output out; + + private Output idx; + + public SetDiff1d(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + out = operation.output(outputIdx++); + idx = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new ListDiff operation. + * * @param scope current scope * @param x 1-D. Values to keep. * @param y 1-D. Values to remove. - * @param outIdx + * @param outIdx The value of the outIdx attribute + * @param data type for {@code ListDiff} output and operands + * @param data type for {@code ListDiff} output and operands * @return a new instance of SetDiff1d */ - public static SetDiff1d create(Scope scope, Operand x, Operand y, DataType outIdx) { - OperationBuilder opBuilder = scope.env().opBuilder("ListDiff", scope.makeOpName("SetDiff1d")); + @Endpoint( + describeByClass = true + ) + public static SetDiff1d create(Scope scope, + Operand x, Operand y, Class outIdx) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "SetDiff1d"); opBuilder.addInput(x.asOutput()); opBuilder.addInput(y.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("out_idx", outIdx); - return new SetDiff1d(opBuilder.build()); + opBuilder.setAttr("out_idx", Operands.toDataType(outIdx)); + return new SetDiff1d<>(opBuilder.build()); } - + /** - * Factory method to create a class wrapping a new SetDiff1d operation using default output types. - * + * Factory method to create a class wrapping a new ListDiff operation, with the 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 + * @param data type for {@code ListDiff} output and operands + * @return a new instance of SetDiff1d, with default output types */ - public static SetDiff1d create(Scope scope, Operand x, Operand y) { - return create(scope, x, y, TInt32.DTYPE); + @Endpoint( + describeByClass = true + ) + public static SetDiff1d create(Scope scope, Operand x, + Operand y) { + return create(scope, x, y, TInt32.class); } - + /** - * 1-D. Values present in `x` but not in `y`. + * Gets out. + * 1-D. Values present in {@code x} but not in {@code y}. + * @return out. */ public Output out() { return out; } - + /** - * 1-D. Positions of `x` values preserved in `out`. + * Gets idx. + * 1-D. Positions of {@code x} values preserved in {@code out}. + * @return idx. */ 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++); + + @OpInputsMetadata( + outputsClass = SetDiff1d.class + ) + public static class Inputs extends RawOpInputs> { + /** + * 1-D. Values to keep. + */ + public final Operand x; + + /** + * 1-D. Values to remove. + */ + public final Operand y; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The outIdx attribute + */ + public final DataType outIdx; + + public Inputs(GraphOperation op) { + super(new SetDiff1d<>(op), op, Arrays.asList("T", "out_idx")); + int inputIndex = 0; + x = (Operand) op.input(inputIndex++); + y = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + outIdx = op.attributes().getAttrType("out_idx"); + } } } 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 index ff3343c7fec..3444bef9840 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,65 +17,71 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.TInt64; import org.tensorflow.types.family.TType; /** - * 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 + * Number of unique elements along last dimension of input {@code set}. + * Input {@code set} is a {@code SparseTensor} represented by {@code set_indices}, {@code set_values}, + * and {@code 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. + *

If {@code validate_indices} is {@code True}, this op validates the order and range of {@code set} + * indices. Setting is to {@code False} while passing invalid arguments results in + * undefined behavior. */ +@OpMetadata( + opType = SetSize.OP_NAME, + inputsClass = SetSize.Inputs.class +) @Operator -public final class SetSize extends PrimitiveOp implements Operand { - +public final class SetSize extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.SetSize} + * The name of this op, as known by TensorFlow core engine */ - public static class Options { - - /** - * @param validateIndices - */ - public Options validateIndices(Boolean validateIndices) { - this.validateIndices = validateIndices; - return this; - } - - private Boolean validateIndices; - - private Options() { - } + public static final String OP_NAME = "SetSize"; + + private Output output; + + public SetSize(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * 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 + * @param setIndices 2D {@code Tensor}, indices of a {@code SparseTensor}. + * @param setValues 1D {@code Tensor}, values of a {@code SparseTensor}. + * @param setShape 1D {@code Tensor}, shape of a {@code SparseTensor}. + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static SetSize create(Scope scope, Operand setIndices, + Operand setValues, Operand setShape, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { @@ -85,33 +91,91 @@ public static SetSize create(Scope scope, Operand setI } return new SetSize(opBuilder.build()); } - + /** - * @param validateIndices + * Sets the validateIndices option. + * + * @param validateIndices the validateIndices option + * @return this Options instance. */ 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`. + * Gets output. + * For {@code set} ranked {@code n}, this is a {@code Tensor} with rank {@code n-1}, and the same 1st + * {@code n-1} dimensions as {@code set}. Each value is the number of unique elements in + * the corresponding {@code [0...n-1]} dimension of {@code set}. + * @return output. */ - public Output size() { - return size; + public Output output() { + return output; } - + @Override public Output asOutput() { - return size; + return output; } - - private Output size; - - private SetSize(Operation operation) { - super(operation); - int outputIdx = 0; - size = operation.output(outputIdx++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.SetSize} + */ + public static class Options { + private Boolean validateIndices; + + private Options() { + } + + /** + * Sets the validateIndices option. + * + * @param validateIndices the validateIndices option + * @return this Options instance. + */ + public Options validateIndices(Boolean validateIndices) { + this.validateIndices = validateIndices; + return this; + } + } + + @OpInputsMetadata( + outputsClass = SetSize.class + ) + public static class Inputs extends RawOpInputs { + /** + * 2D {@code Tensor}, indices of a {@code SparseTensor}. + */ + public final Operand setIndices; + + /** + * 1D {@code Tensor}, values of a {@code SparseTensor}. + */ + public final Operand setValues; + + /** + * 1D {@code Tensor}, shape of a {@code SparseTensor}. + */ + public final Operand setShape; + + /** + * The validateIndices attribute + */ + public final boolean validateIndices; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new SetSize(op), op, Arrays.asList("validate_indices", "T")); + int inputIndex = 0; + setIndices = (Operand) op.input(inputIndex++); + setValues = (Operand) op.input(inputIndex++); + setShape = (Operand) op.input(inputIndex++); + validateIndices = op.attributes().getAttrBool("validate_indices"); + T = op.attributes().getAttrType("T"); + } } } 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 index 8cbef665fe2..2f7592fbc03 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,78 +17,126 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * Returns the shape of a tensor. - *

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

- * For example: - *

{@code
+ * This operation returns a 1-D integer tensor representing the shape of {@code input}.
+ * 

For example: + *

  * # '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 + * shape(t) ==> [2, 2, 3] + *
*/ +@OpMetadata( + opType = Shape.OP_NAME, + inputsClass = Shape.Inputs.class +) @Operator -public final class Shape extends PrimitiveOp implements Operand { - +public final class Shape extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Shape"; + + private Output output; + + public Shape(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new Shape operation. - * + * * @param scope current scope - * @param input - * @param outType + * @param input The input value + * @param outType The value of the outType attribute + * @param data type for {@code Shape} output and operands * @return a new instance of Shape */ - public static Shape create(Scope scope, Operand input, DataType outType) { - OperationBuilder opBuilder = scope.env().opBuilder("Shape", scope.makeOpName("Shape")); + @Endpoint( + describeByClass = true + ) + public static Shape create(Scope scope, Operand input, + Class outType) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Shape"); opBuilder.addInput(input.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("out_type", outType); - return new Shape(opBuilder.build()); + opBuilder.setAttr("out_type", Operands.toDataType(outType)); + return new Shape<>(opBuilder.build()); } - + /** - * Factory method to create a class wrapping a new Shape operation using default output types. - * + * Factory method to create a class wrapping a new Shape operation, with the default output types. + * * @param scope current scope - * @param input - * @return a new instance of Shape + * @param input The input value + * @return a new instance of Shape, with default output types */ - public static Shape create(Scope scope, Operand input) { - return create(scope, input, TInt32.DTYPE); + @Endpoint( + describeByClass = true + ) + public static Shape create(Scope scope, Operand input) { + return create(scope, input, TInt32.class); } - + /** + * Gets output. + * + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = Shape.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The outType attribute + */ + public final DataType outType; + + public Inputs(GraphOperation op) { + super(new Shape<>(op), op, Arrays.asList("T", "out_type")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + outType = op.attributes().getAttrType("out_type"); + } } } 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 index 2324f89e69c..b53a00a1a82 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,76 +20,126 @@ import java.util.Arrays; import java.util.Iterator; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.GraphOperation; 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.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 + * This operation returns N 1-D integer tensors representing shape of {@code input[i]s}. */ +@OpMetadata( + opType = ShapeN.OP_NAME, + inputsClass = ShapeN.Inputs.class +) @Operator -public final class ShapeN extends PrimitiveOp implements Iterable> { - +public final class ShapeN extends RawOp implements Iterable> { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "ShapeN"; + + private List> output; + + @SuppressWarnings("unchecked") + public ShapeN(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int outputLength = operation.outputListLength("output"); + output = Arrays.asList((Output[]) operation.outputList(outputIdx, outputLength)); + outputIdx += outputLength; + } + /** * Factory method to create a class wrapping a new ShapeN operation. - * + * * @param scope current scope - * @param input - * @param outType + * @param input The input value + * @param outType The value of the outType attribute + * @param data type for {@code ShapeN} output and operands * @return a new instance of ShapeN */ - public static ShapeN create(Scope scope, Iterable> input, DataType outType) { - OperationBuilder opBuilder = scope.env().opBuilder("ShapeN", scope.makeOpName("ShapeN")); + @Endpoint( + describeByClass = true + ) + public static ShapeN create(Scope scope, + Iterable> input, Class outType) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "ShapeN"); opBuilder.addInputList(Operands.asOutputs(input)); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("out_type", outType); - return new ShapeN(opBuilder.build()); + opBuilder.setAttr("out_type", Operands.toDataType(outType)); + return new ShapeN<>(opBuilder.build()); } - + /** - * Factory method to create a class wrapping a new ShapeN operation using default output types. - * + * Factory method to create a class wrapping a new ShapeN operation, with the default output types. + * * @param scope current scope - * @param input - * @return a new instance of ShapeN + * @param input The input value + * @return a new instance of ShapeN, with default output types */ - public static ShapeN create(Scope scope, Iterable> input) { - return create(scope, input, TInt32.DTYPE); + @Endpoint( + describeByClass = true + ) + public static ShapeN create(Scope scope, Iterable> input) { + return create(scope, input, TInt32.class); } - + /** + * Gets output. + * + * @return output. */ 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; + + @OpInputsMetadata( + outputsClass = ShapeN.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Iterable> input; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The outType attribute + */ + public final DataType outType; + + public Inputs(GraphOperation op) { + super(new ShapeN<>(op), op, Arrays.asList("T", "out_type")); + int inputIndex = 0; + int inputLength = op.inputListLength("input"); + input = Arrays.asList((Operand[]) op.inputList(inputIndex, inputLength)); + inputIndex += inputLength; + T = op.attributes().getAttrType("T"); + outType = op.attributes().getAttrType("out_type"); + } } } 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 deleted file mode 100644 index c066b5a808a..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ShardDataset.java +++ /dev/null @@ -1,120 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 deleted file mode 100644 index bfa87cf6560..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ShuffleDatasetV2.java +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - */ -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] = 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 deleted file mode 100644 index fbfce9b0437..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ShutdownDistributedTPU.java +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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 index 0b6725052ab..2be90850900 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,79 +17,127 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * Returns the size of a tensor. - *

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

- * For example: - *

{@code
+ * {@code input}.
+ * 

For example: + *

  * # 't' is [[[1, 1,, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]]]
- * size(t) ==> 12
- * }
- * - * - * @param data type for {@code output()} output + * size(t) ==> 12 + *
*/ +@OpMetadata( + opType = Size.OP_NAME, + inputsClass = Size.Inputs.class +) @Operator -public final class Size extends PrimitiveOp implements Operand { - +public final class Size extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Size"; + + private Output output; + + public Size(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new Size operation. - * + * * @param scope current scope - * @param input - * @param outType + * @param input The input value + * @param outType The value of the outType attribute + * @param data type for {@code Size} output and operands * @return a new instance of Size */ - public static Size create(Scope scope, Operand input, DataType outType) { - OperationBuilder opBuilder = scope.env().opBuilder("Size", scope.makeOpName("Size")); + @Endpoint( + describeByClass = true + ) + public static Size create(Scope scope, Operand input, + Class outType) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Size"); opBuilder.addInput(input.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("out_type", outType); - return new Size(opBuilder.build()); + opBuilder.setAttr("out_type", Operands.toDataType(outType)); + return new Size<>(opBuilder.build()); } - + /** - * Factory method to create a class wrapping a new Size operation using default output types. - * + * Factory method to create a class wrapping a new Size operation, with the default output types. + * * @param scope current scope - * @param input - * @return a new instance of Size + * @param input The input value + * @return a new instance of Size, with default output types */ - public static Size create(Scope scope, Operand input) { - return create(scope, input, TInt32.DTYPE); + @Endpoint( + describeByClass = true + ) + public static Size create(Scope scope, Operand input) { + return create(scope, input, TInt32.class); } - + /** + * Gets output. + * + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = Size.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The outType attribute + */ + public final DataType outType; + + public Inputs(GraphOperation op) { + super(new Size<>(op), op, Arrays.asList("T", "out_type")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + outType = op.attributes().getAttrType("out_type"); + } } } 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 index d305126af82..a6c1b030eff 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,11 +17,17 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; import org.tensorflow.types.TInt32; import org.tensorflow.types.TInt64; @@ -30,60 +36,57 @@ /** * Parses a text file and creates a batch of examples. */ +@OpMetadata( + opType = Skipgram.OP_NAME, + inputsClass = Skipgram.Inputs.class +) @Operator -public final class Skipgram extends PrimitiveOp { - +public final class Skipgram extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.Skipgram} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Skipgram"; + + private Output vocabWord; + + private Output vocabFreq; + + private Output wordsPerEpoch; + + private Output currentEpoch; + + private Output totalWordsProcessed; + + private Output examples; + + private Output labels; + + public Skipgram(Operation operation) { + super(operation, OP_NAME); + 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++); } - + /** * 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 + * @param options carries optional attribute values * @return a new instance of Skipgram */ + @Endpoint( + describeByClass = true + ) 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); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Skipgram"); opBuilder.setAttr("filename", filename); opBuilder.setAttr("batch_size", batchSize); if (options != null) { @@ -101,96 +104,190 @@ public static Skipgram create(Scope scope, String filename, Long batchSize, Opti } return new Skipgram(opBuilder.build()); } - + /** + * Sets the windowSize option. + * * @param windowSize The number of words to predict to the left and right of the target. + * @return this Options instance. */ public static Options windowSize(Long windowSize) { return new Options().windowSize(windowSize); } - + /** + * Sets the minCount option. + * * @param minCount The minimum number of word occurrences for it to be included in the * vocabulary. + * @return this Options instance. */ public static Options minCount(Long minCount) { return new Options().minCount(minCount); } - + /** + * Sets the subsample option. + * * @param subsample Threshold for word occurrence. Words that appear with higher * frequency will be randomly down-sampled. Set to 0 to disable. + * @return this Options instance. */ public static Options subsample(Float subsample) { return new Options().subsample(subsample); } - + /** + * Gets vocabWord. * A vector of words in the corpus. + * @return vocabWord. */ public Output vocabWord() { return vocabWord; } - + /** + * Gets vocabFreq. * Frequencies of words. Sorted in the non-ascending order. + * @return vocabFreq. */ public Output vocabFreq() { return vocabFreq; } - + /** + * Gets wordsPerEpoch. * Number of words per epoch in the data file. + * @return wordsPerEpoch. */ public Output wordsPerEpoch() { return wordsPerEpoch; } - + /** + * Gets currentEpoch. * The current epoch number. + * @return currentEpoch. */ public Output currentEpoch() { return currentEpoch; } - + /** + * Gets totalWordsProcessed. * The total number of words processed so far. + * @return totalWordsProcessed. */ public Output totalWordsProcessed() { return totalWordsProcessed; } - + /** + * Gets examples. * A vector of word ids. + * @return examples. */ public Output examples() { return examples; } - + /** + * Gets labels. * A vector of word ids. + * @return labels. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.Skipgram} + */ + public static class Options { + private Long windowSize; + + private Long minCount; + + private Float subsample; + + private Options() { + } + + /** + * Sets the windowSize option. + * + * @param windowSize The number of words to predict to the left and right of the target. + * @return this Options instance. + */ + public Options windowSize(Long windowSize) { + this.windowSize = windowSize; + return this; + } + + /** + * Sets the minCount option. + * + * @param minCount The minimum number of word occurrences for it to be included in the + * vocabulary. + * @return this Options instance. + */ + public Options minCount(Long minCount) { + this.minCount = minCount; + return this; + } + + /** + * Sets the subsample option. + * + * @param subsample Threshold for word occurrence. Words that appear with higher + * frequency will be randomly down-sampled. Set to 0 to disable. + * @return this Options instance. + */ + public Options subsample(Float subsample) { + this.subsample = subsample; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Skipgram.class + ) + public static class Inputs extends RawOpInputs { + /** + * The corpus's text file name. + */ + public final String filename; + + /** + * The size of produced batch. + */ + public final long batchSize; + + /** + * The number of words to predict to the left and right of the target. + */ + public final long windowSize; + + /** + * The minimum number of word occurrences for it to be included in the + * vocabulary. + */ + public final long minCount; + + /** + * Threshold for word occurrence. Words that appear with higher + * frequency will be randomly down-sampled. Set to 0 to disable. + */ + public final float subsample; + + public Inputs(GraphOperation op) { + super(new Skipgram(op), op, Arrays.asList("filename", "batch_size", "window_size", "min_count", "subsample")); + int inputIndex = 0; + filename = op.attributes().getAttrString("filename"); + batchSize = op.attributes().getAttrInt("batch_size"); + windowSize = op.attributes().getAttrInt("window_size"); + minCount = op.attributes().getAttrInt("min_count"); + subsample = op.attributes().getAttrFloat("subsample"); + } } } 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 deleted file mode 100644 index 1702a1b762f..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SleepDataset.java +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - */ -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] = 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 index 4bf53db2892..37a168fb6f7 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,69 +17,132 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 + *

Requirements: + * 0 <= begin[i] <= begin[i] + size[i] <= Di for i in [0, n) */ +@OpMetadata( + opType = Slice.OP_NAME, + inputsClass = Slice.Inputs.class +) @Operator -public final class Slice extends PrimitiveOp implements Operand { - +public final class Slice extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Slice"; + + private Output output; + + public Slice(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new Slice operation. - * + * * @param scope current scope - * @param input + * @param input The input value * @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 + * @param sizeOutput 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]). + * @param data type for {@code Slice} output and operands + * @param data type for {@code Slice} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static Slice create(Scope scope, Operand input, + Operand begin, Operand sizeOutput) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Slice"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(begin.asOutput()); - opBuilder.addInput(size.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new Slice(opBuilder.build()); + opBuilder.addInput(sizeOutput.asOutput()); + return new Slice<>(opBuilder.build()); } - + /** + * Gets output. + * + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = Slice.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * begin[i] specifies the offset into the 'i'th dimension of + * 'input' to slice from. + */ + public final Operand begin; + + /** + * 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]). + */ + public final Operand sizeOutput; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Index attribute + */ + public final DataType Index; + + public Inputs(GraphOperation op) { + super(new Slice<>(op), op, Arrays.asList("T", "Index")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + begin = (Operand) op.input(inputIndex++); + sizeOutput = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Index = op.attributes().getAttrType("Index"); + } } } 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 deleted file mode 100644 index cb85a150867..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SlidingWindowDataset.java +++ /dev/null @@ -1,91 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 index f4601c464bd..bafca31221f 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,53 +17,94 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * Returns a copy of the input tensor. - * - * @param data type for {@code output()} output */ +@OpMetadata( + opType = Snapshot.OP_NAME, + inputsClass = Snapshot.Inputs.class +) @Operator -public final class Snapshot extends PrimitiveOp implements Operand { - +public final class Snapshot extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Snapshot"; + + private Output output; + + public Snapshot(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new Snapshot operation. - * + * * @param scope current scope - * @param input + * @param input The input value + * @param data type for {@code Snapshot} output and operands * @return a new instance of Snapshot */ + @Endpoint( + describeByClass = true + ) public static Snapshot create(Scope scope, Operand input) { - OperationBuilder opBuilder = scope.env().opBuilder("Snapshot", scope.makeOpName("Snapshot")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Snapshot"); opBuilder.addInput(input.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new Snapshot(opBuilder.build()); + return new Snapshot<>(opBuilder.build()); } - + /** + * Gets output. + * + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = Snapshot.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new Snapshot<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 deleted file mode 100644 index 52271041996..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SnapshotDataset.java +++ /dev/null @@ -1,275 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.TString; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 index 3f79d58f976..2a366e46641 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,159 +17,228 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 + * This operation divides "spatial" dimensions {@code [1, ..., M]} of the input into a + * grid of blocks of shape {@code block_shape}, and interleaves these blocks with the + * "batch" dimension (0) such that in the output, the spatial dimensions + * {@code [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 + * input are optionally zero padded according to {@code paddings}. See below for a * precise description. - * - * @param data type for {@code output()} output + *

This operation is equivalent to the following steps: + *

    + *
  1. + *

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

  2. + *
  3. + *

    Reshape {@code padded} to {@code 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 + *

  4. + *
  5. + *

    Permute dimensions of {@code reshaped_padded} to produce + * {@code permuted_reshaped_padded} of shape: + *

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

  6. + *
  7. + *

    Reshape {@code permuted_reshaped_padded} to flatten {@code 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 + *

  8. + *
+ *

Some examples: + *

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

+ * x = [[[[1], [2]], [[3], [4]]]]
+ * 
+ *

The output tensor has shape {@code [4, 1, 1, 1]} and value: + *

+ * [[[[1]]], [[[2]]], [[[3]]], [[[4]]]]
+ * 
+ *

(2) For the following input of shape {@code [1, 2, 2, 3]}, {@code block_shape = [2, 2]}, and + * {@code paddings = [[0, 0], [0, 0]]}: + *

+ * x = [[[[1, 2, 3], [4, 5, 6]],
+ *       [[7, 8, 9], [10, 11, 12]]]]
+ * 
+ *

The output tensor has shape {@code [4, 1, 1, 3]} and value: + *

+ * [[[[1, 2, 3]]], [[[4, 5, 6]]], [[[7, 8, 9]]], [[[10, 11, 12]]]]
+ * 
+ *

(3) For the following input of shape {@code [1, 4, 4, 1]}, {@code block_shape = [2, 2]}, and + * {@code paddings = [[0, 0], [0, 0]]}: + *

+ * x = [[[[1],   [2],  [3],  [4]],
+ *       [[5],   [6],  [7],  [8]],
+ *       [[9],  [10], [11],  [12]],
+ *       [[13], [14], [15],  [16]]]]
+ * 
+ *

The output tensor has shape {@code [4, 2, 2, 1]} and value: + *

+ * x = [[[[1], [3]], [[9], [11]]],
+ *      [[[2], [4]], [[10], [12]]],
+ *      [[[5], [7]], [[13], [15]]],
+ *      [[[6], [8]], [[14], [16]]]]
+ * 
+ *

(4) For the following input of shape {@code [2, 2, 4, 1]}, block_shape = {@code [2, 2]}, and + * paddings = {@code [[0, 0], [2, 0]]}: + *

+ * x = [[[[1],   [2],  [3],  [4]],
+ *       [[5],   [6],  [7],  [8]]],
+ *      [[[9],  [10], [11],  [12]],
+ *       [[13], [14], [15],  [16]]]]
+ * 
+ *

The output tensor has shape {@code [8, 1, 3, 1]} and value: + *

+ * 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. */ +@OpMetadata( + opType = SpaceToBatchNd.OP_NAME, + inputsClass = SpaceToBatchNd.Inputs.class +) @Operator -public final class SpaceToBatchNd extends PrimitiveOp implements Operand { - +public final class SpaceToBatchNd extends RawOp implements Operand { /** - * Factory method to create a class wrapping a new SpaceToBatchNd operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "SpaceToBatchND"; + + private Output output; + + public SpaceToBatchNd(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * 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. + * @param input N-D with shape {@code input_shape = [batch] + spatial_shape + remaining_shape}, + * where spatial_shape has {@code M} dimensions. + * @param blockShape 1-D with shape {@code [M]}, all values must be >= 1. + * @param paddings 2-D with shape {@code [M, 2]}, all values must be >= 0. + * {@code paddings[i] = [pad_start, pad_end]} specifies the padding for input dimension + * {@code i + 1}, which corresponds to spatial dimension {@code i}. It is required that + * {@code block_shape[i]} divides {@code input_shape[i + 1] + pad_start + pad_end}. + * @param data type for {@code SpaceToBatchND} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static SpaceToBatchNd create(Scope scope, Operand input, + Operand blockShape, Operand paddings) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "SpaceToBatchNd"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(blockShape.asOutput()); opBuilder.addInput(paddings.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new SpaceToBatchNd(opBuilder.build()); + return new SpaceToBatchNd<>(opBuilder.build()); } - + /** + * Gets output. + * + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = SpaceToBatchNd.class + ) + public static class Inputs extends RawOpInputs> { + /** + * N-D with shape {@code input_shape = [batch] + spatial_shape + remaining_shape}, + * where spatial_shape has {@code M} dimensions. + */ + public final Operand input; + + /** + * 1-D with shape {@code [M]}, all values must be >= 1. + */ + public final Operand blockShape; + + /** + * 2-D with shape {@code [M, 2]}, all values must be >= 0. + * {@code paddings[i] = [pad_start, pad_end]} specifies the padding for input dimension + * {@code i + 1}, which corresponds to spatial dimension {@code i}. It is required that + * {@code block_shape[i]} divides {@code input_shape[i + 1] + pad_start + pad_end}. + */ + public final Operand paddings; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The TblockShape attribute + */ + public final DataType TblockShape; + + /** + * The Tpaddings attribute + */ + public final DataType Tpaddings; + + public Inputs(GraphOperation op) { + super(new SpaceToBatchNd<>(op), op, Arrays.asList("T", "Tblock_shape", "Tpaddings")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + blockShape = (Operand) op.input(inputIndex++); + paddings = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + TblockShape = op.attributes().getAttrType("Tblock_shape"); + Tpaddings = op.attributes().getAttrType("Tpaddings"); + } } } 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 deleted file mode 100644 index 2621a29569a..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SparseApplyAdagradV2.java +++ /dev/null @@ -1,140 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 index 6d1b3b0dc9e..dc4fad88677 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,67 +20,114 @@ import java.util.Arrays; import java.util.Iterator; import java.util.List; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** - * Splits a tensor into `num_split` tensors along one dimension. - * - * @param data type for {@code output()} output + * Splits a tensor into {@code num_split} tensors along one dimension. */ +@OpMetadata( + opType = Split.OP_NAME, + inputsClass = Split.Inputs.class +) @Operator -public final class Split extends PrimitiveOp implements Iterable> { - +public final class Split extends RawOp implements Iterable> { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Split"; + + private List> output; + + @SuppressWarnings("unchecked") + public Split(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int outputLength = operation.outputListLength("output"); + output = Arrays.asList((Output[]) operation.outputList(outputIdx, outputLength)); + outputIdx += outputLength; + } + /** * 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))`. + * {@code [-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]`. + * {@code value.shape[split_dim]}. + * @param data type for {@code Split} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static Split create(Scope scope, Operand axis, + Operand value, Long numSplit) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Split"); opBuilder.addInput(axis.asOutput()); opBuilder.addInput(value.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); opBuilder.setAttr("num_split", numSplit); - return new Split(opBuilder.build()); + 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`. + * Gets output. + * They are identically shaped tensors, whose shape matches that of {@code value} + * except along {@code axis}, where their sizes are + * {@code values.shape[split_dim] / num_split}. + * @return output. */ 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; + + @OpInputsMetadata( + outputsClass = Split.class + ) + public static class Inputs extends RawOpInputs> { + /** + * 0-D. The dimension along which to split. Must be in the range + * {@code [-rank(value), rank(value))}. + */ + public final Operand axis; + + /** + * The tensor to split. + */ + public final Operand value; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new Split<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + axis = (Operand) op.input(inputIndex++); + value = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index e46801bea9f..cc0525e9645 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,71 +20,132 @@ import java.util.Arrays; import java.util.Iterator; import java.util.List; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * Splits a tensor into `num_split` tensors along one dimension. - * - * @param data type for {@code output()} output + * Splits a tensor into {@code num_split} tensors along one dimension. */ +@OpMetadata( + opType = SplitV.OP_NAME, + inputsClass = SplitV.Inputs.class +) @Operator -public final class SplitV extends PrimitiveOp implements Iterable> { - +public final class SplitV extends RawOp implements Iterable> { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "SplitV"; + + private List> output; + + @SuppressWarnings("unchecked") + public SplitV(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int outputLength = operation.outputListLength("output"); + output = Arrays.asList((Output[]) operation.outputList(outputIdx, outputLength)); + outputIdx += outputLength; + } + /** * 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 + * {@code [-rank(value), rank(value))}. + * @param numSplit The value of the numSplit attribute + * @param data type for {@code SplitV} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static SplitV create(Scope scope, Operand value, + Operand sizeSplits, Operand axis, Long numSplit) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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()); + return new SplitV<>(opBuilder.build()); } - + /** - * Tensors whose shape matches that of `value` - * except along `axis`, where their sizes are - * `size_splits[i]`. + * Gets output. + * Tensors whose shape matches that of {@code value} + * except along {@code axis}, where their sizes are + * {@code size_splits[i]}. + * @return output. */ 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; + + @OpInputsMetadata( + outputsClass = SplitV.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensor to split. + */ + public final Operand value; + + /** + * 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. + */ + public final Operand sizeSplits; + + /** + * 0-D. The dimension along which to split. Must be in the range + * {@code [-rank(value), rank(value))}. + */ + public final Operand axis; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tlen attribute + */ + public final DataType Tlen; + + public Inputs(GraphOperation op) { + super(new SplitV<>(op), op, Arrays.asList("T", "Tlen")); + int inputIndex = 0; + value = (Operand) op.input(inputIndex++); + sizeSplits = (Operand) op.input(inputIndex++); + axis = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tlen = op.attributes().getAttrType("Tlen"); + } } } 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 index e4c021aea9c..52155b47d43 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,115 +17,191 @@ package org.tensorflow.op.core; +import java.util.Arrays; import java.util.List; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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 + * Given a tensor {@code 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
+ * {@code axis}.
+ * 

For example: + *

  * # '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
+ * shape(squeeze(t)) ==> [2, 3]
+ * 
+ *

Or, to remove specific size 1 dimensions: + *

  * # '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 + * shape(squeeze(t, [2, 4])) ==> [1, 2, 3, 1] + *
*/ +@OpMetadata( + opType = Squeeze.OP_NAME, + inputsClass = Squeeze.Inputs.class +) @Operator -public final class Squeeze extends PrimitiveOp implements Operand { - +public final class Squeeze extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.Squeeze} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Squeeze"; + + private Output output; + + public Squeeze(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * 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 + * @param input The {@code input} to squeeze. + * @param options carries optional attribute values + * @param data type for {@code Squeeze} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static Squeeze create(Scope scope, Operand input, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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); + long[] squeezeDimsArray = new long[opts.axis.size()]; + for (int i = 0 ; i < squeezeDimsArray.length ; i++) { + squeezeDimsArray[i] = opts.axis.get(i); } - opBuilder.setAttr("squeeze_dims", axisArray); + opBuilder.setAttr("squeeze_dims", squeezeDimsArray); } } } - return new Squeeze(opBuilder.build()); + return new Squeeze<>(opBuilder.build()); } - + /** + * Sets the axis option. + * * @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))`. + * be in the range {@code [-rank(input), rank(input))}. + * @return this Options instance. */ public static Options axis(List axis) { return new Options().axis(axis); } - + /** - * Contains the same data as `input`, but has one or more dimensions of + * Sets the axis option. + * + * @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 {@code [-rank(input), rank(input))}. + * @return this Options instance. + */ + public static Options axis(Long... axis) { + return new Options().axis(axis); + } + + /** + * Gets output. + * Contains the same data as {@code input}, but has one or more dimensions of * size 1 removed. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.Squeeze} + */ + public static class Options { + private List axis; + + private Options() { + } + + /** + * Sets the axis option. + * + * @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 {@code [-rank(input), rank(input))}. + * @return this Options instance. + */ + public Options axis(List axis) { + this.axis = axis; + return this; + } + + /** + * Sets the axis option. + * + * @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 {@code [-rank(input), rank(input))}. + * @return this Options instance. + */ + public Options axis(Long... axis) { + this.axis = Arrays.asList(axis); + return this; + } + } + + @OpInputsMetadata( + outputsClass = Squeeze.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The {@code input} to squeeze. + */ + public final Operand input; + + /** + * The T attribute + */ + public final DataType T; + + /** + * 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 {@code [-rank(input), rank(input))}. + */ + public final long[] axis; + + public Inputs(GraphOperation op) { + super(new Squeeze<>(op), op, Arrays.asList("T", "squeeze_dims")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + axis = op.attributes().getAttrIntList("squeeze_dims"); + } } } 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 index d695eb1922f..976a86955b3 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,74 +17,76 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; 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.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** - * 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)`. + * Packs a list of {@code N} rank-{@code R} tensors into one rank-{@code (R+1)} tensor. + * Packs the {@code N} tensors in {@code values} into a tensor with rank one higher than each + * tensor in {@code values}, by packing them along the {@code axis} dimension. + * Given a list of tensors of shape {@code (A, B, C)}; + *

if {@code axis == 0} then the {@code output} tensor will have the shape {@code (N, A, B, C)}. + * if {@code axis == 1} then the {@code output} tensor will have the shape {@code (A, N, B, C)}. * Etc. - *

- * For example: - *

{@code
+ * 

For example: + *

  * # '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 + * 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 {@code unpack}. */ +@OpMetadata( + opType = Stack.OP_NAME, + inputsClass = Stack.Inputs.class +) @Operator -public final class Stack extends PrimitiveOp implements Operand { - +public final class Stack extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.Stack} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Pack"; + + private Output output; + + public Stack(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** - * Factory method to create a class wrapping a new Stack operation. - * + * Factory method to create a class wrapping a new Pack operation. + * * @param scope current scope * @param values Must be of same shape and type. - * @param options carries optional attributes values + * @param options carries optional attribute values + * @param data type for {@code Pack} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static Stack create(Scope scope, Iterable> values, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Stack"); opBuilder.addInputList(Operands.asOutputs(values)); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.axis != null) { @@ -92,34 +94,84 @@ public static Stack create(Scope scope, Iterable } } } - return new Stack(opBuilder.build()); + return new Stack<>(opBuilder.build()); } - + /** + * Sets the axis option. + * * @param axis Dimension along which to pack. Negative values wrap around, so the - * valid range is `[-(R+1), R+1)`. + * valid range is {@code [-(R+1), R+1)}. + * @return this Options instance. */ public static Options axis(Long axis) { return new Options().axis(axis); } - + /** + * Gets output. * The packed tensor. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.Stack} + */ + public static class Options { + private Long axis; + + private Options() { + } + + /** + * Sets the axis option. + * + * @param axis Dimension along which to pack. Negative values wrap around, so the + * valid range is {@code [-(R+1), R+1)}. + * @return this Options instance. + */ + public Options axis(Long axis) { + this.axis = axis; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Stack.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Must be of same shape and type. + */ + public final Iterable> values; + + /** + * The T attribute + */ + public final DataType T; + + /** + * Dimension along which to pack. Negative values wrap around, so the + * valid range is {@code [-(R+1), R+1)}. + */ + public final long axis; + + public Inputs(GraphOperation op) { + super(new Stack<>(op), op, Arrays.asList("T", "axis")); + int inputIndex = 0; + int valuesLength = op.inputListLength("values"); + values = Arrays.asList((Operand[]) op.inputList(inputIndex, valuesLength)); + inputIndex += valuesLength; + T = op.attributes().getAttrType("T"); + axis = op.attributes().getAttrInt("axis"); + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StackClose.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StackClose.java new file mode 100644 index 00000000000..810fb716a34 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StackClose.java @@ -0,0 +1,83 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.family.TType; + +/** + * Delete the stack from its resource container. + */ +@OpMetadata( + opType = StackClose.OP_NAME, + inputsClass = StackClose.Inputs.class +) +@Operator +public final class StackClose extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "StackCloseV2"; + + public StackClose(Operation operation) { + super(operation, OP_NAME); + } + + /** + * Factory method to create a class wrapping a new StackCloseV2 operation. + * + * @param scope current scope + * @param handle The handle to a stack. + * @return a new instance of StackClose + */ + @Endpoint( + describeByClass = true + ) + public static StackClose create(Scope scope, Operand handle) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "StackClose"); + opBuilder.addInput(handle.asOutput()); + return new StackClose(opBuilder.build()); + } + + @OpInputsMetadata( + outputsClass = StackClose.class + ) + public static class Inputs extends RawOpInputs { + /** + * The handle to a stack. + */ + public final Operand handle; + + public Inputs(GraphOperation op) { + super(new StackClose(op), op, Arrays.asList()); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StackCreate.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StackCreate.java new file mode 100644 index 00000000000..173c63d4c1e --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StackCreate.java @@ -0,0 +1,167 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +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.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TType; + +/** + * A stack that produces elements in first-in last-out order. + */ +@OpMetadata( + opType = StackCreate.OP_NAME, + inputsClass = StackCreate.Inputs.class +) +@Operator +public final class StackCreate extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "StackV2"; + + private Output handle; + + @SuppressWarnings("unchecked") + public StackCreate(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new StackV2 operation. + * + * @param scope current scope + * @param maxSize The maximum size of the stack if non-negative. If negative, the stack + * size is unlimited. + * @param elemType The type of the elements on the stack. + * @param options carries optional attribute values + * @param data type for {@code StackV2} output and operands + * @return a new instance of StackCreate + */ + @Endpoint( + describeByClass = true + ) + public static StackCreate create(Scope scope, Operand maxSize, + Class elemType, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "StackCreate"); + opBuilder.addInput(maxSize.asOutput()); + opBuilder.setAttr("elem_type", Operands.toDataType(elemType)); + if (options != null) { + for (Options opts : options) { + if (opts.stackName != null) { + opBuilder.setAttr("stack_name", opts.stackName); + } + } + } + return new StackCreate(opBuilder.build()); + } + + /** + * Sets the stackName option. + * + * @param stackName Overrides the name used for the temporary stack resource. Default + * value is the name of the 'Stack' op (which is guaranteed unique). + * @return this Options instance. + */ + public static Options stackName(String stackName) { + return new Options().stackName(stackName); + } + + /** + * Gets handle. + * The handle to the stack. + * @return handle. + */ + public Output handle() { + return handle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) handle; + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.StackCreate} + */ + public static class Options { + private String stackName; + + private Options() { + } + + /** + * Sets the stackName option. + * + * @param stackName Overrides the name used for the temporary stack resource. Default + * value is the name of the 'Stack' op (which is guaranteed unique). + * @return this Options instance. + */ + public Options stackName(String stackName) { + this.stackName = stackName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = StackCreate.class + ) + public static class Inputs extends RawOpInputs { + /** + * The maximum size of the stack if non-negative. If negative, the stack + * size is unlimited. + */ + public final Operand maxSize; + + /** + * The type of the elements on the stack. + */ + public final DataType elemType; + + /** + * Overrides the name used for the temporary stack resource. Default + * value is the name of the 'Stack' op (which is guaranteed unique). + */ + public final String stackName; + + public Inputs(GraphOperation op) { + super(new StackCreate(op), op, Arrays.asList("elem_type", "stack_name")); + int inputIndex = 0; + maxSize = (Operand) op.input(inputIndex++); + elemType = op.attributes().getAttrType("elem_type"); + stackName = op.attributes().getAttrString("stack_name"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StackPop.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StackPop.java new file mode 100644 index 00000000000..502cfcc8c06 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StackPop.java @@ -0,0 +1,114 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +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.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * Pop the element at the top of the stack. + */ +@OpMetadata( + opType = StackPop.OP_NAME, + inputsClass = StackPop.Inputs.class +) +@Operator +public final class StackPop extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "StackPopV2"; + + private Output elem; + + public StackPop(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + elem = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new StackPopV2 operation. + * + * @param scope current scope + * @param handle The handle to a stack. + * @param elemType The type of the elem that is popped. + * @param data type for {@code StackPopV2} output and operands + * @return a new instance of StackPop + */ + @Endpoint( + describeByClass = true + ) + public static StackPop create(Scope scope, Operand handle, + Class elemType) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "StackPop"); + opBuilder.addInput(handle.asOutput()); + opBuilder.setAttr("elem_type", Operands.toDataType(elemType)); + return new StackPop<>(opBuilder.build()); + } + + /** + * Gets elem. + * The tensor that is popped from the top of the stack. + * @return elem. + */ + public Output elem() { + return elem; + } + + @Override + public Output asOutput() { + return elem; + } + + @OpInputsMetadata( + outputsClass = StackPop.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The handle to a stack. + */ + public final Operand handle; + + /** + * The type of the elem that is popped. + */ + public final DataType elemType; + + public Inputs(GraphOperation op) { + super(new StackPop<>(op), op, Arrays.asList("elem_type")); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + elemType = op.attributes().getAttrType("elem_type"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StackPush.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StackPush.java new file mode 100644 index 00000000000..f9f05ff1912 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StackPush.java @@ -0,0 +1,164 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * Push an element onto the stack. + */ +@OpMetadata( + opType = StackPush.OP_NAME, + inputsClass = StackPush.Inputs.class +) +@Operator +public final class StackPush extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "StackPushV2"; + + private Output output; + + public StackPush(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new StackPushV2 operation. + * + * @param scope current scope + * @param handle The handle to a stack. + * @param elem The tensor to be pushed onto the stack. + * @param options carries optional attribute values + * @param data type for {@code StackPushV2} output and operands + * @return a new instance of StackPush + */ + @Endpoint( + describeByClass = true + ) + public static StackPush create(Scope scope, Operand handle, + Operand elem, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "StackPush"); + opBuilder.addInput(handle.asOutput()); + opBuilder.addInput(elem.asOutput()); + if (options != null) { + for (Options opts : options) { + if (opts.swapMemory != null) { + opBuilder.setAttr("swap_memory", opts.swapMemory); + } + } + } + return new StackPush<>(opBuilder.build()); + } + + /** + * Sets the swapMemory option. + * + * @param swapMemory Swap {@code elem} to CPU. Default to false. + * @return this Options instance. + */ + public static Options swapMemory(Boolean swapMemory) { + return new Options().swapMemory(swapMemory); + } + + /** + * Gets output. + * The same tensor as the input 'elem'. + * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.StackPush} + */ + public static class Options { + private Boolean swapMemory; + + private Options() { + } + + /** + * Sets the swapMemory option. + * + * @param swapMemory Swap {@code elem} to CPU. Default to false. + * @return this Options instance. + */ + public Options swapMemory(Boolean swapMemory) { + this.swapMemory = swapMemory; + return this; + } + } + + @OpInputsMetadata( + outputsClass = StackPush.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The handle to a stack. + */ + public final Operand handle; + + /** + * The tensor to be pushed onto the stack. + */ + public final Operand elem; + + /** + * The T attribute + */ + public final DataType T; + + /** + * Swap {@code elem} to CPU. Default to false. + */ + public final boolean swapMemory; + + public Inputs(GraphOperation op) { + super(new StackPush<>(op), op, Arrays.asList("T", "swap_memory")); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + elem = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + swapMemory = op.attributes().getAttrBool("swap_memory"); + } + } +} 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 index 2ba4cffb377..11adc169e0d 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,85 +17,56 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; 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.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; /** * 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. */ +@OpMetadata( + opType = Stage.OP_NAME, + inputsClass = Stage.Inputs.class +) @Operator -public final class Stage extends PrimitiveOp { - +public final class Stage extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.Stage} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Stage"; + + public Stage(Operation operation) { + super(operation, OP_NAME); } - + /** * 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 + * @param options carries optional attribute values * @return a new instance of Stage */ + @Endpoint( + describeByClass = true + ) public static Stage create(Scope scope, Iterable> values, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("Stage", scope.makeOpName("Stage")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Stage"); opBuilder.addInputList(Operands.asOutputs(values)); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.capacity != null) { @@ -114,40 +85,162 @@ public static Stage create(Scope scope, Iterable> values, Options... } return new Stage(opBuilder.build()); } - + /** - * @param capacity Maximum number of elements in the Staging Area. If > 0, inserts + * Sets the capacity option. + * + * @param capacity Maximum number of elements in the Staging Area. If > 0, inserts * on the container will block when the capacity is reached. + * @return this Options instance. */ public static Options capacity(Long capacity) { return new Options().capacity(capacity); } - + /** + * Sets the memoryLimit option. + * * @param memoryLimit The maximum number of bytes allowed for Tensors in the Staging Area. - * If > 0, inserts will block until sufficient space is available. + * If > 0, inserts will block until sufficient space is available. + * @return this Options instance. */ public static Options memoryLimit(Long memoryLimit) { return new Options().memoryLimit(memoryLimit); } - + /** + * Sets the container option. + * * @param container If non-empty, this queue is placed in the given container. Otherwise, * a default container is used. + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** + * Sets the sharedName option. + * * @param sharedName It is necessary to match this name to the matching Unstage Op. + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - - - private Stage(Operation operation) { - super(operation); + + /** + * Optional attributes for {@link org.tensorflow.op.core.Stage} + */ + public static class Options { + private Long capacity; + + private Long memoryLimit; + + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the capacity option. + * + * @param capacity Maximum number of elements in the Staging Area. If > 0, inserts + * on the container will block when the capacity is reached. + * @return this Options instance. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Sets the memoryLimit option. + * + * @param memoryLimit The maximum number of bytes allowed for Tensors in the Staging Area. + * If > 0, inserts will block until sufficient space is available. + * @return this Options instance. + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * Sets the container option. + * + * @param container If non-empty, this queue is placed in the given container. Otherwise, + * a default container is used. + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName It is necessary to match this name to the matching Unstage Op. + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Stage.class + ) + public static class Inputs extends RawOpInputs { + /** + * a list of tensors + * dtypes A list of data types that inserted values should adhere to. + */ + public final Iterable> values; + + /** + * Maximum number of elements in the Staging Area. If > 0, inserts + * on the container will block when the capacity is reached. + */ + public final long capacity; + + /** + * The maximum number of bytes allowed for Tensors in the Staging Area. + * If > 0, inserts will block until sufficient space is available. + */ + public final long memoryLimit; + + /** + * The dtypes attribute + */ + public final DataType[] dtypes; + + /** + * If non-empty, this queue is placed in the given container. Otherwise, + * a default container is used. + */ + public final String container; + + /** + * It is necessary to match this name to the matching Unstage Op. + */ + public final String sharedName; + + public Inputs(GraphOperation op) { + super(new Stage(op), op, Arrays.asList("capacity", "memory_limit", "dtypes", "container", "shared_name")); + int inputIndex = 0; + int valuesLength = op.inputListLength("values"); + values = Arrays.asList((Operand[]) op.inputList(inputIndex, valuesLength)); + inputIndex += valuesLength; + capacity = op.attributes().getAttrInt("capacity"); + memoryLimit = op.attributes().getAttrInt("memory_limit"); + dtypes = op.attributes().getAttrTypeList("dtypes"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + } } } 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 index 9fcebb07647..e72a7a7100d 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,82 +17,55 @@ package org.tensorflow.op.core; +import java.util.Arrays; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.GraphOperation; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; /** * Op removes all elements in the underlying container. */ +@OpMetadata( + opType = StageClear.OP_NAME, + inputsClass = StageClear.Inputs.class +) @Operator -public final class StageClear extends PrimitiveOp { - +public final class StageClear extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.StageClear} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "StageClear"; + + public StageClear(Operation operation) { + super(operation, OP_NAME); } - + /** * Factory method to create a class wrapping a new StageClear operation. - * + * * @param scope current scope - * @param dtypes - * @param options carries optional attributes values + * @param dtypes The value of the dtypes attribute + * @param options carries optional attribute 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] = dtypes.get(i); - } - opBuilder.setAttr("dtypes", dtypesArray); + @Endpoint( + describeByClass = true + ) + public static StageClear create(Scope scope, List> dtypes, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "StageClear"); + opBuilder.setAttr("dtypes", Operands.toDataTypes(dtypes)); if (options != null) { for (Options opts : options) { if (opts.capacity != null) { @@ -111,37 +84,144 @@ public static StageClear create(Scope scope, List> dtypes, Options.. } return new StageClear(opBuilder.build()); } - + /** - * @param capacity + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. */ public static Options capacity(Long capacity) { return new Options().capacity(capacity); } - + /** - * @param memoryLimit + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. */ public static Options memoryLimit(Long memoryLimit) { return new Options().memoryLimit(memoryLimit); } - + /** - * @param container + * Sets the container option. + * + * @param container the container option + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** - * @param sharedName + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - - - private StageClear(Operation operation) { - super(operation); + + /** + * Optional attributes for {@link org.tensorflow.op.core.StageClear} + */ + public static class Options { + private Long capacity; + + private Long memoryLimit; + + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * Sets the container option. + * + * @param container the container option + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = StageClear.class + ) + public static class Inputs extends RawOpInputs { + /** + * The capacity attribute + */ + public final long capacity; + + /** + * The memoryLimit attribute + */ + public final long memoryLimit; + + /** + * The dtypes attribute + */ + public final DataType[] dtypes; + + /** + * The container attribute + */ + public final String container; + + /** + * The sharedName attribute + */ + public final String sharedName; + + public Inputs(GraphOperation op) { + super(new StageClear(op), op, Arrays.asList("capacity", "memory_limit", "dtypes", "container", "shared_name")); + int inputIndex = 0; + capacity = op.attributes().getAttrInt("capacity"); + memoryLimit = op.attributes().getAttrInt("memory_limit"); + dtypes = op.attributes().getAttrTypeList("dtypes"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + } } } 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 index 50f82773b71..203c44f5cd2 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,91 +20,68 @@ import java.util.Arrays; import java.util.Iterator; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** * 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. */ +@OpMetadata( + opType = StagePeek.OP_NAME, + inputsClass = StagePeek.Inputs.class +) @Operator -public final class StagePeek extends PrimitiveOp implements Iterable> { - +public final class StagePeek extends RawOp implements Iterable> { /** - * Optional attributes for {@link org.tensorflow.op.core.StagePeek} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "StagePeek"; + + private List> values; + + @SuppressWarnings("unchecked") + public StagePeek(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int valuesLength = operation.outputListLength("values"); + values = Arrays.asList(operation.outputList(outputIdx, valuesLength)); + outputIdx += valuesLength; } - + /** * 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 + * @param index The index value + * @param dtypes The value of the dtypes attribute + * @param options carries optional attribute 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")); + @Endpoint( + describeByClass = true + ) + public static StagePeek create(Scope scope, Operand index, + List> dtypes, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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] = dtypes.get(i); - } - opBuilder.setAttr("dtypes", dtypesArray); + opBuilder.setAttr("dtypes", Operands.toDataTypes(dtypes)); if (options != null) { for (Options opts : options) { if (opts.capacity != null) { @@ -123,54 +100,165 @@ public static StagePeek create(Scope scope, Operand index, 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; + + /** + * Optional attributes for {@link org.tensorflow.op.core.StagePeek} + */ + public static class Options { + private Long capacity; + + private Long memoryLimit; + + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * Sets the container option. + * + * @param container the container option + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = StagePeek.class + ) + public static class Inputs extends RawOpInputs { + /** + * The index input + */ + public final Operand index; + + /** + * The capacity attribute + */ + public final long capacity; + + /** + * The memoryLimit attribute + */ + public final long memoryLimit; + + /** + * The dtypes attribute + */ + public final DataType[] dtypes; + + /** + * The container attribute + */ + public final String container; + + /** + * The sharedName attribute + */ + public final String sharedName; + + public Inputs(GraphOperation op) { + super(new StagePeek(op), op, Arrays.asList("capacity", "memory_limit", "dtypes", "container", "shared_name")); + int inputIndex = 0; + index = (Operand) op.input(inputIndex++); + capacity = op.attributes().getAttrInt("capacity"); + memoryLimit = op.attributes().getAttrInt("memory_limit"); + dtypes = op.attributes().getAttrTypeList("dtypes"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + } } } 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 index c2998294caa..53e2e2edead 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,85 +17,62 @@ package org.tensorflow.op.core; +import java.util.Arrays; import java.util.List; -import org.tensorflow.DataType; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TType; /** * Op returns the number of elements in the underlying container. */ +@OpMetadata( + opType = StageSize.OP_NAME, + inputsClass = StageSize.Inputs.class +) @Operator -public final class StageSize extends PrimitiveOp implements Operand { - +public final class StageSize extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.StageSize} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "StageSize"; + + private Output output; + + public StageSize(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * Factory method to create a class wrapping a new StageSize operation. - * + * * @param scope current scope - * @param dtypes - * @param options carries optional attributes values + * @param dtypes The value of the dtypes attribute + * @param options carries optional attribute 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] = dtypes.get(i); - } - opBuilder.setAttr("dtypes", dtypesArray); + @Endpoint( + describeByClass = true + ) + public static StageSize create(Scope scope, List> dtypes, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "StageSize"); + opBuilder.setAttr("dtypes", Operands.toDataTypes(dtypes)); if (options != null) { for (Options opts : options) { if (opts.capacity != null) { @@ -114,51 +91,158 @@ public static StageSize create(Scope scope, List> dtypes, Options... } return new StageSize(opBuilder.build()); } - + /** - * @param capacity + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. */ public static Options capacity(Long capacity) { return new Options().capacity(capacity); } - + /** - * @param memoryLimit + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. */ public static Options memoryLimit(Long memoryLimit) { return new Options().memoryLimit(memoryLimit); } - + /** - * @param container + * Sets the container option. + * + * @param container the container option + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** - * @param sharedName + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - + /** + * Gets output. + * + * @return output. */ - public Output size() { - return size; + public Output output() { + return output; } - + @Override public Output asOutput() { - return size; + return output; } - - private Output size; - - private StageSize(Operation operation) { - super(operation); - int outputIdx = 0; - size = operation.output(outputIdx++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.StageSize} + */ + public static class Options { + private Long capacity; + + private Long memoryLimit; + + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the capacity option. + * + * @param capacity the capacity option + * @return this Options instance. + */ + public Options capacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Sets the memoryLimit option. + * + * @param memoryLimit the memoryLimit option + * @return this Options instance. + */ + public Options memoryLimit(Long memoryLimit) { + this.memoryLimit = memoryLimit; + return this; + } + + /** + * Sets the container option. + * + * @param container the container option + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = StageSize.class + ) + public static class Inputs extends RawOpInputs { + /** + * The capacity attribute + */ + public final long capacity; + + /** + * The memoryLimit attribute + */ + public final long memoryLimit; + + /** + * The dtypes attribute + */ + public final DataType[] dtypes; + + /** + * The container attribute + */ + public final String container; + + /** + * The sharedName attribute + */ + public final String sharedName; + + public Inputs(GraphOperation op) { + super(new StageSize(op), op, Arrays.asList("capacity", "memory_limit", "dtypes", "container", "shared_name")); + int inputIndex = 0; + capacity = op.attributes().getAttrInt("capacity"); + memoryLimit = op.attributes().getAttrInt("memory_limit"); + dtypes = op.attributes().getAttrTypeList("dtypes"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulCase.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulCase.java new file mode 100644 index 00000000000..97e4aa05449 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulCase.java @@ -0,0 +1,185 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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.ConcreteFunction; +import org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TType; + +/** + * An n-way switch statement which calls a single branch function. + *

+ * An n-way switch statement, implementing the following:
+ * ```
+ * switch (branch_index) {
+ *   case 0:
+ *     output = branches[0](input);
+ *     break;
+ *   case 1:
+ *     output = branches[1](input);
+ *     break;
+ *   ...
+ *   case [[nbranches-1]]:
+ *   default:
+ *     output = branches[nbranches-1](input);
+ *     break;
+ * }
+ * ```
+ * 
+ */ +@OpMetadata( + opType = StatefulCase.OP_NAME, + inputsClass = StatefulCase.Inputs.class +) +@Operator +public final class StatefulCase extends RawOp implements Case { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Case"; + + private List> output; + + @SuppressWarnings("unchecked") + public StatefulCase(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int outputLength = operation.outputListLength("output"); + output = Arrays.asList(operation.outputList(outputIdx, outputLength)); + outputIdx += outputLength; + } + + /** + * Factory method to create a class wrapping a new Case operation. + * + * @param scope current scope + * @param branchIndex The branch selector, an int32 Tensor. + * @param input A list of input tensors passed to the branch function. + * @param Tout A list of output types. + * @param branches
+   *   A list of functions each of which takes 'inputs' and returns a list of
+   *   tensors, whose types are the same as what every other branch returns.
+   * 
+ * @param options carries optional attribute values + * @return a new instance of StatefulCase + */ + @Endpoint( + describeByClass = true + ) + public static StatefulCase create(Scope scope, Operand branchIndex, + Iterable> input, List> Tout, + List branches, Case.Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "StatefulCase"); + opBuilder.addInput(branchIndex.asOutput()); + opBuilder.addInputList(Operands.asOutputs(input)); + opBuilder.setAttr("Tout", Operands.toDataTypes(Tout)); + ConcreteFunction[] branchesArray = new ConcreteFunction[branches.size()]; + for (int i = 0 ; i < branchesArray.length ; i++) { + branchesArray[i] = branches.get(i); + } + opBuilder.setAttr("branches", branchesArray); + if (options != null) { + for (Case.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 StatefulCase(opBuilder.build()); + } + + /** + * Gets output. + * A list of return values. + * @return output. + */ + @Override + public List> output() { + return output; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) output.iterator(); + } + + @OpInputsMetadata( + outputsClass = StatefulCase.class + ) + public static class Inputs extends RawOpInputs { + /** + * The branch selector, an int32 Tensor. + */ + public final Operand branchIndex; + + /** + * A list of input tensors passed to the branch function. + */ + public final Iterable> input; + + /** + * A list of input types. + */ + public final DataType[] Tin; + + /** + * A list of output types. + */ + public final DataType[] Tout; + + /** + * The outputShapes attribute + */ + public final Shape[] outputShapes; + + public Inputs(GraphOperation op) { + super(new StatefulCase(op), op, Arrays.asList("Tin", "Tout", "output_shapes")); + int inputIndex = 0; + branchIndex = (Operand) op.input(inputIndex++); + int inputLength = op.inputListLength("input"); + input = Arrays.asList((Operand[]) op.inputList(inputIndex, inputLength)); + inputIndex += inputLength; + Tin = op.attributes().getAttrTypeList("Tin"); + Tout = op.attributes().getAttrTypeList("Tout"); + outputShapes = op.attributes().getAttrShapeList("output_shapes"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulIf.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulIf.java new file mode 100644 index 00000000000..b920fe2da46 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulIf.java @@ -0,0 +1,187 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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.ConcreteFunction; +import org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * output = cond ? then_branch(input) : else_branch(input) + */ +@OpMetadata( + opType = StatefulIf.OP_NAME, + inputsClass = StatefulIf.Inputs.class +) +@Operator +public final class StatefulIf extends RawOp implements If { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "If"; + + private List> output; + + @SuppressWarnings("unchecked") + public StatefulIf(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int outputLength = operation.outputListLength("output"); + output = Arrays.asList(operation.outputList(outputIdx, outputLength)); + outputIdx += outputLength; + } + + /** + * Factory method to create a class wrapping a new If operation. + * + * @param scope current scope + * @param cond
+   *   A Tensor. If the tensor is a scalar of non-boolean type, the
+   *   scalar is converted to a boolean according to the
+   *   following rule: if the scalar is a numerical value, non-zero means
+   *   `True` and zero means False; if the scalar is a string, non-empty
+   *   means `True` and empty means `False`. If the tensor is not a scalar,
+   *   being empty means False and being non-empty means True.
+   * 
+ * @param input A list of input tensors. + * @param Tout A list of output types. + * @param thenBranch
+   *   A function that takes 'inputs' and returns a list of tensors, whose
+   *   types are the same as what else_branch returns.
+   * 
+ * @param elseBranch
+   * A function that takes 'inputs' and returns a list of tensors, whose
+   * types are the same as what then_branch returns.
+   * 
+ * @param options carries optional attribute values + * @return a new instance of StatefulIf + */ + @Endpoint( + describeByClass = true + ) + public static StatefulIf create(Scope scope, Operand cond, + Iterable> input, List> Tout, ConcreteFunction thenBranch, + ConcreteFunction elseBranch, If.Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "StatefulIf"); + opBuilder.addInput(cond.asOutput()); + opBuilder.addInputList(Operands.asOutputs(input)); + opBuilder.setAttr("Tout", Operands.toDataTypes(Tout)); + opBuilder.setAttr("then_branch", thenBranch); + opBuilder.setAttr("else_branch", elseBranch); + if (options != null) { + for (If.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 StatefulIf(opBuilder.build()); + } + + /** + * Gets output. + * A list of return values. + * @return output. + */ + @Override + public List> output() { + return output; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) output.iterator(); + } + + @OpInputsMetadata( + outputsClass = StatefulIf.class + ) + public static class Inputs extends RawOpInputs { + /** + *
+     *   A Tensor. If the tensor is a scalar of non-boolean type, the
+     *   scalar is converted to a boolean according to the
+     *   following rule: if the scalar is a numerical value, non-zero means
+     *   `True` and zero means False; if the scalar is a string, non-empty
+     *   means `True` and empty means `False`. If the tensor is not a scalar,
+     *   being empty means False and being non-empty means True.
+     * 
+ */ + public final Operand cond; + + /** + * A list of input tensors. + */ + public final Iterable> input; + + /** + * The Tcond attribute + */ + public final DataType Tcond; + + /** + * A list of input types. + */ + public final DataType[] Tin; + + /** + * A list of output types. + */ + public final DataType[] Tout; + + /** + * The outputShapes attribute + */ + public final Shape[] outputShapes; + + public Inputs(GraphOperation op) { + super(new StatefulIf(op), op, Arrays.asList("Tcond", "Tin", "Tout", "output_shapes")); + int inputIndex = 0; + cond = (Operand) op.input(inputIndex++); + int inputLength = op.inputListLength("input"); + input = Arrays.asList((Operand[]) op.inputList(inputIndex, inputLength)); + inputIndex += inputLength; + Tcond = op.attributes().getAttrType("Tcond"); + Tin = op.attributes().getAttrTypeList("Tin"); + Tout = op.attributes().getAttrTypeList("Tout"); + outputShapes = op.attributes().getAttrShapeList("output_shapes"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulPartitionedCall.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulPartitionedCall.java new file mode 100644 index 00000000000..ca19af055db --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulPartitionedCall.java @@ -0,0 +1,245 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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.ConcreteFunction; +import org.tensorflow.GraphOperation; +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.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * returns {@code f(inputs)}, where {@code f}'s body is placed and partitioned. + */ +@OpMetadata( + opType = StatefulPartitionedCall.OP_NAME, + inputsClass = StatefulPartitionedCall.Inputs.class +) +@Operator +public final class StatefulPartitionedCall extends RawOp implements Iterable> { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "StatefulPartitionedCall"; + + private List> output; + + @SuppressWarnings("unchecked") + public StatefulPartitionedCall(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int outputLength = operation.outputListLength("output"); + output = Arrays.asList(operation.outputList(outputIdx, outputLength)); + outputIdx += outputLength; + } + + /** + * Factory method to create a class wrapping a new StatefulPartitionedCall operation. + * + * @param scope current scope + * @param args A list of input tensors. + * @param Tout A list of output types. + * @param f
+   *   A function that takes 'args', a list of tensors, and returns 'output',
+   *   another list of tensors. Input and output types are specified by 'Tin'
+   *   and 'Tout'. The function body of f will be placed and partitioned across
+   *   devices, setting this op apart from the regular Call op. This op is
+   *   stateful.
+   * 
+ * @param options carries optional attribute values + * @return a new instance of StatefulPartitionedCall + */ + @Endpoint( + describeByClass = true + ) + public static StatefulPartitionedCall create(Scope scope, Iterable> args, + List> Tout, ConcreteFunction f, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "StatefulPartitionedCall"); + opBuilder.addInputList(Operands.asOutputs(args)); + opBuilder.setAttr("Tout", Operands.toDataTypes(Tout)); + opBuilder.setAttr("f", f); + if (options != null) { + for (Options opts : options) { + if (opts.config != null) { + opBuilder.setAttr("config", opts.config); + } + if (opts.configProto != null) { + opBuilder.setAttr("config_proto", opts.configProto); + } + if (opts.executorType != null) { + opBuilder.setAttr("executor_type", opts.executorType); + } + } + } + return new StatefulPartitionedCall(opBuilder.build()); + } + + /** + * Sets the config option. + * + * @param config the config option + * @return this Options instance. + */ + public static Options config(String config) { + return new Options().config(config); + } + + /** + * Sets the configProto option. + * + * @param configProto the configProto option + * @return this Options instance. + */ + public static Options configProto(String configProto) { + return new Options().configProto(configProto); + } + + /** + * Sets the executorType option. + * + * @param executorType the executorType option + * @return this Options instance. + */ + public static Options executorType(String executorType) { + return new Options().executorType(executorType); + } + + /** + * Gets output. + * A list of return values. + * @return output. + */ + public List> output() { + return output; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) output.iterator(); + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.StatefulPartitionedCall} + */ + public static class Options { + private String config; + + private String configProto; + + private String executorType; + + private Options() { + } + + /** + * Sets the config option. + * + * @param config the config option + * @return this Options instance. + */ + public Options config(String config) { + this.config = config; + return this; + } + + /** + * Sets the configProto option. + * + * @param configProto the configProto option + * @return this Options instance. + */ + public Options configProto(String configProto) { + this.configProto = configProto; + return this; + } + + /** + * Sets the executorType option. + * + * @param executorType the executorType option + * @return this Options instance. + */ + public Options executorType(String executorType) { + this.executorType = executorType; + return this; + } + } + + @OpInputsMetadata( + outputsClass = StatefulPartitionedCall.class + ) + public static class Inputs extends RawOpInputs { + /** + * A list of input tensors. + */ + public final Iterable> args; + + /** + * A list of input types. + */ + public final DataType[] Tin; + + /** + * A list of output types. + */ + public final DataType[] Tout; + + /** + * The config attribute + */ + public final String config; + + /** + * The configProto attribute + */ + public final String configProto; + + /** + * The executorType attribute + */ + public final String executorType; + + public Inputs(GraphOperation op) { + super(new StatefulPartitionedCall(op), op, Arrays.asList("Tin", "Tout", "config", "config_proto", "executor_type")); + int inputIndex = 0; + int argsLength = op.inputListLength("args"); + args = Arrays.asList((Operand[]) op.inputList(inputIndex, argsLength)); + inputIndex += argsLength; + Tin = op.attributes().getAttrTypeList("Tin"); + Tout = op.attributes().getAttrTypeList("Tout"); + config = op.attributes().getAttrString("config"); + configProto = op.attributes().getAttrString("config_proto"); + executorType = op.attributes().getAttrString("executor_type"); + } + } +} 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 deleted file mode 100644 index 44d4001f707..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulRandomBinomial.java +++ /dev/null @@ -1,95 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * @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, DataType 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", 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, TInt64.DTYPE); - } - - /** - */ - 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 deleted file mode 100644 index 8911b7d8914..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulStandardNormal.java +++ /dev/null @@ -1,90 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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; -import org.tensorflow.types.TFloat; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType 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", 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, TFloat.DTYPE); - } - - /** - * 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 deleted file mode 100644 index 3464ecc2aac..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulStandardNormalV2.java +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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; -import org.tensorflow.types.TFloat; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType 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", 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, TFloat.DTYPE); - } - - /** - * 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 deleted file mode 100644 index 665216f421f..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulTruncatedNormal.java +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType 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", 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, TFloat.DTYPE); - } - - /** - * 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 deleted file mode 100644 index 60c4afff561..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulUniform.java +++ /dev/null @@ -1,93 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TFloat; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType 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", 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, TFloat.DTYPE); - } - - /** - * 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 deleted file mode 100644 index f5e5273182b..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulUniformFullInt.java +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType 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", 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 deleted file mode 100644 index 8027129575d..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulUniformInt.java +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt64; -import org.tensorflow.types.family.TType; - -/** - * 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/StatefulWhile.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulWhile.java new file mode 100644 index 00000000000..afc78346a40 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatefulWhile.java @@ -0,0 +1,165 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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.ConcreteFunction; +import org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * output = input; While (Cond(output)) { output = Body(output) } + */ +@OpMetadata( + opType = StatefulWhile.OP_NAME, + inputsClass = StatefulWhile.Inputs.class +) +@Operator +public final class StatefulWhile extends RawOp implements While { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "While"; + + private List> output; + + @SuppressWarnings("unchecked") + public StatefulWhile(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int outputLength = operation.outputListLength("output"); + output = Arrays.asList(operation.outputList(outputIdx, outputLength)); + outputIdx += outputLength; + } + + /** + * Factory method to create a class wrapping a new While operation. + * + * @param scope current scope + * @param input A list of input tensors whose types are T. + * @param cond

+   *   A function takes 'input' and returns a tensor.  If the tensor is
+   *   a scalar of non-boolean, the scalar is converted to a boolean
+   *   according to the following rule: if the scalar is a numerical
+   *   value, non-zero means True and zero means False; if the scalar is
+   *   a string, non-empty means True and empty means False. If the
+   *   tensor is not a scalar, non-emptiness means True and False
+   *   otherwise.
+   * 
+ * @param body
+   *   A function that takes a list of tensors and returns another
+   *   list of tensors. Both lists have the same types as specified
+   *   by T.
+   * 
+ * @param options carries optional attribute values + * @return a new instance of StatefulWhile + */ + @Endpoint( + describeByClass = true + ) + public static StatefulWhile create(Scope scope, Iterable> input, ConcreteFunction cond, + ConcreteFunction body, While.Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "StatefulWhile"); + opBuilder.addInputList(Operands.asOutputs(input)); + opBuilder.setAttr("cond", cond); + opBuilder.setAttr("body", body); + if (options != null) { + for (While.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); + } + if (opts.parallelIterations != null) { + opBuilder.setAttr("parallel_iterations", opts.parallelIterations); + } + } + } + return new StatefulWhile(opBuilder.build()); + } + + /** + * Gets output. + * A list of output tensors whose types are T. + * @return output. + */ + @Override + public List> output() { + return output; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) output.iterator(); + } + + @OpInputsMetadata( + outputsClass = StatefulWhile.class + ) + public static class Inputs extends RawOpInputs { + /** + * A list of input tensors whose types are T. + */ + public final Iterable> input; + + /** + * dtype in use. + */ + public final DataType[] T; + + /** + * The outputShapes attribute + */ + public final Shape[] outputShapes; + + /** + * The parallelIterations attribute + */ + public final long parallelIterations; + + public Inputs(GraphOperation op) { + super(new StatefulWhile(op), op, Arrays.asList("T", "output_shapes", "parallel_iterations")); + int inputIndex = 0; + int inputLength = op.inputListLength("input"); + input = Arrays.asList((Operand[]) op.inputList(inputIndex, inputLength)); + inputIndex += inputLength; + T = op.attributes().getAttrTypeList("T"); + outputShapes = op.attributes().getAttrShapeList("output_shapes"); + parallelIterations = op.attributes().getAttrInt("parallel_iterations"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatelessCase.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatelessCase.java new file mode 100644 index 00000000000..915d6908936 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatelessCase.java @@ -0,0 +1,187 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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.ConcreteFunction; +import org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TType; + +/** + * An n-way switch statement which calls a single branch function. + *
+ * An n-way switch statement, implementing the following:
+ * ```
+ * switch (branch_index) {
+ *   case 0:
+ *     output = branches[0](input);
+ *     break;
+ *   case 1:
+ *     output = branches[1](input);
+ *     break;
+ *   ...
+ *   case [[nbranches-1]]:
+ *   default:
+ *     output = branches[nbranches-1](input);
+ *     break;
+ * }
+ * ```
+ *
+ * This should only be used when the none of branches has stateful ops.
+ * 
+ */ +@OpMetadata( + opType = StatelessCase.OP_NAME, + inputsClass = StatelessCase.Inputs.class +) +@Operator +public final class StatelessCase extends RawOp implements Case { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "StatelessCase"; + + private List> output; + + @SuppressWarnings("unchecked") + public StatelessCase(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int outputLength = operation.outputListLength("output"); + output = Arrays.asList(operation.outputList(outputIdx, outputLength)); + outputIdx += outputLength; + } + + /** + * Factory method to create a class wrapping a new StatelessCase operation. + * + * @param scope current scope + * @param branchIndex The branch selector, an int32 Tensor. + * @param input A list of input tensors passed to the branch function. + * @param Tout A list of output types. + * @param branches
+   *   A list of functions each of which takes 'inputs' and returns a list of
+   *   tensors, whose types are the same as what every other branch returns.
+   * 
+ * @param options carries optional attribute values + * @return a new instance of StatelessCase + */ + @Endpoint( + describeByClass = true + ) + public static StatelessCase create(Scope scope, Operand branchIndex, + Iterable> input, List> Tout, + List branches, Case.Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "StatelessCase"); + opBuilder.addInput(branchIndex.asOutput()); + opBuilder.addInputList(Operands.asOutputs(input)); + opBuilder.setAttr("Tout", Operands.toDataTypes(Tout)); + ConcreteFunction[] branchesArray = new ConcreteFunction[branches.size()]; + for (int i = 0 ; i < branchesArray.length ; i++) { + branchesArray[i] = branches.get(i); + } + opBuilder.setAttr("branches", branchesArray); + if (options != null) { + for (Case.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 StatelessCase(opBuilder.build()); + } + + /** + * Gets output. + * A list of return values. + * @return output. + */ + @Override + public List> output() { + return output; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) output.iterator(); + } + + @OpInputsMetadata( + outputsClass = StatelessCase.class + ) + public static class Inputs extends RawOpInputs { + /** + * The branch selector, an int32 Tensor. + */ + public final Operand branchIndex; + + /** + * A list of input tensors passed to the branch function. + */ + public final Iterable> input; + + /** + * A list of input types. + */ + public final DataType[] Tin; + + /** + * A list of output types. + */ + public final DataType[] Tout; + + /** + * The outputShapes attribute + */ + public final Shape[] outputShapes; + + public Inputs(GraphOperation op) { + super(new StatelessCase(op), op, Arrays.asList("Tin", "Tout", "output_shapes")); + int inputIndex = 0; + branchIndex = (Operand) op.input(inputIndex++); + int inputLength = op.inputListLength("input"); + input = Arrays.asList((Operand[]) op.inputList(inputIndex, inputLength)); + inputIndex += inputLength; + Tin = op.attributes().getAttrTypeList("Tin"); + Tout = op.attributes().getAttrTypeList("Tout"); + outputShapes = op.attributes().getAttrShapeList("output_shapes"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatelessIf.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatelessIf.java new file mode 100644 index 00000000000..898516ff813 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatelessIf.java @@ -0,0 +1,193 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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.ConcreteFunction; +import org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * output = cond ? then_branch(input) : else_branch(input) + */ +@OpMetadata( + opType = StatelessIf.OP_NAME, + inputsClass = StatelessIf.Inputs.class +) +@Operator +public final class StatelessIf extends RawOp implements If { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "StatelessIf"; + + private List> output; + + @SuppressWarnings("unchecked") + public StatelessIf(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int outputLength = operation.outputListLength("output"); + output = Arrays.asList(operation.outputList(outputIdx, outputLength)); + outputIdx += outputLength; + } + + /** + * Factory method to create a class wrapping a new StatelessIf operation. + * + * @param scope current scope + * @param cond
+   *   A Tensor. If the tensor is a scalar of non-boolean type, the
+   *   scalar is converted to a boolean according to the
+   *   following rule: if the scalar is a numerical value, non-zero means
+   *   `True` and zero means False; if the scalar is a string, non-empty
+   *   means `True` and empty means `False`. If the tensor is not a scalar,
+   *   being empty means False and being non-empty means True.
+   *
+   *   This should only be used when the if then/else body functions do not
+   *   have stateful ops.
+   * 
+ * @param input A list of input tensors. + * @param Tout A list of output types. + * @param thenBranch
+   *   A function that takes 'inputs' and returns a list of tensors, whose
+   *   types are the same as what else_branch returns.
+   * 
+ * @param elseBranch
+   * A function that takes 'inputs' and returns a list of tensors, whose
+   * types are the same as what then_branch returns.
+   * 
+ * @param options carries optional attribute values + * @return a new instance of StatelessIf + */ + @Endpoint( + describeByClass = true + ) + public static StatelessIf create(Scope scope, Operand cond, + Iterable> input, List> Tout, ConcreteFunction thenBranch, + ConcreteFunction elseBranch, If.Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "StatelessIf"); + opBuilder.addInput(cond.asOutput()); + opBuilder.addInputList(Operands.asOutputs(input)); + opBuilder.setAttr("Tout", Operands.toDataTypes(Tout)); + opBuilder.setAttr("then_branch", thenBranch); + opBuilder.setAttr("else_branch", elseBranch); + if (options != null) { + for (If.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 StatelessIf(opBuilder.build()); + } + + /** + * Gets output. + * A list of return values. + * @return output. + */ + @Override + public List> output() { + return output; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) output.iterator(); + } + + @OpInputsMetadata( + outputsClass = StatelessIf.class + ) + public static class Inputs extends RawOpInputs { + /** + *
+     *   A Tensor. If the tensor is a scalar of non-boolean type, the
+     *   scalar is converted to a boolean according to the
+     *   following rule: if the scalar is a numerical value, non-zero means
+     *   `True` and zero means False; if the scalar is a string, non-empty
+     *   means `True` and empty means `False`. If the tensor is not a scalar,
+     *   being empty means False and being non-empty means True.
+     *
+     *   This should only be used when the if then/else body functions do not
+     *   have stateful ops.
+     * 
+ */ + public final Operand cond; + + /** + * A list of input tensors. + */ + public final Iterable> input; + + /** + * The Tcond attribute + */ + public final DataType Tcond; + + /** + * A list of input types. + */ + public final DataType[] Tin; + + /** + * A list of output types. + */ + public final DataType[] Tout; + + /** + * The outputShapes attribute + */ + public final Shape[] outputShapes; + + public Inputs(GraphOperation op) { + super(new StatelessIf(op), op, Arrays.asList("Tcond", "Tin", "Tout", "output_shapes")); + int inputIndex = 0; + cond = (Operand) op.input(inputIndex++); + int inputLength = op.inputListLength("input"); + input = Arrays.asList((Operand[]) op.inputList(inputIndex, inputLength)); + inputIndex += inputLength; + Tcond = op.attributes().getAttrType("Tcond"); + Tin = op.attributes().getAttrTypeList("Tin"); + Tout = op.attributes().getAttrTypeList("Tout"); + outputShapes = op.attributes().getAttrShapeList("output_shapes"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatelessWhile.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatelessWhile.java new file mode 100644 index 00000000000..cad5b32e302 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatelessWhile.java @@ -0,0 +1,168 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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.ConcreteFunction; +import org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * output = input; While (Cond(output)) { output = Body(output) } + */ +@OpMetadata( + opType = StatelessWhile.OP_NAME, + inputsClass = StatelessWhile.Inputs.class +) +@Operator +public final class StatelessWhile extends RawOp implements While { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "StatelessWhile"; + + private List> output; + + @SuppressWarnings("unchecked") + public StatelessWhile(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + int outputLength = operation.outputListLength("output"); + output = Arrays.asList(operation.outputList(outputIdx, outputLength)); + outputIdx += outputLength; + } + + /** + * Factory method to create a class wrapping a new StatelessWhile operation. + * + * @param scope current scope + * @param input A list of input tensors whose types are T. + * @param cond
+   *   A function takes 'input' and returns a tensor.  If the tensor is
+   *   a scalar of non-boolean, the scalar is converted to a boolean
+   *   according to the following rule: if the scalar is a numerical
+   *   value, non-zero means True and zero means False; if the scalar is
+   *   a string, non-empty means True and empty means False. If the
+   *   tensor is not a scalar, non-emptiness means True and False
+   *   otherwise.
+   *
+   *   This should only be used when the while condition and body functions
+   *   do not have stateful ops.
+   * 
+ * @param body
+   *   A function that takes a list of tensors and returns another
+   *   list of tensors. Both lists have the same types as specified
+   *   by T.
+   * 
+ * @param options carries optional attribute values + * @return a new instance of StatelessWhile + */ + @Endpoint( + describeByClass = true + ) + public static StatelessWhile create(Scope scope, Iterable> input, + ConcreteFunction cond, ConcreteFunction body, While.Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "StatelessWhile"); + opBuilder.addInputList(Operands.asOutputs(input)); + opBuilder.setAttr("cond", cond); + opBuilder.setAttr("body", body); + if (options != null) { + for (While.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); + } + if (opts.parallelIterations != null) { + opBuilder.setAttr("parallel_iterations", opts.parallelIterations); + } + } + } + return new StatelessWhile(opBuilder.build()); + } + + /** + * Gets output. + * A list of output tensors whose types are T. + * @return output. + */ + @Override + public List> output() { + return output; + } + + @Override + @SuppressWarnings({"rawtypes", "unchecked"}) + public Iterator> iterator() { + return (Iterator) output.iterator(); + } + + @OpInputsMetadata( + outputsClass = StatelessWhile.class + ) + public static class Inputs extends RawOpInputs { + /** + * A list of input tensors whose types are T. + */ + public final Iterable> input; + + /** + * dtype in use. + */ + public final DataType[] T; + + /** + * The outputShapes attribute + */ + public final Shape[] outputShapes; + + /** + * The parallelIterations attribute + */ + public final long parallelIterations; + + public Inputs(GraphOperation op) { + super(new StatelessWhile(op), op, Arrays.asList("T", "output_shapes", "parallel_iterations")); + int inputIndex = 0; + int inputLength = op.inputListLength("input"); + input = Arrays.asList((Operand[]) op.inputList(inputIndex, inputLength)); + inputIndex += inputLength; + T = op.attributes().getAttrTypeList("T"); + outputShapes = op.attributes().getAttrShapeList("output_shapes"); + parallelIterations = op.attributes().getAttrInt("parallel_iterations"); + } + } +} 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 deleted file mode 100644 index 4e3af269068..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatsAggregatorHandleV2.java +++ /dev/null @@ -1,116 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TType; - -/** - */ -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 deleted file mode 100644 index 83de21836bf..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StatsAggregatorSetSummaryWriter.java +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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/StochasticCastToInt.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StochasticCastToInt.java new file mode 100644 index 00000000000..a06a2c8017d --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StochasticCastToInt.java @@ -0,0 +1,149 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +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.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TNumber; +import org.tensorflow.types.family.TType; + +/** + * Stochastically cast a given tensor from floats to ints. + * The values are cast with a deterministic pseudo-random tensor from a uniform distribution generated from user given key, counter, algorithm. Values will saturate if out of the specified integer type range, and will become zero if inputs are NaN. + *

The outputs are a deterministic function of {@code input}, {@code key}, {@code counter}, {@code alg}. + */ +@OpMetadata( + opType = StochasticCastToInt.OP_NAME, + inputsClass = StochasticCastToInt.Inputs.class +) +@Operator +public final class StochasticCastToInt extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "StochasticCastToInt"; + + private Output output; + + public StochasticCastToInt(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new StochasticCastToInt operation. + * + * @param scope current scope + * @param input The operand to stochastically cast to int. + * @param key Key for the counter-based RNG algorithm (shape uint64[1]). + * @param counter Initial counter for the counter-based RNG algorithm (shape uint64[2] or uint64[1] depending on the algorithm). If a larger vector is given, only the needed portion on the left (i.e. [:N]) will be used. + * @param alg The RNG algorithm (shape int32[]). + * @param Tout The type of the output. + * @param data type for {@code StochasticCastToInt} output and operands + * @return a new instance of StochasticCastToInt + */ + @Endpoint( + describeByClass = true + ) + public static StochasticCastToInt create(Scope scope, + Operand input, Operand key, + Operand counter, Operand alg, Class Tout) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "StochasticCastToInt"); + opBuilder.addInput(input.asOutput()); + opBuilder.addInput(key.asOutput()); + opBuilder.addInput(counter.asOutput()); + opBuilder.addInput(alg.asOutput()); + opBuilder.setAttr("Tout", Operands.toDataType(Tout)); + return new StochasticCastToInt<>(opBuilder.build()); + } + + /** + * Gets output. + * The cast result with the same shape as the input. + * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + @OpInputsMetadata( + outputsClass = StochasticCastToInt.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The operand to stochastically cast to int. + */ + public final Operand input; + + /** + * Key for the counter-based RNG algorithm (shape uint64[1]). + */ + public final Operand key; + + /** + * Initial counter for the counter-based RNG algorithm (shape uint64[2] or uint64[1] depending on the algorithm). If a larger vector is given, only the needed portion on the left (i.e. [:N]) will be used. + */ + public final Operand counter; + + /** + * The RNG algorithm (shape int32[]). + */ + public final Operand alg; + + /** + * The type of the input. + */ + public final DataType Tin; + + /** + * The type of the output. + */ + public final DataType Tout; + + public Inputs(GraphOperation op) { + super(new StochasticCastToInt<>(op), op, Arrays.asList("Tin", "Tout")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + key = (Operand) op.input(inputIndex++); + counter = (Operand) op.input(inputIndex++); + alg = (Operand) op.input(inputIndex++); + Tin = op.attributes().getAttrType("Tin"); + Tout = op.attributes().getAttrType("Tout"); + } + } +} 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 index a09ab63ec79..fb486c42253 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,78 +17,144 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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 + *

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: + *

This is useful any time you want to compute a value with TensorFlow but need + * to pretend that the value was a constant. For example, the softmax function + * for a vector x can be written as + *

+ *
+ *   def softmax(x):
+ *     numerator = tf.exp(x)
+ *     denominator = tf.reduce_sum(numerator)
+ *     return numerator / denominator
+ * 
+ *

This however is susceptible to overflow if the values in x are large. An + * alternative more stable way is to subtract the maximum of x from each of the + * values. + *

+ *
+ *   def stable_softmax(x):
+ *     z = x - tf.reduce_max(x)
+ *     numerator = tf.exp(z)
+ *     denominator = tf.reduce_sum(numerator)
+ *     return numerator / denominator
+ * 
+ *

However, when we backprop through the softmax to x, we dont want to backprop + * through the {@code tf.reduce_max(x)} (if the max values are not unique then the + * gradient could flow to the wrong input) calculation and treat that as a + * constant. Therefore, we should write this out as + *

+ *
+ *   def stable_softmax(x):
+ *     z = x - tf.stop_gradient(tf.reduce_max(x))
+ *     numerator = tf.exp(z)
+ *     denominator = tf.reduce_sum(numerator)
+ *     return numerator / denominator
+ * 
+ *

Some other 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 + *
  • 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.
  • + *
*/ +@OpMetadata( + opType = StopGradient.OP_NAME, + inputsClass = StopGradient.Inputs.class +) @Operator -public final class StopGradient extends PrimitiveOp implements Operand { - +public final class StopGradient extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "StopGradient"; + + private Output output; + + public StopGradient(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new StopGradient operation. - * + * * @param scope current scope - * @param input + * @param input The input value + * @param data type for {@code StopGradient} output and operands * @return a new instance of StopGradient */ + @Endpoint( + describeByClass = true + ) public static StopGradient create(Scope scope, Operand input) { - OperationBuilder opBuilder = scope.env().opBuilder("StopGradient", scope.makeOpName("StopGradient")); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "StopGradient"); opBuilder.addInput(input.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new StopGradient(opBuilder.build()); + return new StopGradient<>(opBuilder.build()); } - + /** + * Gets output. + * + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = StopGradient.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new StopGradient<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index 15330ccc851..ec55dae1c24 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,208 +17,174 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * 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 + * Return a strided slice from {@code input}. + * Note, most python users will want to use the Python {@code Tensor.__getitem__} + * or {@code 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 {@code n} dimensional {@code input} tensor. The subset is chosen using + * a sequence of {@code 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 + * {@code m} could be equal to {@code 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 + *

    + *
  • + *

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

  • + *
  • + *

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

  • + *
  • + *

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

  • + *
  • + *

    A single index. This is used to keep only elements that have a given + * index. For example ({@code foo[2, :]} on a shape {@code (5,6)} tensor produces a + * shape {@code (6,)} tensor. This is encoded in {@code begin} and {@code end} and + * {@code 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
+ * {@code foo[1, 2:4, None, ..., :-3:-1, :]} will be encoded as
+ * 
  * 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 + * 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 = 1 + *
+ *

In this case if {@code 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 + *

    + *
  1. + *

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

  2. + *
  3. + *

    {@code 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 + *

  4. + *
  5. + *

    None is a synonym for {@code 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 + *

  6. + *
  7. + *

    {@code ...} 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 + *

  8. + *
  9. + *

    {@code :-3:-1} shows the use of negative indices. A negative index {@code i} associated + * with a dimension that has shape {@code s} is converted to a positive index + * {@code s + i}. So {@code -1} becomes {@code 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 + *

  10. + *
  11. + *

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

  12. + *
+ *

Requirements: + * {@code 0 != strides[i] for i in [0, m)} + * {@code ellipsis_mask must be a power of two (only one ellipsis)} */ +@OpMetadata( + opType = StridedSlice.OP_NAME, + inputsClass = StridedSlice.Inputs.class +) @Operator -public final class StridedSlice extends PrimitiveOp implements Operand { - +public final class StridedSlice extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.StridedSlice} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "StridedSlice"; + + private Output output; + + public StridedSlice(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * 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. + * @param input The input value + * @param begin {@code begin[k]} specifies the offset into the {@code 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 + * Out-of-bounds values will be silently clamped. If the {@code k}th bit of + * {@code begin_mask} then {@code 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 + * to start from the highest element e.g. If {@code foo==[1,2,3]} then {@code foo[-1]==3}. + * @param end {@code end[i]} is like {@code begin} with the exception that {@code end_mask} is * used to determine full ranges. - * @param strides `strides[i]` specifies the increment in the `i`th specification + * @param strides {@code strides[i]} specifies the increment in the {@code 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 + * clamped to {@code [0,dim[i]) if slice[i]>0} or {@code [-1,dim[i]-1] if slice[i] < 0} + * @param options carries optional attribute values + * @param data type for {@code StridedSlice} output and operands + * @param data type for {@code StridedSlice} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static StridedSlice create(Scope scope, + Operand input, Operand begin, Operand end, Operand strides, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { @@ -238,75 +204,273 @@ public static StridedSlice create(Scope } } } - return new StridedSlice(opBuilder.build()); + return new StridedSlice<>(opBuilder.build()); } - + /** + * Sets the beginMask option. + * * @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` + * begin[i] will be replaced with {@code [0, n-1)} if {@code stride[i] > 0} or + * {@code [-1, n-1]} if {@code stride[i] < 0} + * @return this Options instance. */ public static Options beginMask(Long beginMask) { return new Options().beginMask(beginMask); } - + /** - * @param endMask analogous to `begin_mask` + * Sets the endMask option. + * + * @param endMask analogous to {@code begin_mask} + * @return this Options instance. */ public static Options endMask(Long endMask) { return new Options().endMask(endMask); } - + /** - * @param ellipsisMask a bitmask where bit `i` being 1 means the `i`th + * Sets the ellipsisMask option. + * + * @param ellipsisMask a bitmask where bit {@code i} being 1 means the {@code 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 + * If {@code ellipsis_mask == 0}, then an implicit ellipsis mask of {@code 1 << (m+1)} + * is provided. This means that {@code 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]`. + * tensor {@code foo} the slice {@code foo[2, ..., 5:8]} implies {@code foo[2, :, :, 5:8]}. + * @return this Options instance. */ public static Options ellipsisMask(Long ellipsisMask) { return new Options().ellipsisMask(ellipsisMask); } - + /** - * @param newAxisMask a bitmask where bit `i` being 1 means the `i`th + * Sets the newAxisMask option. + * + * @param newAxisMask a bitmask where bit {@code i} being 1 means the {@code i}th * specification creates a new shape 1 dimension. For example - * `foo[:4, tf.newaxis, :2]` would produce a shape `(4, 1, 2)` tensor. + * {@code foo[:4, tf.newaxis, :2]} would produce a shape {@code (4, 1, 2)} tensor. + * @return this Options instance. */ public static Options newAxisMask(Long newAxisMask) { return new Options().newAxisMask(newAxisMask); } - + /** - * @param shrinkAxisMask a bitmask where bit `i` implies that the `i`th + * Sets the shrinkAxisMask option. + * + * @param shrinkAxisMask a bitmask where bit {@code i} implies that the {@code 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. + * python one might do {@code foo[:, 3, :]} which would result in + * {@code shrink_axis_mask} being 2. + * @return this Options instance. */ public static Options shrinkAxisMask(Long shrinkAxisMask) { return new Options().shrinkAxisMask(shrinkAxisMask); } - + /** + * Gets output. + * + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.StridedSlice} + */ + public static class Options { + private Long beginMask; + + private Long endMask; + + private Long ellipsisMask; + + private Long newAxisMask; + + private Long shrinkAxisMask; + + private Options() { + } + + /** + * Sets the beginMask option. + * + * @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 {@code [0, n-1)} if {@code stride[i] > 0} or + * {@code [-1, n-1]} if {@code stride[i] < 0} + * @return this Options instance. + */ + public Options beginMask(Long beginMask) { + this.beginMask = beginMask; + return this; + } + + /** + * Sets the endMask option. + * + * @param endMask analogous to {@code begin_mask} + * @return this Options instance. + */ + public Options endMask(Long endMask) { + this.endMask = endMask; + return this; + } + + /** + * Sets the ellipsisMask option. + * + * @param ellipsisMask a bitmask where bit {@code i} being 1 means the {@code i}th + * position is actually an ellipsis. One bit at most can be 1. + * If {@code ellipsis_mask == 0}, then an implicit ellipsis mask of {@code 1 << (m+1)} + * is provided. This means that {@code 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 {@code foo} the slice {@code foo[2, ..., 5:8]} implies {@code foo[2, :, :, 5:8]}. + * @return this Options instance. + */ + public Options ellipsisMask(Long ellipsisMask) { + this.ellipsisMask = ellipsisMask; + return this; + } + + /** + * Sets the newAxisMask option. + * + * @param newAxisMask a bitmask where bit {@code i} being 1 means the {@code i}th + * specification creates a new shape 1 dimension. For example + * {@code foo[:4, tf.newaxis, :2]} would produce a shape {@code (4, 1, 2)} tensor. + * @return this Options instance. + */ + public Options newAxisMask(Long newAxisMask) { + this.newAxisMask = newAxisMask; + return this; + } + + /** + * Sets the shrinkAxisMask option. + * + * @param shrinkAxisMask a bitmask where bit {@code i} implies that the {@code 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 {@code foo[:, 3, :]} which would result in + * {@code shrink_axis_mask} being 2. + * @return this Options instance. + */ + public Options shrinkAxisMask(Long shrinkAxisMask) { + this.shrinkAxisMask = shrinkAxisMask; + return this; + } + } + + @OpInputsMetadata( + outputsClass = StridedSlice.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * {@code begin[k]} specifies the offset into the {@code 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 {@code k}th bit of + * {@code begin_mask} then {@code 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 {@code foo==[1,2,3]} then {@code foo[-1]==3}. + */ + public final Operand begin; + + /** + * {@code end[i]} is like {@code begin} with the exception that {@code end_mask} is + * used to determine full ranges. + */ + public final Operand end; + + /** + * {@code strides[i]} specifies the increment in the {@code i}th specification + * after extracting a given element. Negative indices will reverse + * the original order. Out or range values are + * clamped to {@code [0,dim[i]) if slice[i]>0} or {@code [-1,dim[i]-1] if slice[i] < 0} + */ + public final Operand strides; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Index attribute + */ + public final DataType Index; + + /** + * 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 {@code [0, n-1)} if {@code stride[i] > 0} or + * {@code [-1, n-1]} if {@code stride[i] < 0} + */ + public final long beginMask; + + /** + * analogous to {@code begin_mask} + */ + public final long endMask; + + /** + * a bitmask where bit {@code i} being 1 means the {@code i}th + * position is actually an ellipsis. One bit at most can be 1. + * If {@code ellipsis_mask == 0}, then an implicit ellipsis mask of {@code 1 << (m+1)} + * is provided. This means that {@code 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 {@code foo} the slice {@code foo[2, ..., 5:8]} implies {@code foo[2, :, :, 5:8]}. + */ + public final long ellipsisMask; + + /** + * a bitmask where bit {@code i} being 1 means the {@code i}th + * specification creates a new shape 1 dimension. For example + * {@code foo[:4, tf.newaxis, :2]} would produce a shape {@code (4, 1, 2)} tensor. + */ + public final long newAxisMask; + + /** + * a bitmask where bit {@code i} implies that the {@code 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 {@code foo[:, 3, :]} which would result in + * {@code shrink_axis_mask} being 2. + */ + public final long shrinkAxisMask; + + public Inputs(GraphOperation op) { + super(new StridedSlice<>(op), op, Arrays.asList("T", "Index", "begin_mask", "end_mask", "ellipsis_mask", "new_axis_mask", "shrink_axis_mask")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + begin = (Operand) op.input(inputIndex++); + end = (Operand) op.input(inputIndex++); + strides = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Index = op.attributes().getAttrType("Index"); + beginMask = op.attributes().getAttrInt("begin_mask"); + endMask = op.attributes().getAttrInt("end_mask"); + ellipsisMask = op.attributes().getAttrInt("ellipsis_mask"); + newAxisMask = op.attributes().getAttrInt("new_axis_mask"); + shrinkAxisMask = op.attributes().getAttrInt("shrink_axis_mask"); + } } } 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 index 43440bf0847..2911a675905 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,106 +17,76 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * 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 + * Assign {@code value} to the sliced l-value reference of {@code ref}. + * The values of {@code value} are assigned to the positions in the variable + * {@code ref} that are selected by the slice parameters. The slice parameters + * {@code begin}, {@code end}, {@code strides}, etc. work exactly as in {@code StridedSlice}. + *

NOTE this op currently does not support broadcasting and so {@code value}'s + * shape must be exactly the shape produced by the slice of {@code ref}. */ +@OpMetadata( + opType = StridedSliceAssign.OP_NAME, + inputsClass = StridedSliceAssign.Inputs.class +) @Operator -public final class StridedSliceAssign extends PrimitiveOp implements Operand { - +public final class StridedSliceAssign extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.StridedSliceAssign} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "StridedSliceAssign"; + + private Output outputRef; + + public StridedSliceAssign(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputRef = operation.output(outputIdx++); } - + /** * 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 + * @param ref The ref value + * @param begin The begin value + * @param end The end value + * @param strides The strides value + * @param value The value value + * @param options carries optional attribute values + * @param data type for {@code StridedSliceAssign} output and operands + * @param data type for {@code StridedSliceAssign} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static StridedSliceAssign create(Scope scope, + Operand ref, Operand begin, Operand end, Operand strides, Operand value, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { @@ -136,60 +106,225 @@ public static StridedSliceAssign create( } } } - return new StridedSliceAssign(opBuilder.build()); + return new StridedSliceAssign<>(opBuilder.build()); } - + /** - * @param beginMask + * Sets the beginMask option. + * + * @param beginMask the beginMask option + * @return this Options instance. */ public static Options beginMask(Long beginMask) { return new Options().beginMask(beginMask); } - + /** - * @param endMask + * Sets the endMask option. + * + * @param endMask the endMask option + * @return this Options instance. */ public static Options endMask(Long endMask) { return new Options().endMask(endMask); } - + /** - * @param ellipsisMask + * Sets the ellipsisMask option. + * + * @param ellipsisMask the ellipsisMask option + * @return this Options instance. */ public static Options ellipsisMask(Long ellipsisMask) { return new Options().ellipsisMask(ellipsisMask); } - + /** - * @param newAxisMask + * Sets the newAxisMask option. + * + * @param newAxisMask the newAxisMask option + * @return this Options instance. */ public static Options newAxisMask(Long newAxisMask) { return new Options().newAxisMask(newAxisMask); } - + /** - * @param shrinkAxisMask + * Sets the shrinkAxisMask option. + * + * @param shrinkAxisMask the shrinkAxisMask option + * @return this Options instance. */ public static Options shrinkAxisMask(Long shrinkAxisMask) { return new Options().shrinkAxisMask(shrinkAxisMask); } - + /** + * Gets outputRef. + * + * @return outputRef. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.StridedSliceAssign} + */ + public static class Options { + private Long beginMask; + + private Long endMask; + + private Long ellipsisMask; + + private Long newAxisMask; + + private Long shrinkAxisMask; + + private Options() { + } + + /** + * Sets the beginMask option. + * + * @param beginMask the beginMask option + * @return this Options instance. + */ + public Options beginMask(Long beginMask) { + this.beginMask = beginMask; + return this; + } + + /** + * Sets the endMask option. + * + * @param endMask the endMask option + * @return this Options instance. + */ + public Options endMask(Long endMask) { + this.endMask = endMask; + return this; + } + + /** + * Sets the ellipsisMask option. + * + * @param ellipsisMask the ellipsisMask option + * @return this Options instance. + */ + public Options ellipsisMask(Long ellipsisMask) { + this.ellipsisMask = ellipsisMask; + return this; + } + + /** + * Sets the newAxisMask option. + * + * @param newAxisMask the newAxisMask option + * @return this Options instance. + */ + public Options newAxisMask(Long newAxisMask) { + this.newAxisMask = newAxisMask; + return this; + } + + /** + * Sets the shrinkAxisMask option. + * + * @param shrinkAxisMask the shrinkAxisMask option + * @return this Options instance. + */ + public Options shrinkAxisMask(Long shrinkAxisMask) { + this.shrinkAxisMask = shrinkAxisMask; + return this; + } + } + + @OpInputsMetadata( + outputsClass = StridedSliceAssign.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The ref input + */ + public final Operand ref; + + /** + * The begin input + */ + public final Operand begin; + + /** + * The end input + */ + public final Operand end; + + /** + * The strides input + */ + public final Operand strides; + + /** + * The value input + */ + public final Operand value; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Index attribute + */ + public final DataType Index; + + /** + * The beginMask attribute + */ + public final long beginMask; + + /** + * The endMask attribute + */ + public final long endMask; + + /** + * The ellipsisMask attribute + */ + public final long ellipsisMask; + + /** + * The newAxisMask attribute + */ + public final long newAxisMask; + + /** + * The shrinkAxisMask attribute + */ + public final long shrinkAxisMask; + + public Inputs(GraphOperation op) { + super(new StridedSliceAssign<>(op), op, Arrays.asList("T", "Index", "begin_mask", "end_mask", "ellipsis_mask", "new_axis_mask", "shrink_axis_mask")); + int inputIndex = 0; + ref = (Operand) op.input(inputIndex++); + begin = (Operand) op.input(inputIndex++); + end = (Operand) op.input(inputIndex++); + strides = (Operand) op.input(inputIndex++); + value = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Index = op.attributes().getAttrType("Index"); + beginMask = op.attributes().getAttrInt("begin_mask"); + endMask = op.attributes().getAttrInt("end_mask"); + ellipsisMask = op.attributes().getAttrInt("ellipsis_mask"); + newAxisMask = op.attributes().getAttrInt("new_axis_mask"); + shrinkAxisMask = op.attributes().getAttrInt("shrink_axis_mask"); + } } } 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 index b49c538c0d3..fcd7518dd87 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,108 +17,78 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * 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 + * Returns the gradient of {@code StridedSlice}. + * Since {@code StridedSlice} cuts out pieces of its {@code input} which is size + * {@code shape}, its gradient will have the same shape (which is passed here + * as {@code 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 + *

Arguments are the same as StridedSliceGrad with the exception that + * {@code dy} is the input gradient to be propagated and {@code shape} is the + * shape of {@code StridedSlice}'s {@code input}. */ +@OpMetadata( + opType = StridedSliceGrad.OP_NAME, + inputsClass = StridedSliceGrad.Inputs.class +) @Operator -public final class StridedSliceGrad extends PrimitiveOp implements Operand { - +public final class StridedSliceGrad extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.StridedSliceGrad} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "StridedSliceGrad"; + + private Output output; + + public StridedSliceGrad(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * 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 + * @param shape The shape value + * @param begin The begin value + * @param end The end value + * @param strides The strides value + * @param dy The dy value + * @param options carries optional attribute values + * @param data type for {@code StridedSliceGrad} output and operands + * @param data type for {@code StridedSliceGrad} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static StridedSliceGrad create(Scope scope, + Operand shape, Operand begin, Operand end, Operand strides, Operand dy, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { @@ -138,60 +108,225 @@ public static StridedSliceGrad create(Sc } } } - return new StridedSliceGrad(opBuilder.build()); + return new StridedSliceGrad<>(opBuilder.build()); } - + /** - * @param beginMask + * Sets the beginMask option. + * + * @param beginMask the beginMask option + * @return this Options instance. */ public static Options beginMask(Long beginMask) { return new Options().beginMask(beginMask); } - + /** - * @param endMask + * Sets the endMask option. + * + * @param endMask the endMask option + * @return this Options instance. */ public static Options endMask(Long endMask) { return new Options().endMask(endMask); } - + /** - * @param ellipsisMask + * Sets the ellipsisMask option. + * + * @param ellipsisMask the ellipsisMask option + * @return this Options instance. */ public static Options ellipsisMask(Long ellipsisMask) { return new Options().ellipsisMask(ellipsisMask); } - + /** - * @param newAxisMask + * Sets the newAxisMask option. + * + * @param newAxisMask the newAxisMask option + * @return this Options instance. */ public static Options newAxisMask(Long newAxisMask) { return new Options().newAxisMask(newAxisMask); } - + /** - * @param shrinkAxisMask + * Sets the shrinkAxisMask option. + * + * @param shrinkAxisMask the shrinkAxisMask option + * @return this Options instance. */ public static Options shrinkAxisMask(Long shrinkAxisMask) { return new Options().shrinkAxisMask(shrinkAxisMask); } - + /** + * Gets output. + * + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.StridedSliceGrad} + */ + public static class Options { + private Long beginMask; + + private Long endMask; + + private Long ellipsisMask; + + private Long newAxisMask; + + private Long shrinkAxisMask; + + private Options() { + } + + /** + * Sets the beginMask option. + * + * @param beginMask the beginMask option + * @return this Options instance. + */ + public Options beginMask(Long beginMask) { + this.beginMask = beginMask; + return this; + } + + /** + * Sets the endMask option. + * + * @param endMask the endMask option + * @return this Options instance. + */ + public Options endMask(Long endMask) { + this.endMask = endMask; + return this; + } + + /** + * Sets the ellipsisMask option. + * + * @param ellipsisMask the ellipsisMask option + * @return this Options instance. + */ + public Options ellipsisMask(Long ellipsisMask) { + this.ellipsisMask = ellipsisMask; + return this; + } + + /** + * Sets the newAxisMask option. + * + * @param newAxisMask the newAxisMask option + * @return this Options instance. + */ + public Options newAxisMask(Long newAxisMask) { + this.newAxisMask = newAxisMask; + return this; + } + + /** + * Sets the shrinkAxisMask option. + * + * @param shrinkAxisMask the shrinkAxisMask option + * @return this Options instance. + */ + public Options shrinkAxisMask(Long shrinkAxisMask) { + this.shrinkAxisMask = shrinkAxisMask; + return this; + } + } + + @OpInputsMetadata( + outputsClass = StridedSliceGrad.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The shape input + */ + public final Operand shape; + + /** + * The begin input + */ + public final Operand begin; + + /** + * The end input + */ + public final Operand end; + + /** + * The strides input + */ + public final Operand strides; + + /** + * The dy input + */ + public final Operand dy; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Index attribute + */ + public final DataType Index; + + /** + * The beginMask attribute + */ + public final long beginMask; + + /** + * The endMask attribute + */ + public final long endMask; + + /** + * The ellipsisMask attribute + */ + public final long ellipsisMask; + + /** + * The newAxisMask attribute + */ + public final long newAxisMask; + + /** + * The shrinkAxisMask attribute + */ + public final long shrinkAxisMask; + + public Inputs(GraphOperation op) { + super(new StridedSliceGrad<>(op), op, Arrays.asList("T", "Index", "begin_mask", "end_mask", "ellipsis_mask", "new_axis_mask", "shrink_axis_mask")); + int inputIndex = 0; + shape = (Operand) op.input(inputIndex++); + begin = (Operand) op.input(inputIndex++); + end = (Operand) op.input(inputIndex++); + strides = (Operand) op.input(inputIndex++); + dy = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Index = op.attributes().getAttrType("Index"); + beginMask = op.attributes().getAttrInt("begin_mask"); + endMask = op.attributes().getAttrInt("end_mask"); + ellipsisMask = op.attributes().getAttrInt("ellipsis_mask"); + newAxisMask = op.attributes().getAttrInt("new_axis_mask"); + shrinkAxisMask = op.attributes().getAttrInt("shrink_axis_mask"); + } } } 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 deleted file mode 100644 index 39d8f789254..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StringLower.java +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.TString; - -/** - */ -@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 deleted file mode 100644 index 2f4144f795f..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StringNGrams.java +++ /dev/null @@ -1,105 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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; -import org.tensorflow.types.TString; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index 2453bb9e33d..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/StringUpper.java +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.TString; - -/** - */ -@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 index 1393228ac08..abcdb1ee9ef 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,63 +17,68 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 + * Reduces {@code input} along the dimensions given in {@code axis}. Unless + * {@code keep_dims} is true, the rank of the tensor is reduced by 1 for each entry in + * {@code axis}. If {@code keep_dims} is true, the reduced dimensions are * retained with length 1. - * - * @param data type for {@code output()} output */ +@OpMetadata( + opType = Sum.OP_NAME, + inputsClass = Sum.Inputs.class +) @Operator -public final class Sum extends PrimitiveOp implements Operand { - +public final class Sum extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.Sum} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Sum"; + + private Output output; + + public Sum(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * 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 + * {@code [-rank(input), rank(input))}. + * @param options carries optional attribute values + * @param data type for {@code Sum} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static Sum create(Scope scope, Operand input, + Operand axis, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Sum"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); if (options != null) { for (Options opts : options) { if (opts.keepDims != null) { @@ -81,33 +86,92 @@ public static Sum create(Scope scope, Op } } } - return new Sum(opBuilder.build()); + return new Sum<>(opBuilder.build()); } - + /** + * Sets the keepDims option. + * * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. */ public static Options keepDims(Boolean keepDims) { return new Options().keepDims(keepDims); } - + /** + * Gets output. * The reduced tensor. + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.Sum} + */ + public static class Options { + private Boolean keepDims; + + private Options() { + } + + /** + * Sets the keepDims option. + * + * @param keepDims If true, retain reduced dimensions with length 1. + * @return this Options instance. + */ + public Options keepDims(Boolean keepDims) { + this.keepDims = keepDims; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Sum.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensor to reduce. + */ + public final Operand input; + + /** + * The dimensions to reduce. Must be in the range + * {@code [-rank(input), rank(input))}. + */ + public final Operand axis; + + /** + * If true, retain reduced dimensions with length 1. + */ + public final boolean keepDims; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tidx attribute + */ + public final DataType Tidx; + + public Inputs(GraphOperation op) { + super(new Sum<>(op), op, Arrays.asList("keep_dims", "T", "Tidx")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + axis = (Operand) op.input(inputIndex++); + keepDims = op.attributes().getAttrBool("keep_dims"); + T = op.attributes().getAttrType("T"); + Tidx = op.attributes().getAttrType("Tidx"); + } } } 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 index ebb95e4659d..c6842c9ab87 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,66 +17,114 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TBool; import org.tensorflow.types.family.TType; /** - * 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 + * Forwards {@code data} to the output port determined by {@code pred}. + * If {@code pred} is true, the {@code data} input is forwarded to {@code output_true}. Otherwise, + * the data goes to {@code output_false}. + *

See also {@code RefSwitch} and {@code Merge}. */ +@OpMetadata( + opType = SwitchCond.OP_NAME, + inputsClass = SwitchCond.Inputs.class +) @Operator -public final class SwitchCond extends PrimitiveOp { - +public final class SwitchCond extends RawOp { /** - * Factory method to create a class wrapping a new SwitchCond operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Switch"; + + private Output outputFalse; + + private Output outputTrue; + + public SwitchCond(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputFalse = operation.output(outputIdx++); + outputTrue = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new Switch 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. + * @param data type for {@code Switch} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static SwitchCond create(Scope scope, Operand data, + Operand pred) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "SwitchCond"); opBuilder.addInput(data.asOutput()); opBuilder.addInput(pred.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new SwitchCond(opBuilder.build()); + return new SwitchCond<>(opBuilder.build()); } - + /** - * If `pred` is false, data will be forwarded to this output. + * Gets outputFalse. + * If {@code pred} is false, data will be forwarded to this output. + * @return outputFalse. */ public Output outputFalse() { return outputFalse; } - + /** - * If `pred` is true, data will be forwarded to this output. + * Gets outputTrue. + * If {@code pred} is true, data will be forwarded to this output. + * @return outputTrue. */ 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++); + + @OpInputsMetadata( + outputsClass = SwitchCond.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The tensor to be forwarded to the appropriate output. + */ + public final Operand data; + + /** + * A scalar that specifies which output port will receive data. + */ + public final Operand pred; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new SwitchCond<>(op), op, Arrays.asList("T")); + int inputIndex = 0; + data = (Operand) op.input(inputIndex++); + pred = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SyncDevice.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SyncDevice.java new file mode 100644 index 00000000000..a85fd9312c5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SyncDevice.java @@ -0,0 +1,75 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; + +/** + * Synchronizes the device this op is run on. + * Only GPU ops are asynchrous in TensorFlow, and so this only has an effect when + * run on GPUs. On GPUs, this op synchronizes the GPU's compute stream. + */ +@OpMetadata( + opType = SyncDevice.OP_NAME, + inputsClass = SyncDevice.Inputs.class +) +@Operator +public final class SyncDevice extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "SyncDevice"; + + public SyncDevice(Operation operation) { + super(operation, OP_NAME); + } + + /** + * Factory method to create a class wrapping a new SyncDevice operation. + * + * @param scope current scope + * @return a new instance of SyncDevice + */ + @Endpoint( + describeByClass = true + ) + public static SyncDevice create(Scope scope) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "SyncDevice"); + return new SyncDevice(opBuilder.build()); + } + + @OpInputsMetadata( + outputsClass = SyncDevice.class + ) + public static class Inputs extends RawOpInputs { + public Inputs(GraphOperation op) { + super(new SyncDevice(op), op, Arrays.asList()); + int inputIndex = 0; + } + } +} 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 deleted file mode 100644 index 468a2d9d539..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUCompilationResult.java +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TString; - -/** - * 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 deleted file mode 100644 index af55d307d7d..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUEmbeddingActivations.java +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index a1e008b340f..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUOrdinalSelector.java +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt32; - -/** - * 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 deleted file mode 100644 index 54ef808fa37..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUReplicateMetadata.java +++ /dev/null @@ -1,251 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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 deleted file mode 100644 index 313da21af53..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUReplicatedInput.java +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TType; - -/** - * 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 deleted file mode 100644 index 6b80ab2f594..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TPUReplicatedOutput.java +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.types.family.TType; - -/** - * 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 index 51fb37717ee..d66021bb728 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,74 +17,75 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.tools.Shape; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** * 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 + *

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 + *

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) */ +@OpMetadata( + opType = TemporaryVariable.OP_NAME, + inputsClass = TemporaryVariable.Inputs.class +) @Operator -public final class TemporaryVariable extends PrimitiveOp implements Operand { - +public final class TemporaryVariable extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.TemporaryVariable} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "TemporaryVariable"; + + private Output ref; + + public TemporaryVariable(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + ref = operation.output(outputIdx++); } - + /** * 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 + * @param options carries optional attribute values + * @param data type for {@code TemporaryVariable} output and operands * @return a new instance of TemporaryVariable */ - public static TemporaryVariable create(Scope scope, Shape shape, DataType dtype, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("TemporaryVariable", scope.makeOpName("TemporaryVariable")); - opBuilder = scope.applyControlDependencies(opBuilder); + @Endpoint( + describeByClass = true + ) + public static TemporaryVariable create(Scope scope, Shape shape, + Class dtype, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TemporaryVariable"); opBuilder.setAttr("shape", shape); - opBuilder.setAttr("dtype", dtype); + opBuilder.setAttr("dtype", Operands.toDataType(dtype)); if (options != null) { for (Options opts : options) { if (opts.varName != null) { @@ -92,34 +93,82 @@ public static TemporaryVariable create(Scope scope, Shape s } } } - return new TemporaryVariable(opBuilder.build()); + return new TemporaryVariable<>(opBuilder.build()); } - + /** + * Sets the varName option. + * * @param varName Overrides the name used for the temporary variable resource. Default * value is the name of the 'TemporaryVariable' op (which is guaranteed unique). + * @return this Options instance. */ public static Options varName(String varName) { return new Options().varName(varName); } - + /** + * Gets ref. * A reference to the variable tensor. + * @return ref. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.TemporaryVariable} + */ + public static class Options { + private String varName; + + private Options() { + } + + /** + * Sets the varName option. + * + * @param varName Overrides the name used for the temporary variable resource. Default + * value is the name of the 'TemporaryVariable' op (which is guaranteed unique). + * @return this Options instance. + */ + public Options varName(String varName) { + this.varName = varName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = TemporaryVariable.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The shape of the variable tensor. + */ + public final Shape shape; + + /** + * The type of elements in the variable tensor. + */ + public final DataType dtype; + + /** + * Overrides the name used for the temporary variable resource. Default + * value is the name of the 'TemporaryVariable' op (which is guaranteed unique). + */ + public final String varName; + + public Inputs(GraphOperation op) { + super(new TemporaryVariable<>(op), op, Arrays.asList("shape", "dtype", "var_name")); + int inputIndex = 0; + shape = op.attributes().getAttrShape("shape"); + dtype = op.attributes().getAttrType("dtype"); + varName = op.attributes().getAttrString("var_name"); + } } } 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 index 5b89424aab0..61bf11cfd75 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,108 +17,71 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.tools.Shape; -import org.tensorflow.types.TFloat; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TFloat32; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** * An array of Tensors of given size. - *

* Write data via Write and read via Read or Pack. */ +@OpMetadata( + opType = TensorArray.OP_NAME, + inputsClass = TensorArray.Inputs.class +) @Operator -public final class TensorArray extends PrimitiveOp { - +public final class TensorArray extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.TensorArray} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "TensorArrayV3"; + + private Output handle; + + private Output flow; + + @SuppressWarnings("unchecked") + public TensorArray(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + handle = operation.output(outputIdx++); + flow = operation.output(outputIdx++); } - + /** - * Factory method to create a class wrapping a new TensorArray operation. - * + * Factory method to create a class wrapping a new TensorArrayV3 operation. + * * @param scope current scope - * @param size The size of the array. + * @param sizeOutput The size of the array. * @param dtype The type of the elements on the tensor_array. - * @param options carries optional attributes values + * @param options carries optional attribute values + * @param data type for {@code TensorArrayV3} output and operands * @return a new instance of TensorArray */ - public static TensorArray create(Scope scope, Operand size, DataType dtype, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("TensorArrayV3", scope.makeOpName("TensorArray")); - opBuilder.addInput(size.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("dtype", dtype); + @Endpoint( + describeByClass = true + ) + public static TensorArray create(Scope scope, Operand sizeOutput, + Class dtype, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorArray"); + opBuilder.addInput(sizeOutput.asOutput()); + opBuilder.setAttr("dtype", Operands.toDataType(dtype)); if (options != null) { for (Options opts : options) { if (opts.elementShape != null) { @@ -140,75 +103,233 @@ public static TensorArray create(Scope scope, Operand } return new TensorArray(opBuilder.build()); } - + /** + * Sets the elementShape option. + * * @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. + * @return this Options instance. */ public static Options elementShape(Shape elementShape) { return new Options().elementShape(elementShape); } - + /** + * Sets the dynamicSize option. + * * @param dynamicSize A boolean that determines whether writes to the TensorArray * are allowed to grow the size. By default, this is not allowed. + * @return this Options instance. */ public static Options dynamicSize(Boolean dynamicSize) { return new Options().dynamicSize(dynamicSize); } - + /** + * Sets the clearAfterRead option. + * * @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. + * @return this Options instance. */ public static Options clearAfterRead(Boolean clearAfterRead) { return new Options().clearAfterRead(clearAfterRead); } - + /** + * Sets the identicalElementShapes option. + * * @param identicalElementShapes If true (default is false), then all - * elements in the TensorArray will be expected to have have identical shapes. + * elements in the TensorArray will be expected to 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. + * @return this Options instance. */ public static Options identicalElementShapes(Boolean identicalElementShapes) { return new Options().identicalElementShapes(identicalElementShapes); } - + /** + * Sets the tensorArrayName option. + * * @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). + * @return this Options instance. */ public static Options tensorArrayName(String tensorArrayName) { return new Options().tensorArrayName(tensorArrayName); } - + /** + * Gets handle. * The handle to the TensorArray. + * @return handle. */ - public Output handle() { + public Output handle() { return handle; } - + /** + * Gets flow. * A scalar used to control gradient flow. + * @return flow. */ - public Output 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.TensorArray} + */ + public static class Options { + private Shape elementShape; + + private Boolean dynamicSize; + + private Boolean clearAfterRead; + + private Boolean identicalElementShapes; + + private String tensorArrayName; + + private Options() { + } + + /** + * Sets the elementShape option. + * + * @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. + * @return this Options instance. + */ + public Options elementShape(Shape elementShape) { + this.elementShape = elementShape; + return this; + } + + /** + * Sets the dynamicSize option. + * + * @param dynamicSize A boolean that determines whether writes to the TensorArray + * are allowed to grow the size. By default, this is not allowed. + * @return this Options instance. + */ + public Options dynamicSize(Boolean dynamicSize) { + this.dynamicSize = dynamicSize; + return this; + } + + /** + * Sets the clearAfterRead option. + * + * @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. + * @return this Options instance. + */ + public Options clearAfterRead(Boolean clearAfterRead) { + this.clearAfterRead = clearAfterRead; + return this; + } + + /** + * Sets the identicalElementShapes option. + * + * @param identicalElementShapes If true (default is false), then all + * elements in the TensorArray will be expected to 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. + * @return this Options instance. + */ + public Options identicalElementShapes(Boolean identicalElementShapes) { + this.identicalElementShapes = identicalElementShapes; + return this; + } + + /** + * Sets the tensorArrayName option. + * + * @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). + * @return this Options instance. + */ + public Options tensorArrayName(String tensorArrayName) { + this.tensorArrayName = tensorArrayName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = TensorArray.class + ) + public static class Inputs extends RawOpInputs { + /** + * The size of the array. + */ + public final Operand sizeOutput; + + /** + * The type of the elements on the tensor_array. + */ + public final DataType dtype; + + /** + * 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 final Shape elementShape; + + /** + * A boolean that determines whether writes to the TensorArray + * are allowed to grow the size. By default, this is not allowed. + */ + public final boolean dynamicSize; + + /** + * If true (default), Tensors in the TensorArray are cleared + * after being read. This disables multiple read semantics but allows early + * release of memory. + */ + public final boolean clearAfterRead; + + /** + * If true (default is false), then all + * elements in the TensorArray will be expected to 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 final boolean identicalElementShapes; + + /** + * Overrides the name used for the temporary tensor_array + * resource. Default value is the name of the 'TensorArray' op (which + * is guaranteed unique). + */ + public final String tensorArrayName; + + public Inputs(GraphOperation op) { + super(new TensorArray(op), op, Arrays.asList("dtype", "element_shape", "dynamic_size", "clear_after_read", "identical_element_shapes", "tensor_array_name")); + int inputIndex = 0; + sizeOutput = (Operand) op.input(inputIndex++); + dtype = op.attributes().getAttrType("dtype"); + elementShape = op.attributes().getAttrShape("element_shape"); + dynamicSize = op.attributes().getAttrBool("dynamic_size"); + clearAfterRead = op.attributes().getAttrBool("clear_after_read"); + identicalElementShapes = op.attributes().getAttrBool("identical_element_shapes"); + tensorArrayName = op.attributes().getAttrString("tensor_array_name"); + } } } 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 index 3339a38a587..4fd8a01d8e6 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,38 +17,69 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.family.TType; /** * Delete the TensorArray from its resource container. - *

* This enables the user to close and release the resource in the middle * of a step/run. */ +@OpMetadata( + opType = TensorArrayClose.OP_NAME, + inputsClass = TensorArrayClose.Inputs.class +) @Operator -public final class TensorArrayClose extends PrimitiveOp { - +public final class TensorArrayClose extends RawOp { /** - * Factory method to create a class wrapping a new TensorArrayClose operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorArrayCloseV3"; + + public TensorArrayClose(Operation operation) { + super(operation, OP_NAME); + } + + /** + * Factory method to create a class wrapping a new TensorArrayCloseV3 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")); + @Endpoint( + describeByClass = true + ) + public static TensorArrayClose create(Scope scope, Operand handle) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorArrayClose"); opBuilder.addInput(handle.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new TensorArrayClose(opBuilder.build()); } - - - private TensorArrayClose(Operation operation) { - super(operation); + + @OpInputsMetadata( + outputsClass = TensorArrayClose.class + ) + public static class Inputs extends RawOpInputs { + /** + * The handle to a TensorArray (output of TensorArray or TensorArrayGrad). + */ + public final Operand handle; + + public Inputs(GraphOperation op) { + super(new TensorArrayClose(op), op, Arrays.asList()); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + } } } 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 index cc7f23d413a..75ba48a0102 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,76 +17,81 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.tools.Shape; -import org.tensorflow.types.TFloat; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TFloat32; import org.tensorflow.types.TInt64; import org.tensorflow.types.family.TType; /** - * 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 + * Concat the elements from the TensorArray into value {@code value}. + * Takes {@code T} elements of shapes + *
+ * (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: + *

+ * (n0 + n1 + ... + n(T-1) x d0 x d1 x ...)
+ * 
+ *

All elements must have the same shape (excepting the first dimension). */ +@OpMetadata( + opType = TensorArrayConcat.OP_NAME, + inputsClass = TensorArrayConcat.Inputs.class +) @Operator -public final class TensorArrayConcat extends PrimitiveOp { - +public final class TensorArrayConcat extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.TensorArrayConcat} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "TensorArrayConcatV3"; + + private Output value; + + private Output lengths; + + public TensorArrayConcat(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + value = operation.output(outputIdx++); + lengths = operation.output(outputIdx++); } - + /** - * Factory method to create a class wrapping a new TensorArrayConcat operation. - * + * Factory method to create a class wrapping a new TensorArrayConcatV3 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 + * @param options carries optional attribute values + * @param data type for {@code TensorArrayConcatV3} output and operands * @return a new instance of TensorArrayConcat */ - public static TensorArrayConcat create(Scope scope, Operand handle, Operand flowIn, DataType dtype, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("TensorArrayConcatV3", scope.makeOpName("TensorArrayConcat")); + @Endpoint( + describeByClass = true + ) + public static TensorArrayConcat create(Scope scope, + Operand handle, Operand flowIn, Class dtype, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorArrayConcat"); opBuilder.addInput(handle.asOutput()); opBuilder.addInput(flowIn.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("dtype", dtype); + opBuilder.setAttr("dtype", Operands.toDataType(dtype)); if (options != null) { for (Options opts : options) { if (opts.elementShapeExcept0 != null) { @@ -94,43 +99,101 @@ public static TensorArrayConcat create(Scope scope, Operand } } } - return new TensorArrayConcat(opBuilder.build()); + return new TensorArrayConcat<>(opBuilder.build()); } - + /** + * Sets the elementShapeExcept0 option. + * * @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. + * @return this Options instance. */ public static Options elementShapeExcept0(Shape elementShapeExcept0) { return new Options().elementShapeExcept0(elementShapeExcept0); } - + /** + * Gets value. * All of the elements in the TensorArray, concatenated along the first * axis. + * @return value. */ public Output value() { return value; } - + /** + * Gets lengths. * 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))`. + * {@code (n1, n2, ..., n(T-1))}. + * @return lengths. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.TensorArrayConcat} + */ + public static class Options { + private Shape elementShapeExcept0; + + private Options() { + } + + /** + * Sets the elementShapeExcept0 option. + * + * @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. + * @return this Options instance. + */ + public Options elementShapeExcept0(Shape elementShapeExcept0) { + this.elementShapeExcept0 = elementShapeExcept0; + return this; + } + } + + @OpInputsMetadata( + outputsClass = TensorArrayConcat.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The handle to a TensorArray. + */ + public final Operand handle; + + /** + * A float scalar that enforces proper chaining of operations. + */ + public final Operand flowIn; + + /** + * The type of the elem that is returned. + */ + public final DataType dtype; + + /** + * 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 final Shape elementShapeExcept0; + + public Inputs(GraphOperation op) { + super(new TensorArrayConcat<>(op), op, Arrays.asList("dtype", "element_shape_except0")); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + flowIn = (Operand) op.input(inputIndex++); + dtype = op.attributes().getAttrType("dtype"); + elementShapeExcept0 = op.attributes().getAttrShape("element_shape_except0"); + } } } 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 index b5977647002..60d8b437b00 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,68 +17,72 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.tools.Shape; -import org.tensorflow.types.TFloat; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TFloat32; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** - * 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 + * Gather specific elements from the TensorArray into output {@code value}. + * All elements selected by {@code indices} must have the same shape. */ +@OpMetadata( + opType = TensorArrayGather.OP_NAME, + inputsClass = TensorArrayGather.Inputs.class +) @Operator -public final class TensorArrayGather extends PrimitiveOp implements Operand { - +public final class TensorArrayGather extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.TensorArrayGather} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "TensorArrayGatherV3"; + + private Output value; + + public TensorArrayGather(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + value = operation.output(outputIdx++); } - + /** - * Factory method to create a class wrapping a new TensorArrayGather operation. - * + * Factory method to create a class wrapping a new TensorArrayGatherV3 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 + * @param options carries optional attribute values + * @param data type for {@code TensorArrayGatherV3} output and operands * @return a new instance of TensorArrayGather */ - public static TensorArrayGather create(Scope scope, Operand handle, Operand indices, Operand flowIn, DataType dtype, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("TensorArrayGatherV3", scope.makeOpName("TensorArrayGather")); + @Endpoint( + describeByClass = true + ) + public static TensorArrayGather create(Scope scope, + Operand handle, Operand indices, Operand flowIn, + Class dtype, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorArrayGather"); opBuilder.addInput(handle.asOutput()); opBuilder.addInput(indices.asOutput()); opBuilder.addInput(flowIn.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("dtype", dtype); + opBuilder.setAttr("dtype", Operands.toDataType(dtype)); if (options != null) { for (Options opts : options) { if (opts.elementShape != null) { @@ -86,36 +90,98 @@ public static TensorArrayGather create(Scope scope, Operand } } } - return new TensorArrayGather(opBuilder.build()); + return new TensorArrayGather<>(opBuilder.build()); } - + /** + * Sets the elementShape option. + * * @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. + * @return this Options instance. */ public static Options elementShape(Shape elementShape) { return new Options().elementShape(elementShape); } - + /** + * Gets value. * All of the elements in the TensorArray, concatenated along a new * axis (the new dimension 0). + * @return value. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.TensorArrayGather} + */ + public static class Options { + private Shape elementShape; + + private Options() { + } + + /** + * Sets the elementShape option. + * + * @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. + * @return this Options instance. + */ + public Options elementShape(Shape elementShape) { + this.elementShape = elementShape; + return this; + } + } + + @OpInputsMetadata( + outputsClass = TensorArrayGather.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The handle to a TensorArray. + */ + public final Operand handle; + + /** + * The locations in the TensorArray from which to read tensor elements. + */ + public final Operand indices; + + /** + * A float scalar that enforces proper chaining of operations. + */ + public final Operand flowIn; + + /** + * The type of the elem that is returned. + */ + public final DataType dtype; + + /** + * 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 final Shape elementShape; + + public Inputs(GraphOperation op) { + super(new TensorArrayGather<>(op), op, Arrays.asList("dtype", "element_shape")); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + flowIn = (Operand) op.input(inputIndex++); + dtype = op.attributes().getAttrType("dtype"); + elementShape = op.attributes().getAttrShape("element_shape"); + } } } 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 index 634e8008a1e..1fcbb8e913b 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,25 +17,28 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.types.TFloat; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.family.TType; /** * 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 + *

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 @@ -43,35 +46,50 @@ * 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 + *

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 + *

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 + *

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 + * 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 + * the TensorArray gradient object here (the attribute {@code source}). + *

The attribute {@code 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. */ +@OpMetadata( + opType = TensorArrayGrad.OP_NAME, + inputsClass = TensorArrayGrad.Inputs.class +) @Operator -public final class TensorArrayGrad extends PrimitiveOp { - +public final class TensorArrayGrad extends RawOp { /** - * Factory method to create a class wrapping a new TensorArrayGrad operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorArrayGradV3"; + + private Output gradHandle; + + private Output flowOut; + + @SuppressWarnings("unchecked") + public TensorArrayGrad(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + gradHandle = operation.output(outputIdx++); + flowOut = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new TensorArrayGradV3 operation. + * * @param scope current scope * @param handle The handle to the forward TensorArray. * @param flowIn A float scalar that enforces proper chaining of operations. @@ -79,34 +97,62 @@ public final class TensorArrayGrad extends PrimitiveOp { * 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")); + @Endpoint( + describeByClass = true + ) + public static TensorArrayGrad create(Scope scope, Operand handle, + Operand flowIn, String source) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorArrayGrad"); opBuilder.addInput(handle.asOutput()); opBuilder.addInput(flowIn.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); opBuilder.setAttr("source", source); return new TensorArrayGrad(opBuilder.build()); } - + /** + * Gets gradHandle. + * + * @return gradHandle. */ - public Output gradHandle() { + public Output gradHandle() { return gradHandle; } - + /** + * Gets flowOut. + * + * @return flowOut. */ - public Output flowOut() { + 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++); + + @OpInputsMetadata( + outputsClass = TensorArrayGrad.class + ) + public static class Inputs extends RawOpInputs { + /** + * The handle to the forward TensorArray. + */ + public final Operand handle; + + /** + * A float scalar that enforces proper chaining of operations. + */ + public final Operand flowIn; + + /** + * The gradient source string, used to decide which gradient TensorArray + * to return. + */ + public final String source; + + public Inputs(GraphOperation op) { + super(new TensorArrayGrad(op), op, Arrays.asList("source")); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + flowIn = (Operand) op.input(inputIndex++); + source = op.attributes().getAttrString("source"); + } } } 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 index 7abf799834b..449564fc74f 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,30 +17,56 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.types.TFloat; +import org.tensorflow.types.TFloat32; import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TType; /** * 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. */ +@OpMetadata( + opType = TensorArrayGradWithShape.OP_NAME, + inputsClass = TensorArrayGradWithShape.Inputs.class +) @Operator -public final class TensorArrayGradWithShape extends PrimitiveOp { - +public final class TensorArrayGradWithShape extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorArrayGradWithShape"; + + private Output gradHandle; + + private Output flowOut; + + @SuppressWarnings("unchecked") + public TensorArrayGradWithShape(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + gradHandle = operation.output(outputIdx++); + flowOut = operation.output(outputIdx++); + } + /** * 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. @@ -51,35 +77,71 @@ public final class TensorArrayGradWithShape extends PrimitiveOp { * 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")); + @Endpoint( + describeByClass = true + ) + public static TensorArrayGradWithShape create(Scope scope, Operand handle, + Operand flowIn, Operand shapeToPrepend, String source) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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()); } - + /** + * Gets gradHandle. + * + * @return gradHandle. */ - public Output gradHandle() { + public Output gradHandle() { return gradHandle; } - + /** + * Gets flowOut. + * + * @return flowOut. */ - public Output flowOut() { + 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++); + + @OpInputsMetadata( + outputsClass = TensorArrayGradWithShape.class + ) + public static class Inputs extends RawOpInputs { + /** + * The handle to the forward TensorArray. + */ + public final Operand handle; + + /** + * A float scalar that enforces proper chaining of operations. + */ + public final Operand flowIn; + + /** + * 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. + */ + public final Operand shapeToPrepend; + + /** + * The gradient source string, used to decide which gradient TensorArray + * to return. + */ + public final String source; + + public Inputs(GraphOperation op) { + super(new TensorArrayGradWithShape(op), op, Arrays.asList("source")); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + flowIn = (Operand) op.input(inputIndex++); + shapeToPrepend = (Operand) op.input(inputIndex++); + source = op.attributes().getAttrString("source"); + } } } 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 index 007dfa720db..d1cf5c89e65 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,60 +17,68 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.tools.Shape; -import org.tensorflow.types.TFloat; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TFloat32; import org.tensorflow.types.TString; import org.tensorflow.types.family.TType; /** - * @param data type for {@code value()} output + * The TensorArrayPack operation */ +@OpMetadata( + opType = TensorArrayPack.OP_NAME, + inputsClass = TensorArrayPack.Inputs.class +) @Operator -public final class TensorArrayPack extends PrimitiveOp implements Operand { - +public final class TensorArrayPack extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.TensorArrayPack} + * The name of this op, as known by TensorFlow core engine */ - public static class Options { - - /** - * @param elementShape - */ - public Options elementShape(Shape elementShape) { - this.elementShape = elementShape; - return this; - } - - private Shape elementShape; - - private Options() { - } + public static final String OP_NAME = "TensorArrayPack"; + + private Output value; + + public TensorArrayPack(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + value = operation.output(outputIdx++); } - + /** * 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 + * @param handle The handle value + * @param flowIn The flowIn value + * @param dtype The value of the dtype attribute + * @param options carries optional attribute values + * @param data type for {@code TensorArrayPack} output and operands * @return a new instance of TensorArrayPack */ - public static TensorArrayPack create(Scope scope, Operand handle, Operand flowIn, DataType dtype, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("TensorArrayPack", scope.makeOpName("TensorArrayPack")); + @Endpoint( + describeByClass = true + ) + public static TensorArrayPack create(Scope scope, Operand handle, + Operand flowIn, Class dtype, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorArrayPack"); opBuilder.addInput(handle.asOutput()); opBuilder.addInput(flowIn.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("dtype", dtype); + opBuilder.setAttr("dtype", Operands.toDataType(dtype)); if (options != null) { for (Options opts : options) { if (opts.elementShape != null) { @@ -78,32 +86,85 @@ public static TensorArrayPack create(Scope scope, Operand(opBuilder.build()); + return new TensorArrayPack<>(opBuilder.build()); } - + /** - * @param elementShape + * Sets the elementShape option. + * + * @param elementShape the elementShape option + * @return this Options instance. */ public static Options elementShape(Shape elementShape) { return new Options().elementShape(elementShape); } - + /** + * Gets value. + * + * @return value. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.TensorArrayPack} + */ + public static class Options { + private Shape elementShape; + + private Options() { + } + + /** + * Sets the elementShape option. + * + * @param elementShape the elementShape option + * @return this Options instance. + */ + public Options elementShape(Shape elementShape) { + this.elementShape = elementShape; + return this; + } + } + + @OpInputsMetadata( + outputsClass = TensorArrayPack.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The handle input + */ + public final Operand handle; + + /** + * The flowIn input + */ + public final Operand flowIn; + + /** + * The dtype attribute + */ + public final DataType dtype; + + /** + * The elementShape attribute + */ + public final Shape elementShape; + + public Inputs(GraphOperation op) { + super(new TensorArrayPack<>(op), op, Arrays.asList("dtype", "element_shape")); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + flowIn = (Operand) op.input(inputIndex++); + dtype = op.attributes().getAttrType("dtype"); + elementShape = op.attributes().getAttrShape("element_shape"); + } } } 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 index 5d1e5d8d5fd..f5a0aa073a7 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,63 +17,117 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.types.TFloat; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TFloat32; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** - * Read an element from the TensorArray into output `value`. - * - * @param data type for {@code value()} output + * Read an element from the TensorArray into output {@code value}. */ +@OpMetadata( + opType = TensorArrayRead.OP_NAME, + inputsClass = TensorArrayRead.Inputs.class +) @Operator -public final class TensorArrayRead extends PrimitiveOp implements Operand { - +public final class TensorArrayRead extends RawOp implements Operand { /** - * Factory method to create a class wrapping a new TensorArrayRead operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorArrayReadV3"; + + private Output value; + + public TensorArrayRead(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + value = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new TensorArrayReadV3 operation. + * * @param scope current scope * @param handle The handle to a TensorArray. - * @param index + * @param index The index value * @param flowIn A float scalar that enforces proper chaining of operations. * @param dtype The type of the elem that is returned. + * @param data type for {@code TensorArrayReadV3} output and operands * @return a new instance of TensorArrayRead */ - public static TensorArrayRead create(Scope scope, Operand handle, Operand index, Operand flowIn, DataType dtype) { - OperationBuilder opBuilder = scope.env().opBuilder("TensorArrayReadV3", scope.makeOpName("TensorArrayRead")); + @Endpoint( + describeByClass = true + ) + public static TensorArrayRead create(Scope scope, + Operand handle, Operand index, Operand flowIn, + Class dtype) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorArrayRead"); opBuilder.addInput(handle.asOutput()); opBuilder.addInput(index.asOutput()); opBuilder.addInput(flowIn.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("dtype", dtype); - return new TensorArrayRead(opBuilder.build()); + opBuilder.setAttr("dtype", Operands.toDataType(dtype)); + return new TensorArrayRead<>(opBuilder.build()); } - + /** + * Gets value. * The tensor that is read from the TensorArray. + * @return value. */ 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++); + + @OpInputsMetadata( + outputsClass = TensorArrayRead.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The handle to a TensorArray. + */ + public final Operand handle; + + /** + * The index input + */ + public final Operand index; + + /** + * A float scalar that enforces proper chaining of operations. + */ + public final Operand flowIn; + + /** + * The type of the elem that is returned. + */ + public final DataType dtype; + + public Inputs(GraphOperation op) { + super(new TensorArrayRead<>(op), op, Arrays.asList("dtype")); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + index = (Operand) op.input(inputIndex++); + flowIn = (Operand) op.input(inputIndex++); + dtype = op.attributes().getAttrType("dtype"); + } } } 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 index cca05c5a71f..70e1b748367 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,28 +17,50 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.types.TFloat; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TFloat32; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** * 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`. + * {@code indices} must be a vector, its length must match the first dim of {@code value}. */ +@OpMetadata( + opType = TensorArrayScatter.OP_NAME, + inputsClass = TensorArrayScatter.Inputs.class +) @Operator -public final class TensorArrayScatter extends PrimitiveOp implements Operand { - +public final class TensorArrayScatter extends RawOp implements Operand { /** - * Factory method to create a class wrapping a new TensorArrayScatter operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorArrayScatterV3"; + + private Output flowOut; + + public TensorArrayScatter(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + flowOut = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new TensorArrayScatterV3 operation. + * * @param scope current scope * @param handle The handle to a TensorArray. * @param indices The locations at which to write the tensor elements. @@ -46,33 +68,70 @@ public final class TensorArrayScatter extends PrimitiveOp implements Operand TensorArrayScatter create(Scope scope, Operand handle, Operand indices, Operand value, Operand flowIn) { - OperationBuilder opBuilder = scope.env().opBuilder("TensorArrayScatterV3", scope.makeOpName("TensorArrayScatter")); + @Endpoint( + describeByClass = true + ) + public static TensorArrayScatter create(Scope scope, Operand handle, + Operand indices, Operand value, Operand flowIn) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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()); } - + /** + * Gets flowOut. * A float scalar that enforces proper chaining of operations. + * @return flowOut. */ - public Output flowOut() { + public Output flowOut() { return flowOut; } - + @Override - public Output asOutput() { + public Output asOutput() { return flowOut; } - - private Output flowOut; - - private TensorArrayScatter(Operation operation) { - super(operation); - int outputIdx = 0; - flowOut = operation.output(outputIdx++); + + @OpInputsMetadata( + outputsClass = TensorArrayScatter.class + ) + public static class Inputs extends RawOpInputs { + /** + * The handle to a TensorArray. + */ + public final Operand handle; + + /** + * The locations at which to write the tensor elements. + */ + public final Operand indices; + + /** + * The concatenated tensor to write to the TensorArray. + */ + public final Operand value; + + /** + * A float scalar that enforces proper chaining of operations. + */ + public final Operand flowIn; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new TensorArrayScatter(op), op, Arrays.asList("T")); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + value = (Operand) op.input(inputIndex++); + flowIn = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index f6e5036eaab..7719d72486a 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,55 +17,97 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.types.TFloat; +import org.tensorflow.types.TFloat32; import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TType; /** * Get the current size of the TensorArray. */ +@OpMetadata( + opType = TensorArraySize.OP_NAME, + inputsClass = TensorArraySize.Inputs.class +) @Operator -public final class TensorArraySize extends PrimitiveOp implements Operand { - +public final class TensorArraySize extends RawOp implements Operand { /** - * Factory method to create a class wrapping a new TensorArraySize operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorArraySizeV3"; + + private Output output; + + public TensorArraySize(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new TensorArraySizeV3 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")); + @Endpoint( + describeByClass = true + ) + public static TensorArraySize create(Scope scope, Operand handle, + Operand flowIn) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorArraySize"); opBuilder.addInput(handle.asOutput()); opBuilder.addInput(flowIn.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new TensorArraySize(opBuilder.build()); } - + /** + * Gets output. * The current size of the TensorArray. + * @return output. */ - public Output size() { - return size; + public Output output() { + return output; } - + @Override public Output asOutput() { - return size; + return output; } - - private Output size; - - private TensorArraySize(Operation operation) { - super(operation); - int outputIdx = 0; - size = operation.output(outputIdx++); + + @OpInputsMetadata( + outputsClass = TensorArraySize.class + ) + public static class Inputs extends RawOpInputs { + /** + * The handle to a TensorArray (output of TensorArray or TensorArrayGrad). + */ + public final Operand handle; + + /** + * A float scalar that enforces proper chaining of operations. + */ + public final Operand flowIn; + + public Inputs(GraphOperation op) { + super(new TensorArraySize(op), op, Arrays.asList()); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + flowIn = (Operand) op.input(inputIndex++); + } } } 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 index d4a9911f8a0..64ae60f124f 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,48 +17,66 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.types.TFloat; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TFloat32; import org.tensorflow.types.TInt64; import org.tensorflow.types.family.TType; /** * 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 ...}
- * + * Assuming that {@code lengths} takes on values + *
+ * (n0, n1, ..., n(T-1))
+ * 
+ *

and that {@code value} has shape + *

+ * (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 + *

+ * (n0 + n1 + ... + n(t-1), 0, 0, ...)
+ * 
+ *

and having size + *

+ * nt x d0 x d1 x ...
+ * 
*/ +@OpMetadata( + opType = TensorArraySplit.OP_NAME, + inputsClass = TensorArraySplit.Inputs.class +) @Operator -public final class TensorArraySplit extends PrimitiveOp implements Operand { - +public final class TensorArraySplit extends RawOp implements Operand { /** - * Factory method to create a class wrapping a new TensorArraySplit operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorArraySplitV3"; + + private Output flowOut; + + public TensorArraySplit(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + flowOut = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new TensorArraySplitV3 operation. + * * @param scope current scope * @param handle The handle to a TensorArray. * @param value The concatenated tensor to write to the TensorArray. @@ -67,33 +85,71 @@ public final class TensorArraySplit extends PrimitiveOp implements Operand TensorArraySplit create(Scope scope, Operand handle, Operand value, Operand lengths, Operand flowIn) { - OperationBuilder opBuilder = scope.env().opBuilder("TensorArraySplitV3", scope.makeOpName("TensorArraySplit")); + @Endpoint( + describeByClass = true + ) + public static TensorArraySplit create(Scope scope, Operand handle, + Operand value, Operand lengths, Operand flowIn) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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()); } - + /** + * Gets flowOut. * A float scalar that enforces proper chaining of operations. + * @return flowOut. */ - public Output flowOut() { + public Output flowOut() { return flowOut; } - + @Override - public Output asOutput() { + public Output asOutput() { return flowOut; } - - private Output flowOut; - - private TensorArraySplit(Operation operation) { - super(operation); - int outputIdx = 0; - flowOut = operation.output(outputIdx++); + + @OpInputsMetadata( + outputsClass = TensorArraySplit.class + ) + public static class Inputs extends RawOpInputs { + /** + * The handle to a TensorArray. + */ + public final Operand handle; + + /** + * The concatenated tensor to write to the TensorArray. + */ + public final Operand value; + + /** + * The vector of lengths, how to split the rows of value into the + * TensorArray. + */ + public final Operand lengths; + + /** + * A float scalar that enforces proper chaining of operations. + */ + public final Operand flowIn; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new TensorArraySplit(op), op, Arrays.asList("T")); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + value = (Operand) op.input(inputIndex++); + lengths = (Operand) op.input(inputIndex++); + flowIn = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index 92d73345394..da4be8f4436 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,56 +17,112 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.types.TFloat; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TFloat32; import org.tensorflow.types.TString; import org.tensorflow.types.family.TType; /** + * The TensorArrayUnpack operation */ +@OpMetadata( + opType = TensorArrayUnpack.OP_NAME, + inputsClass = TensorArrayUnpack.Inputs.class +) @Operator -public final class TensorArrayUnpack extends PrimitiveOp implements Operand { - +public final class TensorArrayUnpack extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorArrayUnpack"; + + private Output flowOut; + + public TensorArrayUnpack(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + flowOut = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new TensorArrayUnpack operation. - * + * * @param scope current scope - * @param handle - * @param value - * @param flowIn + * @param handle The handle value + * @param value The value value + * @param flowIn The flowIn value * @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")); + @Endpoint( + describeByClass = true + ) + public static TensorArrayUnpack create(Scope scope, Operand handle, + Operand value, Operand flowIn) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorArrayUnpack"); opBuilder.addInput(handle.asOutput()); opBuilder.addInput(value.asOutput()); opBuilder.addInput(flowIn.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new TensorArrayUnpack(opBuilder.build()); } - + /** + * Gets flowOut. + * + * @return flowOut. */ - public Output flowOut() { + public Output flowOut() { return flowOut; } - + @Override - public Output asOutput() { + public Output asOutput() { return flowOut; } - - private Output flowOut; - - private TensorArrayUnpack(Operation operation) { - super(operation); - int outputIdx = 0; - flowOut = operation.output(outputIdx++); + + @OpInputsMetadata( + outputsClass = TensorArrayUnpack.class + ) + public static class Inputs extends RawOpInputs { + /** + * The handle input + */ + public final Operand handle; + + /** + * The value input + */ + public final Operand value; + + /** + * The flowIn input + */ + public final Operand flowIn; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new TensorArrayUnpack(op), op, Arrays.asList("T")); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + value = (Operand) op.input(inputIndex++); + flowIn = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 index 4bae2f128ff..0b0a2156551 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,26 +17,49 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.types.TFloat; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TFloat32; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** * Push an element onto the tensor_array. */ +@OpMetadata( + opType = TensorArrayWrite.OP_NAME, + inputsClass = TensorArrayWrite.Inputs.class +) @Operator -public final class TensorArrayWrite extends PrimitiveOp implements Operand { - +public final class TensorArrayWrite extends RawOp implements Operand { /** - * Factory method to create a class wrapping a new TensorArrayWrite operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorArrayWriteV3"; + + private Output flowOut; + + public TensorArrayWrite(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + flowOut = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new TensorArrayWriteV3 operation. + * * @param scope current scope * @param handle The handle to a TensorArray. * @param index The position to write to inside the TensorArray. @@ -44,33 +67,70 @@ public final class TensorArrayWrite extends PrimitiveOp implements Operand TensorArrayWrite create(Scope scope, Operand handle, Operand index, Operand value, Operand flowIn) { - OperationBuilder opBuilder = scope.env().opBuilder("TensorArrayWriteV3", scope.makeOpName("TensorArrayWrite")); + @Endpoint( + describeByClass = true + ) + public static TensorArrayWrite create(Scope scope, Operand handle, + Operand index, Operand value, Operand flowIn) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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()); } - + /** + * Gets flowOut. * A float scalar that enforces proper chaining of operations. + * @return flowOut. */ - public Output flowOut() { + public Output flowOut() { return flowOut; } - + @Override - public Output asOutput() { + public Output asOutput() { return flowOut; } - - private Output flowOut; - - private TensorArrayWrite(Operation operation) { - super(operation); - int outputIdx = 0; - flowOut = operation.output(outputIdx++); + + @OpInputsMetadata( + outputsClass = TensorArrayWrite.class + ) + public static class Inputs extends RawOpInputs { + /** + * The handle to a TensorArray. + */ + public final Operand handle; + + /** + * The position to write to inside the TensorArray. + */ + public final Operand index; + + /** + * The tensor to write to the TensorArray. + */ + public final Operand value; + + /** + * A float scalar that enforces proper chaining of operations. + */ + public final Operand flowIn; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new TensorArrayWrite(op), op, Arrays.asList("T")); + int inputIndex = 0; + handle = (Operand) op.input(inputIndex++); + index = (Operand) op.input(inputIndex++); + value = (Operand) op.input(inputIndex++); + flowIn = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + } } } 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 deleted file mode 100644 index 7d376f8b2eb..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestCreateTreeVariable.java +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TString; - -/** - * 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 deleted file mode 100644 index 81dc608b273..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreeDeserialize.java +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TString; - -/** - * 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 deleted file mode 100644 index 1fd3f1c29c0..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreeIsInitializedOp.java +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TBool; - -/** - * 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 deleted file mode 100644 index f6589857f6d..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreePredict.java +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TFloat; - -/** - * 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 deleted file mode 100644 index 2c0fc923353..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreeResourceHandleOp.java +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TType; - -/** - * 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 deleted file mode 100644 index 86f0cb9715b..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreeSerialize.java +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TString; - -/** - * 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 deleted file mode 100644 index 23a4b12f856..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorForestTreeSize.java +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.TInt32; - -/** - * 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 index 53f42b43138..70ef65f9314 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,102 +17,140 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.tools.Shape; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt64; +import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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. + *

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 */ +@OpMetadata( + opType = TensorListConcat.OP_NAME, + inputsClass = TensorListConcat.Inputs.class +) @Operator -public final class TensorListConcat extends PrimitiveOp { - +public final class TensorListConcat extends RawOp { /** - * Optional attributes for {@link org.tensorflow.op.core.TensorListConcat} + * The name of this op, as known by TensorFlow core engine */ - public static class Options { - - /** - * @param elementShape - */ - public Options elementShape(Shape elementShape) { - this.elementShape = elementShape; - return this; - } - - private Shape elementShape; - - private Options() { - } + public static final String OP_NAME = "TensorListConcatV2"; + + private Output tensor; + + private Output lengths; + + public TensorListConcat(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + tensor = operation.output(outputIdx++); + lengths = operation.output(outputIdx++); } - + /** - * Factory method to create a class wrapping a new TensorListConcat operation. - * + * Factory method to create a class wrapping a new TensorListConcatV2 operation. + * * @param scope current scope - * @param inputHandle - * @param elementDtype - * @param options carries optional attributes values + * @param inputHandle The inputHandle value + * @param elementShape The elementShape value + * @param leadingDims The leadingDims value + * @param elementDtype The value of the elementDtype attribute + * @param data type for {@code TensorListConcatV2} output and operands * @return a new instance of TensorListConcat */ - public static TensorListConcat create(Scope scope, Operand inputHandle, DataType elementDtype, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("TensorListConcat", scope.makeOpName("TensorListConcat")); + @Endpoint( + describeByClass = true + ) + public static TensorListConcat create(Scope scope, + Operand inputHandle, Operand elementShape, + Operand leadingDims, Class elementDtype) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorListConcat"); opBuilder.addInput(inputHandle.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("element_dtype", 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); + opBuilder.addInput(elementShape.asOutput()); + opBuilder.addInput(leadingDims.asOutput()); + opBuilder.setAttr("element_dtype", Operands.toDataType(elementDtype)); + return new TensorListConcat<>(opBuilder.build()); } - + /** + * Gets tensor. + * + * @return tensor. */ - public Output tensor() { + public Output tensor() { return tensor; } - + /** + * Gets lengths. + * + * @return lengths. */ 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++); + + @OpInputsMetadata( + outputsClass = TensorListConcat.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The inputHandle input + */ + public final Operand inputHandle; + + /** + * The elementShape input + */ + public final Operand elementShape; + + /** + * The leadingDims input + */ + public final Operand leadingDims; + + /** + * The elementDtype attribute + */ + public final DataType elementDtype; + + /** + * The shapeType attribute + */ + public final DataType shapeType; + + public Inputs(GraphOperation op) { + super(new TensorListConcat<>(op), op, Arrays.asList("element_dtype", "shape_type")); + int inputIndex = 0; + inputHandle = (Operand) op.input(inputIndex++); + elementShape = (Operand) op.input(inputIndex++); + leadingDims = (Operand) op.input(inputIndex++); + elementDtype = op.attributes().getAttrType("element_dtype"); + shapeType = op.attributes().getAttrType("shape_type"); + } } } 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 index bcd89b65021..c42fdd43d92 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,56 +17,108 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** + * The TensorListConcatLists operation */ +@OpMetadata( + opType = TensorListConcatLists.OP_NAME, + inputsClass = TensorListConcatLists.Inputs.class +) @Operator -public final class TensorListConcatLists extends PrimitiveOp implements Operand { - +public final class TensorListConcatLists extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorListConcatLists"; + + private Output output; + + @SuppressWarnings("unchecked") + public TensorListConcatLists(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new TensorListConcatLists operation. - * + * * @param scope current scope - * @param inputA - * @param inputB - * @param elementDtype + * @param inputA The inputA value + * @param inputB The inputB value + * @param elementDtype The value of the elementDtype attribute + * @param data type for {@code TensorListConcatLists} output and operands * @return a new instance of TensorListConcatLists */ - public static TensorListConcatLists create(Scope scope, Operand inputA, Operand inputB, DataType elementDtype) { - OperationBuilder opBuilder = scope.env().opBuilder("TensorListConcatLists", scope.makeOpName("TensorListConcatLists")); + @Endpoint( + describeByClass = true + ) + public static TensorListConcatLists create(Scope scope, + Operand inputA, Operand inputB, Class elementDtype) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorListConcatLists"); opBuilder.addInput(inputA.asOutput()); opBuilder.addInput(inputB.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("element_dtype", elementDtype); + opBuilder.setAttr("element_dtype", Operands.toDataType(elementDtype)); return new TensorListConcatLists(opBuilder.build()); } - + /** + * Gets output. + * + * @return output. */ - public Output output() { + 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++); + + @OpInputsMetadata( + outputsClass = TensorListConcatLists.class + ) + public static class Inputs extends RawOpInputs { + /** + * The inputA input + */ + public final Operand inputA; + + /** + * The inputB input + */ + public final Operand inputB; + + /** + * The elementDtype attribute + */ + public final DataType elementDtype; + + public Inputs(GraphOperation op) { + super(new TensorListConcatLists(op), op, Arrays.asList("element_dtype")); + int inputIndex = 0; + inputA = (Operand) op.input(inputIndex++); + inputB = (Operand) op.input(inputIndex++); + elementDtype = op.attributes().getAttrType("element_dtype"); + } } } 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 deleted file mode 100644 index 19dc4ed9206..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListConcatV2.java +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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, DataType 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", 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 index b021a3c616e..6190f9c1c01 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,60 +17,101 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 + * input_handle: the list + * element_shape: the shape of elements of the list */ +@OpMetadata( + opType = TensorListElementShape.OP_NAME, + inputsClass = TensorListElementShape.Inputs.class +) @Operator -public final class TensorListElementShape extends PrimitiveOp implements Operand { - +public final class TensorListElementShape extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorListElementShape"; + + private Output elementShape; + + public TensorListElementShape(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + elementShape = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new TensorListElementShape operation. - * + * * @param scope current scope - * @param inputHandle - * @param shapeType + * @param inputHandle The inputHandle value + * @param shapeType The value of the shapeType attribute + * @param data type for {@code TensorListElementShape} output and operands * @return a new instance of TensorListElementShape */ - public static TensorListElementShape create(Scope scope, Operand inputHandle, DataType shapeType) { - OperationBuilder opBuilder = scope.env().opBuilder("TensorListElementShape", scope.makeOpName("TensorListElementShape")); + @Endpoint( + describeByClass = true + ) + public static TensorListElementShape create(Scope scope, + Operand inputHandle, Class shapeType) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorListElementShape"); opBuilder.addInput(inputHandle.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("shape_type", shapeType); - return new TensorListElementShape(opBuilder.build()); + opBuilder.setAttr("shape_type", Operands.toDataType(shapeType)); + return new TensorListElementShape<>(opBuilder.build()); } - + /** + * Gets elementShape. + * + * @return elementShape. */ 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++); + + @OpInputsMetadata( + outputsClass = TensorListElementShape.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The inputHandle input + */ + public final Operand inputHandle; + + /** + * The shapeType attribute + */ + public final DataType shapeType; + + public Inputs(GraphOperation op) { + super(new TensorListElementShape<>(op), op, Arrays.asList("shape_type")); + int inputIndex = 0; + inputHandle = (Operand) op.input(inputIndex++); + shapeType = op.attributes().getAttrType("shape_type"); + } } } 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 index ad54bd8eb6c..6b268fa40b6 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,60 +17,114 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * Creates a TensorList which, when stacked, has the value of `tensor`. - *

+ * Creates a TensorList which, when stacked, has the value of {@code tensor}. * Each tensor in the result list corresponds to one row of the input tensor. - *

- * tensor: The input tensor. + *

tensor: The input tensor. * output_handle: The list. */ +@OpMetadata( + opType = TensorListFromTensor.OP_NAME, + inputsClass = TensorListFromTensor.Inputs.class +) @Operator -public final class TensorListFromTensor extends PrimitiveOp implements Operand { - +public final class TensorListFromTensor extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorListFromTensor"; + + private Output outputHandle; + + @SuppressWarnings("unchecked") + public TensorListFromTensor(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputHandle = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new TensorListFromTensor operation. - * + * * @param scope current scope - * @param tensor - * @param elementShape + * @param tensor The tensor value + * @param elementShape The elementShape value * @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")); + @Endpoint( + describeByClass = true + ) + public static TensorListFromTensor create(Scope scope, Operand tensor, + Operand elementShape) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorListFromTensor"); opBuilder.addInput(tensor.asOutput()); opBuilder.addInput(elementShape.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new TensorListFromTensor(opBuilder.build()); } - + /** + * Gets outputHandle. + * + * @return outputHandle. */ - public Output outputHandle() { + 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++); + + @OpInputsMetadata( + outputsClass = TensorListFromTensor.class + ) + public static class Inputs extends RawOpInputs { + /** + * The tensor input + */ + public final Operand tensor; + + /** + * The elementShape input + */ + public final Operand elementShape; + + /** + * The elementDtype attribute + */ + public final DataType elementDtype; + + /** + * The shapeType attribute + */ + public final DataType shapeType; + + public Inputs(GraphOperation op) { + super(new TensorListFromTensor(op), op, Arrays.asList("element_dtype", "shape_type")); + int inputIndex = 0; + tensor = (Operand) op.input(inputIndex++); + elementShape = (Operand) op.input(inputIndex++); + elementDtype = op.attributes().getAttrType("element_dtype"); + shapeType = op.attributes().getAttrType("shape_type"); + } } } 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 index e8e11695421..ac725c72b97 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,68 +17,121 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** * 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. + * specified by the given index (see {@code 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 */ +@OpMetadata( + opType = TensorListGather.OP_NAME, + inputsClass = TensorListGather.Inputs.class +) @Operator -public final class TensorListGather extends PrimitiveOp implements Operand { - +public final class TensorListGather extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorListGather"; + + private Output values; + + public TensorListGather(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + values = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new TensorListGather operation. - * + * * @param scope current scope - * @param inputHandle - * @param indices - * @param elementShape - * @param elementDtype + * @param inputHandle The inputHandle value + * @param indices The indices value + * @param elementShape The elementShape value + * @param elementDtype The value of the elementDtype attribute + * @param data type for {@code TensorListGather} output and operands * @return a new instance of TensorListGather */ - public static TensorListGather create(Scope scope, Operand inputHandle, Operand indices, Operand elementShape, DataType elementDtype) { - OperationBuilder opBuilder = scope.env().opBuilder("TensorListGather", scope.makeOpName("TensorListGather")); + @Endpoint( + describeByClass = true + ) + public static TensorListGather create(Scope scope, + Operand inputHandle, Operand indices, Operand elementShape, + Class elementDtype) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorListGather"); opBuilder.addInput(inputHandle.asOutput()); opBuilder.addInput(indices.asOutput()); opBuilder.addInput(elementShape.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("element_dtype", elementDtype); - return new TensorListGather(opBuilder.build()); + opBuilder.setAttr("element_dtype", Operands.toDataType(elementDtype)); + return new TensorListGather<>(opBuilder.build()); } - + /** + * Gets values. + * + * @return values. */ 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++); + + @OpInputsMetadata( + outputsClass = TensorListGather.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The inputHandle input + */ + public final Operand inputHandle; + + /** + * The indices input + */ + public final Operand indices; + + /** + * The elementShape input + */ + public final Operand elementShape; + + /** + * The elementDtype attribute + */ + public final DataType elementDtype; + + public Inputs(GraphOperation op) { + super(new TensorListGather<>(op), op, Arrays.asList("element_dtype")); + int inputIndex = 0; + inputHandle = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + elementShape = (Operand) op.input(inputIndex++); + elementDtype = op.attributes().getAttrType("element_dtype"); + } } } 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 index 113aec72352..8fbdb5e80e0 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,59 +17,126 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * @param data type for {@code item()} output + * Returns the item in the list with the given index. + * input_handle: the list + * index: the position in the list from which an element will be retrieved + * item: the element at that position */ +@OpMetadata( + opType = TensorListGetItem.OP_NAME, + inputsClass = TensorListGetItem.Inputs.class +) @Operator -public final class TensorListGetItem extends PrimitiveOp implements Operand { - +public final class TensorListGetItem extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorListGetItem"; + + private Output item; + + public TensorListGetItem(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + item = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new TensorListGetItem operation. - * + * * @param scope current scope - * @param inputHandle - * @param index - * @param elementShape - * @param elementDtype + * @param inputHandle The inputHandle value + * @param index The index value + * @param elementShape The elementShape value + * @param elementDtype The value of the elementDtype attribute + * @param data type for {@code TensorListGetItem} output and operands * @return a new instance of TensorListGetItem */ - public static TensorListGetItem create(Scope scope, Operand inputHandle, Operand index, Operand elementShape, DataType elementDtype) { - OperationBuilder opBuilder = scope.env().opBuilder("TensorListGetItem", scope.makeOpName("TensorListGetItem")); + @Endpoint( + describeByClass = true + ) + public static TensorListGetItem create(Scope scope, + Operand inputHandle, Operand index, + Operand elementShape, Class elementDtype) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorListGetItem"); opBuilder.addInput(inputHandle.asOutput()); opBuilder.addInput(index.asOutput()); opBuilder.addInput(elementShape.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("element_dtype", elementDtype); - return new TensorListGetItem(opBuilder.build()); + opBuilder.setAttr("element_dtype", Operands.toDataType(elementDtype)); + return new TensorListGetItem<>(opBuilder.build()); } - + /** + * Gets item. + * + * @return item. */ - public Output item() { + public Output item() { return item; } - + @Override - public Output asOutput() { + public Output asOutput() { return item; } - - private Output item; - - private TensorListGetItem(Operation operation) { - super(operation); - int outputIdx = 0; - item = operation.output(outputIdx++); + + @OpInputsMetadata( + outputsClass = TensorListGetItem.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The inputHandle input + */ + public final Operand inputHandle; + + /** + * The index input + */ + public final Operand index; + + /** + * The elementShape input + */ + public final Operand elementShape; + + /** + * The elementDtype attribute + */ + public final DataType elementDtype; + + /** + * The Tshape attribute + */ + public final DataType Tshape; + + public Inputs(GraphOperation op) { + super(new TensorListGetItem<>(op), op, Arrays.asList("element_dtype", "Tshape")); + int inputIndex = 0; + inputHandle = (Operand) op.input(inputIndex++); + index = (Operand) op.input(inputIndex++); + elementShape = (Operand) op.input(inputIndex++); + elementDtype = op.attributes().getAttrType("element_dtype"); + Tshape = op.attributes().getAttrType("Tshape"); + } } } 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 index f0a5747633a..c00f4e03790 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,54 +17,89 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TType; /** * Returns the number of tensors in the input tensor list. - *

* input_handle: the input list * length: the number of tensors in the list */ +@OpMetadata( + opType = TensorListLength.OP_NAME, + inputsClass = TensorListLength.Inputs.class +) @Operator -public final class TensorListLength extends PrimitiveOp implements Operand { - +public final class TensorListLength extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorListLength"; + + private Output length; + + public TensorListLength(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + length = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new TensorListLength operation. - * + * * @param scope current scope - * @param inputHandle + * @param inputHandle The inputHandle value * @return a new instance of TensorListLength */ - public static TensorListLength create(Scope scope, Operand inputHandle) { - OperationBuilder opBuilder = scope.env().opBuilder("TensorListLength", scope.makeOpName("TensorListLength")); + @Endpoint( + describeByClass = true + ) + public static TensorListLength create(Scope scope, Operand inputHandle) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorListLength"); opBuilder.addInput(inputHandle.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new TensorListLength(opBuilder.build()); } - + /** + * Gets length. + * + * @return length. */ 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++); + + @OpInputsMetadata( + outputsClass = TensorListLength.class + ) + public static class Inputs extends RawOpInputs { + /** + * The inputHandle input + */ + public final Operand inputHandle; + + public Inputs(GraphOperation op) { + super(new TensorListLength(op), op, Arrays.asList()); + int inputIndex = 0; + inputHandle = (Operand) op.input(inputIndex++); + } } } 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 index ab004bc71e0..af805e71f9b 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,69 +17,120 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** * 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 + *

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 */ +@OpMetadata( + opType = TensorListPopBack.OP_NAME, + inputsClass = TensorListPopBack.Inputs.class +) @Operator -public final class TensorListPopBack extends PrimitiveOp { - +public final class TensorListPopBack extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorListPopBack"; + + private Output outputHandle; + + private Output tensor; + + @SuppressWarnings("unchecked") + public TensorListPopBack(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputHandle = operation.output(outputIdx++); + tensor = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new TensorListPopBack operation. - * + * * @param scope current scope - * @param inputHandle - * @param elementShape - * @param elementDtype + * @param inputHandle The inputHandle value + * @param elementShape The elementShape value + * @param elementDtype The value of the elementDtype attribute + * @param data type for {@code TensorListPopBack} output and operands * @return a new instance of TensorListPopBack */ - public static TensorListPopBack create(Scope scope, Operand inputHandle, Operand elementShape, DataType elementDtype) { - OperationBuilder opBuilder = scope.env().opBuilder("TensorListPopBack", scope.makeOpName("TensorListPopBack")); + @Endpoint( + describeByClass = true + ) + public static TensorListPopBack create(Scope scope, + Operand inputHandle, Operand elementShape, Class elementDtype) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorListPopBack"); opBuilder.addInput(inputHandle.asOutput()); opBuilder.addInput(elementShape.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("element_dtype", elementDtype); - return new TensorListPopBack(opBuilder.build()); + opBuilder.setAttr("element_dtype", Operands.toDataType(elementDtype)); + return new TensorListPopBack<>(opBuilder.build()); } - + /** + * Gets outputHandle. + * + * @return outputHandle. */ - public Output outputHandle() { + public Output outputHandle() { return outputHandle; } - + /** + * Gets tensor. + * + * @return tensor. */ 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++); + + @OpInputsMetadata( + outputsClass = TensorListPopBack.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The inputHandle input + */ + public final Operand inputHandle; + + /** + * The elementShape input + */ + public final Operand elementShape; + + /** + * The elementDtype attribute + */ + public final DataType elementDtype; + + public Inputs(GraphOperation op) { + super(new TensorListPopBack<>(op), op, Arrays.asList("element_dtype")); + int inputIndex = 0; + inputHandle = (Operand) op.input(inputIndex++); + elementShape = (Operand) op.input(inputIndex++); + elementDtype = op.attributes().getAttrType("element_dtype"); + } } } 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 index 33739c9d0e0..3a85c898752 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,60 +17,109 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** - * Returns a list which has the passed-in `Tensor` as last element and the other elements of the given list in `input_handle`. - *

+ * Returns a list which has the passed-in {@code Tensor} as last element and the other elements of the given list in {@code 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. */ +@OpMetadata( + opType = TensorListPushBack.OP_NAME, + inputsClass = TensorListPushBack.Inputs.class +) @Operator -public final class TensorListPushBack extends PrimitiveOp implements Operand { - +public final class TensorListPushBack extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorListPushBack"; + + private Output outputHandle; + + @SuppressWarnings("unchecked") + public TensorListPushBack(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputHandle = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new TensorListPushBack operation. - * + * * @param scope current scope - * @param inputHandle - * @param tensor + * @param inputHandle The inputHandle value + * @param tensor The tensor value * @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")); + @Endpoint( + describeByClass = true + ) + public static TensorListPushBack create(Scope scope, Operand inputHandle, + Operand tensor) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorListPushBack"); opBuilder.addInput(inputHandle.asOutput()); opBuilder.addInput(tensor.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new TensorListPushBack(opBuilder.build()); } - + /** + * Gets outputHandle. + * + * @return outputHandle. */ - public Output outputHandle() { + 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++); + + @OpInputsMetadata( + outputsClass = TensorListPushBack.class + ) + public static class Inputs extends RawOpInputs { + /** + * The inputHandle input + */ + public final Operand inputHandle; + + /** + * The tensor input + */ + public final Operand tensor; + + /** + * The elementDtype attribute + */ + public final DataType elementDtype; + + public Inputs(GraphOperation op) { + super(new TensorListPushBack(op), op, Arrays.asList("element_dtype")); + int inputIndex = 0; + inputHandle = (Operand) op.input(inputIndex++); + tensor = (Operand) op.input(inputIndex++); + elementDtype = op.attributes().getAttrType("element_dtype"); + } } } 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 index 029e362c85b..fe3c113c12a 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,53 +17,104 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TType; /** + * The TensorListPushBackBatch operation */ +@OpMetadata( + opType = TensorListPushBackBatch.OP_NAME, + inputsClass = TensorListPushBackBatch.Inputs.class +) @Operator -public final class TensorListPushBackBatch extends PrimitiveOp implements Operand { - +public final class TensorListPushBackBatch extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorListPushBackBatch"; + + private Output outputHandles; + + @SuppressWarnings("unchecked") + public TensorListPushBackBatch(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputHandles = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new TensorListPushBackBatch operation. - * + * * @param scope current scope - * @param inputHandles - * @param tensor + * @param inputHandles The inputHandles value + * @param tensor The tensor value * @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")); + @Endpoint( + describeByClass = true + ) + public static TensorListPushBackBatch create(Scope scope, Operand inputHandles, + Operand tensor) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorListPushBackBatch"); opBuilder.addInput(inputHandles.asOutput()); opBuilder.addInput(tensor.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new TensorListPushBackBatch(opBuilder.build()); } - + /** + * Gets outputHandles. + * + * @return outputHandles. */ - public Output outputHandles() { + 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++); + + @OpInputsMetadata( + outputsClass = TensorListPushBackBatch.class + ) + public static class Inputs extends RawOpInputs { + /** + * The inputHandles input + */ + public final Operand inputHandles; + + /** + * The tensor input + */ + public final Operand tensor; + + /** + * The elementDtype attribute + */ + public final DataType elementDtype; + + public Inputs(GraphOperation op) { + super(new TensorListPushBackBatch(op), op, Arrays.asList("element_dtype")); + int inputIndex = 0; + inputHandles = (Operand) op.input(inputIndex++); + tensor = (Operand) op.input(inputIndex++); + elementDtype = op.attributes().getAttrType("element_dtype"); + } } } 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 index 2fe38d964fb..8c3393a1ef0 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,64 +17,120 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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. */ +@OpMetadata( + opType = TensorListReserve.OP_NAME, + inputsClass = TensorListReserve.Inputs.class +) @Operator -public final class TensorListReserve extends PrimitiveOp implements Operand { - +public final class TensorListReserve extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorListReserve"; + + private Output handle; + + @SuppressWarnings("unchecked") + public TensorListReserve(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + handle = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new TensorListReserve operation. - * + * * @param scope current scope - * @param elementShape - * @param numElements - * @param elementDtype + * @param elementShape The elementShape value + * @param numElements The numElements value + * @param elementDtype The value of the elementDtype attribute + * @param data type for {@code TensorListReserve} output and operands * @return a new instance of TensorListReserve */ - public static TensorListReserve create(Scope scope, Operand elementShape, Operand numElements, DataType elementDtype) { - OperationBuilder opBuilder = scope.env().opBuilder("TensorListReserve", scope.makeOpName("TensorListReserve")); + @Endpoint( + describeByClass = true + ) + public static TensorListReserve create(Scope scope, + Operand elementShape, Operand numElements, Class elementDtype) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorListReserve"); opBuilder.addInput(elementShape.asOutput()); opBuilder.addInput(numElements.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("element_dtype", elementDtype); + opBuilder.setAttr("element_dtype", Operands.toDataType(elementDtype)); return new TensorListReserve(opBuilder.build()); } - + /** + * Gets handle. + * + * @return handle. */ - public Output handle() { + 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++); + + @OpInputsMetadata( + outputsClass = TensorListReserve.class + ) + public static class Inputs extends RawOpInputs { + /** + * The elementShape input + */ + public final Operand elementShape; + + /** + * The numElements input + */ + public final Operand numElements; + + /** + * The elementDtype attribute + */ + public final DataType elementDtype; + + /** + * The shapeType attribute + */ + public final DataType shapeType; + + public Inputs(GraphOperation op) { + super(new TensorListReserve(op), op, Arrays.asList("element_dtype", "shape_type")); + int inputIndex = 0; + elementShape = (Operand) op.input(inputIndex++); + numElements = (Operand) op.input(inputIndex++); + elementDtype = op.attributes().getAttrType("element_dtype"); + shapeType = op.attributes().getAttrType("shape_type"); + } } } 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 index 4ada0ecc87e..0b8aa70e6b1 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,60 +17,100 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** * Resizes the list. - *

- * * input_handle: the input list * size: size of the output list - * */ +@OpMetadata( + opType = TensorListResize.OP_NAME, + inputsClass = TensorListResize.Inputs.class +) @Operator -public final class TensorListResize extends PrimitiveOp implements Operand { - +public final class TensorListResize extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorListResize"; + + private Output outputHandle; + + @SuppressWarnings("unchecked") + public TensorListResize(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputHandle = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new TensorListResize operation. - * + * * @param scope current scope - * @param inputHandle - * @param size + * @param inputHandle The inputHandle value + * @param sizeOutput The sizeOutput value * @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")); + @Endpoint( + describeByClass = true + ) + public static TensorListResize create(Scope scope, Operand inputHandle, + Operand sizeOutput) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorListResize"); opBuilder.addInput(inputHandle.asOutput()); - opBuilder.addInput(size.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.addInput(sizeOutput.asOutput()); return new TensorListResize(opBuilder.build()); } - + /** + * Gets outputHandle. + * + * @return outputHandle. */ - public Output outputHandle() { + 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++); + + @OpInputsMetadata( + outputsClass = TensorListResize.class + ) + public static class Inputs extends RawOpInputs { + /** + * The inputHandle input + */ + public final Operand inputHandle; + + /** + * The sizeOutput input + */ + public final Operand sizeOutput; + + public Inputs(GraphOperation op) { + super(new TensorListResize(op), op, Arrays.asList()); + int inputIndex = 0; + inputHandle = (Operand) op.input(inputIndex++); + sizeOutput = (Operand) op.input(inputIndex++); + } } } 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 index ce0f7447d32..43bf2d40dd6 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,67 +17,139 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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. + * specified by the given index (see {@code 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). + * 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. */ +@OpMetadata( + opType = TensorListScatter.OP_NAME, + inputsClass = TensorListScatter.Inputs.class +) @Operator -public final class TensorListScatter extends PrimitiveOp implements Operand { - +public final class TensorListScatter extends RawOp implements Operand { /** - * Factory method to create a class wrapping a new TensorListScatter operation. - * + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorListScatterV2"; + + private Output outputHandle; + + @SuppressWarnings("unchecked") + public TensorListScatter(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputHandle = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new TensorListScatterV2 operation. + * * @param scope current scope - * @param tensor - * @param indices - * @param elementShape + * @param tensor The tensor value + * @param indices The indices value + * @param elementShape The elementShape value + * @param numElements The numElements value * @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")); + @Endpoint( + describeByClass = true + ) + public static TensorListScatter create(Scope scope, Operand tensor, + Operand indices, Operand elementShape, + Operand numElements) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorListScatter"); opBuilder.addInput(tensor.asOutput()); opBuilder.addInput(indices.asOutput()); opBuilder.addInput(elementShape.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); + opBuilder.addInput(numElements.asOutput()); return new TensorListScatter(opBuilder.build()); } - + /** + * Gets outputHandle. + * + * @return outputHandle. */ - public Output outputHandle() { + 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++); + + @OpInputsMetadata( + outputsClass = TensorListScatter.class + ) + public static class Inputs extends RawOpInputs { + /** + * The tensor input + */ + public final Operand tensor; + + /** + * The indices input + */ + public final Operand indices; + + /** + * The elementShape input + */ + public final Operand elementShape; + + /** + * The numElements input + */ + public final Operand numElements; + + /** + * The elementDtype attribute + */ + public final DataType elementDtype; + + /** + * The shapeType attribute + */ + public final DataType shapeType; + + public Inputs(GraphOperation op) { + super(new TensorListScatter(op), op, Arrays.asList("element_dtype", "shape_type")); + int inputIndex = 0; + tensor = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + elementShape = (Operand) op.input(inputIndex++); + numElements = (Operand) op.input(inputIndex++); + elementDtype = op.attributes().getAttrType("element_dtype"); + shapeType = op.attributes().getAttrType("shape_type"); + } } } 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 index 254bdd83878..4a7c7523b6a 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,65 +17,120 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** * 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. + * specified by the given index (see {@code 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. */ +@OpMetadata( + opType = TensorListScatterIntoExistingList.OP_NAME, + inputsClass = TensorListScatterIntoExistingList.Inputs.class +) @Operator -public final class TensorListScatterIntoExistingList extends PrimitiveOp implements Operand { - +public final class TensorListScatterIntoExistingList extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorListScatterIntoExistingList"; + + private Output outputHandle; + + @SuppressWarnings("unchecked") + public TensorListScatterIntoExistingList(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputHandle = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new TensorListScatterIntoExistingList operation. - * + * * @param scope current scope - * @param inputHandle - * @param tensor - * @param indices + * @param inputHandle The inputHandle value + * @param tensor The tensor value + * @param indices The indices value * @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")); + @Endpoint( + describeByClass = true + ) + public static TensorListScatterIntoExistingList create(Scope scope, + Operand inputHandle, Operand tensor, + Operand indices) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorListScatterIntoExistingList"); opBuilder.addInput(inputHandle.asOutput()); opBuilder.addInput(tensor.asOutput()); opBuilder.addInput(indices.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new TensorListScatterIntoExistingList(opBuilder.build()); } - + /** + * Gets outputHandle. + * + * @return outputHandle. */ - public Output outputHandle() { + 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++); + + @OpInputsMetadata( + outputsClass = TensorListScatterIntoExistingList.class + ) + public static class Inputs extends RawOpInputs { + /** + * The inputHandle input + */ + public final Operand inputHandle; + + /** + * The tensor input + */ + public final Operand tensor; + + /** + * The indices input + */ + public final Operand indices; + + /** + * The elementDtype attribute + */ + public final DataType elementDtype; + + public Inputs(GraphOperation op) { + super(new TensorListScatterIntoExistingList(op), op, Arrays.asList("element_dtype")); + int inputIndex = 0; + inputHandle = (Operand) op.input(inputIndex++); + tensor = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + elementDtype = op.attributes().getAttrType("element_dtype"); + } } } 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 deleted file mode 100644 index 5bf86107ed8..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListScatterV2.java +++ /dev/null @@ -1,88 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.TInt32; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 index 780fe704826..9819855d789 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,56 +17,162 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** + * Sets the index-th position of the list to contain the given tensor. + * input_handle: the list + * index: the position in the list to which the tensor will be assigned + * item: the element to be assigned to that position + * output_handle: the new list, with the element in the proper position */ +@OpMetadata( + opType = TensorListSetItem.OP_NAME, + inputsClass = TensorListSetItem.Inputs.class +) @Operator -public final class TensorListSetItem extends PrimitiveOp implements Operand { - +public final class TensorListSetItem extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorListSetItem"; + + private Output outputHandle; + + @SuppressWarnings("unchecked") + public TensorListSetItem(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputHandle = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new TensorListSetItem operation. - * + * * @param scope current scope - * @param inputHandle - * @param index - * @param item + * @param inputHandle The inputHandle value + * @param index The index value + * @param item The item value + * @param options carries optional attribute values * @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")); + @Endpoint( + describeByClass = true + ) + public static TensorListSetItem create(Scope scope, Operand inputHandle, + Operand index, Operand item, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorListSetItem"); opBuilder.addInput(inputHandle.asOutput()); opBuilder.addInput(index.asOutput()); opBuilder.addInput(item.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); + if (options != null) { + for (Options opts : options) { + if (opts.resizeIfIndexOutOfBounds != null) { + opBuilder.setAttr("resize_if_index_out_of_bounds", opts.resizeIfIndexOutOfBounds); + } + } + } return new TensorListSetItem(opBuilder.build()); } - + /** + * Sets the resizeIfIndexOutOfBounds option. + * + * @param resizeIfIndexOutOfBounds the resizeIfIndexOutOfBounds option + * @return this Options instance. */ - public Output outputHandle() { + public static Options resizeIfIndexOutOfBounds(Boolean resizeIfIndexOutOfBounds) { + return new Options().resizeIfIndexOutOfBounds(resizeIfIndexOutOfBounds); + } + + /** + * Gets outputHandle. + * + * @return outputHandle. + */ + 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.TensorListSetItem} + */ + public static class Options { + private Boolean resizeIfIndexOutOfBounds; + + private Options() { + } + + /** + * Sets the resizeIfIndexOutOfBounds option. + * + * @param resizeIfIndexOutOfBounds the resizeIfIndexOutOfBounds option + * @return this Options instance. + */ + public Options resizeIfIndexOutOfBounds(Boolean resizeIfIndexOutOfBounds) { + this.resizeIfIndexOutOfBounds = resizeIfIndexOutOfBounds; + return this; + } + } + + @OpInputsMetadata( + outputsClass = TensorListSetItem.class + ) + public static class Inputs extends RawOpInputs { + /** + * The inputHandle input + */ + public final Operand inputHandle; + + /** + * The index input + */ + public final Operand index; + + /** + * The item input + */ + public final Operand item; + + /** + * The elementDtype attribute + */ + public final DataType elementDtype; + + /** + * The resizeIfIndexOutOfBounds attribute + */ + public final boolean resizeIfIndexOutOfBounds; + + public Inputs(GraphOperation op) { + super(new TensorListSetItem(op), op, Arrays.asList("element_dtype", "resize_if_index_out_of_bounds")); + int inputIndex = 0; + inputHandle = (Operand) op.input(inputIndex++); + index = (Operand) op.input(inputIndex++); + item = (Operand) op.input(inputIndex++); + elementDtype = op.attributes().getAttrType("element_dtype"); + resizeIfIndexOutOfBounds = op.attributes().getAttrBool("resize_if_index_out_of_bounds"); + } } } 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 index 914b6a3fd29..eb757e2f297 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,66 +17,126 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt64; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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. + *

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. */ +@OpMetadata( + opType = TensorListSplit.OP_NAME, + inputsClass = TensorListSplit.Inputs.class +) @Operator -public final class TensorListSplit extends PrimitiveOp implements Operand { - +public final class TensorListSplit extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorListSplit"; + + private Output outputHandle; + + @SuppressWarnings("unchecked") + public TensorListSplit(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputHandle = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new TensorListSplit operation. - * + * * @param scope current scope - * @param tensor - * @param elementShape - * @param lengths + * @param tensor The tensor value + * @param elementShape The elementShape value + * @param lengths The lengths value * @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")); + @Endpoint( + describeByClass = true + ) + public static TensorListSplit create(Scope scope, Operand tensor, + Operand elementShape, Operand lengths) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorListSplit"); opBuilder.addInput(tensor.asOutput()); opBuilder.addInput(elementShape.asOutput()); opBuilder.addInput(lengths.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); return new TensorListSplit(opBuilder.build()); } - + /** + * Gets outputHandle. + * + * @return outputHandle. */ - public Output outputHandle() { + 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++); + + @OpInputsMetadata( + outputsClass = TensorListSplit.class + ) + public static class Inputs extends RawOpInputs { + /** + * The tensor input + */ + public final Operand tensor; + + /** + * The elementShape input + */ + public final Operand elementShape; + + /** + * The lengths input + */ + public final Operand lengths; + + /** + * The elementDtype attribute + */ + public final DataType elementDtype; + + /** + * The shapeType attribute + */ + public final DataType shapeType; + + public Inputs(GraphOperation op) { + super(new TensorListSplit(op), op, Arrays.asList("element_dtype", "shape_type")); + int inputIndex = 0; + tensor = (Operand) op.input(inputIndex++); + elementShape = (Operand) op.input(inputIndex++); + lengths = (Operand) op.input(inputIndex++); + elementDtype = op.attributes().getAttrType("element_dtype"); + shapeType = op.attributes().getAttrType("shape_type"); + } } } 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 index cd725da36eb..2d058b8e00d 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,67 +17,71 @@ package org.tensorflow.op.core; -import org.tensorflow.DataType; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.Operands; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TType; /** * Stacks all tensors in the list. - *

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

- * input_handle: the input list + *

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 */ +@OpMetadata( + opType = TensorListStack.OP_NAME, + inputsClass = TensorListStack.Inputs.class +) @Operator -public final class TensorListStack extends PrimitiveOp implements Operand { - +public final class TensorListStack extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.TensorListStack} + * The name of this op, as known by TensorFlow core engine */ - public static class Options { - - /** - * @param numElements - */ - public Options numElements(Long numElements) { - this.numElements = numElements; - return this; - } - - private Long numElements; - - private Options() { - } + public static final String OP_NAME = "TensorListStack"; + + private Output tensor; + + public TensorListStack(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + tensor = operation.output(outputIdx++); } - + /** * 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 + * @param inputHandle The inputHandle value + * @param elementShape The elementShape value + * @param elementDtype The value of the elementDtype attribute + * @param options carries optional attribute values + * @param data type for {@code TensorListStack} output and operands * @return a new instance of TensorListStack */ - public static TensorListStack create(Scope scope, Operand inputHandle, Operand elementShape, DataType elementDtype, Options... options) { - OperationBuilder opBuilder = scope.env().opBuilder("TensorListStack", scope.makeOpName("TensorListStack")); + @Endpoint( + describeByClass = true + ) + public static TensorListStack create(Scope scope, + Operand inputHandle, Operand elementShape, Class elementDtype, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorListStack"); opBuilder.addInput(inputHandle.asOutput()); opBuilder.addInput(elementShape.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - opBuilder.setAttr("element_dtype", elementDtype); + opBuilder.setAttr("element_dtype", Operands.toDataType(elementDtype)); if (options != null) { for (Options opts : options) { if (opts.numElements != null) { @@ -85,32 +89,85 @@ public static TensorListStack create(Scope scope, Operand(opBuilder.build()); + return new TensorListStack<>(opBuilder.build()); } - + /** - * @param numElements + * Sets the numElements option. + * + * @param numElements the numElements option + * @return this Options instance. */ public static Options numElements(Long numElements) { return new Options().numElements(numElements); } - + /** + * Gets tensor. + * + * @return tensor. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.TensorListStack} + */ + public static class Options { + private Long numElements; + + private Options() { + } + + /** + * Sets the numElements option. + * + * @param numElements the numElements option + * @return this Options instance. + */ + public Options numElements(Long numElements) { + this.numElements = numElements; + return this; + } + } + + @OpInputsMetadata( + outputsClass = TensorListStack.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The inputHandle input + */ + public final Operand inputHandle; + + /** + * The elementShape input + */ + public final Operand elementShape; + + /** + * The elementDtype attribute + */ + public final DataType elementDtype; + + /** + * The numElements attribute + */ + public final long numElements; + + public Inputs(GraphOperation op) { + super(new TensorListStack<>(op), op, Arrays.asList("element_dtype", "num_elements")); + int inputIndex = 0; + inputHandle = (Operand) op.input(inputIndex++); + elementShape = (Operand) op.input(inputIndex++); + elementDtype = op.attributes().getAttrType("element_dtype"); + numElements = op.attributes().getAttrInt("num_elements"); + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorMapErase.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorMapErase.java new file mode 100644 index 00000000000..ff8d9eb84c7 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorMapErase.java @@ -0,0 +1,133 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +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.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * Returns a tensor map with item from given key erased. + * input_handle: the original map + * output_handle: the map with value from given key removed + * key: the key of the value to be erased + */ +@OpMetadata( + opType = TensorMapErase.OP_NAME, + inputsClass = TensorMapErase.Inputs.class +) +@Operator +public final class TensorMapErase extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorMapErase"; + + private Output outputHandle; + + @SuppressWarnings("unchecked") + public TensorMapErase(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputHandle = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new TensorMapErase operation. + * + * @param scope current scope + * @param inputHandle The inputHandle value + * @param key The key value + * @param valueDtype The value of the valueDtype attribute + * @param data type for {@code TensorMapErase} output and operands + * @return a new instance of TensorMapErase + */ + @Endpoint( + describeByClass = true + ) + public static TensorMapErase create(Scope scope, + Operand inputHandle, Operand key, Class valueDtype) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorMapErase"); + opBuilder.addInput(inputHandle.asOutput()); + opBuilder.addInput(key.asOutput()); + opBuilder.setAttr("value_dtype", Operands.toDataType(valueDtype)); + return new TensorMapErase(opBuilder.build()); + } + + /** + * Gets outputHandle. + * + * @return outputHandle. + */ + public Output outputHandle() { + return outputHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) outputHandle; + } + + @OpInputsMetadata( + outputsClass = TensorMapErase.class + ) + public static class Inputs extends RawOpInputs { + /** + * The inputHandle input + */ + public final Operand inputHandle; + + /** + * The key input + */ + public final Operand key; + + /** + * The keyDtype attribute + */ + public final DataType keyDtype; + + /** + * The valueDtype attribute + */ + public final DataType valueDtype; + + public Inputs(GraphOperation op) { + super(new TensorMapErase(op), op, Arrays.asList("key_dtype", "value_dtype")); + int inputIndex = 0; + inputHandle = (Operand) op.input(inputIndex++); + key = (Operand) op.input(inputIndex++); + keyDtype = op.attributes().getAttrType("key_dtype"); + valueDtype = op.attributes().getAttrType("value_dtype"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorMapHasKey.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorMapHasKey.java new file mode 100644 index 00000000000..bbc9ac4d483 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorMapHasKey.java @@ -0,0 +1,122 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.TBool; +import org.tensorflow.types.family.TType; + +/** + * Returns whether the given key exists in the map. + * input_handle: the input map + * key: the key to check + * has_key: whether the key is already in the map or not + */ +@OpMetadata( + opType = TensorMapHasKey.OP_NAME, + inputsClass = TensorMapHasKey.Inputs.class +) +@Operator +public final class TensorMapHasKey extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorMapHasKey"; + + private Output hasKey; + + public TensorMapHasKey(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + hasKey = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new TensorMapHasKey operation. + * + * @param scope current scope + * @param inputHandle The inputHandle value + * @param key The key value + * @return a new instance of TensorMapHasKey + */ + @Endpoint( + describeByClass = true + ) + public static TensorMapHasKey create(Scope scope, Operand inputHandle, + Operand key) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorMapHasKey"); + opBuilder.addInput(inputHandle.asOutput()); + opBuilder.addInput(key.asOutput()); + return new TensorMapHasKey(opBuilder.build()); + } + + /** + * Gets hasKey. + * + * @return hasKey. + */ + public Output hasKey() { + return hasKey; + } + + @Override + public Output asOutput() { + return hasKey; + } + + @OpInputsMetadata( + outputsClass = TensorMapHasKey.class + ) + public static class Inputs extends RawOpInputs { + /** + * The inputHandle input + */ + public final Operand inputHandle; + + /** + * The key input + */ + public final Operand key; + + /** + * The keyDtype attribute + */ + public final DataType keyDtype; + + public Inputs(GraphOperation op) { + super(new TensorMapHasKey(op), op, Arrays.asList("key_dtype")); + int inputIndex = 0; + inputHandle = (Operand) op.input(inputIndex++); + key = (Operand) op.input(inputIndex++); + keyDtype = op.attributes().getAttrType("key_dtype"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorMapInsert.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorMapInsert.java new file mode 100644 index 00000000000..4569d8eb59f --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorMapInsert.java @@ -0,0 +1,138 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * Returns a map that is the 'input_handle' with the given key-value pair inserted. + * input_handle: the original map + * output_handle: the map with key and value inserted + * key: the key to be inserted + * value: the value to be inserted + */ +@OpMetadata( + opType = TensorMapInsert.OP_NAME, + inputsClass = TensorMapInsert.Inputs.class +) +@Operator +public final class TensorMapInsert extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorMapInsert"; + + private Output outputHandle; + + @SuppressWarnings("unchecked") + public TensorMapInsert(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + outputHandle = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new TensorMapInsert operation. + * + * @param scope current scope + * @param inputHandle The inputHandle value + * @param key The key value + * @param value The value value + * @return a new instance of TensorMapInsert + */ + @Endpoint( + describeByClass = true + ) + public static TensorMapInsert create(Scope scope, Operand inputHandle, + Operand key, Operand value) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorMapInsert"); + opBuilder.addInput(inputHandle.asOutput()); + opBuilder.addInput(key.asOutput()); + opBuilder.addInput(value.asOutput()); + return new TensorMapInsert(opBuilder.build()); + } + + /** + * Gets outputHandle. + * + * @return outputHandle. + */ + public Output outputHandle() { + return outputHandle; + } + + @Override + @SuppressWarnings("unchecked") + public Output asOutput() { + return (Output) outputHandle; + } + + @OpInputsMetadata( + outputsClass = TensorMapInsert.class + ) + public static class Inputs extends RawOpInputs { + /** + * The inputHandle input + */ + public final Operand inputHandle; + + /** + * The key input + */ + public final Operand key; + + /** + * The value input + */ + public final Operand value; + + /** + * The keyDtype attribute + */ + public final DataType keyDtype; + + /** + * The valueDtype attribute + */ + public final DataType valueDtype; + + public Inputs(GraphOperation op) { + super(new TensorMapInsert(op), op, Arrays.asList("key_dtype", "value_dtype")); + int inputIndex = 0; + inputHandle = (Operand) op.input(inputIndex++); + key = (Operand) op.input(inputIndex++); + value = (Operand) op.input(inputIndex++); + keyDtype = op.attributes().getAttrType("key_dtype"); + valueDtype = op.attributes().getAttrType("value_dtype"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorMapLookup.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorMapLookup.java new file mode 100644 index 00000000000..a3e8b54e888 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorMapLookup.java @@ -0,0 +1,131 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +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.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * Returns the value from a given key in a tensor map. + * input_handle: the input map + * key: the key to be looked up + * value: the value found from the given key + */ +@OpMetadata( + opType = TensorMapLookup.OP_NAME, + inputsClass = TensorMapLookup.Inputs.class +) +@Operator +public final class TensorMapLookup extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorMapLookup"; + + private Output value; + + public TensorMapLookup(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + value = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new TensorMapLookup operation. + * + * @param scope current scope + * @param inputHandle The inputHandle value + * @param key The key value + * @param valueDtype The value of the valueDtype attribute + * @param data type for {@code TensorMapLookup} output and operands + * @return a new instance of TensorMapLookup + */ + @Endpoint( + describeByClass = true + ) + public static TensorMapLookup create(Scope scope, + Operand inputHandle, Operand key, Class valueDtype) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorMapLookup"); + opBuilder.addInput(inputHandle.asOutput()); + opBuilder.addInput(key.asOutput()); + opBuilder.setAttr("value_dtype", Operands.toDataType(valueDtype)); + return new TensorMapLookup<>(opBuilder.build()); + } + + /** + * Gets value. + * + * @return value. + */ + public Output value() { + return value; + } + + @Override + public Output asOutput() { + return value; + } + + @OpInputsMetadata( + outputsClass = TensorMapLookup.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The inputHandle input + */ + public final Operand inputHandle; + + /** + * The key input + */ + public final Operand key; + + /** + * The keyDtype attribute + */ + public final DataType keyDtype; + + /** + * The valueDtype attribute + */ + public final DataType valueDtype; + + public Inputs(GraphOperation op) { + super(new TensorMapLookup<>(op), op, Arrays.asList("key_dtype", "value_dtype")); + int inputIndex = 0; + inputHandle = (Operand) op.input(inputIndex++); + key = (Operand) op.input(inputIndex++); + keyDtype = op.attributes().getAttrType("key_dtype"); + valueDtype = op.attributes().getAttrType("value_dtype"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorMapSize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorMapSize.java new file mode 100644 index 00000000000..5f32974f0e2 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorMapSize.java @@ -0,0 +1,105 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TType; + +/** + * Returns the number of tensors in the input tensor map. + * input_handle: the input map + * size: the number of tensors in the map + */ +@OpMetadata( + opType = TensorMapSize.OP_NAME, + inputsClass = TensorMapSize.Inputs.class +) +@Operator +public final class TensorMapSize extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorMapSize"; + + private Output output; + + public TensorMapSize(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new TensorMapSize operation. + * + * @param scope current scope + * @param inputHandle The inputHandle value + * @return a new instance of TensorMapSize + */ + @Endpoint( + describeByClass = true + ) + public static TensorMapSize create(Scope scope, Operand inputHandle) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorMapSize"); + opBuilder.addInput(inputHandle.asOutput()); + return new TensorMapSize(opBuilder.build()); + } + + /** + * Gets output. + * + * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + @OpInputsMetadata( + outputsClass = TensorMapSize.class + ) + public static class Inputs extends RawOpInputs { + /** + * The inputHandle input + */ + public final Operand inputHandle; + + public Inputs(GraphOperation op) { + super(new TensorMapSize(op), op, Arrays.asList()); + int inputIndex = 0; + inputHandle = (Operand) op.input(inputIndex++); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorMapStackKeys.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorMapStackKeys.java new file mode 100644 index 00000000000..8942b2f9f8b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorMapStackKeys.java @@ -0,0 +1,116 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +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.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TType; + +/** + * Returns a Tensor stack of all keys in a tensor map. + * input_handle: the input map + * keys: the returned Tensor of all keys in the map + */ +@OpMetadata( + opType = TensorMapStackKeys.OP_NAME, + inputsClass = TensorMapStackKeys.Inputs.class +) +@Operator +public final class TensorMapStackKeys extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorMapStackKeys"; + + private Output keys; + + public TensorMapStackKeys(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + keys = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new TensorMapStackKeys operation. + * + * @param scope current scope + * @param inputHandle The inputHandle value + * @param keyDtype The value of the keyDtype attribute + * @param data type for {@code TensorMapStackKeys} output and operands + * @return a new instance of TensorMapStackKeys + */ + @Endpoint( + describeByClass = true + ) + public static TensorMapStackKeys create(Scope scope, + Operand inputHandle, Class keyDtype) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorMapStackKeys"); + opBuilder.addInput(inputHandle.asOutput()); + opBuilder.setAttr("key_dtype", Operands.toDataType(keyDtype)); + return new TensorMapStackKeys<>(opBuilder.build()); + } + + /** + * Gets keys. + * + * @return keys. + */ + public Output keys() { + return keys; + } + + @Override + public Output asOutput() { + return keys; + } + + @OpInputsMetadata( + outputsClass = TensorMapStackKeys.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The inputHandle input + */ + public final Operand inputHandle; + + /** + * The keyDtype attribute + */ + public final DataType keyDtype; + + public Inputs(GraphOperation op) { + super(new TensorMapStackKeys<>(op), op, Arrays.asList("key_dtype")); + int inputIndex = 0; + inputHandle = (Operand) op.input(inputIndex++); + keyDtype = op.attributes().getAttrType("key_dtype"); + } + } +} 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 deleted file mode 100644 index af1878b0a52..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterAdd.java +++ /dev/null @@ -1,136 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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/TensorScatterNdAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdAdd.java new file mode 100644 index 00000000000..77d1dd111d5 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdAdd.java @@ -0,0 +1,247 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TNumber; +import org.tensorflow.types.family.TType; + +/** + * Adds sparse {@code updates} to an existing tensor according to {@code indices}. + * This operation creates a new tensor by adding sparse {@code updates} to the passed + * in {@code tensor}. + * This operation is very similar to {@code tf.compat.v1.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. + *

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

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

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

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

The simplest form of {@code tensor_scatter_nd_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: + *

+ *
+ *
+ *

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_nd_add(tensor, indices, updates) + * updated + * <tf.Tensor: shape=(8,), dtype=int32, + * numpy=array([ 1, 12, 1, 11, 10, 1, 1, 13], dtype=int32)> + *

+ *
+ *
+ *

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: + *

+ *
+ *
+ *

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],dtype=tf.int32) + * updated = tf.tensor_scatter_nd_add(tensor, indices, updates) + * updated + * <tf.Tensor: shape=(4, 4, 4), dtype=int32, + * numpy=array([[[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]]], dtype=int32)> + *

+ *
+ *
+ *

If {@code indices} contains any out-of-bound indices, depending on + * {@code bad_indices_policy}, the op will either return an error or ignore the + * out-of-bound indices. {@code bad_indices_policy} can be one of the following values: + *

    + *
  1. "" or "DEFAULT": raises on CPU and ignore on GPU. This is because + * historically on CPU and GPU we handle errors in different ways, and for + * backward compatibility we keep the default behavior.
  2. + *
  3. "ERROR": raises error; GPU does not support this value.
  4. + *
  5. "IGNORE": ignore the bad indices; supported on both CPU and GPU.
  6. + *
+ */ +@OpMetadata( + opType = TensorScatterNdAdd.OP_NAME, + inputsClass = TensorScatterNdAdd.Inputs.class +) +@Operator +public final class TensorScatterNdAdd extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorScatterAdd"; + + private Output output; + + public TensorScatterNdAdd(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * 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. + * @param options carries optional attribute values + * @param data type for {@code TensorScatterAdd} output and operands + * @return a new instance of TensorScatterNdAdd + */ + @Endpoint( + describeByClass = true + ) + public static TensorScatterNdAdd create(Scope scope, Operand tensor, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorScatterNdAdd"); + opBuilder.addInput(tensor.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + if (options != null) { + for (Options opts : options) { + if (opts.badIndicesPolicy != null) { + opBuilder.setAttr("bad_indices_policy", opts.badIndicesPolicy); + } + } + } + return new TensorScatterNdAdd<>(opBuilder.build()); + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public static Options badIndicesPolicy(String badIndicesPolicy) { + return new Options().badIndicesPolicy(badIndicesPolicy); + } + + /** + * Gets output. + * A new tensor copied from tensor and updates added according to the indices. + * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.TensorScatterNdAdd} + */ + public static class Options { + private String badIndicesPolicy; + + private Options() { + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public Options badIndicesPolicy(String badIndicesPolicy) { + this.badIndicesPolicy = badIndicesPolicy; + return this; + } + } + + @OpInputsMetadata( + outputsClass = TensorScatterNdAdd.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Tensor to copy/update. + */ + public final Operand tensor; + + /** + * Index tensor. + */ + public final Operand indices; + + /** + * Updates to scatter into output. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * The badIndicesPolicy attribute + */ + public final String badIndicesPolicy; + + public Inputs(GraphOperation op) { + super(new TensorScatterNdAdd<>(op), op, Arrays.asList("T", "Tindices", "bad_indices_policy")); + int inputIndex = 0; + tensor = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + badIndicesPolicy = op.attributes().getAttrString("bad_indices_policy"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdMax.java new file mode 100644 index 00000000000..cbf9b2dd471 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdMax.java @@ -0,0 +1,193 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TNumber; +import org.tensorflow.types.family.TType; + +/** + * Apply a sparse update to a tensor taking the element-wise maximum. + * Returns a new tensor copied from {@code tensor} whose values are element-wise maximum between + * tensor and updates according to the indices. + *
+ *
+ *
+ *

tensor = [0, 0, 0, 0, 0, 0, 0, 0] + * indices = [[1], [4], [5]] + * updates = [1, -1, 1] + * tf.tensor_scatter_nd_max(tensor, indices, updates).numpy() + * array([0, 1, 0, 0, 0, 1, 0, 0], dtype=int32) + *

+ *
+ *
+ *

Refer to {@code tf.tensor_scatter_nd_update} for more details. + */ +@OpMetadata( + opType = TensorScatterNdMax.OP_NAME, + inputsClass = TensorScatterNdMax.Inputs.class +) +@Operator +public final class TensorScatterNdMax extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorScatterMax"; + + private Output output; + + public TensorScatterNdMax(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new TensorScatterMax operation. + * + * @param scope current scope + * @param tensor Tensor to update. + * @param indices Index tensor. + * @param updates Updates to scatter into output. + * @param options carries optional attribute values + * @param data type for {@code TensorScatterMax} output and operands + * @return a new instance of TensorScatterNdMax + */ + @Endpoint( + describeByClass = true + ) + public static TensorScatterNdMax create(Scope scope, Operand tensor, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorScatterNdMax"); + opBuilder.addInput(tensor.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + if (options != null) { + for (Options opts : options) { + if (opts.badIndicesPolicy != null) { + opBuilder.setAttr("bad_indices_policy", opts.badIndicesPolicy); + } + } + } + return new TensorScatterNdMax<>(opBuilder.build()); + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public static Options badIndicesPolicy(String badIndicesPolicy) { + return new Options().badIndicesPolicy(badIndicesPolicy); + } + + /** + * Gets output. + * A new tensor copied from tensor whose values are element-wise maximum between tensor and updates according to the indices. + * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.TensorScatterNdMax} + */ + public static class Options { + private String badIndicesPolicy; + + private Options() { + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public Options badIndicesPolicy(String badIndicesPolicy) { + this.badIndicesPolicy = badIndicesPolicy; + return this; + } + } + + @OpInputsMetadata( + outputsClass = TensorScatterNdMax.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Tensor to update. + */ + public final Operand tensor; + + /** + * Index tensor. + */ + public final Operand indices; + + /** + * Updates to scatter into output. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * The badIndicesPolicy attribute + */ + public final String badIndicesPolicy; + + public Inputs(GraphOperation op) { + super(new TensorScatterNdMax<>(op), op, Arrays.asList("T", "Tindices", "bad_indices_policy")); + int inputIndex = 0; + tensor = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + badIndicesPolicy = op.attributes().getAttrString("bad_indices_policy"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdMin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdMin.java new file mode 100644 index 00000000000..7db99c551d1 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdMin.java @@ -0,0 +1,179 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TNumber; +import org.tensorflow.types.family.TType; + +/** + * The TensorScatterMin operation + */ +@OpMetadata( + opType = TensorScatterNdMin.OP_NAME, + inputsClass = TensorScatterNdMin.Inputs.class +) +@Operator +public final class TensorScatterNdMin extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorScatterMin"; + + private Output output; + + public TensorScatterNdMin(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new TensorScatterMin operation. + * + * @param scope current scope + * @param tensor Tensor to update. + * @param indices Index tensor. + * @param updates Updates to scatter into output. + * @param options carries optional attribute values + * @param data type for {@code TensorScatterMin} output and operands + * @return a new instance of TensorScatterNdMin + */ + @Endpoint( + describeByClass = true + ) + public static TensorScatterNdMin create(Scope scope, Operand tensor, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorScatterNdMin"); + opBuilder.addInput(tensor.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + if (options != null) { + for (Options opts : options) { + if (opts.badIndicesPolicy != null) { + opBuilder.setAttr("bad_indices_policy", opts.badIndicesPolicy); + } + } + } + return new TensorScatterNdMin<>(opBuilder.build()); + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public static Options badIndicesPolicy(String badIndicesPolicy) { + return new Options().badIndicesPolicy(badIndicesPolicy); + } + + /** + * Gets output. + * A new tensor copied from tensor whose values are element-wise minimum between tensor and updates according to the indices. + * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.TensorScatterNdMin} + */ + public static class Options { + private String badIndicesPolicy; + + private Options() { + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public Options badIndicesPolicy(String badIndicesPolicy) { + this.badIndicesPolicy = badIndicesPolicy; + return this; + } + } + + @OpInputsMetadata( + outputsClass = TensorScatterNdMin.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Tensor to update. + */ + public final Operand tensor; + + /** + * Index tensor. + */ + public final Operand indices; + + /** + * Updates to scatter into output. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * The badIndicesPolicy attribute + */ + public final String badIndicesPolicy; + + public Inputs(GraphOperation op) { + super(new TensorScatterNdMin<>(op), op, Arrays.asList("T", "Tindices", "bad_indices_policy")); + int inputIndex = 0; + tensor = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + badIndicesPolicy = op.attributes().getAttrString("bad_indices_policy"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdSub.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdSub.java new file mode 100644 index 00000000000..095e0428962 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdSub.java @@ -0,0 +1,234 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TNumber; +import org.tensorflow.types.family.TType; + +/** + * Subtracts sparse {@code updates} from an existing tensor according to {@code indices}. + * This operation creates a new tensor by subtracting sparse {@code updates} from the + * passed in {@code tensor}. + * This operation is very similar to {@code 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. + *

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

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

The last dimension of {@code indices} corresponds to indices into elements + * (if {@code indices.shape[-1] = shape.rank}) or slices + * (if {@code indices.shape[-1] < shape.rank}) along dimension {@code indices.shape[-1]} of + * {@code shape}. {@code 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: + *

+ *     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_nd_sub(tensor, indices, updates)
+ *     print(updated)
+ * 
+ *

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: + *

+ *     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],dtype=tf.int32)
+ *     updated = tf.tensor_scatter_nd_sub(tensor, indices, updates)
+ *     print(updated)
+ * 
+ *

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. + */ +@OpMetadata( + opType = TensorScatterNdSub.OP_NAME, + inputsClass = TensorScatterNdSub.Inputs.class +) +@Operator +public final class TensorScatterNdSub extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorScatterSub"; + + private Output output; + + public TensorScatterNdSub(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * 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. + * @param options carries optional attribute values + * @param data type for {@code TensorScatterSub} output and operands + * @return a new instance of TensorScatterNdSub + */ + @Endpoint( + describeByClass = true + ) + public static TensorScatterNdSub create(Scope scope, Operand tensor, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorScatterNdSub"); + opBuilder.addInput(tensor.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + if (options != null) { + for (Options opts : options) { + if (opts.badIndicesPolicy != null) { + opBuilder.setAttr("bad_indices_policy", opts.badIndicesPolicy); + } + } + } + return new TensorScatterNdSub<>(opBuilder.build()); + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public static Options badIndicesPolicy(String badIndicesPolicy) { + return new Options().badIndicesPolicy(badIndicesPolicy); + } + + /** + * Gets output. + * A new tensor copied from tensor and updates subtracted according to the indices. + * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.TensorScatterNdSub} + */ + public static class Options { + private String badIndicesPolicy; + + private Options() { + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public Options badIndicesPolicy(String badIndicesPolicy) { + this.badIndicesPolicy = badIndicesPolicy; + return this; + } + } + + @OpInputsMetadata( + outputsClass = TensorScatterNdSub.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Tensor to copy/update. + */ + public final Operand tensor; + + /** + * Index tensor. + */ + public final Operand indices; + + /** + * Updates to scatter into output. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * The badIndicesPolicy attribute + */ + public final String badIndicesPolicy; + + public Inputs(GraphOperation op) { + super(new TensorScatterNdSub<>(op), op, Arrays.asList("T", "Tindices", "bad_indices_policy")); + int inputIndex = 0; + tensor = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + badIndicesPolicy = op.attributes().getAttrString("bad_indices_policy"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdUpdate.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdUpdate.java new file mode 100644 index 00000000000..96323c0db29 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdUpdate.java @@ -0,0 +1,218 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; +import org.tensorflow.types.family.TNumber; +import org.tensorflow.types.family.TType; + +/** + * Scatter {@code updates} into an existing tensor according to {@code indices}. + * This operation creates a new tensor by applying sparse {@code updates} to the passed + * in {@code tensor}. + * This operation is very similar to {@code 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 {@code indices} contains duplicates, then we pick the last update for the index. + *

WARNING: There are some GPU specific semantics for this operation. + *

    + *
  • If an out of bound index is found, the index is ignored.
  • + *
  • The order in which updates are applied is nondeterministic, so the output + * will be nondeterministic if {@code indices} contains duplicates.
  • + *
+ *

{@code indices} is an integer tensor containing indices into a new tensor of shape + * {@code shape}. + *

    + *
  • {@code indices} must have at least 2 axes: {@code (num_updates, index_depth)}.
  • + *
  • The last axis of {@code indices} is how deep to index into {@code tensor} so this index + * depth must be less than the rank of {@code tensor}: {@code indices.shape[-1] <= tensor.ndim}
  • + *
+ *

if {@code indices.shape[-1] = tensor.rank} this Op indexes and updates scalar elements. + * if {@code indices.shape[-1] < tensor.rank} it indexes and updates slices of the input + * {@code tensor}. + *

Each {@code update} has a rank of {@code tensor.rank - indices.shape[-1]}. + * The overall shape of {@code updates} is: + *

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

If {@code indices} contains any out-of-bound indices, depending on + * {@code bad_indices_policy}, the op will either return an error or ignore the + * out-of-bound indices. {@code bad_indices_policy} can be one of the following values: + *

    + *
  1. "" or "DEFAULT": raises on CPU and ignore on GPU. This is because + * historically on CPU and GPU we handle errors in different ways, and for + * backward compatibility we keep the default behavior.
  2. + *
  3. "ERROR": raises error; GPU does not support this value.
  4. + *
  5. "IGNORE": ignore the bad indices; supported on both CPU and GPU.
  6. + *
+ *

For usage examples see the python tf.tensor_scatter_nd_update {@link org.tensorflow.op.Ops#tensorScatterNdUpdate} function + */ +@OpMetadata( + opType = TensorScatterNdUpdate.OP_NAME, + inputsClass = TensorScatterNdUpdate.Inputs.class +) +@Operator +public final class TensorScatterNdUpdate extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TensorScatterUpdate"; + + private Output output; + + public TensorScatterNdUpdate(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + + /** + * 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. + * @param options carries optional attribute values + * @param data type for {@code TensorScatterUpdate} output and operands + * @return a new instance of TensorScatterNdUpdate + */ + @Endpoint( + describeByClass = true + ) + public static TensorScatterNdUpdate create(Scope scope, Operand tensor, + Operand indices, Operand updates, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TensorScatterNdUpdate"); + opBuilder.addInput(tensor.asOutput()); + opBuilder.addInput(indices.asOutput()); + opBuilder.addInput(updates.asOutput()); + if (options != null) { + for (Options opts : options) { + if (opts.badIndicesPolicy != null) { + opBuilder.setAttr("bad_indices_policy", opts.badIndicesPolicy); + } + } + } + return new TensorScatterNdUpdate<>(opBuilder.build()); + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public static Options badIndicesPolicy(String badIndicesPolicy) { + return new Options().badIndicesPolicy(badIndicesPolicy); + } + + /** + * Gets output. + * A new tensor with the given shape and updates applied according + * to the indices. + * @return output. + */ + public Output output() { + return output; + } + + @Override + public Output asOutput() { + return output; + } + + /** + * Optional attributes for {@link org.tensorflow.op.core.TensorScatterNdUpdate} + */ + public static class Options { + private String badIndicesPolicy; + + private Options() { + } + + /** + * Sets the badIndicesPolicy option. + * + * @param badIndicesPolicy the badIndicesPolicy option + * @return this Options instance. + */ + public Options badIndicesPolicy(String badIndicesPolicy) { + this.badIndicesPolicy = badIndicesPolicy; + return this; + } + } + + @OpInputsMetadata( + outputsClass = TensorScatterNdUpdate.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Tensor to copy/update. + */ + public final Operand tensor; + + /** + * Index tensor. + */ + public final Operand indices; + + /** + * Updates to scatter into output. + */ + public final Operand updates; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tindices attribute + */ + public final DataType Tindices; + + /** + * The badIndicesPolicy attribute + */ + public final String badIndicesPolicy; + + public Inputs(GraphOperation op) { + super(new TensorScatterNdUpdate<>(op), op, Arrays.asList("T", "Tindices", "bad_indices_policy")); + int inputIndex = 0; + tensor = (Operand) op.input(inputIndex++); + indices = (Operand) op.input(inputIndex++); + updates = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tindices = op.attributes().getAttrType("Tindices"); + badIndicesPolicy = op.attributes().getAttrString("bad_indices_policy"); + } + } +} 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 deleted file mode 100644 index 3781aa720de..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterSub.java +++ /dev/null @@ -1,136 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 deleted file mode 100644 index 7dcb38fd312..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterUpdate.java +++ /dev/null @@ -1,148 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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 index 545439804cb..de80c141d72 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,106 +17,76 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** - * 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 + * Assign {@code value} to the sliced l-value reference of {@code input}. + * The values of {@code value} are assigned to the positions in the tensor {@code input} that + * are selected by the slice parameters. The slice parameters {@code begin} {@code end} + * {@code strides} etc. work exactly as in {@code StridedSlice}. + *

NOTE this op currently does not support broadcasting and so {@code value}'s shape + * must be exactly the shape produced by the slice of {@code input}. */ +@OpMetadata( + opType = TensorStridedSliceUpdate.OP_NAME, + inputsClass = TensorStridedSliceUpdate.Inputs.class +) @Operator -public final class TensorStridedSliceUpdate extends PrimitiveOp implements Operand { - +public final class TensorStridedSliceUpdate extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.TensorStridedSliceUpdate} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "TensorStridedSliceUpdate"; + + private Output output; + + public TensorStridedSliceUpdate(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); } - + /** * 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 + * @param input The input value + * @param begin The begin value + * @param end The end value + * @param strides The strides value + * @param value The value value + * @param options carries optional attribute values + * @param data type for {@code TensorStridedSliceUpdate} output and operands + * @param data type for {@code TensorStridedSliceUpdate} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static TensorStridedSliceUpdate create(Scope scope, + Operand input, Operand begin, Operand end, Operand strides, Operand value, + Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { @@ -136,60 +106,225 @@ public static TensorStridedSliceUpdate c } } } - return new TensorStridedSliceUpdate(opBuilder.build()); + return new TensorStridedSliceUpdate<>(opBuilder.build()); } - + /** - * @param beginMask + * Sets the beginMask option. + * + * @param beginMask the beginMask option + * @return this Options instance. */ public static Options beginMask(Long beginMask) { return new Options().beginMask(beginMask); } - + /** - * @param endMask + * Sets the endMask option. + * + * @param endMask the endMask option + * @return this Options instance. */ public static Options endMask(Long endMask) { return new Options().endMask(endMask); } - + /** - * @param ellipsisMask + * Sets the ellipsisMask option. + * + * @param ellipsisMask the ellipsisMask option + * @return this Options instance. */ public static Options ellipsisMask(Long ellipsisMask) { return new Options().ellipsisMask(ellipsisMask); } - + /** - * @param newAxisMask + * Sets the newAxisMask option. + * + * @param newAxisMask the newAxisMask option + * @return this Options instance. */ public static Options newAxisMask(Long newAxisMask) { return new Options().newAxisMask(newAxisMask); } - + /** - * @param shrinkAxisMask + * Sets the shrinkAxisMask option. + * + * @param shrinkAxisMask the shrinkAxisMask option + * @return this Options instance. */ public static Options shrinkAxisMask(Long shrinkAxisMask) { return new Options().shrinkAxisMask(shrinkAxisMask); } - + /** + * Gets output. + * + * @return output. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.TensorStridedSliceUpdate} + */ + public static class Options { + private Long beginMask; + + private Long endMask; + + private Long ellipsisMask; + + private Long newAxisMask; + + private Long shrinkAxisMask; + + private Options() { + } + + /** + * Sets the beginMask option. + * + * @param beginMask the beginMask option + * @return this Options instance. + */ + public Options beginMask(Long beginMask) { + this.beginMask = beginMask; + return this; + } + + /** + * Sets the endMask option. + * + * @param endMask the endMask option + * @return this Options instance. + */ + public Options endMask(Long endMask) { + this.endMask = endMask; + return this; + } + + /** + * Sets the ellipsisMask option. + * + * @param ellipsisMask the ellipsisMask option + * @return this Options instance. + */ + public Options ellipsisMask(Long ellipsisMask) { + this.ellipsisMask = ellipsisMask; + return this; + } + + /** + * Sets the newAxisMask option. + * + * @param newAxisMask the newAxisMask option + * @return this Options instance. + */ + public Options newAxisMask(Long newAxisMask) { + this.newAxisMask = newAxisMask; + return this; + } + + /** + * Sets the shrinkAxisMask option. + * + * @param shrinkAxisMask the shrinkAxisMask option + * @return this Options instance. + */ + public Options shrinkAxisMask(Long shrinkAxisMask) { + this.shrinkAxisMask = shrinkAxisMask; + return this; + } + } + + @OpInputsMetadata( + outputsClass = TensorStridedSliceUpdate.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The input input + */ + public final Operand input; + + /** + * The begin input + */ + public final Operand begin; + + /** + * The end input + */ + public final Operand end; + + /** + * The strides input + */ + public final Operand strides; + + /** + * The value input + */ + public final Operand value; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Index attribute + */ + public final DataType Index; + + /** + * The beginMask attribute + */ + public final long beginMask; + + /** + * The endMask attribute + */ + public final long endMask; + + /** + * The ellipsisMask attribute + */ + public final long ellipsisMask; + + /** + * The newAxisMask attribute + */ + public final long newAxisMask; + + /** + * The shrinkAxisMask attribute + */ + public final long shrinkAxisMask; + + public Inputs(GraphOperation op) { + super(new TensorStridedSliceUpdate<>(op), op, Arrays.asList("T", "Index", "begin_mask", "end_mask", "ellipsis_mask", "new_axis_mask", "shrink_axis_mask")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + begin = (Operand) op.input(inputIndex++); + end = (Operand) op.input(inputIndex++); + strides = (Operand) op.input(inputIndex++); + value = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Index = op.attributes().getAttrType("Index"); + beginMask = op.attributes().getAttrInt("begin_mask"); + endMask = op.attributes().getAttrInt("end_mask"); + ellipsisMask = op.attributes().getAttrInt("ellipsis_mask"); + newAxisMask = op.attributes().getAttrInt("new_axis_mask"); + shrinkAxisMask = op.attributes().getAttrInt("shrink_axis_mask"); + } } } 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 deleted file mode 100644 index 6243eadc3a9..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ThreadPoolDataset.java +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for 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.tools.Shape; -import org.tensorflow.types.family.TType; - -/** - * 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] = 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 deleted file mode 100644 index 38d440dfb2a..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ThreadPoolHandle.java +++ /dev/null @@ -1,146 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TType; - -/** - * 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 index 9c2d771df73..7339fdbb3de 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,62 +17,141 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; /** * 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 + * This operation creates a new tensor by replicating {@code input} {@code multiples} times. + * The output tensor's i'th dimension has {@code input.dims(i) * multiples[i]} elements, + * and the values of {@code input} are replicated {@code multiples[i]} times along the 'i'th + * dimension. For example, tiling {@code [a b c d]} by {@code [2]} produces + * {@code [a b c d a b c d]}. + *

+ *
+ *
+ *

a = tf.constant([[1,2,3],[4,5,6]], tf.int32) + * b = tf.constant([1,2], tf.int32) + * tf.tile(a, b) + * <tf.Tensor: shape=(2, 6), dtype=int32, numpy= + * array([[1, 2, 3, 1, 2, 3], + * [4, 5, 6, 4, 5, 6]], dtype=int32)> + * c = tf.constant([2,1], tf.int32) + * tf.tile(a, c) + * <tf.Tensor: shape=(4, 3), dtype=int32, numpy= + * array([[1, 2, 3], + * [4, 5, 6], + * [1, 2, 3], + * [4, 5, 6]], dtype=int32)> + * d = tf.constant([2,2], tf.int32) + * tf.tile(a, d) + * <tf.Tensor: shape=(4, 6), dtype=int32, numpy= + * array([[1, 2, 3, 1, 2, 3], + * [4, 5, 6, 4, 5, 6], + * [1, 2, 3, 1, 2, 3], + * [4, 5, 6, 4, 5, 6]], dtype=int32)> + *

+ *
+ *
*/ +@OpMetadata( + opType = Tile.OP_NAME, + inputsClass = Tile.Inputs.class +) @Operator -public final class Tile extends PrimitiveOp implements Operand { - +public final class Tile extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Tile"; + + private Output output; + + public Tile(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + output = operation.output(outputIdx++); + } + /** * 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` + * @param input Can be of any rank. + * @param multiples 1-D. Length must be the same as the number of dimensions in {@code input} + * @param data type for {@code Tile} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static Tile create(Scope scope, Operand input, + Operand multiples) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Tile"); opBuilder.addInput(input.asOutput()); opBuilder.addInput(multiples.asOutput()); - opBuilder = scope.applyControlDependencies(opBuilder); - return new Tile(opBuilder.build()); + return new Tile<>(opBuilder.build()); } - + /** + * Gets output. + * + * @return output. */ 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++); + + @OpInputsMetadata( + outputsClass = Tile.class + ) + public static class Inputs extends RawOpInputs> { + /** + * Can be of any rank. + */ + public final Operand input; + + /** + * 1-D. Length must be the same as the number of dimensions in {@code input} + */ + public final Operand multiples; + + /** + * The T attribute + */ + public final DataType T; + + /** + * The Tmultiples attribute + */ + public final DataType Tmultiples; + + public Inputs(GraphOperation op) { + super(new Tile<>(op), op, Arrays.asList("T", "Tmultiples")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + multiples = (Operand) op.input(inputIndex++); + T = op.attributes().getAttrType("T"); + Tmultiples = op.attributes().getAttrType("Tmultiples"); + } } } 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 index 8966533ef97..68f438fd195 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,54 +17,89 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; -import org.tensorflow.types.TDouble; +import org.tensorflow.types.TFloat64; /** * 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. + * Returns the timestamp as a {@code float64} for seconds since the Unix epoch. + *

Common usages include: + *

    + *
  • Logging
  • + *
  • Providing a random number seed
  • + *
  • Debugging graph execution
  • + *
  • Generating timing information, mainly through comparison of timestamps
  • + *
+ *

Note: In graph mode, the timestamp is computed when the op is executed, + * not when it is added to the graph. In eager mode, the timestamp is computed + * when the op is eagerly executed. */ +@OpMetadata( + opType = Timestamp.OP_NAME, + inputsClass = Timestamp.Inputs.class +) @Operator -public final class Timestamp extends PrimitiveOp implements Operand { - +public final class Timestamp extends RawOp implements Operand { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "Timestamp"; + + private Output ts; + + public Timestamp(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + ts = operation.output(outputIdx++); + } + /** * Factory method to create a class wrapping a new Timestamp operation. - * + * * @param scope current scope * @return a new instance of Timestamp */ + @Endpoint( + describeByClass = true + ) public static Timestamp create(Scope scope) { - OperationBuilder opBuilder = scope.env().opBuilder("Timestamp", scope.makeOpName("Timestamp")); - opBuilder = scope.applyControlDependencies(opBuilder); + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "Timestamp"); return new Timestamp(opBuilder.build()); } - + /** + * Gets ts. + * + * @return ts. */ - public Output ts() { + public Output ts() { return ts; } - + @Override - public Output asOutput() { + public Output asOutput() { return ts; } - - private Output ts; - - private Timestamp(Operation operation) { - super(operation); - int outputIdx = 0; - ts = operation.output(outputIdx++); + + @OpInputsMetadata( + outputsClass = Timestamp.class + ) + public static class Inputs extends RawOpInputs { + public Inputs(GraphOperation op) { + super(new Timestamp(op), op, Arrays.asList()); + int inputIndex = 0; + } } } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TopKUnique.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TopKUnique.java new file mode 100644 index 00000000000..56727a653fc --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TopKUnique.java @@ -0,0 +1,130 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TInt32; + +/** + * Returns the TopK unique values in the array in sorted order. + * The running time is proportional to the product of K and the input + * size. Sorting the whole array is more efficient for sufficiently large + * values of K. The median-of-medians algorithm is probably faster, but + * difficult to implement efficiently in XLA. If there are fewer than K + * unique numbers (not NANs), the results are padded with negative + * infinity. NaNs are never returned. Subnormal numbers are flushed to + * zero. If an element appears at multiple indices, the highest index is + * returned. If a TopK element never appears in the input due to padding + * values, the indices are padded with negative one. If a padding value + * appears in the input and padding is needed, the highest index of the + * padding value will be returned. The semantics are not the same as + * kth_order_statistic. + */ +@OpMetadata( + opType = TopKUnique.OP_NAME, + inputsClass = TopKUnique.Inputs.class +) +@Operator +public final class TopKUnique extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TopKUnique"; + + private Output topk; + + private Output topkIndices; + + public TopKUnique(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + topk = operation.output(outputIdx++); + topkIndices = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new TopKUnique operation. + * + * @param scope current scope + * @param input The input value + * @param k The value of the k attribute + * @return a new instance of TopKUnique + */ + @Endpoint( + describeByClass = true + ) + public static TopKUnique create(Scope scope, Operand input, Long k) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TopKUnique"); + opBuilder.addInput(input.asOutput()); + opBuilder.setAttr("k", k); + return new TopKUnique(opBuilder.build()); + } + + /** + * Gets topk. + * + * @return topk. + */ + public Output topk() { + return topk; + } + + /** + * Gets topkIndices. + * + * @return topkIndices. + */ + public Output topkIndices() { + return topkIndices; + } + + @OpInputsMetadata( + outputsClass = TopKUnique.class + ) + public static class Inputs extends RawOpInputs { + /** + * The input input + */ + public final Operand input; + + /** + * The k attribute + */ + public final long k; + + public Inputs(GraphOperation op) { + super(new TopKUnique(op), op, Arrays.asList("k")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + k = op.attributes().getAttrInt("k"); + } + } +} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TopKWithUnique.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TopKWithUnique.java new file mode 100644 index 00000000000..15abf1fcd6b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TopKWithUnique.java @@ -0,0 +1,123 @@ +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for 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 org.tensorflow.GraphOperation; +import org.tensorflow.Operand; +import org.tensorflow.Operation; +import org.tensorflow.OperationBuilder; +import org.tensorflow.Output; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; +import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; +import org.tensorflow.op.annotation.Operator; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TInt32; + +/** + * Returns the TopK values in the array in sorted order. + * This is a combination of MakeUnique and TopKUnique. The returned top-K will + * have its lower bits replaced by iota, thus it will be close to the original + * value but not exactly the same. The running time is proportional to the product + * of K and the input size. NaNs are never returned. Subnormal numbers are flushed + * to zero. + */ +@OpMetadata( + opType = TopKWithUnique.OP_NAME, + inputsClass = TopKWithUnique.Inputs.class +) +@Operator +public final class TopKWithUnique extends RawOp { + /** + * The name of this op, as known by TensorFlow core engine + */ + public static final String OP_NAME = "TopKWithUnique"; + + private Output topk; + + private Output topkIndices; + + public TopKWithUnique(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + topk = operation.output(outputIdx++); + topkIndices = operation.output(outputIdx++); + } + + /** + * Factory method to create a class wrapping a new TopKWithUnique operation. + * + * @param scope current scope + * @param input The input value + * @param k The value of the k attribute + * @return a new instance of TopKWithUnique + */ + @Endpoint( + describeByClass = true + ) + public static TopKWithUnique create(Scope scope, Operand input, Long k) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "TopKWithUnique"); + opBuilder.addInput(input.asOutput()); + opBuilder.setAttr("k", k); + return new TopKWithUnique(opBuilder.build()); + } + + /** + * Gets topk. + * + * @return topk. + */ + public Output topk() { + return topk; + } + + /** + * Gets topkIndices. + * + * @return topkIndices. + */ + public Output topkIndices() { + return topkIndices; + } + + @OpInputsMetadata( + outputsClass = TopKWithUnique.class + ) + public static class Inputs extends RawOpInputs { + /** + * The input input + */ + public final Operand input; + + /** + * The k attribute + */ + public final long k; + + public Inputs(GraphOperation op) { + super(new TopKWithUnique(op), op, Arrays.asList("k")); + int inputIndex = 0; + input = (Operand) op.input(inputIndex++); + k = op.attributes().getAttrInt("k"); + } + } +} 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 deleted file mode 100644 index 50ecdd91de9..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TridiagonalMatMul.java +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TType; - -/** - * 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 deleted file mode 100644 index 8babc7cc5b2..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TridiagonalSolve.java +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.types.family.TType; - -/** - * 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 deleted file mode 100644 index 95f429d8bac..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TryRpc.java +++ /dev/null @@ -1,221 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -=======================================================================*/ - -// This class has been 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.TInt32; -import org.tensorflow.types.TString; - -/** - * 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 index d3984595c0e..fa4c04f3c27 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,88 +17,83 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt64; import org.tensorflow.types.family.TType; /** * 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. + *

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. + * 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 + * assumed to possibly belong to the same batch. If left empty, the op name will + * be used as the shared name. */ +@OpMetadata( + opType = Unbatch.OP_NAME, + inputsClass = Unbatch.Inputs.class +) @Operator -public final class Unbatch extends PrimitiveOp implements Operand { - +public final class Unbatch extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.Unbatch} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "Unbatch"; + + private Output unbatchedTensor; + + public Unbatch(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + unbatchedTensor = operation.output(outputIdx++); } - + /** * 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 + * @param batchedTensor The batchedTensor value + * @param batchIndex The batchIndex value + * @param id The id value + * @param timeoutMicros The value of the timeoutMicros attribute + * @param options carries optional attribute values + * @param data type for {@code Unbatch} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static Unbatch create(Scope scope, Operand batchedTensor, + Operand batchIndex, Operand id, Long timeoutMicros, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { @@ -110,39 +105,126 @@ public static Unbatch create(Scope scope, Operand batche } } } - return new Unbatch(opBuilder.build()); + return new Unbatch<>(opBuilder.build()); } - + /** - * @param container + * Sets the container option. + * + * @param container the container option + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** - * @param sharedName + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - + /** + * Gets unbatchedTensor. + * + * @return unbatchedTensor. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.Unbatch} + */ + public static class Options { + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the container option. + * + * @param container the container option + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = Unbatch.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The batchedTensor input + */ + public final Operand batchedTensor; + + /** + * The batchIndex input + */ + public final Operand batchIndex; + + /** + * The id input + */ + public final Operand id; + + /** + * The timeoutMicros attribute + */ + public final long timeoutMicros; + + /** + * The container attribute + */ + public final String container; + + /** + * The sharedName attribute + */ + public final String sharedName; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new Unbatch<>(op), op, Arrays.asList("timeout_micros", "container", "shared_name", "T")); + int inputIndex = 0; + batchedTensor = (Operand) op.input(inputIndex++); + batchIndex = (Operand) op.input(inputIndex++); + id = (Operand) op.input(inputIndex++); + timeoutMicros = op.attributes().getAttrInt("timeout_micros"); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + T = op.attributes().getAttrType("T"); + } } } 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 index 48c1cdb017f..25418f3986f 100644 --- 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 @@ -1,4 +1,4 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2018-2023 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,24 +17,29 @@ package org.tensorflow.op.core; +import java.util.Arrays; +import org.tensorflow.GraphOperation; import org.tensorflow.Operand; import org.tensorflow.Operation; import org.tensorflow.OperationBuilder; import org.tensorflow.Output; -import org.tensorflow.op.PrimitiveOp; +import org.tensorflow.op.RawOp; +import org.tensorflow.op.RawOpInputs; import org.tensorflow.op.Scope; +import org.tensorflow.op.annotation.Endpoint; +import org.tensorflow.op.annotation.OpInputsMetadata; +import org.tensorflow.op.annotation.OpMetadata; import org.tensorflow.op.annotation.Operator; +import org.tensorflow.proto.DataType; import org.tensorflow.types.TInt64; import org.tensorflow.types.family.TType; /** * 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. + *

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. @@ -42,60 +47,50 @@ * 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 + * are assumed to possibly belong to the same batch. If left empty, the op name + * will be used as the shared name. */ +@OpMetadata( + opType = UnbatchGrad.OP_NAME, + inputsClass = UnbatchGrad.Inputs.class +) @Operator -public final class UnbatchGrad extends PrimitiveOp implements Operand { - +public final class UnbatchGrad extends RawOp implements Operand { /** - * Optional attributes for {@link org.tensorflow.op.core.UnbatchGrad} + * The name of this op, as known by TensorFlow core engine */ - 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() { - } + public static final String OP_NAME = "UnbatchGrad"; + + private Output batchedGrad; + + public UnbatchGrad(Operation operation) { + super(operation, OP_NAME); + int outputIdx = 0; + batchedGrad = operation.output(outputIdx++); } - + /** * 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 + * @param originalInput The originalInput value + * @param batchIndex The batchIndex value + * @param grad The grad value + * @param id The id value + * @param options carries optional attribute values + * @param data type for {@code UnbatchGrad} output and operands * @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")); + @Endpoint( + describeByClass = true + ) + public static UnbatchGrad create(Scope scope, Operand originalInput, + Operand batchIndex, Operand grad, Operand id, Options... options) { + OperationBuilder opBuilder = scope.opBuilder(OP_NAME, "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) { @@ -106,39 +101,126 @@ public static UnbatchGrad create(Scope scope, Operand or } } } - return new UnbatchGrad(opBuilder.build()); + return new UnbatchGrad<>(opBuilder.build()); } - + /** - * @param container + * Sets the container option. + * + * @param container the container option + * @return this Options instance. */ public static Options container(String container) { return new Options().container(container); } - + /** - * @param sharedName + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. */ public static Options sharedName(String sharedName) { return new Options().sharedName(sharedName); } - + /** + * Gets batchedGrad. + * + * @return batchedGrad. */ 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++); + + /** + * Optional attributes for {@link org.tensorflow.op.core.UnbatchGrad} + */ + public static class Options { + private String container; + + private String sharedName; + + private Options() { + } + + /** + * Sets the container option. + * + * @param container the container option + * @return this Options instance. + */ + public Options container(String container) { + this.container = container; + return this; + } + + /** + * Sets the sharedName option. + * + * @param sharedName the sharedName option + * @return this Options instance. + */ + public Options sharedName(String sharedName) { + this.sharedName = sharedName; + return this; + } + } + + @OpInputsMetadata( + outputsClass = UnbatchGrad.class + ) + public static class Inputs extends RawOpInputs> { + /** + * The originalInput input + */ + public final Operand originalInput; + + /** + * The batchIndex input + */ + public final Operand batchIndex; + + /** + * The grad input + */ + public final Operand grad; + + /** + * The id input + */ + public final Operand id; + + /** + * The container attribute + */ + public final String container; + + /** + * The sharedName attribute + */ + public final String sharedName; + + /** + * The T attribute + */ + public final DataType T; + + public Inputs(GraphOperation op) { + super(new UnbatchGrad<>(op), op, Arrays.asList("container", "shared_name", "T")); + int inputIndex = 0; + originalInput = (Operand) op.input(inputIndex++); + batchIndex = (Operand) op.input(inputIndex++); + grad = (Operand) op.input(inputIndex++); + id = (Operand) op.input(inputIndex++); + container = op.attributes().getAttrString("container"); + sharedName = op.attributes().getAttrString("shared_name"); + T = op.attributes().getAttrType("T"); + } } } 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 deleted file mode 100644 index 56dfd29683d..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UnicodeDecode.java +++ /dev/null @@ -1,207 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific 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.types.TInt32; -import org.tensorflow.types.TInt64; -import org.tensorflow.types.TString; -import org.tensorflow.types.family.TNumber; -import org.tensorflow.types.family.TType; - -/** - * 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: - *