diff --git a/.github/ISSUE_TEMPLATE/blank_issue.yml b/.github/ISSUE_TEMPLATE/blank_issue.yml new file mode 100644 index 000000000..bbd855958 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/blank_issue.yml @@ -0,0 +1,12 @@ +name: Blank Issue +description: Submit an issue about Tensorflow.NET. +labels: [Blank Issue] +body: + - type: textarea + id: description + attributes: + label: Description + description: Please describe the issue here. + placeholder: Description + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 000000000..14e237951 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,48 @@ +name: BUG Report +description: Report a BUG of Tensorflow.NET. +title: "[BUG Report]: " +labels: [bug-report] +body: + - type: markdown + attributes: + value: | + We welcome bug reports! Any unexpected behavior could be a BUG and this template help us gather the information to fix it. + - type: textarea + id: background + attributes: + label: Description + description: Please share a clear and concise description of the problem. + placeholder: Description + validations: + required: true + - type: textarea + id: repro-steps + attributes: + label: Reproduction Steps + description: | + Please include minimal steps to reproduce the problem if possible. E.g.: the smallest possible code snippet; or a small project, with steps to run it. It will greatly help us to locate the reason of the problem. + placeholder: Minimal Reproduction + validations: + required: false + - type: textarea + id: known-workarounds + attributes: + label: Known Workarounds + description: | + Please provide a description of any known workarounds. + placeholder: Known Workarounds + validations: + required: false + - type: textarea + id: configuration + attributes: + label: Configuration and Other Information + description: | + Please provide more information on your configuration: + * Which version of Tensorflow.NET is the code depending on? + * Which version of .NET runtime is the code running on? + * What is the OS? + * Any other information about this problem? + placeholder: Configuration + validations: + required: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/documention_issue.yml b/.github/ISSUE_TEMPLATE/documention_issue.yml new file mode 100644 index 000000000..f8a04e40f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documention_issue.yml @@ -0,0 +1,30 @@ +name: Documentation Issue +description: Report an issue about Tensorflow.NET ducumention or require a documention. +title: "[Documention Issue]: " +labels: [Documention Issue] +body: + - type: markdown + attributes: + value: | + Welcome to suggest to Tensorflow.NET documention! This template will help us gather the information we need to improve it. + - type: textarea + id: brief-description + attributes: + label: Brief Description + description: Please describe the problem or the requst for new documention here. + placeholder: Description + validations: + required: true + - type: textarea + id: alternatives + attributes: + label: Alternatives + description: | + Please provide some alternative information here, if any. + placeholder: Alternatives + validations: + required: false + - type: markdown + attributes: + value: | + Thanks for your contributing! diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 000000000..9ce3f1663 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,50 @@ +name: Feature Request +description: Request/Propose a new feature of Tensorflow.NET. +title: "[Feature Request]: " +labels: [feature-request] +body: + - type: markdown + attributes: + value: | + We welcome feature proposal/request! This template will help us gather the information we need to implement the new feature. + - type: textarea + id: background + attributes: + label: Background and Feature Description + description: Please describe the purpose and value of the new feature here. If the feature is linked to a specific problem, please describe it or put the link here. + placeholder: Purpose + validations: + required: true + - type: textarea + id: api-proposal + attributes: + label: API Definition and Usage + description: | + Please tell us the new API related to the requested feature, if any. + placeholder: API declaration (no method bodies) + value: | + ```cs + public Tensor NewFunc(Tensor x, int y); + + var result = NewFunc(input, index); + ``` + validations: + required: false + - type: textarea + id: alternatives + attributes: + label: Alternatives + description: | + Please provide some alternative information of the feature, if any. For example, if you request a feature which depends on a specific device, please provide the device information. + placeholder: Alternatives + validations: + required: false + - type: textarea + id: risks + attributes: + label: Risks + description: | + Please mention any risks that to your knowledge the API proposal might entail, such as breaking changes, performance regressions, etc. + placeholder: Risks + validations: + required: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/performance_issue.yml b/.github/ISSUE_TEMPLATE/performance_issue.yml new file mode 100644 index 000000000..cbe86d329 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/performance_issue.yml @@ -0,0 +1,48 @@ +name: Performance Issue +description: Submit an issue about performance problem or regression of Tensorflow.NET. +title: "[Performance Issue]: " +labels: [Performance Issue] +body: + - type: markdown + attributes: + value: | + We welcome issues about Tensorflow.NET performance! This template will help us gather the information we need to locate the problem improve the performance. + - type: textarea + id: brief-description + attributes: + label: Brief Description + description: Please give a brief description about the performance issue here. + placeholder: Description + validations: + required: true + - type: textarea + id: device-and-context + attributes: + label: Device and Context + description: | + Please describe the device and context you used when you encounter the performance problem/regression. + placeholder: Device and Context + validations: + required: true + - type: textarea + id: benchmark + attributes: + label: Benchmark + description: | + We will appreciate it if you'd like to provide benchmark comparison of the performance issue. + placeholder: Benchmark + validations: + required: false + - type: textarea + id: alternatives + attributes: + label: Alternatives + description: | + Please provide some alternative information of the performance issue here, if any. For example, we'll appreciate it if you'd like to provide the the code to reproduce the performance problem. + placeholder: Alternatives + validations: + required: false + - type: markdown + attributes: + value: | + Thanks for your contributing! diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml new file mode 100644 index 000000000..ca38be340 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.yml @@ -0,0 +1,30 @@ +name: Question +description: Ask any question about Tensorflow.NET and discuss with community members. +title: "[Question]: " +labels: [Question] +body: + - type: markdown + attributes: + value: | + Any question about Tensorflow.NET is welcomed! This template will help us get your point. + - type: textarea + id: description + attributes: + label: Description + description: Please describe your question here. + placeholder: Description + validations: + required: true + - type: textarea + id: alternatives + attributes: + label: Alternatives + description: | + Please provide some alternative information here, if any. + placeholder: Alternatives + validations: + required: false + - type: markdown + attributes: + value: | + We are always willing to answer your questions! diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml new file mode 100644 index 000000000..070c7cbd7 --- /dev/null +++ b/.github/workflows/build_and_test.yml @@ -0,0 +1,66 @@ +# This workflow will build a .NET project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net + +name: build_and_test + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + types: ["opened", "reopened", "synchronize", "ready_for_review", "auto_merge_enabled"] + +jobs: + windows: + + runs-on: windows-latest + + steps: + - uses: actions/checkout@v3 + - name: Setup .NET 6 + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build CPU version + run: dotnet build --no-restore + - name: Test CPU version + run: dotnet test --no-build --verbosity normal + - name: uninstall redist cpu for unit tests + run: dotnet remove helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist + - name: install redist gpu for unit tests + run: dotnet add helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist-Windows-GPU + - name: Restore dependencies + run: dotnet restore + - name: Build GPU version + run: dotnet build --no-restore +# - name: Test GPU version +# run: dotnet test --no-build --verbosity normal + + linux: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build CPU version + run: dotnet build --no-restore + # - name: Test CPU version + # run: dotnet test --no-build --verbosity normal + - name: uninstall redist cpu for unit tests + run: dotnet remove helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist + - name: install redist gpu for unit tests + run: dotnet add helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist-Linux-GPU + - name: Restore dependencies + run: dotnet restore + - name: Build GPU version + run: dotnet build --no-restore +# - name: Test GPU version +# run: dotnet test --no-build --verbosity normal diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..2f6e9f07b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,100 @@ +name: auto-release + +on: + label: + types: [created, edited] + pull_request: + branches: + - master + types: [ labeled, opened, reopened, synchronize ] + +env: + MYGET_API_TOKEN: ${{ SECRETS.RINNE_MYGET_KEY }} + GITHUB_TOKEN: ${{ SECRETS.RINNE_GITHUB_TOKEN }} + +jobs: + build: + if: contains(github.event.pull_request.labels.*.name, 'auto-release') + runs-on: windows-latest + + steps: + - uses: actions/checkout@v3 + - name: Setup .NET 6.0.x SDK + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + + - name: Check .NET info + run: dotnet --info + + - name: Install dependencies + run: dotnet restore + + - name: Build solution + run: dotnet build -c Release --no-restore + +# run-semantic-release: +# runs-on: ubuntu-latest +# needs: build + +# steps: +# - name: Checkout +# uses: actions/checkout@v2 + +# - name: Run semantic-release +# run: | +# export PATH=$PATH:$(yarn global bin) +# yarn global add semantic-release@17.4.3 +# semantic-release + + release: + runs-on: windows-latest +# needs: run-semantic-release + needs: build + + steps: + - uses: actions/checkout@v3 + - name: Setup .NET 6.0.x SDK + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + + - name: Check .NET info + run: dotnet --info + + - name: Install dependencies + run: dotnet restore + + - name: Build solution + run: dotnet build -c Release --no-restore + + - name: Pack packages + run: | + git fetch --unshallow; + git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"; + git fetch origin; + $LastTag = git describe --tags; + echo "Last tag is: $LastTag"; + $Version = ($LastTag).TrimStart('v') + "-preview"; + echo "Publishing version: $Version"; + dotnet pack ./src/TensorFlowNET.Core/Tensorflow.Binding.csproj -c Release -o packages /p:PackageVersion=$Version /p:Version=$Version; + dotnet pack ./src/TensorFlowNET.Keras/Tensorflow.Keras.csproj -c Release -o packages /p:PackageVersion=$Version /p:Version=$Version; + dotnet pack ./src/TensorflowNET.Hub/Tensorflow.Hub.csproj -c Release -o packages /p:PackageVersion=$Version /p:Version=$Version; + + if($LastExitCode -ne 0) + { + Write-Warning -Message "Pack packages warming, last exit code is ${LastExitCode}." + $LastExitCode = 0; + } + + - name: Upload packages artifacts + uses: actions/upload-artifact@v1.0.0 + with: + name: "drop-ci-packages" + path: './packages' + + - name: Add myget nuget source + run: dotnet nuget add source https://www.myget.org/F/rinne/api/v2/package --name myget.org + + - name: Push TensorFlow.NET to myget.org + run: dotnet nuget push .\packages\TensorFlow*.nupkg -s myget.org -k $env:MYGET_API_TOKEN --skip-duplicate diff --git a/.github/workflows/semantic.yml b/.github/workflows/semantic.yml new file mode 100644 index 000000000..db8c06a3e --- /dev/null +++ b/.github/workflows/semantic.yml @@ -0,0 +1,17 @@ +name: Semantic + +on: + pull_request: + branches: [ "master" ] + +jobs: + semantic-pull-request: + name: Semantic check + runs-on: windows-latest + steps: + - name: semantic-pull-request + uses: amannn/action-semantic-pull-request@v4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + validateSingleCommit: true diff --git a/README.md b/README.md index 40ca1afca..84dd7bb6e 100644 --- a/README.md +++ b/README.md @@ -9,72 +9,75 @@ [![Badge](https://img.shields.io/badge/link-996.icu-red.svg)](https://996.icu/#/en_US) [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/javiercp/BinderTF.NET/master?urlpath=lab) -*master branch is based on tensorflow v2.x, v0.6x branch is based on tensorflow v2.6, v0.15-tensorflow1.15 is from tensorflow1.15.* +English | [中文](docs/README-CN.md) + +*master branch is corresponding to tensorflow v2.10, v0.6x branch is from tensorflow v2.6, v0.15-tensorflow1.15 is from tensorflow1.15.* ![tensors_flowing](docs/assets/tensors_flowing.gif) -### Why TensorFlow in C# and F# ? +## Why Tensorflow.NET ? `SciSharp STACK`'s mission is to bring popular data science technology into the .NET world and to provide .NET developers with a powerful Machine Learning tool set without reinventing the wheel. Since the APIs are kept as similar as possible you can immediately adapt any existing TensorFlow code in C# or F# with a zero learning curve. Take a look at a comparison picture and see how comfortably a TensorFlow/Python script translates into a C# program with TensorFlow.NET. -![pythn vs csharp](docs/assets/syntax-comparision.png) +![python vs csharp](docs/assets/syntax-comparision.png) SciSharp's philosophy allows a large number of machine learning code written in Python to be quickly migrated to .NET, enabling .NET developers to use cutting edge machine learning models and access a vast number of TensorFlow resources which would not be possible without this project. -In comparison to other projects, like for instance [TensorFlowSharp](https://www.nuget.org/packages/TensorFlowSharp/) which only provide TensorFlow's low-level C++ API and can only run models that were built using Python, Tensorflow.NET also implements TensorFlow's high level API where all the magic happens. This computation graph building layer is still under active development. Once it is completely implemented you can build new Machine Learning models in C# or F#. +In comparison to other projects, like for instance [TensorFlowSharp](https://www.nuget.org/packages/TensorFlowSharp/) which only provide TensorFlow's low-level C++ API and can only run models that were built using Python, Tensorflow.NET makes it possible to build the pipeline of training and inference with pure C# and F#. Besides, Tensorflow.NET provides binding of Tensorflow.Keras to make it easy to transfer your code from python to .NET. + +[ML.NET](https://github.com/dotnet/machinelearning) also take Tensorflow.NET as one of the backends to train and infer your model, which provides better integration with .NET. + +## Documention -Go through the online docs [TensorFlow for .NET](https://scisharp.github.io/tensorflow-net-docs) before you get started with Machine Learning in .NET. +Introduction and simple examples:[Tensorflow.NET Documents](https://scisharp.github.io/tensorflow-net-docs) -### How to use +Detailed documention:[The Definitive Guide to Tensorflow.NET](https://tensorflownet.readthedocs.io/en/latest/FrontCover.html) -| TensorFlow | tf native1.14, cuda 10.0 | tf native 1.15, cuda 10.0 | tf native 2.3, cuda 10.1 | tf native 2.4, cuda 11 | -| -------------------------- | ------------- | -------------- | ------------- | ------------- | -| tf.net 0.4x, tf.keras 0.5 | | | | x | -| tf.net 0.3x, tf.keras 0.4 | | | x | | -| tf.net 0.2x | | x | x | | -| tf.net 0.15 | x | x | | | -| tf.net 0.14 | x | | | | +Examples:[TensorFlow.NET Examples](https://github.com/SciSharp/TensorFlow.NET-Examples) -Troubleshooting of running example or installation, please refer [here](tensorflowlib/README.md). +Troubleshooting of running example or installation:[Tensorflow.NET FAQ](tensorflowlib/README.md) -There are many examples reside at [TensorFlow.NET Examples](https://github.com/SciSharp/TensorFlow.NET-Examples) written in C# and F#. +## Usage -#### TensorFlow.net Version -` tf.net 0.4x -> tf native 2.4` -`tf.net 0.6x -> tf native 2.6` -`tf.net 0.7x -> tf native 2.7` -`...` +### Installation -#### C# Example +You can search the package name in NuGet Manager, or use the commands below in package manager console. + +The installation contains two parts, the first is the main body: -Install TF.NET and TensorFlow binary through NuGet. ```sh -### install tensorflow C#/F# binding +### Install Tensorflow.NET PM> Install-Package TensorFlow.NET -### install keras for tensorflow + +### Install Tensorflow.Keras PM> Install-Package TensorFlow.Keras +``` + +The second part is the computing support part. Only one of the following packages is needed, depending on your device and system. -### Install tensorflow binary -### For CPU version +``` +### CPU version for Windows, Linux and Mac PM> Install-Package SciSharp.TensorFlow.Redist -### For GPU version (CUDA and cuDNN are required) +### GPU version for Windows (CUDA and cuDNN are required) PM> Install-Package SciSharp.TensorFlow.Redist-Windows-GPU + +### GPU version for Linux (CUDA and cuDNN are required) +PM> Install-Package SciSharp.TensorFlow.Redist-Linux-GPU ``` -Import TF.NET and Keras API in your project. + +Two simple examples are given here to introduce the basic usage of Tensorflow.NET. As you can see, it's easy to write C# code just like that in Python. + +### Example - Linear Regression in `Eager` mode ```csharp using static Tensorflow.Binding; using static Tensorflow.KerasApi; using Tensorflow; using Tensorflow.NumPy; -``` -Linear Regression in `Eager` mode: - -```csharp // Parameters var training_steps = 1000; var learning_rate = 0.01f; @@ -120,10 +123,15 @@ foreach (var step in range(1, training_steps + 1)) Run this example in [Jupyter Notebook](https://github.com/SciSharp/SciSharpCube). -Toy version of `ResNet` in `Keras` functional API: +### Example - Toy version of `ResNet` in `Keras` functional API ```csharp -var layers = new LayersApi(); +using static Tensorflow.Binding; +using static Tensorflow.KerasApi; +using Tensorflow; +using Tensorflow.NumPy; + +var layers = keras.layers; // input layer var inputs = keras.Input(shape: (32, 32, 3), name: "img"); // convolutional layer @@ -147,96 +155,67 @@ var model = keras.Model(inputs, outputs, name: "toy_resnet"); model.summary(); // compile keras model in tensorflow static graph model.compile(optimizer: keras.optimizers.RMSprop(1e-3f), - loss: keras.losses.CategoricalCrossentropy(from_logits: true), + loss: keras.losses.SparseCategoricalCrossentropy(from_logits: true), metrics: new[] { "acc" }); // prepare dataset var ((x_train, y_train), (x_test, y_test)) = keras.datasets.cifar10.load_data(); +// normalize the input x_train = x_train / 255.0f; -y_train = np_utils.to_categorical(y_train, 10); // training model.fit(x_train[new Slice(0, 2000)], y_train[new Slice(0, 2000)], - batch_size: 64, - epochs: 10, - validation_split: 0.2f); + batch_size: 64, + epochs: 10, + validation_split: 0.2f); +// save the model +model.save("./toy_resnet_model"); ``` -#### F# Example - -Linear Regression in `Eager` mode: - -```fsharp -#r "nuget: TensorFlow.Net" -#r "nuget: TensorFlow.Keras" -#r "nuget: SciSharp.TensorFlow.Redist" +The F# example for linear regression is available [here](docs/Example-fsharp.md). -open Tensorflow -open Tensorflow.NumPy -open type Tensorflow.Binding -open type Tensorflow.KerasApi +More adcanced examples could be found in [TensorFlow.NET Examples](https://github.com/SciSharp/TensorFlow.NET-Examples). -let tf = New() -tf.enable_eager_execution() +## Version Relationships -// Parameters -let training_steps = 1000 -let learning_rate = 0.01f -let display_step = 100 - -// Sample data -let train_X = - np.array(3.3f, 4.4f, 5.5f, 6.71f, 6.93f, 4.168f, 9.779f, 6.182f, 7.59f, 2.167f, - 7.042f, 10.791f, 5.313f, 7.997f, 5.654f, 9.27f, 3.1f) -let train_Y = - np.array(1.7f, 2.76f, 2.09f, 3.19f, 1.694f, 1.573f, 3.366f, 2.596f, 2.53f, 1.221f, - 2.827f, 3.465f, 1.65f, 2.904f, 2.42f, 2.94f, 1.3f) -let n_samples = train_X.shape.[0] - -// We can set a fixed init value in order to demo -let W = tf.Variable(-0.06f,name = "weight") -let b = tf.Variable(-0.73f, name = "bias") -let optimizer = keras.optimizers.SGD(learning_rate) - -// Run training for the given number of steps. -for step = 1 to (training_steps + 1) do - // Run the optimization to update W and b values. - // Wrap computation inside a GradientTape for automatic differentiation. - use g = tf.GradientTape() - // Linear regression (Wx + b). - let pred = W * train_X + b - // Mean square error. - let loss = tf.reduce_sum(tf.pow(pred - train_Y,2)) / (2 * n_samples) - // should stop recording - // compute gradients - let gradients = g.gradient(loss,struct (W,b)) +| TensorFlow.NET Versions | tensorflow 1.14, cuda 10.0 | tensorflow 1.15, cuda 10.0 | tensorflow 2.3, cuda 10.1 | tensorflow 2.4, cuda 11 | tensorflow 2.7, cuda 11 |tensorflow 2.10, cuda 11 | +| -------------------------- | ------------- | -------------- | ------------- | ------------- | ------------ | ------------ | +| tf.net 0.10x, tf.keras 0.10 | | | | | | x | +| tf.net 0.7x, tf.keras 0.7 | | | | | x | | +| tf.net 0.4x, tf.keras 0.5 | | | | x | | | +| tf.net 0.3x, tf.keras 0.4 | | | x | | | | +| tf.net 0.2x | | x | x | | | | +| tf.net 0.15 | x | x | | | | | +| tf.net 0.14 | x | | | | | | - // Update W and b following gradients. - optimizer.apply_gradients(zip(gradients, struct (W,b))) - if (step % display_step) = 0 then - let pred = W * train_X + b - let loss = tf.reduce_sum(tf.pow(pred-train_Y,2)) / (2 * n_samples) - printfn $"step: {step}, loss: {loss.numpy()}, W: {W.numpy()}, b: {b.numpy()}" +``` +tf.net 0.4x -> tf native 2.4 +tf.net 0.6x -> tf native 2.6 +tf.net 0.7x -> tf native 2.7 +tf.net 0.10x -> tf native 2.10 +... ``` -Read the book [The Definitive Guide to Tensorflow.NET](https://tensorflownet.readthedocs.io/en/latest/FrontCover.html) if you want to know more about TensorFlow for .NET under the hood. +## Contribution: -### Contribute: +Feel like contributing to one of the hottest projects in the Machine Learning field? Want to know how Tensorflow magically creates the computational graph? -Feel like contributing to one of the hottest projects in the Machine Learning field? Want to know how Tensorflow magically creates the computational graph? We appreciate every contribution however small. There are tasks for novices to experts alike, if everyone tackles only a small task the sum of contributions will be huge. +We appreciate every contribution however small! There are tasks for novices to experts alike, if everyone tackles only a small task the sum of contributions will be huge. You can: -* Let everyone know about this project -* Port Tensorflow unit tests from Python to C# or F# -* Port missing Tensorflow code from Python to C# or F# -* Port Tensorflow examples to C# or F# and raise issues if you come accross missing parts of the API -* Debug one of the unit tests that is marked as Ignored to get it to work -* Debug one of the not yet working examples and get it to work +- Star Tensorflow.NET or share it with others +- Tell us about the missing APIs compared to Tensorflow +- Port Tensorflow unit tests from Python to C# or F# +- Port Tensorflow examples to C# or F# and raise issues if you come accross missing parts of the API or BUG +- Debug one of the unit tests that is marked as Ignored to get it to work +- Debug one of the not yet working examples and get it to work +- Help us to complete the documentions. -### How to debug unit tests: + +#### How to debug unit tests: The best way to find out why a unit test is failing is to single step it in C# or F# and its corresponding Python at the same time to see where the flow of execution digresses or where variables exhibit different values. Good Python IDEs like PyCharm let you single step into the tensorflow library code. -### Git Knowhow for Contributors +#### Git Knowhow for Contributors Add SciSharp/TensorFlow.NET as upstream to your local repo ... ```git @@ -247,6 +226,7 @@ Please make sure you keep your fork up to date by regularly pulling from upstrea ```git git pull upstream master ``` + ### Support Buy our book to make open source project be sustainable [TensorFlow.NET实战](https://item.jd.com/13441549.html)

diff --git a/TensorFlow.NET.sln b/TensorFlow.NET.sln index 8846d5bfd..0c7d6e3c2 100644 --- a/TensorFlow.NET.sln +++ b/TensorFlow.NET.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31624.102 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33213.308 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tensorflow.Binding", "src\TensorFlowNET.Core\Tensorflow.Binding.csproj", "{FD682AC0-7B2D-45D3-8B0D-C6D678B04144}" EndProject @@ -23,11 +23,26 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tensorflow.Keras.UnitTest", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowNET.Graph.UnitTest", "test\TensorFlowNET.Graph.UnitTest\TensorFlowNET.Graph.UnitTest.csproj", "{3F5388FF-FBB4-462B-8F6F-829FFBAEB8A3}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tensorflow.Hub", "src\TensorflowNET.Hub\Tensorflow.Hub.csproj", "{9738D16A-CFA0-405C-A7DF-D3D203B0CB18}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tensorflow.Hub.Unittest", "test\TensorflowNET.Hub.Unittest\Tensorflow.Hub.Unittest.csproj", "{7DEA8760-E401-4872-81F3-405F185A13A0}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{01A1787F-A9BE-4221-84E8-6360DD010AB6}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{1B0918B9-65AD-4F34-A287-AF4597B27DBD}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "helpers", "helpers", "{E1A5D2B7-10AF-4876-85C0-7714EF274214}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tensorflow.UnitTest.RedistHolder", "helpers\Tensorflow.UnitTest.RedistHolder\Tensorflow.UnitTest.RedistHolder.csproj", "{62D543A2-8846-45A3-829B-5754B094A8E2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + GPU|Any CPU = GPU|Any CPU + GPU|x64 = GPU|x64 + GPU|x86 = GPU|x86 Release|Any CPU = Release|Any CPU Release|x64 = Release|x64 Release|x86 = Release|x86 @@ -39,6 +54,12 @@ Global {FD682AC0-7B2D-45D3-8B0D-C6D678B04144}.Debug|x64.Build.0 = Debug|x64 {FD682AC0-7B2D-45D3-8B0D-C6D678B04144}.Debug|x86.ActiveCfg = Debug|Any CPU {FD682AC0-7B2D-45D3-8B0D-C6D678B04144}.Debug|x86.Build.0 = Debug|Any CPU + {FD682AC0-7B2D-45D3-8B0D-C6D678B04144}.GPU|Any CPU.ActiveCfg = GPU|Any CPU + {FD682AC0-7B2D-45D3-8B0D-C6D678B04144}.GPU|Any CPU.Build.0 = GPU|Any CPU + {FD682AC0-7B2D-45D3-8B0D-C6D678B04144}.GPU|x64.ActiveCfg = GPU|x64 + {FD682AC0-7B2D-45D3-8B0D-C6D678B04144}.GPU|x64.Build.0 = GPU|x64 + {FD682AC0-7B2D-45D3-8B0D-C6D678B04144}.GPU|x86.ActiveCfg = GPU|Any CPU + {FD682AC0-7B2D-45D3-8B0D-C6D678B04144}.GPU|x86.Build.0 = GPU|Any CPU {FD682AC0-7B2D-45D3-8B0D-C6D678B04144}.Release|Any CPU.ActiveCfg = Release|Any CPU {FD682AC0-7B2D-45D3-8B0D-C6D678B04144}.Release|Any CPU.Build.0 = Release|Any CPU {FD682AC0-7B2D-45D3-8B0D-C6D678B04144}.Release|x64.ActiveCfg = Release|x64 @@ -51,6 +72,12 @@ Global {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.Debug|x64.Build.0 = Debug|x64 {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.Debug|x86.ActiveCfg = Debug|Any CPU {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.Debug|x86.Build.0 = Debug|Any CPU + {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.GPU|Any CPU.ActiveCfg = Release|Any CPU + {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.GPU|Any CPU.Build.0 = Release|Any CPU + {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.GPU|x64.ActiveCfg = Release|x64 + {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.GPU|x64.Build.0 = Release|x64 + {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.GPU|x86.ActiveCfg = Release|Any CPU + {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.GPU|x86.Build.0 = Release|Any CPU {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.Release|Any CPU.ActiveCfg = Release|Any CPU {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.Release|Any CPU.Build.0 = Release|Any CPU {3A6EB896-604F-4E25-B677-B8103BCF3D2E}.Release|x64.ActiveCfg = Release|x64 @@ -63,6 +90,12 @@ Global {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.Debug|x64.Build.0 = Debug|x64 {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.Debug|x86.ActiveCfg = Debug|Any CPU {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.Debug|x86.Build.0 = Debug|Any CPU + {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.GPU|Any CPU.ActiveCfg = Release|Any CPU + {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.GPU|Any CPU.Build.0 = Release|Any CPU + {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.GPU|x64.ActiveCfg = Release|x64 + {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.GPU|x64.Build.0 = Release|x64 + {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.GPU|x86.ActiveCfg = Release|Any CPU + {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.GPU|x86.Build.0 = Release|Any CPU {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.Release|Any CPU.ActiveCfg = Release|Any CPU {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.Release|Any CPU.Build.0 = Release|Any CPU {23C28035-2FCE-41F3-9A12-E73CE8A5AE32}.Release|x64.ActiveCfg = Release|x64 @@ -75,6 +108,12 @@ Global {03F06299-3F4B-4449-A709-3A647657BC0C}.Debug|x64.Build.0 = Debug|x64 {03F06299-3F4B-4449-A709-3A647657BC0C}.Debug|x86.ActiveCfg = Debug|Any CPU {03F06299-3F4B-4449-A709-3A647657BC0C}.Debug|x86.Build.0 = Debug|Any CPU + {03F06299-3F4B-4449-A709-3A647657BC0C}.GPU|Any CPU.ActiveCfg = Release|Any CPU + {03F06299-3F4B-4449-A709-3A647657BC0C}.GPU|Any CPU.Build.0 = Release|Any CPU + {03F06299-3F4B-4449-A709-3A647657BC0C}.GPU|x64.ActiveCfg = Release|x64 + {03F06299-3F4B-4449-A709-3A647657BC0C}.GPU|x64.Build.0 = Release|x64 + {03F06299-3F4B-4449-A709-3A647657BC0C}.GPU|x86.ActiveCfg = Release|Any CPU + {03F06299-3F4B-4449-A709-3A647657BC0C}.GPU|x86.Build.0 = Release|Any CPU {03F06299-3F4B-4449-A709-3A647657BC0C}.Release|Any CPU.ActiveCfg = Release|Any CPU {03F06299-3F4B-4449-A709-3A647657BC0C}.Release|Any CPU.Build.0 = Release|Any CPU {03F06299-3F4B-4449-A709-3A647657BC0C}.Release|x64.ActiveCfg = Release|x64 @@ -87,6 +126,12 @@ Global {49D71826-C03D-4FA7-9BAC-22C1327E65CF}.Debug|x64.Build.0 = Debug|x64 {49D71826-C03D-4FA7-9BAC-22C1327E65CF}.Debug|x86.ActiveCfg = Debug|Any CPU {49D71826-C03D-4FA7-9BAC-22C1327E65CF}.Debug|x86.Build.0 = Debug|Any CPU + {49D71826-C03D-4FA7-9BAC-22C1327E65CF}.GPU|Any CPU.ActiveCfg = GPU|Any CPU + {49D71826-C03D-4FA7-9BAC-22C1327E65CF}.GPU|Any CPU.Build.0 = GPU|Any CPU + {49D71826-C03D-4FA7-9BAC-22C1327E65CF}.GPU|x64.ActiveCfg = GPU|x64 + {49D71826-C03D-4FA7-9BAC-22C1327E65CF}.GPU|x64.Build.0 = GPU|x64 + {49D71826-C03D-4FA7-9BAC-22C1327E65CF}.GPU|x86.ActiveCfg = GPU|Any CPU + {49D71826-C03D-4FA7-9BAC-22C1327E65CF}.GPU|x86.Build.0 = GPU|Any CPU {49D71826-C03D-4FA7-9BAC-22C1327E65CF}.Release|Any CPU.ActiveCfg = Release|Any CPU {49D71826-C03D-4FA7-9BAC-22C1327E65CF}.Release|Any CPU.Build.0 = Release|Any CPU {49D71826-C03D-4FA7-9BAC-22C1327E65CF}.Release|x64.ActiveCfg = Release|x64 @@ -99,6 +144,12 @@ Global {1AB8108D-4FFE-4A16-88E7-328EAF686370}.Debug|x64.Build.0 = Debug|x64 {1AB8108D-4FFE-4A16-88E7-328EAF686370}.Debug|x86.ActiveCfg = Debug|Any CPU {1AB8108D-4FFE-4A16-88E7-328EAF686370}.Debug|x86.Build.0 = Debug|Any CPU + {1AB8108D-4FFE-4A16-88E7-328EAF686370}.GPU|Any CPU.ActiveCfg = Release|Any CPU + {1AB8108D-4FFE-4A16-88E7-328EAF686370}.GPU|Any CPU.Build.0 = Release|Any CPU + {1AB8108D-4FFE-4A16-88E7-328EAF686370}.GPU|x64.ActiveCfg = Release|x64 + {1AB8108D-4FFE-4A16-88E7-328EAF686370}.GPU|x64.Build.0 = Release|x64 + {1AB8108D-4FFE-4A16-88E7-328EAF686370}.GPU|x86.ActiveCfg = Release|Any CPU + {1AB8108D-4FFE-4A16-88E7-328EAF686370}.GPU|x86.Build.0 = Release|Any CPU {1AB8108D-4FFE-4A16-88E7-328EAF686370}.Release|Any CPU.ActiveCfg = Release|Any CPU {1AB8108D-4FFE-4A16-88E7-328EAF686370}.Release|Any CPU.Build.0 = Release|Any CPU {1AB8108D-4FFE-4A16-88E7-328EAF686370}.Release|x64.ActiveCfg = Release|x64 @@ -111,6 +162,12 @@ Global {F17AAECB-960A-4E18-A270-BAD776F0E55B}.Debug|x64.Build.0 = Debug|x64 {F17AAECB-960A-4E18-A270-BAD776F0E55B}.Debug|x86.ActiveCfg = Debug|Any CPU {F17AAECB-960A-4E18-A270-BAD776F0E55B}.Debug|x86.Build.0 = Debug|Any CPU + {F17AAECB-960A-4E18-A270-BAD776F0E55B}.GPU|Any CPU.ActiveCfg = Release|Any CPU + {F17AAECB-960A-4E18-A270-BAD776F0E55B}.GPU|Any CPU.Build.0 = Release|Any CPU + {F17AAECB-960A-4E18-A270-BAD776F0E55B}.GPU|x64.ActiveCfg = Release|x64 + {F17AAECB-960A-4E18-A270-BAD776F0E55B}.GPU|x64.Build.0 = Release|x64 + {F17AAECB-960A-4E18-A270-BAD776F0E55B}.GPU|x86.ActiveCfg = Release|Any CPU + {F17AAECB-960A-4E18-A270-BAD776F0E55B}.GPU|x86.Build.0 = Release|Any CPU {F17AAECB-960A-4E18-A270-BAD776F0E55B}.Release|Any CPU.ActiveCfg = Release|Any CPU {F17AAECB-960A-4E18-A270-BAD776F0E55B}.Release|Any CPU.Build.0 = Release|Any CPU {F17AAECB-960A-4E18-A270-BAD776F0E55B}.Release|x64.ActiveCfg = Release|x64 @@ -123,6 +180,12 @@ Global {84CA35F8-99FC-408E-8DF3-5AA175E5EFD3}.Debug|x64.Build.0 = Debug|x64 {84CA35F8-99FC-408E-8DF3-5AA175E5EFD3}.Debug|x86.ActiveCfg = Debug|Any CPU {84CA35F8-99FC-408E-8DF3-5AA175E5EFD3}.Debug|x86.Build.0 = Debug|Any CPU + {84CA35F8-99FC-408E-8DF3-5AA175E5EFD3}.GPU|Any CPU.ActiveCfg = Release|Any CPU + {84CA35F8-99FC-408E-8DF3-5AA175E5EFD3}.GPU|Any CPU.Build.0 = Release|Any CPU + {84CA35F8-99FC-408E-8DF3-5AA175E5EFD3}.GPU|x64.ActiveCfg = Release|x64 + {84CA35F8-99FC-408E-8DF3-5AA175E5EFD3}.GPU|x64.Build.0 = Release|x64 + {84CA35F8-99FC-408E-8DF3-5AA175E5EFD3}.GPU|x86.ActiveCfg = Release|Any CPU + {84CA35F8-99FC-408E-8DF3-5AA175E5EFD3}.GPU|x86.Build.0 = Release|Any CPU {84CA35F8-99FC-408E-8DF3-5AA175E5EFD3}.Release|Any CPU.ActiveCfg = Release|Any CPU {84CA35F8-99FC-408E-8DF3-5AA175E5EFD3}.Release|Any CPU.Build.0 = Release|Any CPU {84CA35F8-99FC-408E-8DF3-5AA175E5EFD3}.Release|x64.ActiveCfg = Release|x64 @@ -135,6 +198,12 @@ Global {79EB56DF-E29E-4AE2-A7D9-FE403FD919BA}.Debug|x64.Build.0 = Debug|x64 {79EB56DF-E29E-4AE2-A7D9-FE403FD919BA}.Debug|x86.ActiveCfg = Debug|Any CPU {79EB56DF-E29E-4AE2-A7D9-FE403FD919BA}.Debug|x86.Build.0 = Debug|Any CPU + {79EB56DF-E29E-4AE2-A7D9-FE403FD919BA}.GPU|Any CPU.ActiveCfg = Release|Any CPU + {79EB56DF-E29E-4AE2-A7D9-FE403FD919BA}.GPU|Any CPU.Build.0 = Release|Any CPU + {79EB56DF-E29E-4AE2-A7D9-FE403FD919BA}.GPU|x64.ActiveCfg = Release|x64 + {79EB56DF-E29E-4AE2-A7D9-FE403FD919BA}.GPU|x64.Build.0 = Release|x64 + {79EB56DF-E29E-4AE2-A7D9-FE403FD919BA}.GPU|x86.ActiveCfg = Release|Any CPU + {79EB56DF-E29E-4AE2-A7D9-FE403FD919BA}.GPU|x86.Build.0 = Release|Any CPU {79EB56DF-E29E-4AE2-A7D9-FE403FD919BA}.Release|Any CPU.ActiveCfg = Release|Any CPU {79EB56DF-E29E-4AE2-A7D9-FE403FD919BA}.Release|Any CPU.Build.0 = Release|Any CPU {79EB56DF-E29E-4AE2-A7D9-FE403FD919BA}.Release|x64.ActiveCfg = Release|x64 @@ -147,16 +216,91 @@ Global {3F5388FF-FBB4-462B-8F6F-829FFBAEB8A3}.Debug|x64.Build.0 = Debug|x64 {3F5388FF-FBB4-462B-8F6F-829FFBAEB8A3}.Debug|x86.ActiveCfg = Debug|Any CPU {3F5388FF-FBB4-462B-8F6F-829FFBAEB8A3}.Debug|x86.Build.0 = Debug|Any CPU + {3F5388FF-FBB4-462B-8F6F-829FFBAEB8A3}.GPU|Any CPU.ActiveCfg = Release|Any CPU + {3F5388FF-FBB4-462B-8F6F-829FFBAEB8A3}.GPU|Any CPU.Build.0 = Release|Any CPU + {3F5388FF-FBB4-462B-8F6F-829FFBAEB8A3}.GPU|x64.ActiveCfg = Release|x64 + {3F5388FF-FBB4-462B-8F6F-829FFBAEB8A3}.GPU|x64.Build.0 = Release|x64 + {3F5388FF-FBB4-462B-8F6F-829FFBAEB8A3}.GPU|x86.ActiveCfg = Release|Any CPU + {3F5388FF-FBB4-462B-8F6F-829FFBAEB8A3}.GPU|x86.Build.0 = Release|Any CPU {3F5388FF-FBB4-462B-8F6F-829FFBAEB8A3}.Release|Any CPU.ActiveCfg = Release|Any CPU {3F5388FF-FBB4-462B-8F6F-829FFBAEB8A3}.Release|Any CPU.Build.0 = Release|Any CPU {3F5388FF-FBB4-462B-8F6F-829FFBAEB8A3}.Release|x64.ActiveCfg = Release|x64 {3F5388FF-FBB4-462B-8F6F-829FFBAEB8A3}.Release|x64.Build.0 = Release|x64 {3F5388FF-FBB4-462B-8F6F-829FFBAEB8A3}.Release|x86.ActiveCfg = Release|Any CPU {3F5388FF-FBB4-462B-8F6F-829FFBAEB8A3}.Release|x86.Build.0 = Release|Any CPU + {9738D16A-CFA0-405C-A7DF-D3D203B0CB18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9738D16A-CFA0-405C-A7DF-D3D203B0CB18}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9738D16A-CFA0-405C-A7DF-D3D203B0CB18}.Debug|x64.ActiveCfg = Debug|Any CPU + {9738D16A-CFA0-405C-A7DF-D3D203B0CB18}.Debug|x64.Build.0 = Debug|Any CPU + {9738D16A-CFA0-405C-A7DF-D3D203B0CB18}.Debug|x86.ActiveCfg = Debug|Any CPU + {9738D16A-CFA0-405C-A7DF-D3D203B0CB18}.Debug|x86.Build.0 = Debug|Any CPU + {9738D16A-CFA0-405C-A7DF-D3D203B0CB18}.GPU|Any CPU.ActiveCfg = Debug|Any CPU + {9738D16A-CFA0-405C-A7DF-D3D203B0CB18}.GPU|Any CPU.Build.0 = Debug|Any CPU + {9738D16A-CFA0-405C-A7DF-D3D203B0CB18}.GPU|x64.ActiveCfg = Debug|Any CPU + {9738D16A-CFA0-405C-A7DF-D3D203B0CB18}.GPU|x64.Build.0 = Debug|Any CPU + {9738D16A-CFA0-405C-A7DF-D3D203B0CB18}.GPU|x86.ActiveCfg = Debug|Any CPU + {9738D16A-CFA0-405C-A7DF-D3D203B0CB18}.GPU|x86.Build.0 = Debug|Any CPU + {9738D16A-CFA0-405C-A7DF-D3D203B0CB18}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9738D16A-CFA0-405C-A7DF-D3D203B0CB18}.Release|Any CPU.Build.0 = Release|Any CPU + {9738D16A-CFA0-405C-A7DF-D3D203B0CB18}.Release|x64.ActiveCfg = Release|Any CPU + {9738D16A-CFA0-405C-A7DF-D3D203B0CB18}.Release|x64.Build.0 = Release|Any CPU + {9738D16A-CFA0-405C-A7DF-D3D203B0CB18}.Release|x86.ActiveCfg = Release|Any CPU + {9738D16A-CFA0-405C-A7DF-D3D203B0CB18}.Release|x86.Build.0 = Release|Any CPU + {7DEA8760-E401-4872-81F3-405F185A13A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7DEA8760-E401-4872-81F3-405F185A13A0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7DEA8760-E401-4872-81F3-405F185A13A0}.Debug|x64.ActiveCfg = Debug|Any CPU + {7DEA8760-E401-4872-81F3-405F185A13A0}.Debug|x64.Build.0 = Debug|Any CPU + {7DEA8760-E401-4872-81F3-405F185A13A0}.Debug|x86.ActiveCfg = Debug|Any CPU + {7DEA8760-E401-4872-81F3-405F185A13A0}.Debug|x86.Build.0 = Debug|Any CPU + {7DEA8760-E401-4872-81F3-405F185A13A0}.GPU|Any CPU.ActiveCfg = Debug|Any CPU + {7DEA8760-E401-4872-81F3-405F185A13A0}.GPU|Any CPU.Build.0 = Debug|Any CPU + {7DEA8760-E401-4872-81F3-405F185A13A0}.GPU|x64.ActiveCfg = Debug|Any CPU + {7DEA8760-E401-4872-81F3-405F185A13A0}.GPU|x64.Build.0 = Debug|Any CPU + {7DEA8760-E401-4872-81F3-405F185A13A0}.GPU|x86.ActiveCfg = Debug|Any CPU + {7DEA8760-E401-4872-81F3-405F185A13A0}.GPU|x86.Build.0 = Debug|Any CPU + {7DEA8760-E401-4872-81F3-405F185A13A0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7DEA8760-E401-4872-81F3-405F185A13A0}.Release|Any CPU.Build.0 = Release|Any CPU + {7DEA8760-E401-4872-81F3-405F185A13A0}.Release|x64.ActiveCfg = Release|Any CPU + {7DEA8760-E401-4872-81F3-405F185A13A0}.Release|x64.Build.0 = Release|Any CPU + {7DEA8760-E401-4872-81F3-405F185A13A0}.Release|x86.ActiveCfg = Release|Any CPU + {7DEA8760-E401-4872-81F3-405F185A13A0}.Release|x86.Build.0 = Release|Any CPU + {62D543A2-8846-45A3-829B-5754B094A8E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {62D543A2-8846-45A3-829B-5754B094A8E2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {62D543A2-8846-45A3-829B-5754B094A8E2}.Debug|x64.ActiveCfg = Debug|Any CPU + {62D543A2-8846-45A3-829B-5754B094A8E2}.Debug|x64.Build.0 = Debug|Any CPU + {62D543A2-8846-45A3-829B-5754B094A8E2}.Debug|x86.ActiveCfg = Debug|Any CPU + {62D543A2-8846-45A3-829B-5754B094A8E2}.Debug|x86.Build.0 = Debug|Any CPU + {62D543A2-8846-45A3-829B-5754B094A8E2}.GPU|Any CPU.ActiveCfg = Debug|Any CPU + {62D543A2-8846-45A3-829B-5754B094A8E2}.GPU|Any CPU.Build.0 = Debug|Any CPU + {62D543A2-8846-45A3-829B-5754B094A8E2}.GPU|x64.ActiveCfg = Debug|Any CPU + {62D543A2-8846-45A3-829B-5754B094A8E2}.GPU|x64.Build.0 = Debug|Any CPU + {62D543A2-8846-45A3-829B-5754B094A8E2}.GPU|x86.ActiveCfg = Debug|Any CPU + {62D543A2-8846-45A3-829B-5754B094A8E2}.GPU|x86.Build.0 = Debug|Any CPU + {62D543A2-8846-45A3-829B-5754B094A8E2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {62D543A2-8846-45A3-829B-5754B094A8E2}.Release|Any CPU.Build.0 = Release|Any CPU + {62D543A2-8846-45A3-829B-5754B094A8E2}.Release|x64.ActiveCfg = Release|Any CPU + {62D543A2-8846-45A3-829B-5754B094A8E2}.Release|x64.Build.0 = Release|Any CPU + {62D543A2-8846-45A3-829B-5754B094A8E2}.Release|x86.ActiveCfg = Release|Any CPU + {62D543A2-8846-45A3-829B-5754B094A8E2}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {FD682AC0-7B2D-45D3-8B0D-C6D678B04144} = {01A1787F-A9BE-4221-84E8-6360DD010AB6} + {3A6EB896-604F-4E25-B677-B8103BCF3D2E} = {E1A5D2B7-10AF-4876-85C0-7714EF274214} + {23C28035-2FCE-41F3-9A12-E73CE8A5AE32} = {1B0918B9-65AD-4F34-A287-AF4597B27DBD} + {03F06299-3F4B-4449-A709-3A647657BC0C} = {E1A5D2B7-10AF-4876-85C0-7714EF274214} + {49D71826-C03D-4FA7-9BAC-22C1327E65CF} = {01A1787F-A9BE-4221-84E8-6360DD010AB6} + {1AB8108D-4FFE-4A16-88E7-328EAF686370} = {01A1787F-A9BE-4221-84E8-6360DD010AB6} + {F17AAECB-960A-4E18-A270-BAD776F0E55B} = {01A1787F-A9BE-4221-84E8-6360DD010AB6} + {84CA35F8-99FC-408E-8DF3-5AA175E5EFD3} = {1B0918B9-65AD-4F34-A287-AF4597B27DBD} + {79EB56DF-E29E-4AE2-A7D9-FE403FD919BA} = {1B0918B9-65AD-4F34-A287-AF4597B27DBD} + {3F5388FF-FBB4-462B-8F6F-829FFBAEB8A3} = {1B0918B9-65AD-4F34-A287-AF4597B27DBD} + {9738D16A-CFA0-405C-A7DF-D3D203B0CB18} = {01A1787F-A9BE-4221-84E8-6360DD010AB6} + {7DEA8760-E401-4872-81F3-405F185A13A0} = {1B0918B9-65AD-4F34-A287-AF4597B27DBD} + {62D543A2-8846-45A3-829B-5754B094A8E2} = {E1A5D2B7-10AF-4876-85C0-7714EF274214} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {2DEAD3CC-486B-4918-A607-50B0DE7B114A} EndGlobalSection diff --git a/docs/Example-fsharp.md b/docs/Example-fsharp.md new file mode 100644 index 000000000..578543454 --- /dev/null +++ b/docs/Example-fsharp.md @@ -0,0 +1,55 @@ +Linear Regression in `Eager` mode: + +```fsharp +#r "nuget: TensorFlow.Net" +#r "nuget: TensorFlow.Keras" +#r "nuget: SciSharp.TensorFlow.Redist" + +open Tensorflow +open Tensorflow.NumPy +open type Tensorflow.Binding +open type Tensorflow.KerasApi + +let tf = New() +tf.enable_eager_execution() + +// Parameters +let training_steps = 1000 +let learning_rate = 0.01f +let display_step = 100 + +// Sample data +let train_X = + np.array(3.3f, 4.4f, 5.5f, 6.71f, 6.93f, 4.168f, 9.779f, 6.182f, 7.59f, 2.167f, + 7.042f, 10.791f, 5.313f, 7.997f, 5.654f, 9.27f, 3.1f) +let train_Y = + np.array(1.7f, 2.76f, 2.09f, 3.19f, 1.694f, 1.573f, 3.366f, 2.596f, 2.53f, 1.221f, + 2.827f, 3.465f, 1.65f, 2.904f, 2.42f, 2.94f, 1.3f) +let n_samples = train_X.shape.[0] + +// We can set a fixed init value in order to demo +let W = tf.Variable(-0.06f,name = "weight") +let b = tf.Variable(-0.73f, name = "bias") +let optimizer = keras.optimizers.SGD(learning_rate) + +// Run training for the given number of steps. +for step = 1 to (training_steps + 1) do + // Run the optimization to update W and b values. + // Wrap computation inside a GradientTape for automatic differentiation. + use g = tf.GradientTape() + // Linear regression (Wx + b). + let pred = W * train_X + b + // Mean square error. + let loss = tf.reduce_sum(tf.pow(pred - train_Y,2)) / (2 * n_samples) + // should stop recording + // compute gradients + let gradients = g.gradient(loss,struct (W,b)) + + // Update W and b following gradients. + optimizer.apply_gradients(zip(gradients, struct (W,b))) + + if (step % display_step) = 0 then + let pred = W * train_X + b + let loss = tf.reduce_sum(tf.pow(pred-train_Y,2)) / (2 * n_samples) + printfn $"step: {step}, loss: {loss.numpy()}, W: {W.numpy()}, b: {b.numpy()}" +``` \ No newline at end of file diff --git a/docs/README-CN.md b/docs/README-CN.md new file mode 100644 index 000000000..9776b0fb8 --- /dev/null +++ b/docs/README-CN.md @@ -0,0 +1,228 @@ +![logo](assets/tf.net.logo.png) + +**Tensorflow.NET**是AI框架[TensorFlow](https://www.tensorflow.org/)在.NET平台上的实现,支持C#和F#,可以用来搭建深度学习模型并进行训练和推理,并内置了Numpy API,可以用来进行其它科学计算。 + +Tensorflow.NET并非对于Python的简单封装,而是基于C API的pure C#实现,因此使用时无需额外的环境,可以很方便地用NuGet直接安装使用。并且dotnet团队提供的[ML.NET](https://github.com/dotnet/machinelearning)也依赖于Tensorflow.NET,支持调用Tensorflow.NET进行训练和推理,可以很方便地融入.NET生态。 + +与tensorflow相同,Tensorflow.NET也内置了Keras这一高级API,只要在安装Tensorflow.NET的同时安装Tensorflow.Keras就可以使用,Keras支持以模块化的方式调用模型,给模型的搭建提供了极大的便利。 + +[![Join the chat at https://gitter.im/publiclab/publiclab](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sci-sharp/community) +[![Tensorflow.NET](https://ci.appveyor.com/api/projects/status/wx4td43v2d3f2xj6?svg=true)](https://ci.appveyor.com/project/Haiping-Chen/tensorflow-net) +[![NuGet](https://img.shields.io/nuget/dt/TensorFlow.NET.svg)](https://www.nuget.org/packages/TensorFlow.NET) +[![Documentation Status](https://readthedocs.org/projects/tensorflownet/badge/?version=latest)](https://tensorflownet.readthedocs.io/en/latest/?badge=latest) +[![Badge](https://img.shields.io/badge/link-996.icu-red.svg)](https://996.icu/#/en_US) +[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/javiercp/BinderTF.NET/master?urlpath=lab) + +中文 | [English](https://github.com/SciSharp/TensorFlow.NET#readme) + +*当前主分支与Tensorflow2.10版本相对应,支持Eager Mode,同时也支持v1的静态图。* + + +![tensors_flowing](assets/tensors_flowing.gif) + +## Why Tensorflow.NET? + +`SciSharp STACK`开源社区的目标是构建.NET平台下易用的科学计算库,而Tensorflow.NET就是其中最具代表性的仓库之一。在深度学习领域Python是主流,无论是初学者还是资深开发者,模型的搭建和训练都常常使用Python写就的AI框架,比如tensorflow。但在实际应用深度学习模型的时候,又可能希望用到.NET生态,亦或只是因为.NET是自己最熟悉的领域,这时候Tensorflow.NET就有显著的优点,因为它不仅可以和.NET生态很好地贴合,其API还使得开发者很容易将Python代码迁移过来。下面的对比就是很好的例子,Python代码和C#代码有着高度相似的API,这会使得迁移的时候无需做过多修改。 + +![python vs csharp](assets/syntax-comparision.png) + +除了高度相似的API外,Tensorflow.NET与tensorflow也已经打通数据通道,tensorflow训练并保存的模型可以在Tensorflow.NET中直接读取并继续训练或推理,反之Tensorflow.NET保存的模型也可以在tensorflow中读取,这大大方便了模型的训练和部署。 + +与其它类似的库比如[TensorFlowSharp](https://www.nuget.org/packages/TensorFlowSharp/)相比,Tensorflow.NET的实现更加完全,提供了更多的高级API,使用起来更为方便,更新也更加迅速。 + + +## 文档 + +基本介绍与简单用例:[Tensorflow.NET Documents](https://scisharp.github.io/tensorflow-net-docs) + +详细文档:[The Definitive Guide to Tensorflow.NET](https://tensorflownet.readthedocs.io/en/latest/FrontCover.html) + +例程:[TensorFlow.NET Examples](https://github.com/SciSharp/TensorFlow.NET-Examples) + +运行例程常见问题:[Tensorflow.NET FAQ](tensorflowlib/README.md) + +## 安装与使用 + +安装可以在NuGet包管理器中搜索包名安装,也可以用下面命令行的方式。 + +安装分为两个部分,第一部分是Tensorflow.NET的主体: + +```sh +### 安装Tensorflow.NET +PM> Install-Package TensorFlow.NET + +### 安装Tensorflow.Keras +PM> Install-Package TensorFlow.Keras +``` + +第二部分是计算支持部分,只需要根据自己的设备和系统选择下面之一即可: + +``` +### CPU版本,支持Windows、Linux和Mac +PM> Install-Package SciSharp.TensorFlow.Redist + +### Windows下的GPU版本(需要安装CUDA和cuDNN) +PM> Install-Package SciSharp.TensorFlow.Redist-Windows-GPU + +### Linux下的GPU版本(需要安装CUDA和cuDNN) +PM> Install-Package SciSharp.TensorFlow.Redist-Linux-GPU +``` + +下面给出两个简单的例子,更多例子可以在[TensorFlow.NET Examples]中查看。 + +### 简单例子(使用Eager Mode进行线性回归) + +```csharp +using static Tensorflow.Binding; +using static Tensorflow.KerasApi; +using Tensorflow; +using Tensorflow.NumPy; + +// Parameters +var training_steps = 1000; +var learning_rate = 0.01f; +var display_step = 100; + +// Sample data +var X = np.array(3.3f, 4.4f, 5.5f, 6.71f, 6.93f, 4.168f, 9.779f, 6.182f, 7.59f, 2.167f, + 7.042f, 10.791f, 5.313f, 7.997f, 5.654f, 9.27f, 3.1f); +var Y = np.array(1.7f, 2.76f, 2.09f, 3.19f, 1.694f, 1.573f, 3.366f, 2.596f, 2.53f, 1.221f, + 2.827f, 3.465f, 1.65f, 2.904f, 2.42f, 2.94f, 1.3f); +var n_samples = X.shape[0]; + +// We can set a fixed init value in order to demo +var W = tf.Variable(-0.06f, name: "weight"); +var b = tf.Variable(-0.73f, name: "bias"); +var optimizer = keras.optimizers.SGD(learning_rate); + +// Run training for the given number of steps. +foreach (var step in range(1, training_steps + 1)) +{ + // Run the optimization to update W and b values. + // Wrap computation inside a GradientTape for automatic differentiation. + using var g = tf.GradientTape(); + // Linear regression (Wx + b). + var pred = W * X + b; + // Mean square error. + var loss = tf.reduce_sum(tf.pow(pred - Y, 2)) / (2 * n_samples); + // should stop recording + // Compute gradients. + var gradients = g.gradient(loss, (W, b)); + + // Update W and b following gradients. + optimizer.apply_gradients(zip(gradients, (W, b))); + + if (step % display_step == 0) + { + pred = W * X + b; + loss = tf.reduce_sum(tf.pow(pred - Y, 2)) / (2 * n_samples); + print($"step: {step}, loss: {loss.numpy()}, W: {W.numpy()}, b: {b.numpy()}"); + } +} +``` + +这一用例也可以在[Jupyter Notebook Example](https://github.com/SciSharp/SciSharpCube)进行运行. + +### 简单例子(使用Keras搭建Resnet) + +```csharp +using static Tensorflow.Binding; +using static Tensorflow.KerasApi; +using Tensorflow; +using Tensorflow.NumPy; + +var layers = keras.layers; +// input layer +var inputs = keras.Input(shape: (32, 32, 3), name: "img"); +// convolutional layer +var x = layers.Conv2D(32, 3, activation: "relu").Apply(inputs); +x = layers.Conv2D(64, 3, activation: "relu").Apply(x); +var block_1_output = layers.MaxPooling2D(3).Apply(x); +x = layers.Conv2D(64, 3, activation: "relu", padding: "same").Apply(block_1_output); +x = layers.Conv2D(64, 3, activation: "relu", padding: "same").Apply(x); +var block_2_output = layers.Add().Apply(new Tensors(x, block_1_output)); +x = layers.Conv2D(64, 3, activation: "relu", padding: "same").Apply(block_2_output); +x = layers.Conv2D(64, 3, activation: "relu", padding: "same").Apply(x); +var block_3_output = layers.Add().Apply(new Tensors(x, block_2_output)); +x = layers.Conv2D(64, 3, activation: "relu").Apply(block_3_output); +x = layers.GlobalAveragePooling2D().Apply(x); +x = layers.Dense(256, activation: "relu").Apply(x); +x = layers.Dropout(0.5f).Apply(x); +// output layer +var outputs = layers.Dense(10).Apply(x); +// build keras model +var model = keras.Model(inputs, outputs, name: "toy_resnet"); +model.summary(); +// compile keras model in tensorflow static graph +model.compile(optimizer: keras.optimizers.RMSprop(1e-3f), + loss: keras.losses.SparseCategoricalCrossentropy(from_logits: true), + metrics: new[] { "acc" }); +// prepare dataset +var ((x_train, y_train), (x_test, y_test)) = keras.datasets.cifar10.load_data(); +// normalize the input +x_train = x_train / 255.0f; +// training +model.fit(x_train[new Slice(0, 2000)], y_train[new Slice(0, 2000)], + batch_size: 64, + epochs: 10, + validation_split: 0.2f); +// save the model +model.save("./toy_resnet_model"); +``` + +此外,Tensorflow.NET也支持用F#搭建上述模型进行训练和推理。 + +## Tensorflow.NET版本对应关系 + +| TensorFlow.NET Versions | tensorflow 1.14, cuda 10.0 | tensorflow 1.15, cuda 10.0 | tensorflow 2.3, cuda 10.1 | tensorflow 2.4, cuda 11 | tensorflow 2.7, cuda 11 |tensorflow 2.10, cuda 11 | +| -------------------------- | ------------- | -------------- | ------------- | ------------- | ------------ | ------------ | +| tf.net 0.10x, tf.keras 0.10 | | | | | | x | +| tf.net 0.7x, tf.keras 0.7 | | | | | x | | +| tf.net 0.4x, tf.keras 0.5 | | | | x | | | +| tf.net 0.3x, tf.keras 0.4 | | | x | | | | +| tf.net 0.2x | | x | x | | | | +| tf.net 0.15 | x | x | | | | | +| tf.net 0.14 | x | | | | | | + + +``` +tf.net 0.4x -> tf native 2.4 +tf.net 0.6x -> tf native 2.6 +tf.net 0.7x -> tf native 2.7 +tf.net 0.10x -> tf native 2.10 +... +``` + +如果使用过程中发现有缺失的版本,请告知我们,谢谢! + +请注意Tensorflow.NET与Tensorflow.Keras版本存在一一对应关系,请安装与Tensorflow.NET对应的Tensorflow.Keras版本。 + +## 参与我们的开发: + +我们欢迎任何人的任何形式的贡献!无论是文档中的错误纠正,新特性提议,还是BUG修复等等,都会使得Tensorflow.NET项目越来越好,Tensorflow.NET的全体开发者也会积极帮助解决您提出的问题。 + +下面任何一种形式都可以帮助Tensorflow.NET越来越好: + +* Star和分享Tensorflow.NET项目 +* 为Tensorflow.NET添加更多的用例 +* 在issue中告知我们Tensorflow.NET目前相比tensorflow缺少的API或者没有对齐的特性 +* 在issue中提出Tensorflow.NET存在的BUG或者可以改进的地方 +* 在待办事项清单中选择一个进行或者解决某个issue +* 帮助我们完善文档,这也十分重要 + + +## 支持我们 +我们推出了[TensorFlow.NET实战](https://item.jd.com/13441549.html)这本书,包含了Tensorflow.NET主要开发者编写的讲解与实战例程,欢迎您的购买,希望这本书可以给您带来帮助。 +

+ + + +

+ +## 联系我们 + +可以在 [Twitter](https://twitter.com/ScisharpStack), [Facebook](https://www.facebook.com/scisharp.stack.9), [Medium](https://medium.com/scisharp), [LinkedIn](https://www.linkedin.com/company/scisharp-stack/)中关注我们,也可以在[Gitter](https://gitter.im/sci-sharp/community)中与项目开发者以及其它使用者进行沟通交流,也欢迎在仓库中提起issue。 + +TensorFlow.NET is a part of [SciSharp STACK](https://scisharp.github.io/SciSharp/) +
+ diff --git a/helpers/Tensorflow.UnitTest.RedistHolder/EmptyClass.cs b/helpers/Tensorflow.UnitTest.RedistHolder/EmptyClass.cs new file mode 100644 index 000000000..563f18b8f --- /dev/null +++ b/helpers/Tensorflow.UnitTest.RedistHolder/EmptyClass.cs @@ -0,0 +1,3 @@ +internal class EmptyClass +{ +} diff --git a/helpers/Tensorflow.UnitTest.RedistHolder/Tensorflow.UnitTest.RedistHolder.csproj b/helpers/Tensorflow.UnitTest.RedistHolder/Tensorflow.UnitTest.RedistHolder.csproj new file mode 100644 index 000000000..878077582 --- /dev/null +++ b/helpers/Tensorflow.UnitTest.RedistHolder/Tensorflow.UnitTest.RedistHolder.csproj @@ -0,0 +1,12 @@ + + + + netstandard2.0 + + + + + + + + diff --git a/src/TensorFlowNET.Console/MemoryMonitor.cs b/src/TensorFlowNET.Console/MemoryMonitor.cs index 92cd224f2..f9a6bfd1d 100644 --- a/src/TensorFlowNET.Console/MemoryMonitor.cs +++ b/src/TensorFlowNET.Console/MemoryMonitor.cs @@ -23,11 +23,9 @@ public void WarmUp() var x = tf.placeholder(tf.float64, shape: (1024, 1024)); var log = tf.log(x); - using (var sess = tf.Session()) - { - var ones = np.ones((1024, 1024), dtype: np.float64); - var o = sess.run(log, new FeedItem(x, ones)); - } + var sess = tf.Session(); + var ones = np.ones((1024, 1024), dtype: np.float64); + var o = sess.run(log, new FeedItem(x, ones)); // Thread.Sleep(1); } diff --git a/src/TensorFlowNET.Console/Program.cs b/src/TensorFlowNET.Console/Program.cs index 091456f8c..5f12badb0 100644 --- a/src/TensorFlowNET.Console/Program.cs +++ b/src/TensorFlowNET.Console/Program.cs @@ -8,8 +8,6 @@ class Program { static void Main(string[] args) { - tf.UseKeras(); - var diag = new Diagnostician(); // diag.Diagnose(@"D:\memory.txt"); diff --git a/src/TensorFlowNET.Console/Tensorflow.Console.csproj b/src/TensorFlowNET.Console/Tensorflow.Console.csproj index e66c7033c..1b84bb145 100644 --- a/src/TensorFlowNET.Console/Tensorflow.Console.csproj +++ b/src/TensorFlowNET.Console/Tensorflow.Console.csproj @@ -6,7 +6,7 @@ Tensorflow Tensorflow AnyCPU;x64 - 11.0 + 10.0 @@ -20,7 +20,7 @@ - + diff --git a/src/TensorFlowNET.Core/APIs/c_api.customize.cs b/src/TensorFlowNET.Core/APIs/c_api.customize.cs new file mode 100644 index 000000000..d2aab9ac0 --- /dev/null +++ b/src/TensorFlowNET.Core/APIs/c_api.customize.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Text; + +namespace Tensorflow +{ + public partial class c_api + { + [DllImport(TensorFlowLibName)] + public static extern void TFC_SetAttr(SafeGraphHandle graph, IntPtr op, string attr_name, SafeBufferHandle attr_value_proto, SafeStatusHandle status); + [DllImport(TensorFlowLibName)] + public static extern IntPtr TFC_GetHandleShapeAndType(SafeGraphHandle c_graph, TF_Output output); + [DllImport(TensorFlowLibName)] + public static extern void TFC_SetHandleShapeAndType(SafeGraphHandle c_graph, TF_Output output, byte[] data, long proto_len, SafeStatusHandle status); + } +} diff --git a/src/TensorFlowNET.Core/APIs/tf.compat.cs b/src/TensorFlowNET.Core/APIs/tf.compat.cs index 5b2b5a107..8a30badd9 100644 --- a/src/TensorFlowNET.Core/APIs/tf.compat.cs +++ b/src/TensorFlowNET.Core/APIs/tf.compat.cs @@ -14,6 +14,7 @@ You may obtain a copy of the License at limitations under the License. ******************************************************************************/ +using Google.Protobuf; using System.Text; namespace Tensorflow @@ -45,6 +46,23 @@ internal string as_str(byte[] bytes_or_text, Encoding? encoding = null) { return as_text(bytes_or_text, encoding); } + + public ByteString as_bytes(ByteString bytes, Encoding encoding = null) + { + return bytes; + } + public ByteString as_bytes(byte[] bytes, Encoding encoding = null) + { + return ByteString.CopyFrom(bytes); + } + public ByteString as_bytes(string text, Encoding encoding = null) + { + if(encoding is null) + { + encoding = Encoding.UTF8; + } + return ByteString.CopyFrom(encoding.GetBytes(text)); + } } public bool executing_eagerly() diff --git a/src/TensorFlowNET.Core/APIs/tf.init.cs b/src/TensorFlowNET.Core/APIs/tf.init.cs index 0681258e4..8635f6620 100644 --- a/src/TensorFlowNET.Core/APIs/tf.init.cs +++ b/src/TensorFlowNET.Core/APIs/tf.init.cs @@ -76,13 +76,13 @@ public IInitializer random_normal_initializer(float mean = 0.0f, /// /// public IInitializer variance_scaling_initializer(float factor = 1.0f, - string mode = "FAN_IN", - bool uniform = false, + string mode = "fan_in", + string distribution = "truncated_normal", int? seed = null, TF_DataType dtype = TF_DataType.TF_FLOAT) => new VarianceScaling( - factor: factor, + scale: factor, mode: mode, - uniform: uniform, + distribution: distribution, seed: seed, dtype: dtype); diff --git a/src/TensorFlowNET.Core/APIs/tf.io.cs b/src/TensorFlowNET.Core/APIs/tf.io.cs index 0c0510dd5..be1e86e6c 100644 --- a/src/TensorFlowNET.Core/APIs/tf.io.cs +++ b/src/TensorFlowNET.Core/APIs/tf.io.cs @@ -54,6 +54,6 @@ public ITensorOrOperation[] import_graph_def(GraphDef graph_def, Dictionary input_map = null, string[] return_elements = null, string name = null, - OpList producer_op_list = null) => importer.import_graph_def(graph_def, input_map, return_elements, name, producer_op_list); + OpList producer_op_list = null) => importer.import_graph_def(graph_def, input_map, return_elements, name: name, producer_op_list: producer_op_list); } } diff --git a/src/TensorFlowNET.Core/APIs/tf.math.cs b/src/TensorFlowNET.Core/APIs/tf.math.cs index c7aa46704..83653c8bb 100644 --- a/src/TensorFlowNET.Core/APIs/tf.math.cs +++ b/src/TensorFlowNET.Core/APIs/tf.math.cs @@ -1,5 +1,5 @@ /***************************************************************************** - Copyright 2018 The TensorFlow.NET Authors. All Rights Reserved. + Copyright 2023 The TensorFlow.NET Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -57,7 +57,7 @@ public Tensor softplus(Tensor features, string name = null) public Tensor tanh(Tensor x, string name = null) => math_ops.tanh(x, name: name); - + /// /// Finds values and indices of the `k` largest entries for the last dimension. /// @@ -93,6 +93,16 @@ public Tensor bincount(Tensor arr, Tensor weights = null, bool binary_output = false) => math_ops.bincount(arr, weights: weights, minlength: minlength, maxlength: maxlength, dtype: dtype, name: name, axis: axis, binary_output: binary_output); + + public Tensor real(Tensor x, string name = null) + => gen_ops.real(x, x.dtype.real_dtype(), name); + public Tensor imag(Tensor x, string name = null) + => gen_ops.imag(x, x.dtype.real_dtype(), name); + + public Tensor conj(Tensor x, string name = null) + => gen_ops.conj(x, name); + public Tensor angle(Tensor x, string name = null) + => gen_ops.angle(x, x.dtype.real_dtype(), name); } public Tensor abs(Tensor x, string name = null) @@ -537,7 +547,7 @@ public Tensor reduce_prod(Tensor input_tensor, Axis? axis = null, bool keepdims public Tensor reduce_sum(Tensor input, Axis? axis = null, Axis? reduction_indices = null, bool keepdims = false, string name = null) { - if(keepdims) + if (keepdims) return math_ops.reduce_sum(input, axis: constant_op.constant(axis ?? reduction_indices), keepdims: keepdims, name: name); else return math_ops.reduce_sum(input, axis: constant_op.constant(axis ?? reduction_indices)); @@ -585,5 +595,7 @@ public Tensor square(Tensor x, string name = null) => gen_math_ops.square(x, name: name); public Tensor squared_difference(Tensor x, Tensor y, string name = null) => gen_math_ops.squared_difference(x: x, y: y, name: name); + public Tensor complex(Tensor real, Tensor imag, Tensorflow.TF_DataType? dtype = null, + string name = null) => gen_ops.complex(real, imag, dtype, name); } } diff --git a/src/TensorFlowNET.Core/APIs/tf.saved_model.cs b/src/TensorFlowNET.Core/APIs/tf.saved_model.cs new file mode 100644 index 000000000..ef6251ca8 --- /dev/null +++ b/src/TensorFlowNET.Core/APIs/tf.saved_model.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Tensorflow.Train; + +namespace Tensorflow +{ + public partial class tensorflow + { + public SavedModelAPI saved_model { get; } = new SavedModelAPI(); + } + + public class SavedModelAPI + { + public Trackable load(string export_dir, LoadOptions? options = null) + { + return Loader.load(export_dir, options); + } + } +} diff --git a/src/TensorFlowNET.Core/APIs/tf.signal.cs b/src/TensorFlowNET.Core/APIs/tf.signal.cs new file mode 100644 index 000000000..2471124c5 --- /dev/null +++ b/src/TensorFlowNET.Core/APIs/tf.signal.cs @@ -0,0 +1,40 @@ +/***************************************************************************** + Copyright 2023 Konstantin Balashov All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +******************************************************************************/ + +using Tensorflow.Operations; + +namespace Tensorflow +{ + public partial class tensorflow + { + public SignalApi signal { get; } = new SignalApi(); + public class SignalApi + { + public Tensor fft(Tensor input, string name = null) + => gen_ops.f_f_t(input, name: name); + public Tensor ifft(Tensor input, string name = null) + => gen_ops.i_f_f_t(input, name: name); + public Tensor fft2d(Tensor input, string name = null) + => gen_ops.f_f_t2d(input, name: name); + public Tensor ifft2d(Tensor input, string name = null) + => gen_ops.i_f_f_t2d(input, name: name); + public Tensor fft3d(Tensor input, string name = null) + => gen_ops.f_f_t3d(input, name: name); + public Tensor ifft3d(Tensor input, string name = null) + => gen_ops.i_f_f_t3d(input, name: name); + } + } +} diff --git a/src/TensorFlowNET.Core/APIs/tf.tensor.cs b/src/TensorFlowNET.Core/APIs/tf.tensor.cs index 91293b3a7..35efde06b 100644 --- a/src/TensorFlowNET.Core/APIs/tf.tensor.cs +++ b/src/TensorFlowNET.Core/APIs/tf.tensor.cs @@ -14,6 +14,8 @@ You may obtain a copy of the License at limitations under the License. ******************************************************************************/ +using Tensorflow.Operations; + namespace Tensorflow { public partial class tensorflow @@ -79,5 +81,10 @@ public Tensor[] split(Tensor value, int num_split, int axis, string name = null) num_split: num_split, axis: axis, name: name); + + public Tensor ensure_shape(Tensor x, Shape shape, string name = null) + { + return gen_ops.ensure_shape(x, shape, name); + } } } diff --git a/src/TensorFlowNET.Core/Attributes/c_api.ops.cs b/src/TensorFlowNET.Core/Attributes/c_api.ops.cs index 7d9ff65fa..2a22413b0 100644 --- a/src/TensorFlowNET.Core/Attributes/c_api.ops.cs +++ b/src/TensorFlowNET.Core/Attributes/c_api.ops.cs @@ -61,7 +61,7 @@ public partial class c_api public static extern void TF_SetAttrBool(IntPtr desc, string attr_name, bool value); [DllImport(TensorFlowLibName)] - public static extern void TF_SetAttrValueProto(IntPtr desc, string attr_name, byte[] proto, int proto_len, SafeStatusHandle status); + public static extern void TF_SetAttrValueProto(IntPtr desc, string attr_name, byte[] proto, ulong proto_len, SafeStatusHandle status); /// /// Set `num_dims` to -1 to represent "unknown rank". diff --git a/src/TensorFlowNET.Core/Binding.Util.cs b/src/TensorFlowNET.Core/Binding.Util.cs index 5d9d799d7..8df39334a 100644 --- a/src/TensorFlowNET.Core/Binding.Util.cs +++ b/src/TensorFlowNET.Core/Binding.Util.cs @@ -22,6 +22,7 @@ limitations under the License. using System.Diagnostics; using System.IO; using System.Linq; +using Tensorflow.Operations; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Buffers/Buffer.cs b/src/TensorFlowNET.Core/Buffers/Buffer.cs index bb4b880a2..330e30caa 100644 --- a/src/TensorFlowNET.Core/Buffers/Buffer.cs +++ b/src/TensorFlowNET.Core/Buffers/Buffer.cs @@ -25,15 +25,15 @@ namespace Tensorflow /// /// Represents a TF_Buffer that can be passed to Tensorflow. /// - public sealed class Buffer : IDisposable + public sealed class Buffer { - public SafeBufferHandle Handle { get; } + SafeBufferHandle _handle; /// /// /// private unsafe ref readonly TF_Buffer DangerousBuffer - => ref Unsafe.AsRef(Handle.DangerousGetHandle().ToPointer()); + => ref Unsafe.AsRef(_handle.DangerousGetHandle().ToPointer()); /// /// The memory block representing this buffer. @@ -59,7 +59,7 @@ public ulong Length { get { - using (Handle.Lease()) + using (_handle.Lease()) { return DangerousBuffer.length; } @@ -67,13 +67,13 @@ public ulong Length } public Buffer() - => Handle = TF_NewBuffer(); + => _handle = TF_NewBuffer(); public Buffer(SafeBufferHandle handle) - => Handle = handle; + => _handle = handle; public Buffer(byte[] data) - => Handle = _toBuffer(data); + => _handle = _toBuffer(data); private static SafeBufferHandle _toBuffer(byte[] data) { @@ -92,7 +92,7 @@ private static SafeBufferHandle _toBuffer(byte[] data) /// public unsafe byte[] ToArray() { - using (Handle.Lease()) + using (_handle.Lease()) { ref readonly TF_Buffer buffer = ref DangerousBuffer; @@ -107,7 +107,18 @@ public unsafe byte[] ToArray() } } - public void Dispose() - => Handle.Dispose(); + public void Release() + { + _handle.Dispose(); + _handle = null; + } + + public override string ToString() + => $"0x{_handle.DangerousGetHandle():x16}"; + + public static implicit operator SafeBufferHandle(Buffer buffer) + { + return buffer._handle; + } } } \ No newline at end of file diff --git a/src/TensorFlowNET.Core/Buffers/TF_Buffer.cs b/src/TensorFlowNET.Core/Buffers/TF_Buffer.cs index 7ebdd5b85..c10f7b5f1 100644 --- a/src/TensorFlowNET.Core/Buffers/TF_Buffer.cs +++ b/src/TensorFlowNET.Core/Buffers/TF_Buffer.cs @@ -25,5 +25,32 @@ public struct TF_Buffer public IntPtr data; public ulong length; public IntPtr data_deallocator; + + public unsafe Span AsSpan() where T: unmanaged + { + if(length > int.MaxValue) + { + throw new ValueError($"The length {length} is too large to use in the span."); + } + return new Span(data.ToPointer(), (int)length); + } + + public unsafe byte[] ToByteArray() + { + byte[] res = new byte[length]; + if(length > int.MaxValue) + { + byte* root = (byte*)data; + for(ulong i = 0; i < length; i++) + { + res[i] = *(root++); + } + } + else + { + new Span(data.ToPointer(), (int)length).CopyTo(res.AsSpan()); + } + return res; + } } } diff --git a/src/TensorFlowNET.Core/Checkpoint/CheckPointUtils.cs b/src/TensorFlowNET.Core/Checkpoint/CheckPointUtils.cs index 9793798d2..071b41875 100644 --- a/src/TensorFlowNET.Core/Checkpoint/CheckPointUtils.cs +++ b/src/TensorFlowNET.Core/Checkpoint/CheckPointUtils.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.IO; using System.Linq; +using Tensorflow.Functions; using Tensorflow.Train; using Tensorflow.Training; using pbc = global::Google.Protobuf.Collections; @@ -13,7 +14,7 @@ public static class CheckPointUtils { private static string _ESCAPE_CHAR = "."; public static (IList, IDictionary>, IDictionary, - IDictionary>, + IDictionary>, IDictionary) objects_ids_and_slot_variables_and_paths(ObjectGraphView graph_view) { var (trackable_objects, node_paths) = graph_view.breadth_first_traversal(); @@ -161,7 +162,7 @@ public static IList list_objects(ObjectGraphView graph_view) internal static IEnumerable _objects_with_attributes(IEnumerable full_list) { - return full_list.TakeWhile(x => + return full_list.Where(x => { var saveables = x.gather_saveables_for_checkpoint(); return saveables is not null && saveables.Count > 0; diff --git a/src/TensorFlowNET.Core/Checkpoint/CheckpointReader.cs b/src/TensorFlowNET.Core/Checkpoint/CheckpointReader.cs index ffefe3128..a1dba371c 100644 --- a/src/TensorFlowNET.Core/Checkpoint/CheckpointReader.cs +++ b/src/TensorFlowNET.Core/Checkpoint/CheckpointReader.cs @@ -11,7 +11,7 @@ public CheckpointReader(string filename) Status status = new Status(); VariableToDataTypeMap = new Dictionary(); VariableToShapeMap = new Dictionary(); - _handle = c_api.TF_NewCheckpointReader(filename, status.Handle); + _handle = c_api.TF_NewCheckpointReader(filename, status); status.Check(true); ReadAllShapeAndType(); } @@ -38,7 +38,7 @@ public Shape GetVariableShape(string name) int num_dims = GetVariableNumDims(name); long[] dims = new long[num_dims]; Status status = new Status(); - c_api.TF_CheckpointReaderGetVariableShape(_handle, name, dims, num_dims, status.Handle); + c_api.TF_CheckpointReaderGetVariableShape(_handle, name, dims, num_dims, status); status.Check(true); return new Shape(dims); } @@ -49,7 +49,7 @@ public int GetVariableNumDims(string name) public unsafe Tensor GetTensor(string name, TF_DataType dtype = TF_DataType.DtInvalid) { Status status = new Status(); - var tensor = c_api.TF_CheckpointReaderGetTensor(_handle, name, status.Handle); + var tensor = c_api.TF_CheckpointReaderGetTensor(_handle, name, status); status.Check(true); return new Tensor(tensor); } diff --git a/src/TensorFlowNET.Core/Checkpoint/SaveUtil.cs b/src/TensorFlowNET.Core/Checkpoint/SaveUtil.cs index c54cc93f6..7a5da7e3a 100644 --- a/src/TensorFlowNET.Core/Checkpoint/SaveUtil.cs +++ b/src/TensorFlowNET.Core/Checkpoint/SaveUtil.cs @@ -1,10 +1,12 @@ -using System; +using OneOf; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using Tensorflow.Train; using Tensorflow.Training; +using Tensorflow.Common.Extensions; using pbc = global::Google.Protobuf.Collections; namespace Tensorflow.Checkpoint @@ -28,7 +30,7 @@ Trackable object_to_save ); public static class SaveUtil { - public static (IDictionary>>>, IDictionary, IDictionary>, TrackableObjectGraph) + public static (IDictionary>>>, IDictionary, IDictionary>, TrackableObjectGraph) serialize_graph_view(ObjectGraphView graph_view, IDictionary? object_map = null, bool call_with_mapped_captures = false, object? cache = null) { var (trackable_data, node_ids) = gather_trackable_data(graph_view, object_map); @@ -104,7 +106,10 @@ private static TrackableObjectGraph fill_object_graph_proto(IList { var td = trackable_data[i]; Debug.Assert(td.node_id == i); - object_graph_proto.Nodes.Add(new TrackableObjectGraph.Types.TrackableObject(td.slot_variable_proto, td.children_proto)); + TrackableObjectGraph.Types.TrackableObject trackable_object = new(); + trackable_object.SlotVariables.AddRange(td.slot_variable_proto); + trackable_object.Children.AddRange(td.children_proto); + object_graph_proto.Nodes.Add(trackable_object); } return object_graph_proto; } @@ -117,16 +122,16 @@ private static TrackableObjectGraph fill_object_graph_proto(IList /// /// /// - private static IDictionary>>> get_and_write_tensors_to_serialize(IList tensor_trackables, IDictionary node_ids, + private static IDictionary>>> get_and_write_tensors_to_serialize(IList tensor_trackables, IDictionary node_ids, bool call_with_mapped_captures, object? cache, TrackableObjectGraph object_graph_proto) { - Dictionary>>> serialized_tensors = new(); + Dictionary>>> serialized_tensors = new(); foreach(var td in tensor_trackables) { // TODO: deal with cache. var legacy_name = SaveableCompat.get_saveable_name(td.object_to_save) ?? ""; Trackable trackable = null; - IDictionary>> tensor_dict; + IDictionary>> tensor_dict; if(!saveable_object_util.trackable_has_serialize_to_tensor(td.object_to_save) || legacy_name.Length > 0) { (trackable, tensor_dict) = get_tensors_from_legacy_saveable(td, node_ids, call_with_mapped_captures, object_graph_proto); @@ -148,12 +153,12 @@ private static IDictionary>> get_tensors_from_trackable(TrackableData trackable_data, bool call_with_mapped_captures, TrackableObjectGraph object_graph_proto) + private static IDictionary>> get_tensors_from_trackable(TrackableData trackable_data, bool call_with_mapped_captures, TrackableObjectGraph object_graph_proto) { var trackable = trackable_data.object_to_save; // TODO: complete it. Note that actually `call_with_mapped_captures` is of function type. - IDictionary>> ret_tensor_dict; + IDictionary>> ret_tensor_dict; if (call_with_mapped_captures) { throw new NotImplementedException(); @@ -163,8 +168,7 @@ private static IDictionary>> g ret_tensor_dict = trackable.serialize_to_tensors(); } - // TODO: deal with the type `SaveSpce` (currently it will never be it). - Dictionary>> tensor_dict = new(); + Dictionary>> tensor_dict = new(); foreach(var pair in ret_tensor_dict) { var local_name = TrackableUtils.escape_local_name(pair.Key); @@ -173,10 +177,12 @@ private static IDictionary>> g tensor_dict[checkpoint_key] = maybe_tensor; - if(maybe_tensor.IsTypeOrDeriveFrom()) + foreach(var key in maybe_tensor.Keys) { - throw new NotImplementedException(); - //((SaveSpec)maybe_tensor).name = local_name + ((SaveSpec)maybe_tensor).name; + if (maybe_tensor[key].IsTypeOrDeriveFrom()) + { + maybe_tensor[key].AsT1.name = local_name + maybe_tensor[key].AsT1.name; + } } if(object_graph_proto is not null) @@ -200,7 +206,7 @@ private static IDictionary>> g /// /// /// - private static (Trackable, IDictionary>>) get_tensors_from_legacy_saveable(TrackableData trackable_data, IDictionary node_ids, + private static (Trackable, IDictionary>>) get_tensors_from_legacy_saveable(TrackableData trackable_data, IDictionary node_ids, bool call_with_mapped_captures, TrackableObjectGraph object_graph_proto) { Dictionary object_names = new(); diff --git a/src/TensorFlowNET.Core/Checkpoint/SaveUtilV1.cs b/src/TensorFlowNET.Core/Checkpoint/SaveUtilV1.cs index 72372e410..9280179c0 100644 --- a/src/TensorFlowNET.Core/Checkpoint/SaveUtilV1.cs +++ b/src/TensorFlowNET.Core/Checkpoint/SaveUtilV1.cs @@ -8,6 +8,7 @@ using pbc = global::Google.Protobuf.Collections; using static Tensorflow.Binding; using Google.Protobuf; +using OneOf; namespace Tensorflow.Checkpoint; @@ -53,8 +54,11 @@ public static (IList, IDictionary + { + // TODO(Rinne): locate the error that causes transferring TF_STRING to this function throws an exception. + return constant_op.constant(graph_proto.ToByteArray()); + }); named_saveable_objects.Add(new NoRestoreSaveable(object_graph_tensor, Trackable.Constants.OBJECT_GRAPH_PROTO_KEY)); g.Exit(); return (named_saveable_objects, registered_savers); @@ -65,8 +69,10 @@ public static (IList, IDictionary + { + return constant_op.constant(graph_proto.ToString()); + }); named_saveable_objects.Add(new NoRestoreSaveable(object_graph_tensor, Trackable.Constants.OBJECT_GRAPH_PROTO_KEY)); return (named_saveable_objects, registered_savers); } @@ -109,14 +115,10 @@ private static TrackableObjectGraph fill_object_graph_proto(ObjectGraphView grap { var trackable = trackable_objects[i]; Debug.Assert(node_ids[trackable] == i); - TrackableObjectGraph.Types.TrackableObject object_proto; + var object_proto = new TrackableObjectGraph.Types.TrackableObject(); if (slot_variables.TryGetValue(trackable, out var slots)) { - object_proto = new TrackableObjectGraph.Types.TrackableObject(slots); - } - else - { - object_proto = new TrackableObjectGraph.Types.TrackableObject(); + object_proto.SlotVariables.AddRange(slots); } object_graph_proto.Nodes.Add(object_proto); foreach (var child in graph_view.list_children(trackable)) @@ -179,13 +181,13 @@ public static (IList, object?) generate_saveable_objects( // TODO: tensorflow python has a process with callable `saveable_factory`. List saveables = new(); - if (maybe_saveable.TryGet(out var s)) + if (maybe_saveable.TryPickT1(out var s, out var variable)) { saveables.Add(s); } else { - saveables.AddRange(saveable_object_util.saveable_objects_for_op(maybe_saveable.GetValue() as Trackable, key)); + saveables.AddRange(saveable_object_util.saveable_objects_for_op(variable as Trackable, key)); } foreach (var saveable in saveables) @@ -217,7 +219,7 @@ public static (IList, object?) generate_saveable_objects( public record class CheckpointFactoryData ( - Func> factory, + Func> factory, string name, string checkpoint_key ); diff --git a/src/TensorFlowNET.Core/Checkpoint/checkpoint.cs b/src/TensorFlowNET.Core/Checkpoint/checkpoint.cs index 1934ffd5f..30d45e82c 100644 --- a/src/TensorFlowNET.Core/Checkpoint/checkpoint.cs +++ b/src/TensorFlowNET.Core/Checkpoint/checkpoint.cs @@ -12,6 +12,7 @@ using Tensorflow.Operations; using Newtonsoft.Json; using Tensorflow.Training; +using OneOf; namespace Tensorflow.Checkpoint; @@ -44,12 +45,12 @@ public TrackableSaver(ObjectGraphView graph_view) _graph_view = graph_view; // TODO: cache when not executing eagerly. - // including `_cache`, `_file_prefix_feed_tensor`, `_file_prefix_placeholder`, + // including `_cache`, `_file_prefix_feed_tensor`, `_file_prefix_placeholder` // `_object_graph_feed_tensor`, `_object_map`, `_restore_op_cache`, `_saveables_cache` } - private (IDictionary>>>, IDictionary, IDictionary>, TrackableObjectGraph) + private (IDictionary>>>, IDictionary, IDictionary>, TrackableObjectGraph) gather_serialized_tensors(Tensor? object_graph_tensor = null) { var (serialized_tensors, feed_additions, registered_savers, graph_proto) = SaveUtil.serialize_graph_view(_graph_view, _object_map, cache:_cache); @@ -58,8 +59,10 @@ public TrackableSaver(ObjectGraphView graph_view) if(object_graph_tensor is null) { - tf.device("/cpu:0"); - object_graph_tensor = constant_op.constant(graph_proto.ToByteArray()); + tf_with(ops.device("/cpu:0"), _ => + { + object_graph_tensor = constant_op.constant(graph_proto.ToByteArray()); + }); } else { @@ -68,9 +71,10 @@ public TrackableSaver(ObjectGraphView graph_view) Debug.Assert(!serialized_tensors.ContainsKey(Trackable.None) || !serialized_tensors[Trackable.None].ContainsKey(Trackable.Constants.OBJECT_GRAPH_PROTO_KEY)); if (!serialized_tensors.ContainsKey(Trackable.None)) { - serialized_tensors[Trackable.None] = new Dictionary>>(); + serialized_tensors[Trackable.None] = new Dictionary>>(); } - serialized_tensors[Trackable.None][Trackable.Constants.OBJECT_GRAPH_PROTO_KEY] = object_graph_tensor; + serialized_tensors[Trackable.None][Trackable.Constants.OBJECT_GRAPH_PROTO_KEY] = new Dictionary>(); + serialized_tensors[Trackable.None][Trackable.Constants.OBJECT_GRAPH_PROTO_KEY].Add(saveable_object_util.NO_SLICE_SPEC_KEY, object_graph_tensor); return (serialized_tensors, feed_additions, registered_savers, graph_proto); } @@ -230,13 +234,15 @@ public LoadStatus restore(string? save_path, CheckpointOptions? options = null) Tensor object_graph_string = reader.GetTensor(Trackable.Constants.OBJECT_GRAPH_PROTO_KEY, dtype: TF_DataType.TF_STRING); Dictionary file_prefix_feed_dict; - Tensor file_prefix_tensor; + Tensor file_prefix_tensor = null; if (graph_building) { if(_file_prefix_placeholder is null) { - tf.device("/cpu:0"); - _file_prefix_placeholder = constant_op.constant("model"); + _file_prefix_placeholder = tf_with(ops.device("/cpu:0"), _ => + { + return constant_op.constant("model"); + }); } file_prefix_tensor = _file_prefix_placeholder; file_prefix_feed_dict = new(); @@ -244,8 +250,10 @@ public LoadStatus restore(string? save_path, CheckpointOptions? options = null) } else { - tf.device("/cpu:0"); - file_prefix_tensor = constant_op.constant(save_path); + file_prefix_tensor = tf_with(ops.device("/cpu:0"), _ => + { + return constant_op.constant(save_path); + }); file_prefix_feed_dict = null; } TrackableObjectGraph object_graph_proto = new(); @@ -386,6 +394,7 @@ public bool ExpectPartial /// public List AllTrackables => _all_trackables; public HashSet MatchedProtoIds => _matched_proto_ids; + // TODO(Rinne): change to weak ref. public Dictionary ObjectByProtoId => _object_by_proto_id; public int RestoreUid => _restore_uid; public TrackableObjectGraph ObjectGraphProto => _object_graph_proto; @@ -400,7 +409,7 @@ public void new_restore_ops(IEnumerable new_ops) // skip the callback. } - public List restore_saveables(Dictionary> tensor_saveables, List positions, object? registered_savers = null) + public List restore_saveables(Dictionary> tensor_saveables, List positions, object? registered_savers = null) { List restore_ops = new(); foreach(var position in positions) @@ -412,7 +421,7 @@ public List restore_saveables(Dictionary variable_dict = new(); foreach(var item in tensor_saveables) { - if(item.Value.TryGet(out var variable)) + if(item.Value.TryPickT0(out var variable, out var _)) { variable_dict[item.Key] = variable; } diff --git a/src/TensorFlowNET.Core/Checkpoint/functional_saver.cs b/src/TensorFlowNET.Core/Checkpoint/functional_saver.cs index 96e6c8dd9..211d7d6f0 100644 --- a/src/TensorFlowNET.Core/Checkpoint/functional_saver.cs +++ b/src/TensorFlowNET.Core/Checkpoint/functional_saver.cs @@ -15,106 +15,14 @@ using System.Xml.Linq; using System.Diagnostics; using RestoreFunc = System.Func; +using OneOf; namespace Tensorflow.Checkpoint { - public class Maybe - { - private TA? _valueA = default(TA); - private TB? _valueB = default(TB); - private Type _type; - private bool _assignedTA; - public Maybe(TA value) - { - _valueA = value; - _type= typeof(TA); - _assignedTA = true; - } - public Maybe(TB value) - { - _valueB = value; - _type = typeof(TB); - _assignedTA = false; - } - - public Type DataType => _type; - - /// - /// Try to get the type T member of this instance. It returns true when TA or TB derive from T and is correspondingly assigned. - /// It returns - /// - /// - /// - /// - public bool TryGet(out T? res) - { - if(_valueA is T && _valueB is not T) - { - res = (T)(object)_valueA; - return _assignedTA; - } - else if(_valueA is not T && _valueB is T) - { - res = (T)(object)_valueB; - return !_assignedTA; - } - res = default(T); - return false; - } - - public bool IsTypeOrDeriveFrom() - { - if (_valueA is T && _valueB is not T) - { - return _assignedTA; - } - else if (_valueA is not T && _valueB is T) - { - return !_assignedTA; - } - else if (_valueA is T && _valueB is T) - { - return true; - } - else - { - return false; - } - } - - public T GetValue() - { - if (_valueA is T && _valueB is not T) - { - return (T)(object)_valueA; - } - else if (_valueA is not T && _valueB is T) - { - return (T)(object)_valueB; - } - else if (_valueA is T && _valueB is T) - { - throw new TypeError("The type is vague, this is always because TA and TB both derive from T."); - } - else - { - throw new TypeError($"Expected {typeof(TA)} or {typeof(TB)}, but got typeof{typeof(T)}."); - } - } - - public static implicit operator Maybe(TA a) - { - return new Maybe(a); - } - public static implicit operator Maybe(TB b) - { - return new Maybe(b); - } - } internal class SingleDeviceSaver { - private IDictionary>> _tensor_slice_dict; - public SingleDeviceSaver(IDictionary>> tensor_slice_dict) + private IDictionary>> _tensor_slice_dict; + public SingleDeviceSaver(IDictionary>> tensor_slice_dict) { _tensor_slice_dict = tensor_slice_dict; } @@ -122,15 +30,15 @@ public SingleDeviceSaver(IDictionary> tensor { _tensor_slice_dict = tensor_slice_dict.ToDictionary( x => x.Key, x => x.Value.ToDictionary( - y => y.Key, y => new Maybe(y.Value)) - as IDictionary>); + y => y.Key, y => OneOf.FromT0(y.Value)) + as IDictionary>); } public SingleDeviceSaver(IDictionary> tensor_slice_dict) { _tensor_slice_dict = tensor_slice_dict.ToDictionary( x => x.Key, x => x.Value.ToDictionary( - y => y.Key, y => new Maybe(y.Value)) - as IDictionary>); + y => y.Key, y => OneOf.FromT1(y.Value)) + as IDictionary>); } public Operation? save(Tensor file_prefix, CheckpointOptions? options = null) { @@ -149,7 +57,7 @@ public SingleDeviceSaver(IDictionary> tens { var slice_spec = slice.Key; var maybe_tensor = slice.Value; - if(maybe_tensor.TryGet(out var spec)) + if(maybe_tensor.TryPickT1(out var spec, out var tensor)) { var tensor_value = spec.tensor; if (tensor_value is not null) @@ -161,7 +69,6 @@ public SingleDeviceSaver(IDictionary> tens } else { - var tensor = maybe_tensor.GetValue(); tensor_names.Add(checkpoint_key); tensors.Add(tensor); slice_specs.Add(slice_spec); @@ -193,7 +100,7 @@ public IDictionary> restore(Tensor file_pref var slice_spec = slice.Key; var maybe_tensor = slice.Value; // TODO: deal with other types. Currently only `SaveSpec` is allowed. - if(maybe_tensor.TryGet(out var spec)) + if(maybe_tensor.TryPickT1(out var spec, out var tensor)) { tensor_dtypes.Add(spec.dtype); slice_specs.Add(spec.slice_spec); @@ -201,7 +108,6 @@ public IDictionary> restore(Tensor file_pref } else { - var tensor = maybe_tensor.GetValue(); tensor_dtypes.Add(tensor.dtype); slice_specs.Add(slice_spec); tensor_names.Add(checkpoint_key); @@ -211,9 +117,11 @@ public IDictionary> restore(Tensor file_pref string restore_device = string.IsNullOrEmpty(options.experimental_io_device) ? "cpu:0": options.experimental_io_device!; - // tf python has code `with ops.device(restore_device):` here. - tf.device(restore_device); // may be risky. - var restored_tensors = gen_ops.restore_v2(file_prefix, tensor_names.ToArray(), slice_specs.ToArray(), tensor_dtypes.ToArray()); + Tensor[] restored_tensors = null; + tf_with(ops.device(restore_device), _ => + { + restored_tensors = gen_ops.restore_v2(file_prefix, tensor_names.ToArray(), slice_specs.ToArray(), tensor_dtypes.ToArray()); + }); Dictionary> restored_tensor_dict = new(); int idx = 0; @@ -254,12 +162,12 @@ public class MultiDeviceSaver /// A dictionary mapping `Trackable` to a tensor dict, which maps checkpoint_key -> (slice_spec ->) -> Tensor/SaveSpec. /// /// - public MultiDeviceSaver(IDictionary>>> serialized_tensors, + public MultiDeviceSaver(IDictionary>>> serialized_tensors, IDictionary>? registered_savers = null, bool call_with_mapped_capture = false) { _keys_to_restore_fn = new Dictionary<(string, string), RestoreFunc>(); _restore_fn_to_keys = new Dictionary>(); - Dictionary>> tensors_by_device= new(); + Dictionary>>> tensors_by_device= new(); foreach(var pair in serialized_tensors) { @@ -274,9 +182,9 @@ public MultiDeviceSaver(IDictionary { - if(x is IDictionary>>) + if(x is IDictionary>>) { - return obj._restore_from_tensors(x as IDictionary>>); + return obj._restore_from_tensors(x as IDictionary>>); } throw new TypeError($"Expected `IDictionary>>` as input, got{x.GetType()}."); }); @@ -285,16 +193,7 @@ public MultiDeviceSaver(IDictionary spec_to_tensor; - if(item.Value.TryGet(out var t)) - { - spec_to_tensor = new Dictionary(); - spec_to_tensor[""] = t; - } - else - { - spec_to_tensor = item.Value.GetValue>(); - } + var spec_to_tensor = item.Value; foreach(var spec in spec_to_tensor) { @@ -309,12 +208,20 @@ public MultiDeviceSaver(IDictionary()).Add((checkpoint_key, slice_spec)); - // skip the process of device name because lack of API. - var host_device = tensor.Device; - var internal_dict = tensors_by_device.SetDefault(host_device, new Dictionary>()); + string host_device; + if (tensor.IsT0) + { + host_device = tensor.AsT0.Device; + } + else + { + host_device = tensor.AsT1.device; + } + host_device = saveable_object_util.set_cpu0(host_device); + var internal_dict = tensors_by_device.SetDefault(host_device, new Dictionary>>()); if (!internal_dict.ContainsKey(checkpoint_key)) { - internal_dict[checkpoint_key] = new Dictionary(); + internal_dict[checkpoint_key] = new Dictionary>(); } internal_dict[checkpoint_key][slice_spec] = tensor; } @@ -338,11 +245,14 @@ public Operation save(Tensor file_prefix, CheckpointOptions? options= null) options = new CheckpointOptions(); } - tf.device("CPU"); // may be risky. - var sharded_suffix = array_ops.where(gen_ops.regex_full_match(file_prefix, tf.constant(@"^s3://.*")), + Tensor tmp_checkpoint_prefix = null; + tf_with(ops.device("CPU"), _ => + { + var sharded_suffix = array_ops.where(gen_ops.regex_full_match(file_prefix, tf.constant(@"^s3://.*")), constant_op.constant(".part"), constant_op.constant("_temp/part")); - var tmp_checkpoint_prefix = gen_ops.string_join(new Tensor[] { file_prefix, sharded_suffix }); - IDictionary registered_paths = _registered_savers.Keys.ToDictionary(x => x, x => registered_saver_filename(file_prefix, x)); + tmp_checkpoint_prefix = gen_ops.string_join(new Tensor[] { file_prefix, sharded_suffix }); + IDictionary registered_paths = _registered_savers.Keys.ToDictionary(x => x, x => registered_saver_filename(file_prefix, x)); + }); Operation save_fn() { @@ -364,16 +274,24 @@ Operation save_fn() var saver = pair.Value; last_device = device; // skip the extra process of device name because of lack of API. - tf.device(device); - var shard_prefix = sharded_filename(tmp_checkpoint_prefix, shard, num_shards_tensor); + Tensor shard_prefix = null; + tf_with(ops.device(device), _ => + { + shard_prefix = sharded_filename(tmp_checkpoint_prefix, shard, num_shards_tensor); + }); saved_prefixes.Add(shard_prefix); - sharded_saves.Add(saver.save(shard_prefix, options)); + tf_with(ops.device(device), _ => + { + sharded_saves.Add(saver.save(shard_prefix, options)); + }); } using (var controller = ops.control_dependencies(sharded_saves.ToArray())) { string merge_device = string.IsNullOrEmpty(options.experimental_io_device) ? last_device : options.experimental_io_device; - tf.device(merge_device); - return gen_ops.merge_v2_checkpoints(saved_prefixes.ToArray(), tf.constant(file_prefix), delete_old_dirs: true); + return tf_with(ops.device(merge_device), _ => + { + return gen_ops.merge_v2_checkpoints(saved_prefixes.ToArray(), tf.constant(file_prefix), delete_old_dirs: true); + }); } } @@ -399,7 +317,7 @@ public IDictionary restore(Tensor file_prefix, CheckpointOpti IDictionary restore_func() { - Dictionary>>> restore_fn_inputs = new(); + Dictionary>>> restore_fn_inputs = new(); Dictionary restore_fn_input_count = _restore_fn_to_keys.ToDictionary(x => x.Key, x => x.Value.Count); Dictionary restore_ops = new(); @@ -407,54 +325,56 @@ IDictionary restore_func() { var device = single_saver.Key; var saver = single_saver.Value; - tf.device(device); - var restored_tensor_dict = saver.restore(file_prefix, options); - - foreach(var pair in restored_tensor_dict) + tf_with(ops.device(device), _ => { - var checkpoint_key = pair.Key; - var slice_and_tensor = pair.Value; - foreach(var item in slice_and_tensor) + var restored_tensor_dict = saver.restore(file_prefix, options); + + foreach (var pair in restored_tensor_dict) { - var slice_spec = item.Key; - var tensor = item.Value; - var restore_fn = _keys_to_restore_fn[(checkpoint_key, slice_spec)]; - var internal_dict = restore_fn_inputs.SetDefault(restore_fn, new Dictionary>>()); - if (!string.IsNullOrEmpty(slice_spec)) + var checkpoint_key = pair.Key; + var slice_and_tensor = pair.Value; + foreach (var item in slice_and_tensor) { - if (!internal_dict.ContainsKey(checkpoint_key)) + var slice_spec = item.Key; + var tensor = item.Value; + var restore_fn = _keys_to_restore_fn[(checkpoint_key, slice_spec)]; + var internal_dict = restore_fn_inputs.SetDefault(restore_fn, new Dictionary>>()); + if (!string.IsNullOrEmpty(slice_spec)) { - Dictionary dict = new(); - dict[slice_spec] = tensor; - internal_dict[checkpoint_key] = new Maybe>(dict); + if (!internal_dict.ContainsKey(checkpoint_key)) + { + Dictionary dict = new(); + dict[slice_spec] = tensor; + internal_dict[checkpoint_key] = OneOf>.FromT1(dict); + } + else + { + internal_dict[checkpoint_key].AsT1[slice_spec] = tensor; + } } else { - internal_dict[checkpoint_key].GetValue>()[slice_spec] = tensor; + internal_dict[checkpoint_key] = OneOf>.FromT0(tensor); } - } - else - { - internal_dict[checkpoint_key] = new Maybe>(tensor); - } - restore_fn_input_count[restore_fn]--; + restore_fn_input_count[restore_fn]--; - if (restore_fn_input_count[restore_fn] == 0) - { - Dictionary>> restored_tensors = new(); - foreach(var input in restore_fn_inputs[restore_fn]) - { - restored_tensors[TrackableUtils.extract_local_name(input.Key)] = input.Value; - } - var ret = restore_fn.DynamicInvoke(restored_tensors); - if(ret is IDictionary) + if (restore_fn_input_count[restore_fn] == 0) { - var dict = (IDictionary)ret; - restore_ops = restore_ops.Concat(dict).ToDictionary(x => x.Key, x => x.Value); + Dictionary>> restored_tensors = new(); + foreach (var input in restore_fn_inputs[restore_fn]) + { + restored_tensors[TrackableUtils.extract_local_name(input.Key)] = input.Value; + } + var ret = restore_fn.DynamicInvoke(restored_tensors); + if (ret is IDictionary) + { + var dict = (IDictionary)ret; + restore_ops = restore_ops.Concat(dict).ToDictionary(x => x.Key, x => x.Value); + } } } } - } + }); } foreach(var item in _registered_savers) @@ -500,26 +420,30 @@ public SaverDef to_proto() private Tensor _traced_save(Tensor file_prefix) { var save_op = save(file_prefix); - tf.device("cpu:0"); - using (ops.control_dependencies(new object[]{ save_op })) + return tf_with(ops.device("cpu:0"), _ => { - return array_ops.identity(file_prefix); - } + return tf_with(ops.control_dependencies(new object[] { save_op }), __ => + { + return array_ops.identity(file_prefix); + }); + }); } private Tensor _traced_restore(Tensor file_prefix) { var restore_op = restore(file_prefix); - tf.device("cpu:0"); - using (ops.control_dependencies(restore_op.Values.ToArray())) + return tf_with(ops.device("cpu:0"), _ => { - return array_ops.identity(file_prefix); - } + return tf_with(ops.control_dependencies(restore_op.Values.ToArray()), __ => + { + return array_ops.identity(file_prefix); + }); + }); } public static MultiDeviceSaver from_saveables(IEnumerable saveables, IDictionary>? registered_savers = null, bool call_with_mapped_captures = false) { - Dictionary>>> serialized_tensors = new(); + Dictionary>>> serialized_tensors = new(); foreach (var saveable in saveables) { var trackable = new SaveableCompatibilityConverter(saveable, new List() { saveable }); diff --git a/src/TensorFlowNET.Core/Checkpoint/restore.cs b/src/TensorFlowNET.Core/Checkpoint/restore.cs index b27396a79..0e1a300e9 100644 --- a/src/TensorFlowNET.Core/Checkpoint/restore.cs +++ b/src/TensorFlowNET.Core/Checkpoint/restore.cs @@ -1,7 +1,9 @@ -using System; +using OneOf; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Security; using System.Text; using Tensorflow.Train; using Tensorflow.Training; @@ -49,7 +51,7 @@ public bool bind_project(Trackable trackable) { _checkpoint.AllTrackables.Add(trackable); _checkpoint.MatchedProtoIds.Add(_proto_id); - if(_checkpoint.ObjectByProtoId.TryGetValue(_proto_id, out var current_assignment)) + if(_checkpoint.ObjectByProtoId.TryGetValue(_proto_id, out var current_assignment) && current_assignment is not null) { // skip the `logging.warning`. return false; @@ -61,13 +63,13 @@ public bool bind_project(Trackable trackable) } } - public (List, Dictionary>, List, object?) gather_ops_or_named_saveables() + public (List, Dictionary>, List, object?) gather_ops_or_named_saveables() { // skip the registered_saver if (ObjectProto.Attributes is null || ObjectProto.Attributes.Count == 0) { - return (new List(), new Dictionary>(), + return (new List(), new Dictionary>(), new List(), null); } @@ -75,7 +77,7 @@ public bool bind_project(Trackable trackable) List existing_restore_ops; List positions = new(); - Dictionary> named_saveables; + Dictionary> named_saveables; if (saveable_factories.Keys.Count == 1 && saveable_factories.Keys.First() == TrackableUtils.SERIALIZE_TO_TENSORS_NAME) { (existing_restore_ops, named_saveables) = _create_serialize_to_tensor_saveable(saveable_factories); @@ -109,8 +111,8 @@ public CheckpointPosition create_child_position(int node_id) /// Creates a saveable using the _serialize_to_tensor method. /// /// - private (List, Dictionary>) _create_serialize_to_tensor_saveable( - IDictionary>> saveable_factories) + private (List, Dictionary>) _create_serialize_to_tensor_saveable( + IDictionary>> saveable_factories) { string suffix = SaveableCompat.get_saveable_name(this.Trackable); suffix = suffix ?? ""; @@ -124,23 +126,23 @@ public CheckpointPosition create_child_position(int node_id) var saveable = saveable_factories[TrackableUtils.SERIALIZE_TO_TENSORS_NAME](saveable_name); // skip the cache. - Dictionary> dict = new(); + Dictionary> dict = new(); dict[saveable_name] = saveable; return (new List(), dict); } - private (List, Dictionary>) _create_saveables_by_attribute_name( - IDictionary>> saveable_factories) + private (List, Dictionary>) _create_saveables_by_attribute_name( + IDictionary>> saveable_factories) { // TODO(Rinne): implement it. if(ObjectProto.Attributes is null) { - return (new List(), new Dictionary>()); + return (new List(), new Dictionary>()); } List existing_restore_ops = new(); HashSet created_compat_names = new(); - Dictionary> named_saveables = new(); + Dictionary> named_saveables = new(); foreach (var serialized_tensor in ObjectProto.Attributes) { Operation existing_op; @@ -172,12 +174,12 @@ public CheckpointPosition create_child_position(int node_id) _checkpoint.UnusedAttributes.SetDefault(_proto_id, new List()).Add(serialized_tensor.Name); continue; } - named_saveables[serialized_tensor.CheckpointKey] = saveable; + named_saveables[serialized_tensor.CheckpointKey] = saveable.Value; } return (existing_restore_ops, named_saveables); } - private Maybe _get_saveable_from_factory(IDictionary>> saveable_factories, + private OneOf? _get_saveable_from_factory(IDictionary>> saveable_factories, TrackableObjectGraph.Types.TrackableObject.Types.SerializedTensor serialized_tensor, HashSet created_compat_names) { var expected_factory_name = serialized_tensor.Name; @@ -221,7 +223,7 @@ private List _restore_descendants() Queue<(CheckpointPosition, Trackable)> visit_queue = new(); visit_queue.Enqueue((this, this.Trackable)); List restore_ops = new(); - Dictionary> tensor_saveables = new(); + Dictionary> tensor_saveables = new(); List positions = new(); CheckpointPosition current_position = null; @@ -306,7 +308,7 @@ private void _queue_slot_variables(CheckpointPosition checkpoint_position, Queue } } - private (List, Dictionary>, List, object?) _single_restore() + private (List, Dictionary>, List, object?) _single_restore() { var trackable = this.Trackable; trackable._maybe_initialize_trackable(); @@ -318,7 +320,7 @@ private void _queue_slot_variables(CheckpointPosition checkpoint_position, Queue } else { - return (new List(), new Dictionary>(), + return (new List(), new Dictionary>(), new List(), null); } } diff --git a/src/TensorFlowNET.Core/Contexts/Context.Config.cs b/src/TensorFlowNET.Core/Contexts/Context.Config.cs index b363b516e..0c7bded6e 100644 --- a/src/TensorFlowNET.Core/Contexts/Context.Config.cs +++ b/src/TensorFlowNET.Core/Contexts/Context.Config.cs @@ -14,9 +14,11 @@ You may obtain a copy of the License at limitations under the License. ******************************************************************************/ +using Google.Protobuf; using System; using System.Diagnostics; using System.Linq; +using Tensorflow.Common.Extensions; namespace Tensorflow.Contexts { @@ -25,12 +27,93 @@ namespace Tensorflow.Contexts /// public sealed partial class Context { - public ConfigProto Config { get; set; } = new ConfigProto + protected Device.PhysicalDevice[] _physical_devices; + protected Dictionary _physical_device_to_index; + ConfigProto _config; + public ConfigProto Config { - GpuOptions = new GPUOptions + get { + _initialize_physical_devices(); + + var config = new ConfigProto(); + if(_config is not null) + { + config.MergeFrom(_config); + } + config.LogDevicePlacement = _log_device_placement; + + config.DeviceCount["CPU"] = 0; + config.DeviceCount["GPU"] = 0; + foreach(var dev in _physical_devices) + { + if (config.DeviceCount.ContainsKey(dev.DeviceType)) + { + config.DeviceCount[dev.DeviceType] += 1; + } + else + { + config.DeviceCount[dev.DeviceType] = 1; + } + } + + var gpu_options = _compute_gpu_options(); + config.GpuOptions = GPUOptions.Parser.ParseFrom(gpu_options.ToByteArray()); + + return config; + } + set + { + _config = value; + } + } + + protected void _initialize_physical_devices(bool reinitialize = false) + { + if(!reinitialize && _physical_devices is not null) + { + return; + } + var devs = list_physical_devices(); + _physical_devices = devs.Select(d => new Device.PhysicalDevice() + { + DeviceName = d.DeviceName, + DeviceType = d.DeviceType + }).ToArray(); + _physical_device_to_index = _physical_devices.Select((p, i) => new KeyValuePair(p, i)) + .ToDictionary(x => x.Key, x => x.Value); + + _import_config(); + } + + protected void _import_config() + { + if(_config is null) + { + return; + } + if(!_config.DeviceCount.TryGetValue("CPU", out var num_cpus)) + { + num_cpus = 1; + } + if(num_cpus != 1) + { + // TODO(Rinne): implement it. } - }; + + var gpus = _physical_devices.Where(d => d.DeviceType == "GPU"); + if(gpus.Count() == 0) + { + return; + } + + if(!_config.DeviceCount.TryGetValue("GPU", out var gpu_count)) + { + gpu_count = 0; + } + + // TODO(Rinne): implement it. + } ConfigProto MergeConfig() { diff --git a/src/TensorFlowNET.Core/Contexts/Context.Device.cs b/src/TensorFlowNET.Core/Contexts/Context.Device.cs index fea2c8241..d35d10847 100644 --- a/src/TensorFlowNET.Core/Contexts/Context.Device.cs +++ b/src/TensorFlowNET.Core/Contexts/Context.Device.cs @@ -21,6 +21,7 @@ limitations under the License. using static Tensorflow.Binding; using Google.Protobuf; using Tensorflow.Device; +using Tensorflow.Exceptions; using System.Collections.Generic; namespace Tensorflow.Contexts @@ -30,14 +31,34 @@ namespace Tensorflow.Contexts /// public sealed partial class Context { + internal static Dictionary<(string, string), (string, DeviceSpec)> _device_parsing_cache = new(); + internal List _logical_devices = null; + internal List _context_devices = null; + ContextDevicePlacementPolicy _device_policy; bool _log_device_placement; + int _num_gpus; Dictionary _memory_growth_map = new Dictionary(); + public string DeviceName { get; set; } = ""; + public DeviceSpec DeviceSpec { get; set; } = null; + + internal List Devices + { + get + { + if(_context_devices is null) + { + throw new AssertionError("Context must be initialized first."); + } + return _context_devices; + } + } + public void log_device_placement(bool enable) { if (_handle != null) - c_api.TFE_ContextSetLogDevicePlacement(_handle, enable, tf.Status.Handle); + c_api.TFE_ContextSetLogDevicePlacement(_handle, enable, tf.Status); _log_device_placement = enable; // _thread_local_data.function_call_options = null; } @@ -60,15 +81,15 @@ public void set_memory_growth(PhysicalDevice device, bool enable) public PhysicalDevice[] list_physical_devices(string device_type = null) { using var opts = c_api.TFE_NewContextOptions(); - using var ctx = c_api.TFE_NewContext(opts, tf.Status.Handle); - using var devices = c_api.TFE_ContextListDevices(ctx, tf.Status.Handle); + using var ctx = c_api.TFE_NewContext(opts, tf.Status); + using var devices = c_api.TFE_ContextListDevices(ctx, tf.Status); tf.Status.Check(true); int num_devices = c_api.TF_DeviceListCount(devices); var results = new List(); for (int i = 0; i < num_devices; ++i) { - var dev_type = c_api.StringPiece(c_api.TF_DeviceListType(devices, i, tf.Status.Handle)); + var dev_type = c_api.StringPiece(c_api.TF_DeviceListType(devices, i, tf.Status)); tf.Status.Check(true); if (dev_type.StartsWith("XLA")) @@ -76,7 +97,7 @@ public PhysicalDevice[] list_physical_devices(string device_type = null) if (device_type == null || dev_type == device_type) { - var dev_name = c_api.TF_DeviceListName(devices, i, tf.Status.Handle); + var dev_name = c_api.TF_DeviceListName(devices, i, tf.Status); tf.Status.Check(true); results.Add(new PhysicalDevice @@ -89,5 +110,65 @@ public PhysicalDevice[] list_physical_devices(string device_type = null) return results.ToArray(); } + + public bool is_custom_device(string device_name) + { + return false; + // TODO(Rinne): After tf2.11 TFE_IsCustomDevice has been added to C APIs. + //ensure_initialized(); + //return c_api.TFE_IsCustomDevice(_handle, device_name); + } + + public EagerDeviceContext device(string name) + { + return new EagerDeviceContext(this, name); + } + + internal void _set_device(string device_name, DeviceSpec device_spec) + { + DeviceSpec = device_spec; + DeviceName = device_name; + } + + internal void _initialize_logical_devices() + { + List logical_devices = new(); + List context_devices = new(); + Status status = new(); + var device_list = c_api.TFE_ContextListDevices(_handle, status); + status.Check(true); + try + { + this._num_gpus = 0; + string current_job = null; + int current_task = -1; + for(int i = 0; i < c_api.TF_DeviceListCount(device_list); i++) + { + var dev_name = c_api.TF_DeviceListName(device_list, i, status); + status.Check(true); + context_devices.Add(DeviceUtils.canonical_name(dev_name)); + var spec = DeviceSpec.from_string(dev_name); + if(spec.Job == "localhost") + { + spec = spec.replace(job: null, replica: -1, task: -1); + } + logical_devices.Add(new LogicalDevice(spec.ToString(), spec.DeviceType)); + var dev_type_memory = c_api.TF_DeviceListType(device_list, i, status); + var dev_type = c_api.StringPiece(dev_type_memory); + status.Check(true); + if(dev_type == "GPU" && spec.Job == current_job && spec.Task == current_task) + { + _num_gpus++; + } + } + } + finally + { + _logical_devices = logical_devices; + _context_devices = context_devices; + } + } } + + public record class LogicalDevice(string name, string device_type); } diff --git a/src/TensorFlowNET.Core/Contexts/Context.cs b/src/TensorFlowNET.Core/Contexts/Context.cs index 5d02c0274..0507cc2f8 100644 --- a/src/TensorFlowNET.Core/Contexts/Context.cs +++ b/src/TensorFlowNET.Core/Contexts/Context.cs @@ -28,28 +28,38 @@ namespace Tensorflow.Contexts /// /// Environment in which eager operations execute. /// - public sealed partial class Context : IDisposable + public sealed partial class Context { public const int GRAPH_MODE = 0; public const int EAGER_MODE = 1; int defaultExecutionMode = EAGER_MODE; - public string DeviceName { get; set; } = ""; public string ScopeName { get; set; } = ""; bool initialized = false; ContextSwitchStack context_switches; - public FunctionCallOptions FunctionCallOptions { get; } - - SafeContextHandle _handle; - public SafeContextHandle Handle + protected FunctionCallOptions _function_call_options; + public FunctionCallOptions FunctionCallOptions { get { - if (_handle == null) - ensure_initialized(); - return _handle; + if(_function_call_options is null) + { + var config = Config; + _function_call_options = new FunctionCallOptions() + { + Config = config + }; + } + return _function_call_options; + } + set + { + _function_call_options = value; } } + + SafeContextHandle _handle; + int? _seed; Random _rng; @@ -59,6 +69,7 @@ public Context() context_switches = new ContextSwitchStack(defaultExecutionMode == EAGER_MODE, false); initialized = false; FunctionCallOptions = new FunctionCallOptions(); + ensure_initialized(); } /// @@ -69,16 +80,19 @@ public void ensure_initialized() if (initialized) return; + Debug.Assert(_context_devices is null); + Config = MergeConfig(); FunctionCallOptions.Config = Config; var config_str = Config.ToByteArray(); - using var opts = new ContextOptions(); - using var status = new Status(); - c_api.TFE_ContextOptionsSetConfig(opts.Handle, config_str, (ulong)config_str.Length, status.Handle); + var opts = new ContextOptions(); + var status = new Status(); + c_api.TFE_ContextOptionsSetConfig(opts, config_str, (ulong)config_str.Length, status); status.Check(true); - c_api.TFE_ContextOptionsSetDevicePlacementPolicy(opts.Handle, _device_policy); - _handle = c_api.TFE_NewContext(opts.Handle, status.Handle); + c_api.TFE_ContextOptionsSetDevicePlacementPolicy(opts, _device_policy); + _handle = c_api.TFE_NewContext(opts, status); status.Check(true); + _initialize_logical_devices(); initialized = true; } @@ -127,6 +141,11 @@ public string shared_name(string name = null) name : "cd2c89b7-88b7-44c8-ad83-06c2a9158347"; + public string anonymous_name() + { + return "cd2c89b7-88b7-44c8-ad83-06c2a9158347"; + } + public void graph_mode(bool isFunc = false) => context_switches.Push(false, isFunc); @@ -163,6 +182,37 @@ public bool has_graph_arg(params object[] args) return has_graph_arg; } + public bool has_function(string name) + { + ensure_initialized(); + return c_api.TFE_ContextHasFunction(_handle, name); + } + + public void add_function(SafeFuncGraphHandle fn) + { + ensure_initialized(); + Status status = new(); + c_api.TFE_ContextAddFunction(_handle, fn, status); + status.Check(true); + } + + public void remove_function(string name) + { + ensure_initialized(); + Status status = new(); + c_api.TFE_ContextRemoveFunction(_handle, name, status); + status.Check(true); + } + + public void add_function_def(FunctionDef fdef) + { + ensure_initialized(); + var fdef_string = fdef.ToByteArray(); + Status status = new Status(); + c_api.TFE_ContextAddFunctionDef(_handle, fdef_string, (ulong)fdef_string.Length, status); + status.Check(true); + } + public void restore_mode() { context_switches.Pop(); @@ -178,10 +228,15 @@ public void reset_context() tf.Context.ensure_initialized(); if (_handle != null) + { c_api.TFE_ContextClearCaches(_handle); + } + _device_parsing_cache.Clear(); } - public void Dispose() - => _handle.Dispose(); + public static implicit operator SafeContextHandle(Context ctx) + { + return ctx._handle; + } } } diff --git a/src/TensorFlowNET.Core/Contexts/ContextOptions.cs b/src/TensorFlowNET.Core/Contexts/ContextOptions.cs index 6c2156a97..4a07f1f5c 100644 --- a/src/TensorFlowNET.Core/Contexts/ContextOptions.cs +++ b/src/TensorFlowNET.Core/Contexts/ContextOptions.cs @@ -14,21 +14,21 @@ You may obtain a copy of the License at limitations under the License. ******************************************************************************/ -using System; using Tensorflow.Eager; -namespace Tensorflow.Contexts +namespace Tensorflow.Contexts; + +public sealed class ContextOptions { - public sealed class ContextOptions : IDisposable - { - public SafeContextOptionsHandle Handle { get; } + SafeContextOptionsHandle _handle { get; } - public ContextOptions() - { - Handle = c_api.TFE_NewContextOptions(); - } + public ContextOptions() + { + _handle = c_api.TFE_NewContextOptions(); + } - public void Dispose() - => Handle.Dispose(); + public static implicit operator SafeContextOptionsHandle(ContextOptions opt) + { + return opt._handle; } } diff --git a/src/TensorFlowNET.Core/Contexts/EagerDeviceContext.cs b/src/TensorFlowNET.Core/Contexts/EagerDeviceContext.cs new file mode 100644 index 000000000..2d5f61cdb --- /dev/null +++ b/src/TensorFlowNET.Core/Contexts/EagerDeviceContext.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Tensorflow.Device; + +namespace Tensorflow.Contexts +{ + public class EagerDeviceContext : ITensorFlowObject + { + private Context _ctx; + private string _device_name; + private Stack<(string, DeviceSpec, DeviceSpec)> _stack; + + public EagerDeviceContext(Context ctx, string device_name) + { + _ctx = ctx; + _device_name = device_name; + _stack = new Stack<(string, DeviceSpec, DeviceSpec)>(); + } + public void __enter__() + { + var ctx = _ctx; + var old_device_name = ctx.DeviceName; + var old_device_spec = ctx.DeviceSpec; + var new_device_name = _device_name; + var cache_key = (old_device_name, new_device_name); + DeviceSpec new_device_spec; + if (Context._device_parsing_cache.ContainsKey(cache_key)) + { + (new_device_name, new_device_spec) = Context._device_parsing_cache[cache_key]; + } + else + { + if(new_device_name is not null) + { + var device_spec = DeviceSpec.from_string(new_device_name); + if (!string.IsNullOrEmpty(old_device_name)) + { + new_device_spec = new DeviceSpec(old_device_spec); + } + else + { + ctx.ensure_initialized(); + new_device_spec = DeviceSpec.from_string(ctx._context_devices[0]); + } + new_device_spec = new_device_spec.make_merged_spec(device_spec); + } + else + { + new_device_spec = DeviceSpec.from_string(ctx._context_devices[0]); + } + new_device_name = new_device_spec.ToString(); + Context._device_parsing_cache[cache_key] = (new_device_name, new_device_spec); + } + ctx._set_device(new_device_name, new_device_spec); + _stack.Push((old_device_name, old_device_spec, new_device_spec)); + } + + public void __exit__() + { + var ctx = _ctx; + var (old_device_name, old_device_spec, new_device_spec) = _stack.Pop(); + ctx._set_device(old_device_name, old_device_spec); + } + + public void Dispose() + { + + } + } +} diff --git a/src/TensorFlowNET.Core/Contexts/FunctionCallOptions.cs b/src/TensorFlowNET.Core/Contexts/FunctionCallOptions.cs index 6b6028f03..71312d11b 100644 --- a/src/TensorFlowNET.Core/Contexts/FunctionCallOptions.cs +++ b/src/TensorFlowNET.Core/Contexts/FunctionCallOptions.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using Google.Protobuf; +using Protobuf.Text; using static Tensorflow.Binding; namespace Tensorflow.Contexts @@ -9,10 +10,11 @@ namespace Tensorflow.Contexts public class FunctionCallOptions { public ConfigProto Config { get; set; } + public string ExecutorType { get; set; } - public string config_proto_serialized() + public ByteString config_proto_serialized() { - return Config.ToByteString().ToStringUtf8(); + return Config.ToByteString(); } } } diff --git a/src/TensorFlowNET.Core/Data/DatasetV2.cs b/src/TensorFlowNET.Core/Data/DatasetV2.cs index 103d7cfff..324d7e834 100644 --- a/src/TensorFlowNET.Core/Data/DatasetV2.cs +++ b/src/TensorFlowNET.Core/Data/DatasetV2.cs @@ -19,6 +19,8 @@ public class DatasetV2 : IDatasetV2 public TensorSpec[] structure { get; set; } + public int FirstInputTensorCount { get; set; } = 1; + public Shape[] output_shapes => structure.Select(x => x.shape).ToArray(); public TF_DataType[] output_types => structure.Select(x => x.dtype).ToArray(); @@ -131,6 +133,7 @@ public IDatasetV2 apply_options() // (4) Apply stats aggregator options + dataset.FirstInputTensorCount = this.FirstInputTensorCount; return dataset; } @@ -142,7 +145,7 @@ public override string ToString() $"types: {string.Join(", ", structure.Select(x => "tf." + x.dtype.as_numpy_name()))}, " + $"len: {length}"; - public IEnumerator<(Tensor, Tensor)> GetEnumerator() + public IEnumerator<(Tensors, Tensors)> GetEnumerator() { using var ownedIterator = new OwnedIterator(this); @@ -158,7 +161,8 @@ public override string ToString() break; } - yield return (results[0], results.Length == 1 ? null : results[1]); + yield return (new Tensors(results.Take(FirstInputTensorCount)), results.Length == FirstInputTensorCount ? + null : new Tensors(results.Skip(FirstInputTensorCount))); } } diff --git a/src/TensorFlowNET.Core/Data/IDatasetV2.cs b/src/TensorFlowNET.Core/Data/IDatasetV2.cs index 5cfeb27cc..320cbe348 100644 --- a/src/TensorFlowNET.Core/Data/IDatasetV2.cs +++ b/src/TensorFlowNET.Core/Data/IDatasetV2.cs @@ -4,7 +4,7 @@ namespace Tensorflow { - public interface IDatasetV2 : IEnumerable<(Tensor, Tensor)> + public interface IDatasetV2 : IEnumerable<(Tensors, Tensors)> { string[] class_names { get; set; } @@ -18,6 +18,8 @@ public interface IDatasetV2 : IEnumerable<(Tensor, Tensor)> TensorSpec[] structure { get; set; } + int FirstInputTensorCount { get; set; } + /// /// Caches the elements in this dataset. /// diff --git a/src/TensorFlowNET.Core/Data/OwnedIterator.cs b/src/TensorFlowNET.Core/Data/OwnedIterator.cs index eb91272c7..6f6fd0b58 100644 --- a/src/TensorFlowNET.Core/Data/OwnedIterator.cs +++ b/src/TensorFlowNET.Core/Data/OwnedIterator.cs @@ -13,7 +13,7 @@ public class OwnedIterator : IDisposable IDatasetV2 _dataset; TensorSpec[] _element_spec; dataset_ops ops = new dataset_ops(); - Tensor _deleter; + //Tensor _deleter; Tensor _iterator_resource; public OwnedIterator(IDatasetV2 dataset) @@ -26,8 +26,8 @@ void _create_iterator(IDatasetV2 dataset) dataset = dataset.apply_options(); _dataset = dataset; _element_spec = dataset.element_spec; - // _flat_output_types = - (_iterator_resource, _deleter) = ops.anonymous_iterator_v2(_dataset.output_types, _dataset.output_shapes); + _iterator_resource = ops.anonymous_iterator_v3(_dataset.output_types, _dataset.output_shapes); + // TODO(Rinne): deal with graph mode. ops.make_iterator(dataset.variant_tensor, _iterator_resource); } @@ -48,7 +48,7 @@ public Tensor[] next() public void Dispose() { - tf.Runner.Execute(tf.Context, "DeleteIterator", 0, new[] { _iterator_resource, _deleter }, null); + //tf.Runner.Execute(tf.Context, "DeleteIterator", 0, new[] { _iterator_resource, _deleter }, null); } } } diff --git a/src/TensorFlowNET.Core/Device/DeviceSpec.cs b/src/TensorFlowNET.Core/Device/DeviceSpec.cs new file mode 100644 index 000000000..f4ea8cf05 --- /dev/null +++ b/src/TensorFlowNET.Core/Device/DeviceSpec.cs @@ -0,0 +1,205 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace Tensorflow.Device +{ + public class DeviceSpec + { + private static Dictionary _STRING_TO_COMPONENTS_CACHE = new(); + private static Dictionary _COMPONENTS_TO_STRING_CACHE = new(); + private string _job; + private int _replica; + private int _task; + private string _device_type; + private int _device_index; + private string _as_string; + + public string Job => _job; + public int Replica => _replica; + public int Task => _task; + public string DeviceType => _device_type; + public int DeviceIndex => _device_index; + + public DeviceSpec(string job = null, int replica = -1, int task = -1, + string device_type = null, int device_index = -1) + { + _job = job; + _replica = replica; + _task = task; + _device_type = device_type; + _device_index = device_index; + _as_string = _components_to_string(job, replica, task, device_type, _device_index); + + } + + public DeviceSpec(DeviceSpec other) + { + _job = other._job; + _replica = other._replica; + _task = other._task; + _device_type = other._device_type; + _device_index = other._device_index; + _as_string = other._as_string; + } + + protected DeviceSpec(Components com) + { + _job = com.Job; + _replica = com.Replica; + _task = com.Task; + _device_type = com.DeviceType; + _device_index = com.DeviceIndex; + _as_string = _components_to_string(_job, _replica, _task, _device_type, _device_index); + } + + public DeviceSpec replace(string job = null, int replica = -1, int task = -1, + string device_type = null, int device_index = -1) + { + job = job ?? _job; + replica = replica == -1 ? _replica : replica; + task = task == -1 ? _task : task; + device_type = device_type ?? _device_type; + device_index = device_index == -1 ? _device_index : device_index; + return new DeviceSpec(job, replica, task, device_type, device_index); + } + + public static DeviceSpec from_string(string spec) + { + var components = _string_to_components(spec); + return new DeviceSpec(components.Job, components.Replica, components.Task, components.DeviceType, components.DeviceIndex); + } + + public DeviceSpec make_merged_spec(DeviceSpec dev) + { + return new DeviceSpec(_get_combined_properties(dev)); + } + + private Components _get_combined_properties(DeviceSpec dev) + { + return new Components( + dev.Job ?? _job, + dev.Replica == -1 ? _replica : dev.Replica, + dev.Task == -1 ? _task : dev.Task, + dev.DeviceType ?? _device_type, + dev.DeviceIndex == -1 ? _device_index : dev.DeviceIndex + ); + } + + private static string _components_to_string(string job, int replica, int task, string device_type, int device_index) + { + var key = new Components(job, replica, task, device_type, device_index); + if(_COMPONENTS_TO_STRING_CACHE.TryGetValue(key, out var cache_result)) + { + return cache_result; + } + + StringBuilder output = new(); + if(job is not null) + { + output.Append($"/job:{job}"); + } + if(replica != -1) + { + output.Append($"/replica:{replica}"); + } + if(task != -1) + { + output.Append($"/task:{task}"); + } + if (device_type is not null) + { + string device_index_string = "*"; + if (device_index != -1) + { + device_index_string = device_index.ToString(); + } + output.Append($"/device:{device_type}:{device_index_string}"); + } + var result = output.ToString(); + _COMPONENTS_TO_STRING_CACHE[key] = result; + return result; + } + + private static Components _string_to_components(string spec) + { + if(_STRING_TO_COMPONENTS_CACHE.TryGetValue(spec, out var cached_result)) + { + return cached_result; + } + var raw_spec = spec; + var splits = spec.Split('/').Select(x => x.Split(':')); + var valid_device_types = _get_valid_device_types(); + string job = null, device_type = null; + int replica = -1, task = -1, device_index = -1; + foreach (var y in splits) + { + var ly = y.Length; + if (ly > 0) + { + if(ly == 2 && y[0] == "job") + { + job = y[1]; + } + else if(ly == 2 && y[0] == "replica") + { + replica = int.Parse(y[1]); + } + else if(ly == 2 && y[0] == "task") + { + task = int.Parse(y[1]); + } + else if((ly == 1 || ly == 2) && valid_device_types.Contains(y[0].ToUpper())) + { + if (device_type is not null) + { + throw new ValueError($"Multiple device types are not allowed " + + $"while parsing the device spec: {spec}."); + } + device_type = y[0].ToUpper(); + if(ly == 2 && y[1] != "*") + { + device_index = int.Parse(y[1]); + } + } + else if(ly == 3 && y[0] == "device") + { + if(device_type is not null) + { + throw new ValueError($"Multiple device types are not allowed " + + $"while parsing the device spec: {spec}."); + } + device_type = y[1]; + if (y[2] != "*") + { + device_index = int.Parse(y[2]); + } + } + else if (y[0] != "") + { + throw new ValueError($"Unknown attribute '{y[0]}' is encountered " + + $"while parsing the device spec: {spec}."); + } + } + } + + var output = new Components(job, replica, task, device_type, device_index); + _STRING_TO_COMPONENTS_CACHE[raw_spec] = output; + return output; + } + + private static HashSet _get_valid_device_types() + { + // TODO(Rinne): revise it to calling C API (need customized API). + return new HashSet(new string[] { "CPU", "GPU" }); + } + + public override string ToString() + { + return _as_string; + } + + protected record class Components(string Job, int Replica, int Task, string DeviceType, int DeviceIndex); + } +} diff --git a/src/TensorFlowNET.Core/Device/DeviceUtils.cs b/src/TensorFlowNET.Core/Device/DeviceUtils.cs new file mode 100644 index 000000000..8f11e6c8a --- /dev/null +++ b/src/TensorFlowNET.Core/Device/DeviceUtils.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow.Device +{ + internal static class DeviceUtils + { + public static string canonical_name(string device) + { + if(device is null) + { + return ""; + } + return DeviceSpec.from_string(device).ToString(); + } + public static string canonical_name(DeviceSpec device) + { + if (device is null) + { + return ""; + } + return device.ToString(); + } + } +} diff --git a/src/TensorFlowNET.Core/Eager/EagerRunner.MustRecordGradient.cs b/src/TensorFlowNET.Core/Eager/EagerRunner.MustRecordGradient.cs index c4bce84f1..333827037 100644 --- a/src/TensorFlowNET.Core/Eager/EagerRunner.MustRecordGradient.cs +++ b/src/TensorFlowNET.Core/Eager/EagerRunner.MustRecordGradient.cs @@ -12,18 +12,36 @@ public bool MustRecordGradient() return HasGradientTape(); } - private bool ShouldRecord(Tensor[] inputs) + public int TFE_TapeSetPossibleGradientTypes(Tensor[] tensors) { - bool should_record = false; - foreach (var tape in tf.GetTapeSet()) + var tape_set = tf.GetTapeSet(); + var input_ids = MakeTensorIDList(tensors); + var input_dtypes = MakeTensorDtypeList(tensors); + bool some_tape_watching = false; + if (tape_set is not null && tape_set.Count > 0) { - if (tape.ShouldRecord(inputs)) + foreach (var tape in tape_set) { - should_record = true; - break; + if (tape.ShouldRecord(input_ids, input_dtypes)) + { + if (tape.Persistent || some_tape_watching) + { + return gradients_util.POSSIBLE_GRADIENT_TYPES_HIGHER_ORDER; + } + some_tape_watching = true; + } } } - return should_record; + // skip the forward_accumulators. + + if (some_tape_watching) + { + return gradients_util.POSSIBLE_GRADIENT_TYPES_FIRST_ORDER; + } + else + { + return gradients_util.POSSIBLE_GRADIENT_TYPES_NONE; + } } } } diff --git a/src/TensorFlowNET.Core/Eager/EagerRunner.RecordGradient.cs b/src/TensorFlowNET.Core/Eager/EagerRunner.RecordGradient.cs index cfcea55a2..59d5fd030 100644 --- a/src/TensorFlowNET.Core/Eager/EagerRunner.RecordGradient.cs +++ b/src/TensorFlowNET.Core/Eager/EagerRunner.RecordGradient.cs @@ -13,7 +13,17 @@ public bool RecordGradient(string op_name, Tensor[] results, BackwardFunction backwardFunction = null) { - bool should_record = ShouldRecord(inputs); + var input_ids = MakeTensorIDList(inputs); + var input_dtypes = MakeTensorDtypeList(inputs); + bool should_record = false; + foreach (var tape in tf.GetTapeSet()) + { + if (tape.ShouldRecord(input_ids, input_dtypes)) + { + should_record = true; + break; + } + } if (!should_record) { @@ -59,7 +69,7 @@ public bool RecordGradient(string op_name, op_inputs = inputs;*/ backwardFunction = backwardFunction ?? GetGradientFunction(op_name, inputs, attrs, results); - TapeSetRecordOperation(op_name, inputs, results, backwardFunction); + TapeSetRecordOperation(op_name, inputs, results, input_ids, input_dtypes, backwardFunction); return true; } @@ -129,10 +139,5 @@ bool CouldBackprop() { return HasGradientTape(); } - - TF_DataType[] MakeTensorDtypeList(Tensor[] tensors) - { - return tensors.Select(x => x.dtype).ToArray(); - } } } diff --git a/src/TensorFlowNET.Core/Eager/EagerRunner.TFE_Execute.cs b/src/TensorFlowNET.Core/Eager/EagerRunner.TFE_Execute.cs index 4aad851ff..018ba921e 100644 --- a/src/TensorFlowNET.Core/Eager/EagerRunner.TFE_Execute.cs +++ b/src/TensorFlowNET.Core/Eager/EagerRunner.TFE_Execute.cs @@ -17,6 +17,7 @@ limitations under the License. using System; using System.Linq; using Tensorflow.Contexts; +using Tensorflow.Functions; using static Tensorflow.Binding; namespace Tensorflow.Eager @@ -41,9 +42,9 @@ public Tensor[] TFE_ExecuteCancelable(Context ctx, object[] attrs, int num_outputs) { - var status = tf.Status; + var status = new Status(); var op = GetOp(ctx, op_name, status); - c_api.TFE_OpSetDevice(op, device_name, status.Handle); + c_api.TFE_OpSetDevice(op, device_name, status); if (status.ok()) { for (int i = 0; i < inputs.Length; ++i) @@ -54,7 +55,7 @@ public Tensor[] TFE_ExecuteCancelable(Context ctx, Tensor nd => nd.EagerTensorHandle, _ => throw new NotImplementedException("Eager tensor handle has not been allocated.") }; - c_api.TFE_OpAddInput(op, tensor_handle, status.Handle); + c_api.TFE_OpAddInput(op, tensor_handle, status); status.Check(true); } } @@ -64,7 +65,7 @@ public Tensor[] TFE_ExecuteCancelable(Context ctx, var outputs = new SafeEagerTensorHandle[num_outputs]; if (status.ok()) { - c_api.TFE_Execute(op, outputs, out num_outputs, status.Handle); + c_api.TFE_Execute(op, outputs, out num_outputs, status); status.Check(true); } return outputs.Select(x => new EagerTensor(x)).ToArray(); diff --git a/src/TensorFlowNET.Core/Eager/EagerRunner.TFE_FastPathExecute.cs b/src/TensorFlowNET.Core/Eager/EagerRunner.TFE_FastPathExecute.cs index c6158ab00..fedc02cb9 100644 --- a/src/TensorFlowNET.Core/Eager/EagerRunner.TFE_FastPathExecute.cs +++ b/src/TensorFlowNET.Core/Eager/EagerRunner.TFE_FastPathExecute.cs @@ -104,7 +104,7 @@ public Tensor[] TFE_FastPathExecute(FastPathOpExecInfo op_exec_info) var eager_tensor = ops.convert_to_tensor(fast_input_array[j]); attr_values[j] = eager_tensor.dtype; - c_api.TFE_OpAddInput(op, eager_tensor.EagerTensorHandle, status.Handle); + c_api.TFE_OpAddInput(op, eager_tensor.EagerTensorHandle, status); if (op_exec_info.run_callbacks) { @@ -142,7 +142,7 @@ public Tensor[] TFE_FastPathExecute(FastPathOpExecInfo op_exec_info) } var retVals = new SafeEagerTensorHandle[num_retvals]; - c_api.TFE_Execute(op, retVals, out num_retvals, status.Handle); + c_api.TFE_Execute(op, retVals, out num_retvals, status); status.Check(true); var flat_result = retVals.Select(x => new EagerTensor(x)).ToArray(); @@ -160,10 +160,10 @@ public Tensor[] TFE_FastPathExecute(FastPathOpExecInfo op_exec_info) SafeEagerOpHandle GetOp(Context ctx, string op_or_function_name, Status status) { if (thread_local_eager_operation_map.find(op_or_function_name, out var op)) - c_api.TFE_OpReset(op, op_or_function_name, ctx.DeviceName, status.Handle); + c_api.TFE_OpReset(op, op_or_function_name, ctx.DeviceName, status); else { - op = c_api.TFE_NewOp(ctx.Handle, op_or_function_name, status.Handle); + op = c_api.TFE_NewOp(ctx, op_or_function_name, status); thread_local_eager_operation_map[op_or_function_name] = op; } @@ -219,7 +219,7 @@ bool AddInputToOp(object inputs, flattened_attrs.Add(dtype); } - c_api.TFE_OpAddInput(op, tensor.EagerTensorHandle, status.Handle); + c_api.TFE_OpAddInput(op, tensor.EagerTensorHandle, status); status.Check(true); return true; @@ -235,7 +235,7 @@ public void SetOpAttrs(SafeEagerOpHandle op, params object[] attrs) var value = attrs[i + 1]; byte is_list = 0; - var type = c_api.TFE_OpGetAttrType(op, key, ref is_list, status.Handle); + var type = c_api.TFE_OpGetAttrType(op, key, ref is_list, status); if (!status.ok()) return; if (is_list != 0) SetOpAttrList(tf.Context, op, key, value as object[], type, null, status); @@ -264,7 +264,7 @@ void SetOpAttrWithDefaults(Context ctx, SafeEagerOpHandle op, AttrDef attr, Status status) { byte is_list = 0; - var type = c_api.TFE_OpGetAttrType(op, attr_name, ref is_list, status.Handle); + var type = c_api.TFE_OpGetAttrType(op, attr_name, ref is_list, status); if (status.Code != TF_Code.TF_OK) return; if (attr_value == null) @@ -305,7 +305,7 @@ bool SetOpAttrList(Context ctx, SafeEagerOpHandle op, tf.memcpy(dims[i], values1[i].dims, values1[i].ndim * sizeof(long)); } - c_api.TFE_OpSetAttrShapeList(op, key, dims, num_dims, num_values, status.Handle); + c_api.TFE_OpSetAttrShapeList(op, key, dims, num_dims, num_values, status); Array.ForEach(dims, x => Marshal.FreeHGlobal(x)); } else if (type == TF_AttrType.TF_ATTR_TYPE && values is TF_DataType[] values2) @@ -353,12 +353,12 @@ bool SetOpAttrScalar(Context ctx, SafeEagerOpHandle op, break; case TF_AttrType.TF_ATTR_SHAPE: var dims = (value as long[]).ToArray(); - c_api.TFE_OpSetAttrShape(op, key, dims, dims.Length, status.Handle); + c_api.TFE_OpSetAttrShape(op, key, dims, dims.Length, status); status.Check(true); break; case TF_AttrType.TF_ATTR_FUNC: if (value is ConcreteFunction func) - c_api.TFE_OpSetAttrFunctionName(op, key, func.Name, func.Name.Length); + c_api.TFE_OpSetAttrFunctionName(op, key, func.func_graph.FuncName, func.func_graph.FuncName.Length); else throw new NotImplementedException("TF_AttrType.TF_ATTR_FUNC"); break; diff --git a/src/TensorFlowNET.Core/Eager/EagerRunner.TFE_TapeGradient.cs b/src/TensorFlowNET.Core/Eager/EagerRunner.TFE_TapeGradient.cs index c96d09e58..1f7b3ae64 100644 --- a/src/TensorFlowNET.Core/Eager/EagerRunner.TFE_TapeGradient.cs +++ b/src/TensorFlowNET.Core/Eager/EagerRunner.TFE_TapeGradient.cs @@ -1,6 +1,8 @@ -using System; +using OneOf.Types; +using System; using Tensorflow.Gradients; using Tensorflow.Util; +using static Tensorflow.Binding; namespace Tensorflow.Eager { @@ -9,40 +11,183 @@ namespace Tensorflow.Eager /// public partial class EagerRunner { + /// + /// + /// + /// + /// + /// + /// + /// determines the value returned if the target and + /// sources are unconnected.When 'none' the value returned is None wheras when + /// 'zero' a zero tensor in the same shape as the sources is returned. + /// + /// public Tensor[] TFE_TapeGradient(ITape tape, Tensor[] target, Tensor[] sources, - Tensor[] output_gradients) + List output_gradients, + Tensor[] sources_raw, + string unconnected_gradients) { - var target_vec = target; - var sources_vec = sources; - var sources_set = sources_vec; + if (!tape.Persistent) + { + var tape_set = tf.GetTapeSet(); + if (tape_set.Contains(tape)) + { + throw new RuntimeError("gradient() cannot be invoked within the " + + "GradientTape context (i.e., while operations are being " + + "recorded). Either move the call to gradient() to be " + + "outside the 'with tf.GradientTape' block, or " + + "use a persistent tape: " + + "'with tf.GradientTape(persistent=true)'"); + } + } + + var target_vec = MakeTensorIDList(target); + var sources_vec = MakeTensorIDList(sources); + HashSet sources_set = new HashSet(sources_vec); + var source_tensors_that_are_targets = new UnorderedMap(); + + int len = target.Length; + for(int i = 0; i < len; i++) + { + var target_id = target_vec[i]; + if (sources_set.Contains(target_id)) + { + var tensor = target[i]; + source_tensors_that_are_targets[target_id] = TapeTensorFromTensor(tensor); + } + } + + List outgrad_vec = new(); + if(output_gradients is not null) + { + outgrad_vec = output_gradients.ToList(); + } + var result = tape.ComputeGradient(target_vec, sources_vec, source_tensors_that_are_targets, outgrad_vec, false); - var seq_array = target; - var source_tensors_that_are_targets = new UnorderedMap(); - for (int i = 0; i < target.Length; ++i) + bool unconnected_gradients_zero = unconnected_gradients == "zero"; + Tensor[] sources_obj = null; + if (unconnected_gradients_zero) { - source_tensors_that_are_targets.Add(target_vec[i], new TapeTensor(seq_array[i])); + sources_obj = MakeTensorList(sources_raw); } - if (output_gradients != null) + if (result.Length > 0) { - throw new NotImplementedException(""); + for(int i = 0; i < result.Length; i++) + { + if (result[i] is null && unconnected_gradients_zero) + { + var dtype = sources_obj[i].dtype; + result[i] = new TapeTensor(sources_vec[i], dtype, sources_obj[i]).ZerosLike(); + } + } } - else + return result; + } + + Tensor[] MakeTensorList(IEnumerable tensors) + { + return tensors.ToArray(); + } + + long[] MakeTensorIDList(Tensor[] tensors) + { + int len = tensors.Length; + long[] ids = new long[len]; + for(int i = 0; i < len; i++) + { + var tensor = tensors[i]; + ids[i] = tensor.Id; + } + return ids; + } + + TF_DataType[] MakeTensorDtypeList(Tensor[] tensors) + { + int len = tensors.Length; + TF_DataType[] dtypes = new TF_DataType[len]; + for (int i = 0; i < len; i++) { - output_gradients = new Tensor[0]; + var tensor = tensors[i]; + dtypes[i] = tensor.dtype; } + return dtypes; + } - var outgrad_vec = MakeTensorList(output_gradients); + TapeTensor TapeTensorFromTensor(Tensor tensor) + { + long id = tensor.Id; + var dtype = tensor.dtype; + if (tensor is EagerTensor) + { + var handle = tensor.EagerTensorHandle; + if (DTypeNeedsHandleData(dtype)) + { + return new TapeTensor(id, c_api.TFE_TensorHandleDataType(handle), tensor); + } + + Status status = new(); + int num_dims = c_api.TFE_TensorHandleNumDims(handle, status); + long[] dims = new long[num_dims]; + for(int i = 0; i < num_dims; i++) + { + dims[i] = c_api.TFE_TensorHandleDim(handle, i, status); + } + Shape tensor_shape = new(dims); + + if(status.Code != TF_Code.TF_OK) + { + return new TapeTensor(id, TF_DataType.DtInvalid, Shape.Null); + } + else + { + return new TapeTensor(id, dtype, tensor_shape); + } + } + var shape_tuple = tensor.shape.dims; + if(ListContainNone(shape_tuple) || DTypeNeedsHandleData(dtype)) + { + return new TapeTensor(id, dtype, tensor); + } + long[] l = new long[shape_tuple.Length]; + for(int i = 0; i < shape_tuple.Length; i++) + { + if (shape_tuple[i] < 0) + { + l[i] = 0; + } + else + { + l[i] = shape_tuple[i]; + } + } + return new TapeTensor(id, dtype, new Shape(l)); + } - return tape.ComputeGradient(target_vec, sources_vec, source_tensors_that_are_targets, outgrad_vec); + bool DTypeNeedsHandleData(TF_DataType dtype) + { + return dtype == dtypes.variant || dtype == dtypes.resource; } - Tensor[] MakeTensorList(Tensor[] tensors) + bool ListContainNone(long[] list) { - return tensors; + int len = list.Length; + if(len == 0) + { + return true; + } + for(int i = 0; i < len; i++) + { + if (list[i] == -1) + { + return true; + } + } + return false; } } } diff --git a/src/TensorFlowNET.Core/Eager/EagerRunner.TapeSetRecordBackprop.cs b/src/TensorFlowNET.Core/Eager/EagerRunner.TapeSetRecordBackprop.cs index e8751aed3..9bcc8fe2e 100644 --- a/src/TensorFlowNET.Core/Eager/EagerRunner.TapeSetRecordBackprop.cs +++ b/src/TensorFlowNET.Core/Eager/EagerRunner.TapeSetRecordBackprop.cs @@ -7,8 +7,9 @@ namespace Tensorflow.Eager public partial class EagerRunner { void TapeSetRecordBackprop(string op_type, - Tensor[] input_tensors, - TapeTensor[] output_tensors, + TapeTensor[] output_info, + long[] input_ids, + TF_DataType[] input_detyps, BackwardFunction backward_function) { if (!CouldBackprop()) @@ -18,7 +19,7 @@ void TapeSetRecordBackprop(string op_type, foreach (var tape in tf.GetTapeSet()) { - tape.RecordOperation(op_type, input_tensors, output_tensors, backward_function); + tape.RecordOperation(op_type, output_info, input_ids, input_detyps, backward_function); } } } diff --git a/src/TensorFlowNET.Core/Eager/EagerRunner.TapeSetRecordOperation.cs b/src/TensorFlowNET.Core/Eager/EagerRunner.TapeSetRecordOperation.cs index 42e1cff98..3987e7a3d 100644 --- a/src/TensorFlowNET.Core/Eager/EagerRunner.TapeSetRecordOperation.cs +++ b/src/TensorFlowNET.Core/Eager/EagerRunner.TapeSetRecordOperation.cs @@ -10,18 +10,28 @@ public partial class EagerRunner public bool TapeSetRecordOperation(string op_type, Tensor[] input_tensors, Tensor[] output_tensors, + long[] input_ids, + TF_DataType[] input_dtypes, BackwardFunction backward_function) { - var output_info = output_tensors.Select(x => new TapeTensor(x)).ToArray(); - + var output_info = output_tensors.Select(t => TapeTensorFromTensor(t)).ToArray(); if (!TapeSetRecordForwardprop(op_type, input_tensors, output_info, backward_function)) return false; - TapeSetRecordBackprop(op_type, input_tensors, output_info, + TapeSetRecordBackprop(op_type, output_info, input_ids, input_dtypes, backward_function); return true; } + + public void TFE_TapeSetRecordOperation(string op_type, Tensor[] output_tensors, + Tensor[] input_tensors, BackwardFunction backward_function) + { + var input_ids = MakeTensorIDList(input_tensors); + var input_dtypes = MakeTensorDtypeList(input_tensors); + TapeSetRecordOperation(op_type, input_tensors, output_tensors, input_ids, input_dtypes, + backward_function); + } } } diff --git a/src/TensorFlowNET.Core/Eager/EagerTensor.Creation.cs b/src/TensorFlowNET.Core/Eager/EagerTensor.Creation.cs index b9f741f3e..c7d71de38 100644 --- a/src/TensorFlowNET.Core/Eager/EagerTensor.Creation.cs +++ b/src/TensorFlowNET.Core/Eager/EagerTensor.Creation.cs @@ -54,7 +54,7 @@ public EagerTensor(IntPtr data_ptr, Shape shape, TF_DataType dtype) : base(data_ void NewEagerTensorHandle(SafeTensorHandle h) { _id = ops.uid(); - _eagerTensorHandle = c_api.TFE_NewTensorHandle(h, tf.Status.Handle); + _eagerTensorHandle = c_api.TFE_NewTensorHandle(h, tf.Status); #if TRACK_TENSOR_LIFE Console.WriteLine($"New EagerTensor {_eagerTensorHandle}"); #endif @@ -65,7 +65,7 @@ public void Resolve() { if (_handle != null) return; - _handle = c_api.TFE_TensorHandleResolve(_eagerTensorHandle, tf.Status.Handle); + _handle = c_api.TFE_TensorHandleResolve(_eagerTensorHandle, tf.Status); tf.Status.Check(true); } diff --git a/src/TensorFlowNET.Core/Eager/EagerTensor.cs b/src/TensorFlowNET.Core/Eager/EagerTensor.cs index f85e8df66..02bd0bdf2 100644 --- a/src/TensorFlowNET.Core/Eager/EagerTensor.cs +++ b/src/TensorFlowNET.Core/Eager/EagerTensor.cs @@ -24,10 +24,10 @@ public override IntPtr buffer } } - public override string Device => c_api.StringPiece(c_api.TFE_TensorHandleDeviceName(_eagerTensorHandle, tf.Status.Handle)); + public override string Device => c_api.StringPiece(c_api.TFE_TensorHandleDeviceName(_eagerTensorHandle, tf.Status)); public override TF_DataType dtype => c_api.TFE_TensorHandleDataType(_eagerTensorHandle); - public override int rank => c_api.TFE_TensorHandleNumDims(EagerTensorHandle, tf.Status.Handle); + public override int rank => c_api.TFE_TensorHandleNumDims(EagerTensorHandle, tf.Status); public override ulong bytesize { @@ -49,9 +49,9 @@ public override IntPtr TensorDataPointer protected override Shape GetShapeInternal() { - var dims = new int[c_api.TFE_TensorHandleNumDims(_eagerTensorHandle, tf.Status.Handle)]; + var dims = new int[c_api.TFE_TensorHandleNumDims(_eagerTensorHandle, tf.Status)]; for (int i = 0; i < dims.Length; i++) - dims[i] = c_api.TFE_TensorHandleDim(_eagerTensorHandle, i, tf.Status.Handle); + dims[i] = c_api.TFE_TensorHandleDim(_eagerTensorHandle, i, tf.Status); return dims; } @@ -64,15 +64,15 @@ protected override void SetShapeInternal(Shape value) public static int GetRank(IntPtr handle) { var tfe_tensor_handle = c_api.TFE_EagerTensorHandle(handle); - return c_api.TFE_TensorHandleNumDims(tfe_tensor_handle, tf.Status.Handle); + return c_api.TFE_TensorHandleNumDims(tfe_tensor_handle, tf.Status); } public static int[] GetDims(IntPtr handle) { var tfe_tensor_handle = c_api.TFE_EagerTensorHandle(handle); - var dims = new int[c_api.TFE_TensorHandleNumDims(tfe_tensor_handle, tf.Status.Handle)]; + var dims = new int[c_api.TFE_TensorHandleNumDims(tfe_tensor_handle, tf.Status)]; for (int i = 0; i < dims.Length; i++) - dims[i] = c_api.TFE_TensorHandleDim(tfe_tensor_handle, i, tf.Status.Handle); + dims[i] = c_api.TFE_TensorHandleDim(tfe_tensor_handle, i, tf.Status); return dims; } diff --git a/src/TensorFlowNET.Core/Eager/IEagerRunner.cs b/src/TensorFlowNET.Core/Eager/IEagerRunner.cs index 7baf4cd7a..21a336690 100644 --- a/src/TensorFlowNET.Core/Eager/IEagerRunner.cs +++ b/src/TensorFlowNET.Core/Eager/IEagerRunner.cs @@ -29,7 +29,14 @@ Tensor[] TFE_Execute(Context ctx, Tensor[] TFE_TapeGradient(ITape tape, Tensor[] target, Tensor[] sources, - Tensor[] output_gradients); + List output_gradients, + Tensor[] sources_raw, + string unconnected_gradients); + + void TFE_TapeSetRecordOperation(string op_type, Tensor[] output_tensors, + Tensor[] input_tensors, BackwardFunction backward_function); + + int TFE_TapeSetPossibleGradientTypes(Tensor[] tensors); bool RecordGradient(string op_name, Tensor[] inputs, diff --git a/src/TensorFlowNET.Core/Eager/backprop_util.cs b/src/TensorFlowNET.Core/Eager/backprop_util.cs new file mode 100644 index 000000000..0d726e1de --- /dev/null +++ b/src/TensorFlowNET.Core/Eager/backprop_util.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Tensorflow.Operations; + +namespace Tensorflow.Eager +{ + internal static class backprop_util + { + // TODO: add quantized_dtypes (after being supported). + private static HashSet _trainable_dtypes = new HashSet(new TF_DataType[] + { + dtypes.float16, dtypes.float32, dtypes.float64, dtypes.complex64, dtypes.complex128, + dtypes.resource, dtypes.variant, TF_DataType.TF_BFLOAT16 + }); + public static bool IsTrainable(Tensor tensor) + { + var dtype = _DTypeFromTensor(tensor); + return _trainable_dtypes.Contains(dtype); + } + public static bool IsTrainable(TF_DataType dtype) + { + return _trainable_dtypes.Contains(dtype); + } + + private static TF_DataType _DTypeFromTensor(Tensor tensor) + { + var dtype = tensor.dtype; + if(dtype.as_base_dtype() == TF_DataType.TF_VARIANT) + { + CppShapeInferenceResult.Types.HandleData handle_data; + if (tensor is EagerTensor) + { + handle_data = tensor.HandleData; + } + else + { + handle_data = handle_data_util.get_resource_handle_data(tensor); + } + if(handle_data is not null && handle_data.IsSet && handle_data.ShapeAndType is not null && + handle_data.ShapeAndType.Count > 0) + { + var first_type = handle_data.ShapeAndType[0].Dtype; + if(first_type != DataType.DtInvalid && handle_data.ShapeAndType.All(x => x.Dtype == first_type)) + { + return first_type.as_tf_dtype(); + } + } + } + return dtype; + } + } +} diff --git a/src/TensorFlowNET.Core/Eager/c_api.eager.cs b/src/TensorFlowNET.Core/Eager/c_api.eager.cs index d874ac933..11de49600 100644 --- a/src/TensorFlowNET.Core/Eager/c_api.eager.cs +++ b/src/TensorFlowNET.Core/Eager/c_api.eager.cs @@ -30,6 +30,9 @@ public partial class c_api [DllImport(TensorFlowLibName)] public static extern void TFE_ContextOptionsSetConfig(SafeContextOptionsHandle opts, byte[] proto, ulong proto_len, SafeStatusHandle status); + [DllImport(TensorFlowLibName)] + public static extern void TFE_ContextAddFunctionDef(SafeContextHandle ctx, byte[] serialized_function_def, ulong size, SafeStatusHandle status); + [DllImport(TensorFlowLibName)] public static extern void TFE_ContextOptionsSetDevicePlacementPolicy(SafeContextOptionsHandle opts, ContextDevicePlacementPolicy device_policy); @@ -114,7 +117,7 @@ public partial class c_api /// /// [DllImport(TensorFlowLibName)] - public static extern void TFE_ContextAddFunction(SafeContextHandle ctx, IntPtr function, SafeStatusHandle status); + public static extern void TFE_ContextAddFunction(SafeContextHandle ctx, SafeFuncGraphHandle function, SafeStatusHandle status); /// /// Removes a function from the context. Once removed, you can no longer @@ -277,7 +280,7 @@ public static void TFE_Execute(SafeEagerOpHandle op, SafeEagerTensorHandle[] ret public static extern void TFE_OpSetAttrIntList(SafeEagerOpHandle op, string attr_name, long[] values, int num_values); [DllImport(TensorFlowLibName)] - public static extern void TFE_OpSetAttrValueProto(SafeEagerOpHandle op, string attr_name, IMessage[] proto, int proto_len, SafeStatusHandle status); + public static extern void TFE_OpSetAttrValueProto(IntPtr op, string attr_name, IntPtr proto, ulong proto_len, SafeStatusHandle status); /// /// @@ -480,5 +483,8 @@ public static extern SafeStatusHandle TFE_TapeGradient(IntPtr tape, IntPtr[] target, int target_size, IntPtr[] sources, int source_size, IntPtr[] outputs, int output_size); + + [DllImport(TensorFlowLibName)] + public static extern bool TFE_IsCustomDevice(SafeContextHandle ctx, string device_name); } } diff --git a/src/TensorFlowNET.Core/Eager/execute.cs b/src/TensorFlowNET.Core/Eager/execute.cs index 2926f8e28..1804992ac 100644 --- a/src/TensorFlowNET.Core/Eager/execute.cs +++ b/src/TensorFlowNET.Core/Eager/execute.cs @@ -18,6 +18,10 @@ public static (DataType[], Tensor[]) onvert_to_mixed_eager_tensors(Tensor[] valu var types = v.Select(t => t.dtype.as_datatype_enum()); return (types.ToArray(), v.ToArray()); } + public static Tensor[] executes(string op_name, int num_outputs, Tensor[] inputs, object[] attrs, Context ctx, string name = null) + { + return quick_execute(op_name, num_outputs, inputs, attrs, ctx, name); + } public static Tensor[] quick_execute(string op_name, int num_outputs, Tensor[] inputs, object[] attrs, Context ctx, string name = null) { string device_name = ctx.DeviceName; diff --git a/src/TensorFlowNET.Core/Eager/forwardprop_util.cs b/src/TensorFlowNET.Core/Eager/forwardprop_util.cs new file mode 100644 index 000000000..a53026d42 --- /dev/null +++ b/src/TensorFlowNET.Core/Eager/forwardprop_util.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow.Eager +{ + public class TangentInfo + { + // TODO(Rinne): implement it. + public object Indices { get; set; } + public object Tangents { get; set; } + } +} diff --git a/src/TensorFlowNET.Core/Extensions/DictionaryExtension.cs b/src/TensorFlowNET.Core/Extensions/DictionaryExtension.cs new file mode 100644 index 000000000..7502a3a78 --- /dev/null +++ b/src/TensorFlowNET.Core/Extensions/DictionaryExtension.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Text; + +namespace Tensorflow.Common.Extensions +{ + public static class DictionaryExtension + { + public static void Deconstruct(this KeyValuePair pair, out T1 first, out T2 second) + { + first = pair.Key; + second = pair.Value; + } + public static void Update(this Dictionary dic, IDictionary other) + { + foreach(var (key, value) in other) + { + dic[key] = value; + } + } + public static T2 GetOrDefault(this Dictionary dic, T1 key, T2 defaultValue) + { + if (dic.ContainsKey(key)) + { + return dic[key]; + } + return defaultValue; + } + } +} diff --git a/src/TensorFlowNET.Core/Extensions/JObjectExtensions.cs b/src/TensorFlowNET.Core/Extensions/JObjectExtensions.cs new file mode 100644 index 000000000..2e758dbf1 --- /dev/null +++ b/src/TensorFlowNET.Core/Extensions/JObjectExtensions.cs @@ -0,0 +1,23 @@ +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow.Extensions +{ + public static class JObjectExtensions + { + public static T? TryGetOrReturnNull(this JObject obj, string key) + { + var res = obj[key]; + if(res is null) + { + return default(T); + } + else + { + return res.ToObject(); + } + } + } +} diff --git a/src/TensorFlowNET.Core/Extensions/NamedTuple.cs b/src/TensorFlowNET.Core/Extensions/NamedTuple.cs new file mode 100644 index 000000000..48073c61b --- /dev/null +++ b/src/TensorFlowNET.Core/Extensions/NamedTuple.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Text; + +namespace Tensorflow.Common.Types +{ + public class NamedTuple + { + public string Name { get; set; } + public Dictionary ValueDict { get; set; } + } +} diff --git a/src/TensorFlowNET.Core/Extensions/OneofExtension.cs b/src/TensorFlowNET.Core/Extensions/OneofExtension.cs new file mode 100644 index 000000000..c7fb80938 --- /dev/null +++ b/src/TensorFlowNET.Core/Extensions/OneofExtension.cs @@ -0,0 +1,13 @@ +using OneOf; +using System; + +namespace Tensorflow.Common.Extensions +{ + public static class OneofExtension + { + public static bool IsTypeOrDeriveFrom(this IOneOf src) + { + return src.Value is T; + } + } +} diff --git a/src/TensorFlowNET.Core/Framework/Models/DenseSpec.cs b/src/TensorFlowNET.Core/Framework/Models/DenseSpec.cs index 1af29e227..5a89b90ed 100644 --- a/src/TensorFlowNET.Core/Framework/Models/DenseSpec.cs +++ b/src/TensorFlowNET.Core/Framework/Models/DenseSpec.cs @@ -6,8 +6,11 @@ public class DenseSpec : TypeSpec { protected Shape _shape; - public Shape shape => _shape; - + public Shape shape + { + get { return _shape; } + set { _shape = value; } + } protected TF_DataType _dtype; public TF_DataType dtype => _dtype; diff --git a/src/TensorFlowNET.Core/Framework/Models/ScopedTFFunction.cs b/src/TensorFlowNET.Core/Framework/Models/ScopedTFFunction.cs deleted file mode 100644 index bce889b6b..000000000 --- a/src/TensorFlowNET.Core/Framework/Models/ScopedTFFunction.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Tensorflow.Framework.Models -{ - class ScopedTFFunction - { - } -} diff --git a/src/TensorFlowNET.Core/Framework/Models/TensorSpec.cs b/src/TensorFlowNET.Core/Framework/Models/TensorSpec.cs index b6a279db7..083d4813a 100644 --- a/src/TensorFlowNET.Core/Framework/Models/TensorSpec.cs +++ b/src/TensorFlowNET.Core/Framework/Models/TensorSpec.cs @@ -7,7 +7,7 @@ public class TensorSpec : DenseSpec public TensorSpec(Shape shape, TF_DataType dtype = TF_DataType.TF_FLOAT, string name = null) : base(shape, dtype, name) { - + } public TensorSpec _unbatch() diff --git a/src/TensorFlowNET.Core/Framework/ScopedTFFunction.cs b/src/TensorFlowNET.Core/Framework/ScopedTFFunction.cs new file mode 100644 index 000000000..11e920f86 --- /dev/null +++ b/src/TensorFlowNET.Core/Framework/ScopedTFFunction.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow.Framework +{ + internal class ScopedTFFunction + { + SafeFuncGraphHandle _handle; + string _name; + public ScopedTFFunction(SafeFuncGraphHandle func, string name) + { + _handle = func; + _name = name; + } + + public SafeFuncGraphHandle Get() + { + return _handle; + } + } +} diff --git a/src/TensorFlowNET.Core/Framework/c_api_util.cs b/src/TensorFlowNET.Core/Framework/c_api_util.cs index 9cfbf0d04..e21c3b019 100644 --- a/src/TensorFlowNET.Core/Framework/c_api_util.cs +++ b/src/TensorFlowNET.Core/Framework/c_api_util.cs @@ -111,7 +111,17 @@ public static void DownloadLibrary() public static ImportGraphDefOptions ScopedTFImportGraphDefOptions() => new ImportGraphDefOptions(); - public static Buffer tf_buffer(byte[] data) => new Buffer(data); + public static Buffer tf_buffer(byte[] data = null) + { + if(data is not null) + { + return new Buffer(data); ; + } + else + { + return new Buffer(); + } + } public static IEnumerable new_tf_operations(Graph graph) { diff --git a/src/TensorFlowNET.Core/Framework/function_def_lib.cs b/src/TensorFlowNET.Core/Framework/function_def_lib.cs new file mode 100644 index 000000000..67f8d324e --- /dev/null +++ b/src/TensorFlowNET.Core/Framework/function_def_lib.cs @@ -0,0 +1,297 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Security.Cryptography; +using System.Text; +using Tensorflow.Graphs; +using Tensorflow.Common.Extensions; +using static Tensorflow.Binding; +using static Tensorflow.CppShapeInferenceResult.Types; + +namespace Tensorflow.Framework +{ + public class function_def_lib + { + // TODO(Rinne): process signatures and structured outputs. + public static FuncGraph function_def_to_graph(FunctionDef fdef, object? structured_input_signature, + object? structured_outputs, List input_shapes = null) + { + var func_graph = new FuncGraph(fdef.Signature.Name); + if(input_shapes is null) + { + if(fdef.Attr.TryGetValue("_input_shapes", out var input_shapes_attr)) + { + var raw_input_shapes = input_shapes_attr.List.Shape; + input_shapes = new List(); + foreach(var (input_shape, arg_def) in raw_input_shapes.Zip(fdef.Signature.InputArg, (x, y) => (x, y))) + { + if(arg_def.Type == DataType.DtResource && arg_def.HandleData is not null && arg_def.HandleData.Count > 0) + { + input_shapes.Add(null); + } + else + { + input_shapes.Add(input_shape); + } + } + } + } + + var (graph_def, nested_to_flat_tensor_name) = function_def_to_graph_def(fdef, input_shapes); + + func_graph.as_default(); + importer.import_graph_def(graph_def, name: "", validate_colocation_constraints: false); + var input_tensor_names = fdef.Signature.InputArg.Select(x => nested_to_flat_tensor_name[x.Name]); + func_graph.Inputs = new Tensors(input_tensor_names.Select(x => func_graph.get_tensor_by_name(x))); + + var output_tensor_names = fdef.Signature.OutputArg.Select(x => nested_to_flat_tensor_name[fdef.Ret[x.Name]]); + func_graph.Outputs = new Tensors(output_tensor_names.Select(x => func_graph.get_tensor_by_name(x))); + // TODO(Rinne): func_graph.ControlOutputs + _set_handle_data(func_graph, fdef); + + foreach(var node in graph_def.Node) + { + if(node.Attr.TryGetValue("_output_shapes", out var output_shapes)) + { + var op = func_graph.get_operation_by_name(node.Name); + foreach(var (output_index, shape) in enumerate(output_shapes.List.Shape.Take(op.outputs.Length))) + { + op.outputs[output_index].shape = new Shape(shape); + } + } + } + Dictionary output_names = new(); + foreach(var (ret_arg_def, tensor_name) in zip(fdef.Signature.OutputArg, output_tensor_names)) + { + output_names[ops.tensor_id(func_graph.get_tensor_by_name(tensor_name))] = ret_arg_def.Name; + } + func_graph._output_names = output_names; + + func_graph.Exit(); + return func_graph; + } + + public static (GraphDef, Dictionary) function_def_to_graph_def(FunctionDef fdef, List input_shapes) + { + var graph_def = new GraphDef() + { + Versions = new VersionDef() + { + Producer = versions.GRAPH_DEF_VERSION, + MinConsumer = versions.GRAPH_DEF_VERSION_MIN_CONSUMER + } + }; + + var default_graph = ops.get_default_graph(); + + if(input_shapes is not null && input_shapes.Count > 0 && input_shapes.Count != fdef.Signature.InputArg.Count) + { + throw new ValueError($"Length of `input_shapes` must match the number " + + $"of `input_arg`s in `fdef`. Got {input_shapes.Count} `input_shapes` and " + + $"{fdef.Signature.InputArg.Count} `input_arg`s."); + } + + foreach(var (i, arg_def) in enumerate(fdef.Signature.InputArg)) + { + NodeDef node_def = new(); + node_def.Name = arg_def.Name; + node_def.Op = "Placeholder"; + node_def.Attr["dtype"] = new AttrValue() + { + Type = arg_def.Type + }; + if(input_shapes is not null && input_shapes.Count > 0 && input_shapes[i] is not null) + { + var input_shape = input_shapes[i]; + // skip the condition that input_shape is not `TensorShapeProto`. + AttrValue shape = new AttrValue() + { + Shape = new TensorShapeProto() + }; + shape.Shape = new TensorShapeProto(input_shape); + node_def.Attr["shape"] = shape; + } + if (!fdef.ArgAttr.ContainsKey((uint)i)) + { + fdef.ArgAttr[(uint)i] = new FunctionDef.Types.ArgAttrs(); + } + var arg_attrs = fdef.ArgAttr[(uint)i].Attr; + foreach(var k in arg_attrs.Keys) + { + if(k == "_output_shapes") + { + if (arg_attrs[k].ValueCase == AttrValue.ValueOneofCase.List) + { + node_def.Attr["shape"].Shape = new TensorShapeProto(arg_attrs[k].List.Shape[0]); + } + else if (arg_attrs[k].ValueCase == AttrValue.ValueOneofCase.Shape) + { + node_def.Attr["shape"].Shape = new TensorShapeProto(arg_attrs[k].Shape); + } + } + else if (k.StartsWith("_")) + { + if (!node_def.Attr.ContainsKey(k)) + { + node_def.Attr[k] = new AttrValue(); + } + node_def.Attr[k] = new AttrValue(arg_attrs[k]); + } + } + + graph_def.Node.Add(node_def); + } + + graph_def.Node.AddRange(fdef.NodeDef); + + Dictionary nested_to_flat_tensor_name = new(); + foreach(var arg_def in fdef.Signature.InputArg) + { + nested_to_flat_tensor_name[arg_def.Name] = $"{arg_def.Name}:0"; + string control_name = "^" + arg_def.Name; + nested_to_flat_tensor_name[control_name] = control_name; + } + + foreach(var node_def in fdef.NodeDef) + { + var graph = default_graph; + while (true) + { + if(graph is null) + { + break; + } + var f = graph.Functions.GetOrDefault(node_def.Op, null); + if(f is not null && graph.OuterGraph is null) + { + break; + } + graph = graph.OuterGraph; + } + + var op_def = default_graph.GetOpDef(node_def.Op); + + foreach(var attr in op_def.Attr) + { + if(attr.Type == "func") + { + var fname = node_def.Attr[attr.Name].Func.Name; + if (!is_function(fname)) + { + throw new ValueError($"Function {fname} was not found. Please make sure " + + $"the FunctionDef `fdef` is correct."); + } + } + else if(attr.Type == "list(func)") + { + foreach(var fn in node_def.Attr[attr.Name].List.Func) + { + var fname = fn.Name; + if (!is_function(fname)) + { + throw new ValueError($"Function {fname} was not found. Please make " + + $"sure the FunctionDef `fdef` is correct."); + } + } + } + } + + int flattened_index = 0; + foreach(var arg_def in op_def.OutputArg) + { + var num_args = _get_num_args(arg_def, node_def); + for(int i = 0; i < num_args; i++) + { + var nested_name = $"{node_def.Name}:{arg_def.Name}:{i}"; + var flat_name = $"{node_def.Name}:{flattened_index}"; + nested_to_flat_tensor_name[nested_name] = flat_name; + flattened_index++; + } + } + string control_name = "^" + node_def.Name; + nested_to_flat_tensor_name[control_name] = control_name; + } + + foreach(var node_def in graph_def.Node) + { + for(int i = 0; i < node_def.Input.Count; i++) + { + node_def.Input[i] = nested_to_flat_tensor_name[node_def.Input[i]]; + } + } + + return (graph_def, nested_to_flat_tensor_name); + } + + private static void _set_handle_data(FuncGraph func_graph, FunctionDef fdef) + { + foreach(var (tensor, arg_def) in zip(func_graph.Inputs, fdef.Signature.InputArg).Concat(zip(func_graph.Outputs, fdef.Signature.OutputArg))) + { + if(arg_def.HandleData is not null && arg_def.HandleData.Count > 0) + { + tensor.shape = Shape.Scalar; + + var shape_and_type = arg_def.HandleData[0]; + var handle_data = new HandleData(); + handle_data.IsSet = true; + handle_data.ShapeAndType.Add(new HandleShapeAndType() + { + Shape = shape_and_type.Shape, + Dtype = shape_and_type.Dtype + }); + resource_variable_ops._set_handle_shapes_and_types(tensor, handle_data, true); + } + } + } + + private static long _get_num_args(OpDef.Types.ArgDef arg_def, NodeDef node_def) + { + if (!string.IsNullOrEmpty(arg_def.NumberAttr)) + { + return node_def.Attr[arg_def.NumberAttr].I; + } + else if(!string.IsNullOrEmpty(arg_def.TypeListAttr)) + { + return node_def.Attr[arg_def.TypeListAttr].List.Type.Count; + } + else if(arg_def.TypeAttr is not null || arg_def.Type != DataType.DtInvalid) + { + return 1; + } + else + { + throw new ValueError($"Invalid arg_def:\n\n{arg_def}. Please make sure the " + + $"FunctionDef `fdef` is correct."); + } + } + + public static bool is_function(string fname) + { + if (tf.Context.executing_eagerly()) + { + return tf.Context.has_function(fname); + } + else + { + var graph = ops.get_default_graph(); + while(graph is not null) + { + if (graph.IsFunction(fname)) + { + return true; + } + if(graph.OuterGraph is not null) + { + graph = graph.OuterGraph; + } + else + { + return false; + } + } + } + throw new ValueError("Unexpected behavior happened in runtime, please submit an issue to " + + "https://github.com/SciSharp/TensorFlow.NET/issues"); + } + } +} diff --git a/src/TensorFlowNET.Core/Framework/importer.cs b/src/TensorFlowNET.Core/Framework/importer.cs index 1d0098b45..e7e7cf394 100644 --- a/src/TensorFlowNET.Core/Framework/importer.cs +++ b/src/TensorFlowNET.Core/Framework/importer.cs @@ -17,6 +17,7 @@ limitations under the License. using Google.Protobuf; using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using static Tensorflow.Binding; using static Tensorflow.OpDef.Types; @@ -25,9 +26,14 @@ namespace Tensorflow { public class importer { + public static ITensorOrOperation[] import_graph_def_for_function(GraphDef graph_def, string name = null) + { + return import_graph_def(graph_def, validate_colocation_constraints: false, name: name); + } public static ITensorOrOperation[] import_graph_def(GraphDef graph_def, Dictionary input_map = null, string[] return_elements = null, + bool validate_colocation_constraints = true, string name = null, OpList producer_op_list = null) { @@ -56,15 +62,14 @@ public static ITensorOrOperation[] import_graph_def(GraphDef graph_def, TF_ImportGraphDefResults results = null; var bytes = graph_def.ToByteString().ToArray(); - using (var buffer = c_api_util.tf_buffer(bytes)) - using (var scoped_options = c_api_util.ScopedTFImportGraphDefOptions()) - using (var status = new Status()) - { - _PopulateTFImportGraphDefOptions(scoped_options, prefix, input_map, return_elements); - // need to create a class ImportGraphDefWithResults with IDisposal - results = new TF_ImportGraphDefResults(c_api.TF_GraphImportGraphDefWithResults(graph, buffer.Handle, scoped_options.Handle, status.Handle)); - status.Check(true); - } + var buffer = c_api_util.tf_buffer(bytes); + var scoped_options = c_api_util.ScopedTFImportGraphDefOptions(); + var status = new Status(); + + _PopulateTFImportGraphDefOptions(scoped_options, prefix, input_map, return_elements, validate_colocation_constraints ); + // need to create a class ImportGraphDefWithResults with IDisposal + results = new TF_ImportGraphDefResults(c_api.TF_GraphImportGraphDefWithResults(graph, buffer, scoped_options, status)); + status.Check(true); _ProcessNewOps(graph); @@ -108,21 +113,36 @@ private static void _ProcessNewOps(Graph graph) foreach (var new_op in graph._add_new_tf_operations()) { var original_device = new_op.Device; + new_op._set_device(original_device); } } public static void _PopulateTFImportGraphDefOptions(ImportGraphDefOptions options, string prefix, Dictionary input_map, - string[] return_elements) + string[] return_elements, + bool validate_colocation_constraints) { - c_api.TF_ImportGraphDefOptionsSetPrefix(options.Handle, prefix); - c_api.TF_ImportGraphDefOptionsSetUniquifyNames(options.Handle, (char)1); + c_api.TF_ImportGraphDefOptionsSetPrefix(options, prefix); + c_api.TF_ImportGraphDefOptionsSetUniquifyNames(options.Options, true); foreach (var input in input_map) { - var (src_name, src_index) = _ParseTensorName(input.Key); - c_api.TF_ImportGraphDefOptionsAddInputMapping(options.Handle, src_name, src_index, input.Value._as_tf_output()); + var input_src = tf.compat.as_str(input.Key); + var input_dst = input.Value; + if (input_src.StartsWith("^")) + { + var src_name = tf.compat.as_str(input_src.Substring(1)); + var dst_op = input_dst._as_tf_output().oper; + c_api.TF_ImportGraphDefOptionsRemapControlDependency(options.Options, src_name, dst_op); + } + else + { + var (src_name, src_index) = _ParseTensorName(input.Key); + src_name = tf.compat.as_str(src_name); + var dst_output = input_dst._as_tf_output(); + c_api.TF_ImportGraphDefOptionsAddInputMapping(options.Options, src_name, src_index, dst_output); + } } if (return_elements == null) @@ -133,15 +153,16 @@ public static void _PopulateTFImportGraphDefOptions(ImportGraphDefOptions option if (name.Contains(":")) { var (op_name, index) = _ParseTensorName(name); - c_api.TF_ImportGraphDefOptionsAddReturnOutput(options.Handle, op_name, index); + op_name = tf.compat.as_str(op_name); + c_api.TF_ImportGraphDefOptionsAddReturnOutput(options.Options, op_name, index); } else { - c_api.TF_ImportGraphDefOptionsAddReturnOperation(options.Handle, name); + c_api.TF_ImportGraphDefOptionsAddReturnOperation(options.Options, tf.compat.as_str(name)); } } - // c_api.TF_ImportGraphDefOptionsSetValidateColocationConstraints(options, validate_colocation_constraints); + c_api.TF_ImportGraphDefOptionsSetValidateColocationConstraints(options.Options, validate_colocation_constraints); } private static (string, int) _ParseTensorName(string tensor_name) @@ -174,6 +195,14 @@ public static GraphDef _ProcessGraphDefParam(GraphDef graph_def, Dictionary op_dict, OpLis } } + private static void _RemoveDefaultAttrs(OpList producer_op_list, GraphDef graph_def) + { + var producer_op_dict = producer_op_list.Op.ToDictionary(x => x.Name, x => x); + + foreach (var node in graph_def.Node) + { + // Remove any default attr values that aren't in op_def. + if (producer_op_dict.ContainsKey(node.Op)) + { + var op_def = op_def_registry.GetOpDef(node.Op); + if(op_def is null) + { + continue; + } + var producer_op_def = producer_op_dict[node.Op]; + foreach (var key in node.Attr.Keys) + { + if (_FindAttrInOpDef(key, op_def) is null) + { + var attr_def = _FindAttrInOpDef(key, producer_op_def); + if (attr_def != null && attr_def.DefaultValue != null && + node.Attr[key] == attr_def.DefaultValue) + node.Attr[key].ClearValue(); + } + } + } + } + } + private static AttrDef _FindAttrInOpDef(string name, OpDef op_def) { return op_def.Attr.FirstOrDefault(x => x.Name == name); diff --git a/src/TensorFlowNET.Core/Framework/op_def_registry.py.cs b/src/TensorFlowNET.Core/Framework/op_def_registry.py.cs index eec234c64..111719aad 100644 --- a/src/TensorFlowNET.Core/Framework/op_def_registry.py.cs +++ b/src/TensorFlowNET.Core/Framework/op_def_registry.py.cs @@ -33,7 +33,7 @@ public static Dictionary get_registered_ops() if (_registered_ops.Count > 0) return _registered_ops; - using var buffer = new Buffer(c_api.TF_GetAllOpList()); + var buffer = new Buffer(c_api.TF_GetAllOpList()); var op_list = OpList.Parser.ParseFrom(buffer.ToArray()); foreach (var op_def in op_list.Op) _registered_ops[op_def.Name] = op_def; diff --git a/src/TensorFlowNET.Core/Framework/smart_module.cs b/src/TensorFlowNET.Core/Framework/smart_module.cs index d9e35a6d6..e1f84d7eb 100644 --- a/src/TensorFlowNET.Core/Framework/smart_module.cs +++ b/src/TensorFlowNET.Core/Framework/smart_module.cs @@ -56,8 +56,8 @@ public static Tensor smart_cond(bool pred, if (pred_value is null) { var result = range(pred.op.NumOutputs).Select(x => IntPtr.Zero).ToArray(); - var evaluated = c_api.TF_TryEvaluateConstant(pred.graph, pred._as_tf_output(), result, tf.Status.Handle); - if (!evaluated || c_api.TF_GetCode(tf.Status.Handle) != TF_Code.TF_OK) + var evaluated = c_api.TF_TryEvaluateConstant(pred.graph, pred._as_tf_output(), result, tf.Status); + if (!evaluated || c_api.TF_GetCode(tf.Status) != TF_Code.TF_OK) return null; else throw new NotImplementedException(""); diff --git a/src/TensorFlowNET.Core/Framework/versions.cs b/src/TensorFlowNET.Core/Framework/versions.cs new file mode 100644 index 000000000..e91f08a2c --- /dev/null +++ b/src/TensorFlowNET.Core/Framework/versions.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow.Framework +{ + public class versions + { + public static int GRAPH_DEF_VERSION = 1286; + public static int GRAPH_DEF_VERSION_MIN_CONSUMER = 0; + } +} diff --git a/src/TensorFlowNET.Core/Functions/ConcreteFunction.cs b/src/TensorFlowNET.Core/Functions/ConcreteFunction.cs index a6720a5f3..88dce7d98 100644 --- a/src/TensorFlowNET.Core/Functions/ConcreteFunction.cs +++ b/src/TensorFlowNET.Core/Functions/ConcreteFunction.cs @@ -1,9 +1,13 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; +using Tensorflow.Eager; using Tensorflow.Framework.Models; +using Tensorflow.Gradients; using Tensorflow.Graphs; using Tensorflow.Train; +using Tensorflow.Util; using static Tensorflow.Binding; namespace Tensorflow.Functions @@ -13,29 +17,46 @@ namespace Tensorflow.Functions /// public class ConcreteFunction: Trackable { + protected IEnumerable _captured_inputs; + protected DelayedRewriteGradientFunctions _delayed_rewrite_functions; + protected Dictionary _attrs; + protected FunctionSpec _function_spec; + protected FunctionSpec _pre_initialized_function_spec = null; + protected EagerDefinedFunction _inference_function; + protected Dictionary _tape_functions_cache = new(); internal FuncGraph func_graph; internal ForwardBackwardCall forward_backward; public Tensor[] Inputs => func_graph.Inputs; public Tensor[] CapturedInputs => func_graph.external_captures; - public string Name => func_graph?.FuncName; + public string Name => _delayed_rewrite_functions.Forward().Name; - public Tensor[] Outputs; + public Tensor[] Outputs => func_graph.Outputs; public Type ReturnType; public TensorSpec[] OutputStructure; public IEnumerable ArgKeywords { get; set; } public long NumPositionArgs { get; set; } + public FunctionDef FunctionDef => _delayed_rewrite_functions.Forward().Definition; + public Tensor[] FlatStructuredOutputs => func_graph.FlatStructuredOutputs; + public IEnumerable Variables => func_graph.Variables; + public IEnumerable TrainableVariables => func_graph.TrainableVariables; public ConcreteFunction(string name) { func_graph = new FuncGraph(name); + _captured_inputs = func_graph.external_captures; + _attrs= new Dictionary(); + _set_infer_function(); } - public ConcreteFunction(FuncGraph graph, Dictionary attrs = null) + public ConcreteFunction(FuncGraph graph, Dictionary attrs = null) { func_graph = graph; + _captured_inputs = func_graph.external_captures; - ToGraph(graph.Inputs, graph.Outputs.Where(x => x != null).ToArray()); + //ToGraph(graph.Inputs, graph.Outputs.Where(x => x != null).ToArray()); + _attrs = attrs; + _set_infer_function(); } public ConcreteFunction(Func func, TF_DataType dtype) @@ -53,6 +74,9 @@ public ConcreteFunction(Func func, TF_DataType dtype) new[] { output }, null); func_graph.Exit(); + _captured_inputs = func_graph.external_captures; + _attrs = new Dictionary(); + _set_infer_function(); } public ConcreteFunction(Func func, TF_DataType dtype) @@ -73,6 +97,9 @@ public ConcreteFunction(Func func, TF_DataType dtype) new[] { output.variant_tensor }, null); func_graph.Exit(); + _captured_inputs = func_graph.external_captures; + _attrs = new Dictionary(); + _set_infer_function(); } /*public ConcreteFunction(Func func, @@ -130,39 +157,56 @@ public Tensors CallFlat(Tensor[] args, Tensor[] captured_inputs) { var executing_eagerly = tf.Context.executing_eagerly(); var default_graph = ops.get_default_graph(); + // TODO(Rinne): deal with `default_graph.building_function` + + var tempvv = func_graph.Variables; + if(tf.GetTapeSet().Count > 0 || default_graph is FuncGraph) + { + foreach(var v in this.func_graph.Variables) + { + resource_variable_ops.variable_accessed(v); + } + } + var tensor_inputs = new Tensors(); foreach (var (i, arg) in enumerate(args)) { tensor_inputs.Add(arg); // If we're graph building, shape inference is on. - if (!executing_eagerly) - { - } } - tensor_inputs.AddRange(captured_inputs); + if (!executing_eagerly) + { + // TODO(Rinne): add the check + } + tensor_inputs.AddRange(captured_inputs); args = tensor_inputs.ToArray(); - var possible_gradient_type = tf.Runner.MustRecordGradient() ? 1 : 0; + var possible_gradient_type = gradients_util.PossibleTapeGradientTypes(args); // No tape is watching; skip to running the function. - if (possible_gradient_type == 0 && executing_eagerly) + if (possible_gradient_type == gradients_util.POSSIBLE_GRADIENT_TYPES_NONE && executing_eagerly) { - var attrs = new object[] - { - "executor_type", "", - "config_proto", tf.Context.FunctionCallOptions.config_proto_serialized() - }; - return tf.Runner.Execute(tf.Context, func_graph.FuncName, func_graph.Outputs.Length, args, attrs); + return _build_call_outputs(_inference_function.Call(args)); } - if (forward_backward == null) - forward_backward = SelectForwardAndBackwardFunctions(args, possible_gradient_type, executing_eagerly); + forward_backward = SelectForwardAndBackwardFunctions(args, possible_gradient_type, executing_eagerly); var (forward_function, args_with_tangents) = forward_backward.Forward(); Tensors flat_outputs = null; if (executing_eagerly) + { flat_outputs = forward_function.Call(args_with_tangents); + } + else + { + tf_with(default_graph._override_gradient_function(new Dictionary>(){ + { "PartitionedCall", _get_gradient_function() }, { "StatefulPartitionedCall", _get_gradient_function() } + }), _ => + { + flat_outputs = forward_function.Call(args_with_tangents); + }); + } forward_backward.Record(flat_outputs); - return flat_outputs; + return _build_call_outputs(flat_outputs); } public void AddTograph(Graph? g = null) @@ -171,13 +215,99 @@ public void AddTograph(Graph? g = null) { g = ops.get_default_graph(); } - // TODO(Rinne); complete it with `_delayed_rewrite_functions`. + _delayed_rewrite_functions.Forward().AddToGraph(g); + } + + public void SetExternalCaptures(IEnumerable captures) + { + _captured_inputs = captures; } ForwardBackwardCall SelectForwardAndBackwardFunctions(Tensors args, int possible_gradient_type, bool executing_eagerly) { - var functions = new FirstOrderTapeGradientFunctions(func_graph, false); - return new ForwardBackwardCall(functions, args, tape_watching: true); + TangentInfo input_tangents; + if (executing_eagerly) + { + // TODO(Rinne): check if it needs to be implemented. + input_tangents = new TangentInfo(); + } + else + { + input_tangents = new TangentInfo(); + } + if(possible_gradient_type == gradients_util.POSSIBLE_GRADIENT_TYPES_FIRST_ORDER) + { + if(input_tangents.Indices is not null || executing_eagerly) + { + string cache_key = "first_order"; + if(!_tape_functions_cache.TryGetValue(cache_key, out var functions)) + { + functions = new FirstOrderTapeGradientFunctions(func_graph, false); + _tape_functions_cache[cache_key] = functions; + } + return new ForwardBackwardCall(functions, args, tape_watching: true); + } + else + { + return new ForwardBackwardCall(_delayed_rewrite_functions, args, tape_watching: true); + } + } + else if(possible_gradient_type == gradients_util.POSSIBLE_GRADIENT_TYPES_HIGHER_ORDER) + { + throw new NotImplementedException(); + } + + // TODO(Rinne): add arg "input_tagents" for ForwardBackwardCall. + return new ForwardBackwardCall(_delayed_rewrite_functions, args, tape_watching: false); + } + + internal void set_variables(IEnumerable variables) + { + func_graph.Variables = variables; + } + + internal void _set_infer_function() + { + _delayed_rewrite_functions = new DelayedRewriteGradientFunctions(func_graph, _attrs); + _inference_function = _delayed_rewrite_functions.Forward(); + } + + internal void _set_function_spec(FunctionSpec spec) + { + _function_spec = null; + _pre_initialized_function_spec = spec; + _initialize_function_spec(); + } + + internal void _initialize_function_spec() + { + if(_pre_initialized_function_spec is null) + { + return; + } + Debug.Assert(_function_spec is null, "already initialized"); + var spec = _pre_initialized_function_spec; + //var args = spec.Fullargspec.DictValue.Fields["args"]; + // TODO(Rinne): self.structured_input_signature + + _function_spec = new FunctionSpec() + { + Fullargspec = spec.Fullargspec, + IsMethod = spec.IsMethod, + InputSignature = spec.InputSignature + }; + } + + internal Func _get_gradient_function() + { + return _delayed_rewrite_functions._rewrite_forward_and_call_backward; + } + + private Tensors _build_call_outputs(Tensors result) + { + // TODO(Rinne): deal with `func_graph.structured_outputs` + + return result; } public override string ToString() diff --git a/src/TensorFlowNET.Core/Functions/EagerDefinedFunction.cs b/src/TensorFlowNET.Core/Functions/EagerDefinedFunction.cs index bfb8aa71a..cc38683db 100644 --- a/src/TensorFlowNET.Core/Functions/EagerDefinedFunction.cs +++ b/src/TensorFlowNET.Core/Functions/EagerDefinedFunction.cs @@ -1,50 +1,232 @@ using Google.Protobuf; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; +using Tensorflow.Contexts; +using Tensorflow.Eager; using Tensorflow.Graphs; +using Tensorflow.Operations; +using Tensorflow.Util; +using Tensorflow.Common.Extensions; using static Tensorflow.Binding; +using Tensorflow.Framework; +using System.Buffers; +using Tensorflow.Gradients; namespace Tensorflow.Functions { - public class EagerDefinedFunction + public class EagerDefinedFunction: IDisposable { public int _num_outputs; - public string Name => _func_graph.FuncName; + FuncGraph _graph; + FunctionDef _definition; + OpDef _signature; + string _name; + internal ScopedTFFunction _c_func; + internal Tensor[] _func_graph_outputs; + internal string _grad_func_name; + internal Func csharp_grad_func; + internal EagerDefinedFunction _grad_func; + internal bool _registered_on_context = false; + public string Name => _name; + public DataType[] OutputTypes { get; protected set; } + public Shape[] OutputShapes { get; protected set; } + public FunctionDef Definition + { + get + { + if(_definition is null) + { + _definition = _get_definition(); + } + return _definition; + } + } - FuncGraph _func_graph; - public EagerDefinedFunction(string name, FuncGraph graph, + public OpDef Signature + { + get + { + if( _signature is null) + { + _signature = Definition.Signature; + } + return _signature; + } + } + public unsafe EagerDefinedFunction(string name, FuncGraph graph, Tensors inputs, Tensors outputs, - Dictionary attrs) + Dictionary attrs) { - _num_outputs = outputs.Length; - var input_ops = inputs.Select(x => x.op).ToArray(); var operations = graph.get_operations().Where(x => !input_ops.Contains(x.op)) .Select(x => x as Operation).ToArray(); - var output_names = new string[0]; + var graph_output_names = graph._output_names; + string[] output_names; + if(graph_output_names is not null && outputs.All(t => graph_output_names.ContainsKey(ops.tensor_id(t)))) + { + output_names = outputs.Select(t => graph_output_names[ops.tensor_id(t)]).ToArray(); + if(output_names.Distinct().Count() != output_names.Length) + { + output_names = new string[0]; + } + } + else + { + output_names = new string[0]; + } - _func_graph = new FuncGraph(graph, name, attrs); - _func_graph.ToGraph(operations, inputs, outputs, output_names); + Status status = new Status(); + var fn = c_api.TF_GraphToFunction(graph.c_graph, + name, + false, + operations.Length, + operations.Length == 0 ? new IntPtr[0] : operations.Select(x => (IntPtr)x).ToArray(), + inputs.Length, + inputs.Select(t => t._as_tf_output()).ToArray(), + outputs.Length, + outputs.Select(t => t._as_tf_output()).ToArray(), + output_names.Length != outputs.Length ? null : output_names, + IntPtr.Zero, // warning: the control output hasbben totally ignored. + null, + status); + status.Check(true); + + _c_func = new ScopedTFFunction(fn, name); + + foreach(var (attr_name, attr_value) in attrs) + { + var serialized = attr_value.ToByteArray(); + c_api.TF_FunctionSetAttrValueProto(fn, attr_name, serialized, serialized.Length, status); + status.Check(true); + } + + var signature = _get_definition().Signature; + _name = signature.Name; + tf_with(ops.init_scope(), s => + { + tf.Context.add_function(fn); + _registered_on_context = true; + }); + + _num_outputs = signature.OutputArg.Count; + OutputTypes = signature.OutputArg.Select(x => x.Type).ToArray(); + OutputShapes = outputs.Select(x => x.shape).ToArray(); + _func_graph_outputs = new List(outputs).ToArray(); + csharp_grad_func = null; + _graph = graph; } - public Tensors Call(Tensors args) + public unsafe Tensors Call(Tensors args) { + // TODO(Rinne): Add arg `CancellationManager`. + // TODO(Rinne): Check the arg length. + var function_call_options = tf.Context.FunctionCallOptions; + string config = ""; // TODO(Rinne): revise it. The following code should work but not, for unclear reasons. + + //if (function_call_options.config_proto_serialized().Length == 0) + //{ + // config = function_utils.get_disabled_rewriter_config().ToStringUtf8(); + //} + //else + //{ + // config = function_call_options.config_proto_serialized().ToStringUtf8(); + //} + + string executor_type = function_call_options.ExecutorType ?? ""; + var executing_eagerly = tf.Context.executing_eagerly(); + var attrs = new object[] { - "executor_type", "", - "config_proto", tf.Context.FunctionCallOptions.config_proto_serialized() + "executor_type", executor_type, + "config_proto", config }; - var results = tf.Runner.TFE_Execute(tf.Context, - tf.Context.DeviceName, - _func_graph.FuncName, - args, - attrs, - _num_outputs); + Tensor[] outputs; + if (executing_eagerly) + { + outputs = execute.executes( + Signature.Name, + _num_outputs, + args, + attrs, + tf.Context); + } + else + { + if(tf.GetTapeSet().Count == 0) + { + outputs = functional_ops.partitioned_call(args, this, OutputTypes, + executing_eagerly, config, ""); + } + else + { + var tape = tf.GetTapeSet().Peek(); + tape.StopRecord(); + outputs = functional_ops.partitioned_call(args, this, OutputTypes, + executing_eagerly, config, ""); + tape.StartRecord(); + } + } + foreach(var (i, func_graph_output) in enumerate(_func_graph_outputs)) + { + handle_data_util.copy_handle_data(func_graph_output, outputs[i]); + } + if (executing_eagerly) + { + return outputs; + } + else + { + foreach(var (i, shape) in enumerate(OutputShapes)) + { + outputs[i].shape = shape; + } + return outputs; + } + } + + public void AddToGraph(Graph g = null) + { + if(g is null && tf.Context.executing_eagerly()) + { + var ctx = tf.Context; + if (!ctx.has_function(this.Name)) + { + ctx.add_function_def(Definition); + } + } + else + { + if (!g.IsFunction(Name)) + { + g.AddFunction(this); + } + foreach(var f in _graph.Functions.Values) + { + if (!g.IsFunction(f.Name)) + { + g.AddFunction(f); + } + } + } + } - return results; + private FunctionDef _get_definition() + { + var buffer = c_api_util.tf_buffer(); + Status status = new(); + c_api.TF_FunctionToFunctionDef(_c_func.Get(), buffer, status); + status.Check(true); + var proto_data = c_api.TF_GetBuffer(buffer); + return FunctionDef.Parser.ParseFrom(proto_data.AsSpan()); + } + + public void Dispose() + { + tf.Context.remove_function(Name); } } } diff --git a/src/TensorFlowNET.Core/Functions/FirstOrderTapeGradientFunctions.cs b/src/TensorFlowNET.Core/Functions/FirstOrderTapeGradientFunctions.cs index 3c099927c..bfb0defcb 100644 --- a/src/TensorFlowNET.Core/Functions/FirstOrderTapeGradientFunctions.cs +++ b/src/TensorFlowNET.Core/Functions/FirstOrderTapeGradientFunctions.cs @@ -14,12 +14,11 @@ public FirstOrderTapeGradientFunctions(FuncGraph func_graph, } - public override EagerDefinedFunction ForwardAndBackwardFunctions(Tensors inference_args) + public override (EagerDefinedFunction, FuncGraph, ConcreteFunction, List, int) + ForwardAndBackwardFunctions(Tensors inference_args) { - var outputs = _func_graph.Outputs; - (_forward, _forward_graph, _backward, _forwardprop_output_indices, _num_forwardprop_outputs) - = BuildFunctionsForOutputs(outputs, inference_args); - return _forward; + var outputs = _func_graph.Outputs.Take(_num_inference_outputs).ToArray(); + return BuildFunctionsForOutputs(outputs, inference_args); } } } diff --git a/src/TensorFlowNET.Core/Functions/Function.cs b/src/TensorFlowNET.Core/Functions/Function.cs index 056d15f4d..e301048a8 100644 --- a/src/TensorFlowNET.Core/Functions/Function.cs +++ b/src/TensorFlowNET.Core/Functions/Function.cs @@ -1,23 +1,84 @@ using System; +using Tensorflow.Functions; using Tensorflow.Train; namespace Tensorflow { - public class Function: Trackable + public class Function: Trackable, IGenericFunction { #pragma warning disable CS0169 // The field 'Function._handle' is never used private IntPtr _handle; #pragma warning restore CS0169 // The field 'Function._handle' is never used - + + protected Func _csharp_function; + protected ConcreteFunction _concrete_variable_creation_fn; + protected bool _autograph; + protected TracingCompiler _variable_creation_fn; public string Name { get; set; } - public Function() + public Function(Func csharp_function, + string name, bool auto_graph = true) + { + _csharp_function = csharp_function; + Name = name; + _autograph = auto_graph; + } + + public virtual Tensors Apply(Tensors inputs) { + if (_run_functions_eagerly()) + { + return _csharp_function(inputs); + } + + var result = _call(inputs); + return result; + } + public ConcreteFunction get_concrete_function(params Tensor[] args) + { + return _get_concrete_function_garbage_collected(args); } - - public Function(string name) + + protected virtual Tensors _call(Tensors inputs) { - Name = name; + if(_variable_creation_fn is not null) + { + return _variable_creation_fn.Apply(inputs); + } + _initialize(inputs); + + return _concrete_variable_creation_fn.CallFlat(inputs, + _concrete_variable_creation_fn.CapturedInputs); + } + + protected TracingCompiler _compiler(Func fn) + { + var name = nameof(fn); + return new TracingCompiler(fn, name, autograph: _autograph); + } + + protected virtual bool _run_functions_eagerly() + { + return false; + } + + protected ConcreteFunction _get_concrete_function_garbage_collected(Tensor[] args) + { + if(_variable_creation_fn is null) + { + _initialize(args); + // TODO(Rinne): _initialize_uninitialized_variables + } + + var concrete = _variable_creation_fn._get_concrete_function_internal_garbage_collected(args); + return concrete; + } + + private void _initialize(Tensor[] args) + { + _variable_creation_fn = _compiler(_csharp_function); + _variable_creation_fn._name = this.Name; + _concrete_variable_creation_fn = _variable_creation_fn._get_concrete_function_internal_garbage_collected(args); } } } diff --git a/src/TensorFlowNET.Core/Functions/IGenericFunction.cs b/src/TensorFlowNET.Core/Functions/IGenericFunction.cs new file mode 100644 index 000000000..f046731bf --- /dev/null +++ b/src/TensorFlowNET.Core/Functions/IGenericFunction.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow.Functions +{ + public interface IGenericFunction + { + Tensors Apply(Tensors args); + ConcreteFunction get_concrete_function(params Tensor[] args); + } +} diff --git a/src/TensorFlowNET.Core/Functions/TapeGradientFunctions.cs b/src/TensorFlowNET.Core/Functions/TapeGradientFunctions.cs index 9f216ff73..3895226ef 100644 --- a/src/TensorFlowNET.Core/Functions/TapeGradientFunctions.cs +++ b/src/TensorFlowNET.Core/Functions/TapeGradientFunctions.cs @@ -3,8 +3,10 @@ using System.Linq; using System.Text; using Tensorflow.Eager; +using Tensorflow.Gradients; using Tensorflow.Graphs; using Tensorflow.NumPy; +using Tensorflow.Operations; using static Tensorflow.Binding; using static Tensorflow.tensorflow; @@ -15,17 +17,21 @@ namespace Tensorflow.Functions /// public abstract class TapeGradientFunctions { - string FORWARD_FUNCTION_ATTRIBUTE_NAME = "forward_function_name"; - string BACKWARD_FUNCTION_ATTRIBUTE_NAME = "backward_function_name"; - string _FORWARD_PREFIX = "__forward_"; - string _BACKWARD_PREFIX = "__backward_"; - string _INFERENCE_PREFIX = "__inference_"; + protected string FORWARD_FUNCTION_ATTRIBUTE_NAME = "forward_function_name"; + protected string BACKWARD_FUNCTION_ATTRIBUTE_NAME = "backward_function_name"; + protected string _FORWARD_PREFIX = "__forward_"; + protected string _BACKWARD_PREFIX = "__backward_"; + protected string _INFERENCE_PREFIX = "__inference_"; protected FuncGraph _func_graph; protected EagerDefinedFunction _forward; protected FuncGraph _forward_graph; + protected List _forwardprop_input_indices; protected List _forwardprop_output_indices; protected int _num_forwardprop_outputs; + protected int _num_inference_outputs; + protected int _num_outputs; + protected int _num_trainable_inference_outputs; protected ConcreteFunction _backward; BackwardFunction _backward_function_wrapper; @@ -33,11 +39,25 @@ public TapeGradientFunctions(FuncGraph func_graph, bool need_gradients_for_jvps) { _func_graph = func_graph; + _forward_graph = null; + _forward = null; + _backward = null; + _num_outputs = func_graph.Outputs.Length; + _forwardprop_output_indices = null; + _num_forwardprop_outputs = 0; + _num_inference_outputs = func_graph.Outputs.Length; + _num_trainable_inference_outputs = func_graph.Outputs.Where(t => backprop_util.IsTrainable(t)).Count(); } - public EagerDefinedFunction Forward(Tensors inference_args) + public virtual EagerDefinedFunction Forward(Tensors inference_args, Tensors input_tangents = null) { - return ForwardAndBackwardFunctions(inference_args); + // TODO(Rinne): add input_tangents arg. + if(_forward is null) + { + (_forward, _forward_graph, _backward, _forwardprop_output_indices, _num_forwardprop_outputs) + = ForwardAndBackwardFunctions(inference_args); + } + return _forward; } /// @@ -45,11 +65,16 @@ public EagerDefinedFunction Forward(Tensors inference_args) /// /// /// - public void Record(Tensors flat_outputs, Tensors inference_args) + public virtual void Record(Tensors flat_outputs, Tensors inference_args) { + // TODO(Rinne): add arg `input_tagents`. var (backward_function, to_record) = _wrap_backward_function(_forward_graph, _backward, flat_outputs); - tf.Runner.RecordGradient(_forward.Name, inference_args, new object[0], to_record, - getBackwardFunction: backward_function); + if(_forwardprop_output_indices is not null && _forwardprop_output_indices.Count > 0) + { + // TODO(Rinne): implement it. + throw new NotImplementedException(); + } + tf.Runner.TFE_TapeSetRecordOperation(_forward.Signature.Name, to_record, inference_args, backward_function); } /// @@ -61,66 +86,95 @@ public void Record(Tensors flat_outputs, Tensors inference_args) /// (BackwardFunction, Tensors) _wrap_backward_function(FuncGraph forward_graph, ConcreteFunction backward, Tensors outputs) { + var capture_mapping = zip(forward_graph.Outputs.Select(t => ops.tensor_id(t)), outputs) + .ToDictionary(x => x.Item1, x => x.Item2); + var captured_inputs = backward.CapturedInputs; + var remapped_captures = captured_inputs.Select(c => + { + if (capture_mapping.TryGetValue(ops.tensor_id(c), out var value)) + { + return value; + } + else + { + return c; + } + }).ToArray(); + if(remapped_captures.Where(t => t is not EagerTensor).Any(t => t.graph == forward_graph)) + { + var incorrect_mapping = remapped_captures.Where(t => t is not EagerTensor && t.graph != forward_graph); + throw new RuntimeError($"Failed to map all backward graph captures to " + + $"the forward graph. Incorrectly mapped: {string.Join(", ", incorrect_mapping)}"); + } + + Dictionary variant_zeros_like = new Dictionary(); var backward_function_inputs = backward.Inputs.Length - backward.CapturedInputs.Length; var recorded_outputs = new Tensors(); - var trainable_recorded_outputs = 0; - foreach (var (output_index, output) in enumerate(outputs)) + int trainable_recorded_outputs = 0; + var skip_positions = new HashSet(); + var relevant_outputs = outputs; + foreach (var (output_index, output) in enumerate(relevant_outputs)) { if (trainable_recorded_outputs < backward_function_inputs) recorded_outputs.Add(output); - if (gradients_util.IsTrainable(output)) - trainable_recorded_outputs += 1; + if (backprop_util.IsTrainable(output)) + trainable_recorded_outputs++; + else + skip_positions.Add(output_index); + if (output.dtype == dtypes.variant) + variant_zeros_like[output_index] = default_gradient.zeros_like(output); } - if(_backward_function_wrapper == null) + _backward_function_wrapper = (args, unneeded_gradients) => { - var capture_mapping = new Dictionary(); - foreach (var (i, output) in enumerate(outputs)) - capture_mapping[forward_graph.Outputs[i].Id] = output; - - var remapped_captures = new Tensors(); - foreach (var capture in backward.CapturedInputs) - { - if (capture_mapping.ContainsKey(capture.Id)) - remapped_captures.Add(capture_mapping[capture.Id]); - } - - var skip_positions = new List(); - foreach (var (output_index, output) in enumerate(outputs)) + if(backward.Outputs is null || backward.Outputs.Length == 0) { - if (!gradients_util.IsTrainable(output)) - skip_positions.Add(output_index); + return backward.FlatStructuredOutputs; } - _backward_function_wrapper = (args, unneeded_gradients) => + var processed_args = new Tensors(); + int input_index = 0; + foreach (var (output_index, arg) in enumerate(args)) { - var processed_args = new Tensors(); - var input_index = 0; - foreach (var (output_index, arg) in enumerate(args)) + if (skip_positions.Contains(output_index)) + continue; + if (arg is null) + { + var input_placeholder = backward.Inputs[input_index]; + Tensor variant_arg; + if (input_placeholder.dtype == dtypes.variant) + { + variant_arg = variant_zeros_like[output_index]; + } + else + { + var (shape, type) = default_gradient.shape_and_dtype(input_placeholder); + + variant_arg = array_ops.zeros(shape, type); + } + processed_args.Add(variant_arg); + } + else { - if (skip_positions.Contains(output_index)) - continue; - if (arg == null) - throw new NotImplementedException(""); processed_args.Add(arg); - input_index += 1; - if (input_index >= backward_function_inputs) - break; } + input_index++; + if (input_index >= backward_function_inputs) + break; + } - tf.Logger.Debug($"Invoke backward function: {backward.Name}"); - var gradients = backward.CallFlat(processed_args, remapped_captures); + tf.Logger.Debug($"Invoke backward function: {backward.Name}"); + var gradients = backward.CallFlat(processed_args, remapped_captures); - foreach (var unneeded_gradient_index in unneeded_gradients) - { - var index = Convert.ToInt32(unneeded_gradient_index); - if (gradients.Length <= index) - gradients.Insert(index, null); - } + foreach (var unneeded_gradient_index in unneeded_gradients) + { + var index = Convert.ToInt32(unneeded_gradient_index); + if (gradients.Length <= index) + gradients.Insert(index, null); + } - return gradients; - }; - } + return gradients; + }; return (_backward_function_wrapper, recorded_outputs); } @@ -132,51 +186,66 @@ public void Record(Tensors flat_outputs, Tensors inference_args) var trainable_indices = new List(); foreach(var (index, output) in enumerate(outputs)) { - if (gradients_util.IsTrainable(output)) + if (backprop_util.IsTrainable(output)) { trainable_outputs.Add(output); trainable_indices.Add(index); } } - var gradients_wrt_outputs = new List(); - var backwards_graph = new FuncGraph($"{_BACKWARD_PREFIX}_{_func_graph.FuncName}_{ops.uid()}"); + var backwards_graph = new FuncGraph(monomorphic_function_utils._backward_name(_func_graph.Name)); backwards_graph.as_default(); + var gradients_wrt_outputs = new List(); foreach (var output in trainable_outputs) - gradients_wrt_outputs.Add(tf.placeholder(output.dtype, output.shape)); + { + var (gradient_shape, gradient_dtype) = default_gradient.shape_and_dtype(output); + var gradient_placeholder = tf.placeholder(gradient_dtype, gradient_shape); + gradients_wrt_outputs.Add(gradient_placeholder); + handle_data_util.copy_handle_data(output, gradient_placeholder); + } + // TODO(Rinne): with ops.device(None) var gradients_wrt_inputs = gradients_util._GradientsHelper(trainable_outputs.ToArray(), - _func_graph.Inputs, - grad_ys: gradients_wrt_outputs.ToArray(), - src_graph: _func_graph); + _func_graph.Inputs, + grad_ys: gradients_wrt_outputs.ToArray(), + src_graph: _func_graph); var captures_from_forward = backwards_graph.external_captures .Where(x => x is not EagerTensor && x is not NDArray && x.graph == _func_graph) .ToArray(); + HashSet existing_outputs = new(_func_graph.Outputs); foreach(var capture in captures_from_forward) { - if (!_func_graph.Outputs.Contains(capture)) + if (!existing_outputs.Contains(capture)) + { + existing_outputs.Add(capture); _func_graph.Outputs.Add(capture); + } } backwards_graph.Exit(); - var forward_function_name = $"{_FORWARD_PREFIX}_{_func_graph.FuncName}_{ops.uid()}"; - var backward_function_attr = new Dictionary(); - backward_function_attr[FORWARD_FUNCTION_ATTRIBUTE_NAME] = forward_function_name; - gradients_wrt_outputs.append(backwards_graph.internal_captures); - backwards_graph.Inputs = gradients_wrt_outputs; - backwards_graph.Outputs = gradients_wrt_inputs; + backwards_graph.Inputs = gradients_wrt_outputs.Concat(backwards_graph.internal_captures).ToArray(); + backwards_graph.Outputs.AddRange(gradients_wrt_inputs.Where(x => x is not null)); + + var (wrapped_forward_function, wrapped_backward_function) = + monomorphic_function_utils._create_forward_backward_with_graph(null, _func_graph, backwards_graph); + //var forward_function_name = $"{_FORWARD_PREFIX}_{_func_graph.FuncName}_{ops.uid()}"; + //var backward_function_attr = new Dictionary(); + //backward_function_attr[FORWARD_FUNCTION_ATTRIBUTE_NAME] = forward_function_name; - var backward_function = new ConcreteFunction(backwards_graph, backward_function_attr); + //var backward_function = new ConcreteFunction(backwards_graph, + // monomorphic_function_utils._parse_func_attrs(backward_function_attr)); - var forward_function_attr = new Dictionary(); - forward_function_attr[BACKWARD_FUNCTION_ATTRIBUTE_NAME] = backward_function.Name; - var forward_function = new EagerDefinedFunction(forward_function_name, _func_graph, - _func_graph.Inputs, _func_graph.Outputs, forward_function_attr); + //var forward_function_attr = new Dictionary(); + //forward_function_attr[BACKWARD_FUNCTION_ATTRIBUTE_NAME] = backward_function.Name; + //var forward_function = new EagerDefinedFunction(forward_function_name, _func_graph, + // _func_graph.Inputs, _func_graph.Outputs, + // monomorphic_function_utils._parse_func_attrs(forward_function_attr)); - return (forward_function, _func_graph, backward_function, null, 0); + return (wrapped_forward_function, _func_graph, wrapped_backward_function, null, 0); } - public virtual EagerDefinedFunction ForwardAndBackwardFunctions(Tensors inference_args) + public virtual (EagerDefinedFunction, FuncGraph, ConcreteFunction, List, int) + ForwardAndBackwardFunctions(Tensors inference_args) { throw new NotImplementedException(""); } diff --git a/src/TensorFlowNET.Core/Functions/TracingCompiler.cs b/src/TensorFlowNET.Core/Functions/TracingCompiler.cs new file mode 100644 index 000000000..aa30c9f79 --- /dev/null +++ b/src/TensorFlowNET.Core/Functions/TracingCompiler.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using Tensorflow.Graphs; + +namespace Tensorflow.Functions +{ + public class TracingCompiler + { + Func _csharp_function; + //FunctionSpec _function_spec; + internal string _name; + bool _autograph; + Dictionary _function_cache; + Dictionary _function_attributes; + int _tracing_count; + + public TracingCompiler(Func csharp_function, string name, object? input_signatures = null, + Dictionary attributes = null, bool autograph = true, object? autograph_options = null, + bool reduce_retracing = false, bool capture_by_value = false) + { + _csharp_function = csharp_function; + bool pure_function = attributes is not null && attributes.Count > 0 && attributes.ContainsKey(monomorphic_function_utils.IMPLEMENTS_ATTRIBUTE_NAME); + _name = name; + _autograph = autograph; + _function_attributes = attributes ?? new Dictionary(); + _function_cache = new Dictionary(); + _tracing_count = 0; + } + + public Tensor[] Apply(Tensor[] inputs) + { + // TODO(Rinne): add lock here. + var (concrete_function, filtered_flat_args) = _maybe_define_function(inputs); + return concrete_function.CallFlat(filtered_flat_args, concrete_function.CapturedInputs); + } + + internal ConcreteFunction _get_concrete_function_internal_garbage_collected(Tensor[] args) + { + var (concrete_function, _) = _maybe_define_concrete_function(args); + return concrete_function; + } + + private (ConcreteFunction, Tensor[]) _maybe_define_concrete_function(Tensor[] args) + { + return _maybe_define_function(args); + } + + private (ConcreteFunction, Tensor[]) _maybe_define_function(Tensor[] args) + { + var lookup_func_key = make_cache_key(args); + if(_function_cache.TryGetValue(lookup_func_key, out var concrete_function)) + { + return (concrete_function, args); + } + concrete_function = _create_concrete_function(args); + _function_cache[lookup_func_key] = concrete_function; + return (concrete_function, args); + } + + private ConcreteFunction _create_concrete_function(Tensor[] args) + { + _tracing_count++; + + int arglen = args.Length; + var concrete_function = new ConcreteFunction(FuncGraph.func_graph_from_func( + _name, x => _csharp_function(x.Where(y => y is Tensor).Select(y => (Tensor)y).ToArray()), + args, new Dictionary(), autograph: _autograph + ), _function_attributes); + return concrete_function; + } + + private static string make_cache_key(Tensor[] inputs) + { + //string res = ""; + //foreach (var input in inputs) + //{ + // res += $"{input.name}_{input.Id}"; + //} + return inputs.Length.ToString(); + } + } +} diff --git a/src/TensorFlowNET.Core/Functions/c_api.function.cs b/src/TensorFlowNET.Core/Functions/c_api.function.cs index 230d85ba6..04d102b5f 100644 --- a/src/TensorFlowNET.Core/Functions/c_api.function.cs +++ b/src/TensorFlowNET.Core/Functions/c_api.function.cs @@ -16,6 +16,7 @@ limitations under the License. using System; using System.Runtime.InteropServices; +using Tensorflow.Functions; namespace Tensorflow { @@ -34,10 +35,10 @@ public partial class c_api /// /// [DllImport(TensorFlowLibName)] - public static extern void TF_FunctionToFunctionDef(IntPtr func, SafeBufferHandle output_func_def, SafeStatusHandle status); + public static extern void TF_FunctionToFunctionDef(SafeFuncGraphHandle func, SafeBufferHandle output_func_def, SafeStatusHandle status); [DllImport(TensorFlowLibName)] - public static extern IntPtr TF_GraphToFunction(IntPtr fn_body, string fn_name, + public static extern SafeFuncGraphHandle TF_GraphToFunction(SafeGraphHandle fn_body, string fn_name, bool append_hash_to_fn_name, int num_opers, IntPtr[] opers, int ninputs, TF_Output[] inputs, @@ -48,12 +49,15 @@ public static extern IntPtr TF_GraphToFunction(IntPtr fn_body, string fn_name, SafeStatusHandle status); [DllImport(TensorFlowLibName)] - public static extern IntPtr TF_FunctionSetAttrValueProto(IntPtr func, string attr_name, byte[] proto, int proto_len, SafeStatusHandle status); + public static extern IntPtr TF_FunctionSetAttrValueProto(SafeFuncGraphHandle func, string attr_name, byte[] proto, int proto_len, SafeStatusHandle status); [DllImport(TensorFlowLibName)] - public static extern IntPtr TF_FunctionName(IntPtr func); + public static extern IntPtr TF_FunctionName(SafeFuncGraphHandle func); [DllImport(TensorFlowLibName)] - public static extern void TF_GraphCopyFunction(IntPtr g, IntPtr func, IntPtr grad, SafeStatusHandle status); + public static extern void TF_GraphCopyFunction(SafeGraphHandle g, SafeFuncGraphHandle func, SafeFuncGraphHandle grad, SafeStatusHandle status); + + [DllImport(TensorFlowLibName)] + public static extern int TF_GraphGetFunctions(SafeGraphHandle g, IntPtr[] funcs, int max_func, SafeStatusHandle status); } } diff --git a/src/TensorFlowNET.Core/Functions/composite_tensor_utils.cs b/src/TensorFlowNET.Core/Functions/composite_tensor_utils.cs new file mode 100644 index 000000000..7994bef11 --- /dev/null +++ b/src/TensorFlowNET.Core/Functions/composite_tensor_utils.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Tensorflow.Framework; +using Tensorflow.Framework.Models; +using Tensorflow.Util; + +namespace Tensorflow.Functions +{ + internal static class composite_tensor_utils + { + public static List flatten_with_variables(object inputs) + { + List flat_inputs = new(); + foreach(var value in nest.flatten(inputs)) + { + if(value is CompositeTensor && !resource_variable_ops.is_resource_variable(value)) + { + throw new NotImplementedException("The composite tensor has not been fully supported."); + } + else + { + flat_inputs.Add(value); + } + } + return flat_inputs; + } + public static List flatten_with_variables_or_variable_specs(object arg) + { + List flat_inputs = new(); + foreach(var value in nest.flatten(arg)) + { + if(value is CompositeTensor && !resource_variable_ops.is_resource_variable(value)) + { + throw new NotImplementedException("The composite tensor has not been fully supported."); + } + // TODO(Rinne): deal with `VariableSpec`. + else if(value is TypeSpec type_spec && value is not TensorSpec) + { + throw new NotImplementedException("The TypeSpec has not been fully supported."); + } + else + { + flat_inputs.Add(value); + } + } + return flat_inputs; + } + } +} diff --git a/src/TensorFlowNET.Core/Functions/function_saved_model_utils.cs b/src/TensorFlowNET.Core/Functions/function_saved_model_utils.cs new file mode 100644 index 000000000..b3caef96c --- /dev/null +++ b/src/TensorFlowNET.Core/Functions/function_saved_model_utils.cs @@ -0,0 +1,94 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Tensorflow.Operations; +using Tensorflow.Train; +using Tensorflow.Variables; +using static Tensorflow.Binding; + +namespace Tensorflow.Functions +{ + public static class function_saved_model_utils + { + /// + /// + /// + /// + /// a list tensors or other objects (such as variables) which + /// contain tensors that were originally captured by the function + public static void restore_captures(ConcreteFunction concrete_function, IEnumerable inputs) + { + var bound_inputs = inputs?.Select(obj => + { + if(obj is Tensor tensor) + { + return get_tensor_from_node(tensor); + } + else if(obj is IVariableV1 variable) + { + return get_tensor_from_node(variable); + } + else + { + throw new TypeError("Encountered an type error, please submit an issue to " + + "https://github.com/SciSharp/TensorFlow.NET/issues"); + } + }); + var bound_variables = inputs.Where(obj => obj is IVariableV1).Select(x => (IVariableV1)x); + + List captured_inputs_list = new(); + concrete_function.set_variables(bound_variables); + + if (bound_inputs is not null) + { + foreach(var (bound_input, internal_capture) in zip(bound_inputs, concrete_function.Inputs.Skip(concrete_function.Inputs.Length - bound_inputs.Count()))) + { + if(hasattr(bound_input, "__tf_experimental_restore_capture__")) + { + throw new NotImplementedException(); + } + else + { + captured_inputs_list.Add(bound_input); + concrete_function.func_graph.replace_capture(bound_input, internal_capture); + if(internal_capture.dtype == dtypes.resource) + { + if (resource_variable_ops.is_resource_variable(bound_input)) + { + handle_data_util.copy_handle_data(bound_input.Handle, internal_capture); + } + else + { + handle_data_util.copy_handle_data(bound_input, internal_capture); + } + } + concrete_function.func_graph.capture(bound_input); + } + } + } + + if(captured_inputs_list.Any(inp => inp is null)) + { + // TODO(Rinne): add warnings. + } + concrete_function.SetExternalCaptures(captured_inputs_list); + } + + public static Tensor get_tensor_from_node(Tensor node) + { + return node; + } + public static Tensor get_tensor_from_node(IVariableV1 node) + { + if (resource_variable_ops.is_resource_variable(node)) + { + return node.Handle; + } + else + { + throw new TypeError("Encountered an type error, please submit an issue to " + + "https://github.com/SciSharp/TensorFlow.NET/issues"); + } + } + } +} diff --git a/src/TensorFlowNET.Core/Functions/monomorphic_function.cs b/src/TensorFlowNET.Core/Functions/monomorphic_function.cs new file mode 100644 index 000000000..7cb5c7050 --- /dev/null +++ b/src/TensorFlowNET.Core/Functions/monomorphic_function.cs @@ -0,0 +1,282 @@ +using Google.Protobuf; +using System; +using System.Collections.Generic; +using System.Text; +using Tensorflow.Eager; +using Tensorflow.Framework.Models; +using Tensorflow.Gradients; +using Tensorflow.Graphs; +using Tensorflow.Common.Extensions; +using Tensorflow.Operations; +using Tensorflow.Framework; +using static Tensorflow.Binding; +using System.Diagnostics; + +namespace Tensorflow.Functions +{ + internal static class monomorphic_function_utils + { + internal static string _FORWARD_PREFIX = "__forward_"; + internal static string _BACKWARD_PREFIX = "__backward_"; + internal static string _INFERENCE_PREFIX = "__inference_"; + internal static string IMPLEMENTS_ATTRIBUTE_NAME = "_implements"; + internal static string FORWARD_FUNCTION_ATTRIBUTE_NAME = "forward_function_name"; + internal static string BACKWARD_FUNCTION_ATTRIBUTE_NAME = "backward_function_name"; + public static string _inference_name(string name) + { + return $"{_INFERENCE_PREFIX}{name}_{ops.uid()}"; + } + public static string _forward_name(string name) + { + return $"{_FORWARD_PREFIX}{name}_{ops.uid()}"; + } + public static string _backward_name(string name) + { + return $"{_BACKWARD_PREFIX}{name}_{ops.uid()}"; + } + + public static (EagerDefinedFunction, ConcreteFunction) _create_forward_backward_with_graph(Dictionary attrs, + FuncGraph forward_graph, FuncGraph backwards_graph) + { + string forward_function_name = _forward_name(forward_graph.Name); + Dictionary common_attributes; + if(attrs is null) + { + common_attributes = new Dictionary(); + } + else + { + common_attributes = new Dictionary(attrs); + } + + if (common_attributes.ContainsKey(IMPLEMENTS_ATTRIBUTE_NAME)) + { + common_attributes.Remove(IMPLEMENTS_ATTRIBUTE_NAME); + } + var backward_function_attr = _parse_func_attrs(new Dictionary() + { + {FORWARD_FUNCTION_ATTRIBUTE_NAME, forward_function_name } + }); + backward_function_attr.Update(common_attributes); + var backward_function = new ConcreteFunction(backwards_graph, backward_function_attr); + var forward_function_attr = _parse_func_attrs(new Dictionary() + { + {BACKWARD_FUNCTION_ATTRIBUTE_NAME, backward_function.Name } + }); + forward_function_attr.Update(common_attributes); + var forward_function = new EagerDefinedFunction(forward_function_name, forward_graph, + forward_graph.Inputs, forward_graph.Outputs, forward_function_attr); + return (forward_function, backward_function); + } + + public static Dictionary _parse_func_attrs(Dictionary attributes) + { + Dictionary attrs = new(); + foreach(var item in attributes) + { + var key = item.Key; + var value = item.Value; + if (value is AttrValue attr_value) + { + attrs[key] = attr_value; + } + else if (value is bool b) + { + attrs[key] = new AttrValue() { B = b }; + } + else if (value is int i) + { + attrs[key] = new AttrValue() { I = i }; + } + else if (value is float f) + { + attrs[key] = new AttrValue() { F = f }; + } + else if(value is string s) + { + attrs[key] = new AttrValue() { S = ByteString.CopyFromUtf8(s) }; + } + else if (value is byte[] bytes) + { + attrs[key] = new AttrValue() { S = ByteString.CopyFrom(bytes) }; + } + else + { + throw new ValueError($"Attribute {key} must be bool, int, float, string, or " + + $"AttrValue. Got {value.GetType()}."); + } + } + return attrs; + } + + public static Dictionary _parse_func_attrs(Dictionary attributes) + { + Dictionary attrs = new(); + foreach (var item in attributes) + { + var key = item.Key; + var value = item.Value; + attrs[key] = new AttrValue() { S = ByteString.CopyFromUtf8(value) }; + } + return attrs; + } + } + public class DelayedRewriteGradientFunctions : TapeGradientFunctions + { + EagerDefinedFunction _inference_function; + Dictionary _attrs; + int _num_inference_outputs; + Dictionary _cached_function_pairs = new(); + public DelayedRewriteGradientFunctions(FuncGraph func_graph, Dictionary attrs) + : base(func_graph, false) + { + _func_graph = func_graph; + _inference_function = new EagerDefinedFunction(monomorphic_function_utils._inference_name(_func_graph.Name), + _func_graph, _func_graph.Inputs, _func_graph.Outputs, attrs); + _attrs = attrs; + _num_inference_outputs = _func_graph.Outputs.Length; + } + + public override EagerDefinedFunction Forward(Tensors inference_args = null, Tensors input_tangents = null) + { + if (input_tangents is not null) + { + throw new InvalidArgumentError($"unexpectedly got forwardprop information in " + + $"a class that does not support forwardprop."); + } + return _inference_function; + } + + public override void Record(Tensors flat_outputs, Tensors inference_args) + { + var (backward_function, to_record) = _backward(flat_outputs); + foreach(var tape in tf.GetTapeSet()) + { + tape.RecordOperation(_inference_function.Signature.Name, to_record, + inference_args, backward_function); + } + } + + public (EagerDefinedFunction, ConcreteFunction) forward_backward(int num_doutputs = -2) + { + if(num_doutputs == -2) + { + num_doutputs = _num_inference_outputs; + } + if(_cached_function_pairs.TryGetValue(num_doutputs, out var target)) + { + return target; + } + var (forward, backward) = _construct_forward_backward(num_doutputs); + _cached_function_pairs[num_doutputs] = (forward, backward); + return (forward, backward); + + } + + private (BackwardFunction, Tensors) _backward(Tensors outputs) + { + Tensor[] backward_function(Tensor[] args, long[] unneeded_gradients) + { + var call_op = outputs[0].op; + return _rewrite_forward_and_call_backward(call_op, args); + } + return (backward_function, outputs); + } + + internal Tensor[] _rewrite_forward_and_call_backward(Operation op, params object[] doutputs) + { + var (forward_function, backward_function) = forward_backward(doutputs.Length); + if(backward_function.Outputs is null || backward_function.Outputs.Length == 0) + { + return backward_function.FlatStructuredOutputs; + } + forward_function.AddToGraph(op.graph); + + op._set_func_attr("f", forward_function.Name); + op._set_type_list_attr("Tout", forward_function.OutputTypes); + op._add_outputs(forward_function.OutputTypes.Select(x => x.as_tf_dtype()). + Skip(op.outputs.Length).ToArray(), forward_function.OutputShapes.Skip(op.outputs.Length).ToArray() + ); + for(int i = 0; i < op.outputs.Length; i++) + { + var func_graph_output = forward_function._func_graph_outputs[i]; + handle_data_util.copy_handle_data(func_graph_output, op.outputs[i]); + } + + var capture_mapping = zip(_func_graph.Outputs.Select(t => ops.tensor_id(t)), op.outputs). + ToDictionary(x => x.Item1, x => x.Item2); + var remapped_captures = backward_function.CapturedInputs.Select( + x => capture_mapping.GetOrDefault(ops.tensor_id(x), x) + ); + + List cleaned_doutputs = new(); + foreach(var (doutput, placeholder) in zip(doutputs, _func_graph.Outputs)) + { + if (backprop_util.IsTrainable(placeholder)) + { + if(doutput is IndexedSlices) + { + cleaned_doutputs.Add(ops.convert_to_tensor(doutput)); + } + else if(doutput is null) + { + cleaned_doutputs.Add(default_gradient.zeros_like(placeholder)); + } + else if(doutput is Tensor tensor) + { + cleaned_doutputs.Add(tensor); + } + else + { + throw new ValueError($"Unsupported type {doutput.GetType()} in function _rewrite_forward_and_call_backward"); + } + } + } + + return backward_function.CallFlat(cleaned_doutputs.ToArray(), remapped_captures.ToArray()); + } + + private (EagerDefinedFunction, ConcreteFunction) _construct_forward_backward(int num_doutputs) + { + var trainable_outputs = _func_graph.Outputs.Take(num_doutputs).Where(x => backprop_util.IsTrainable(x)); + + List signature = new(); + foreach(var t in trainable_outputs) + { + var (shape, dtype) = default_gradient.shape_and_dtype(t); + signature.Add(new TensorSpec(shape, dtype)); + } + + Tensor[] _backprop_function(Tensor[] grad_ys) + { + return gradients_util._GradientsHelper(trainable_outputs.ToArray(), _func_graph.Inputs, + grad_ys, src_graph: _func_graph); + } + + _func_graph.as_default(); + FuncGraph backwards_graph = new(monomorphic_function_utils._backward_name(_func_graph.Name)); + FuncGraph.func_graph_from_func(backwards_graph.Name, x => _backprop_function(x.Select(y => + { + Debug.Assert(y is Tensor); + return (Tensor)y; + }).ToArray()), new object[0], new Dictionary(), signature.ToArray(), backwards_graph); + var backwards_graph_captures = backwards_graph.external_captures; + var captures_from_forward = backwards_graph_captures.Where(c => c is not EagerTensor && c.graph == _func_graph); + + HashSet existing_outputs = new HashSet(_func_graph.Outputs); + foreach(var capture in captures_from_forward) + { + if (!existing_outputs.Contains(capture)) + { + existing_outputs.Add(capture); + _func_graph.Outputs.Add(capture); + } + } + + var (forward_function, backward_function) = monomorphic_function_utils._create_forward_backward_with_graph( + _attrs, _func_graph, backwards_graph); + _func_graph.Exit(); + return (forward_function, backward_function); + } + } +} diff --git a/src/TensorFlowNET.Core/Gradients/BackpropInitialState.cs b/src/TensorFlowNET.Core/Gradients/BackpropInitialState.cs index eee98a61a..743ed0d8e 100644 --- a/src/TensorFlowNET.Core/Gradients/BackpropInitialState.cs +++ b/src/TensorFlowNET.Core/Gradients/BackpropInitialState.cs @@ -9,7 +9,7 @@ public class BackpropInitialState /// Map from tensor to how many references still exist for this tensor in /// the tape. /// - public UnorderedMap tensor_usage_counts { get; set; } + public UnorderedMap tensor_usage_counts { get; set; } /// /// Maps from op ID to how many output tensors of this op still need to have /// their gradients computed. @@ -19,7 +19,7 @@ public class BackpropInitialState public BackpropInitialState() { op_tape = new OpTape(); - tensor_usage_counts = new UnorderedMap(); + tensor_usage_counts = new UnorderedMap(); op_missing_tensor = new UnorderedMap(); } } diff --git a/src/TensorFlowNET.Core/Gradients/GradientTape.cs b/src/TensorFlowNET.Core/Gradients/GradientTape.cs index 31517e580..b5fd373e9 100644 --- a/src/TensorFlowNET.Core/Gradients/GradientTape.cs +++ b/src/TensorFlowNET.Core/Gradients/GradientTape.cs @@ -67,40 +67,59 @@ public void watch(Tensor x) /// /// /// - public Tensor gradient(Tensor target, Tensor source) + public Tensor gradient(Tensor target, Tensor source, List output_gradients = null, + string unconnected_gradients = null) { + if(_tape is null) + { + throw new RuntimeError("A non-persistent GradientTape can only be used to " + + "compute one set of gradients (or jacobians)."); + } + ITape tape = stop_recording(); var results = tf.Runner.TFE_TapeGradient(tape, new[] { target }, new[] { source }, - null); + output_gradients, + new[] { source }, + unconnected_gradients); return results[0]; } - public Tensor gradient(Tensor target, ResourceVariable source) + public Tensor gradient(Tensor target, ResourceVariable source, List output_gradients = null, + string unconnected_gradients = null) { - var results = gradient(target, new List { source }); + var results = gradient(target, new List { source }, output_gradients, unconnected_gradients); return results[0]; } - public (Tensor, Tensor) gradient(Tensor target, (ResourceVariable, ResourceVariable) sources) + public (Tensor, Tensor) gradient(Tensor target, (ResourceVariable, ResourceVariable) sources, List output_gradients = null, + string unconnected_gradients = null) { - var results = gradient(target, new List { sources.Item1, sources.Item2 }); + var results = gradient(target, new List { sources.Item1, sources.Item2 }, output_gradients, unconnected_gradients); return (results[0], results[1]); } - public Tensor[] gradient(Tensor target, IEnumerable sources) + public Tensor[] gradient(Tensor target, IEnumerable sources, List output_gradients = null, + string unconnected_gradients = null) { + if (_tape is null) + { + throw new RuntimeError("A non-persistent GradientTape can only be used to " + + "compute one set of gradients (or jacobians)."); + } var tape = stop_recording(); var results = tf.Runner.TFE_TapeGradient(tape, new[] { target }, sources.Select(x => x.Handle).ToArray(), - null); + output_gradients, + sources.Select(x => x.Handle).ToArray(), + unconnected_gradients); if (!tape.Persistent) { diff --git a/src/TensorFlowNET.Core/Gradients/ITape.cs b/src/TensorFlowNET.Core/Gradients/ITape.cs index dbd085eac..07594dabd 100644 --- a/src/TensorFlowNET.Core/Gradients/ITape.cs +++ b/src/TensorFlowNET.Core/Gradients/ITape.cs @@ -6,24 +6,31 @@ namespace Tensorflow.Gradients public interface ITape { void SetTapeId(int id); - bool ShouldRecord(Tensor[] tensors); + bool ShouldRecord(long[] tensor_ids, TF_DataType[] tensor_dtypes); void StartRecord(); void StopRecord(); bool Persistent { get; } void RecordOperation(string op_type, - Tensor[] input_tensors, TapeTensor[] output_tensors, + long[] input_tensor_id, + TF_DataType[] input_dtypes, BackwardFunction backward_function); - void VariableAccessed(ResourceVariable variable); + void RecordOperation(string op_type, + Tensor[] outputs, + Tensor[] inputs, + BackwardFunction backward_function); + + void VariableAccessed(IVariableV1 variable); void Watch(Tensor x); - ResourceVariable[] WatchedVariables(); + IVariableV1[] WatchedVariables(); - Tensor[] ComputeGradient(Tensor[] target_tensor_ids, - Tensor[] source_tensor_ids, - UnorderedMap sources_that_are_targets, - Tensor[] output_gradients); + Tensor[] ComputeGradient(long[] target_tensor_ids, + long[] source_tensor_ids, + UnorderedMap sources_that_are_targets, + List output_gradients, + bool build_default_zeros_grads); } } diff --git a/src/TensorFlowNET.Core/Gradients/OpTapeEntry.cs b/src/TensorFlowNET.Core/Gradients/OpTapeEntry.cs index 537369dd8..7665fa017 100644 --- a/src/TensorFlowNET.Core/Gradients/OpTapeEntry.cs +++ b/src/TensorFlowNET.Core/Gradients/OpTapeEntry.cs @@ -9,9 +9,9 @@ public class OpTapeEntry { public string op_type { get; set; } public TapeTensor[] output_tensor_info { get; set; } - public Tensor[] input_tensor_id { get; set; } + public long[] input_tensor_id { get; set; } public BackwardFunction backward_function { get; set; } public override string ToString() - => $"{op_type}, inputs: {string.Join(",", input_tensor_id.Select(x => x.Id))}"; + => $"{op_type}, inputs: {string.Join(",", input_tensor_id)}"; } } diff --git a/src/TensorFlowNET.Core/Gradients/Tape.ComputeGradient.cs b/src/TensorFlowNET.Core/Gradients/Tape.ComputeGradient.cs index 73c9e501e..8a4a41f62 100644 --- a/src/TensorFlowNET.Core/Gradients/Tape.ComputeGradient.cs +++ b/src/TensorFlowNET.Core/Gradients/Tape.ComputeGradient.cs @@ -2,235 +2,246 @@ using System.Collections.Generic; using System.Linq; using Tensorflow.Util; +using static Tensorflow.Binding; namespace Tensorflow.Gradients { public partial class Tape { - // int kMinAggregateCount = 4; - // int kMinAggregateBytes = 128 * 1024 * 1024; + static readonly int kMinAggregateCount = 4; + static readonly int kMinAggregateBytes = 128 * 1024 * 1024; + private static UnorderedMap> _functionsAcceptingNoneForIndicesMap; - public Tensor[] ComputeGradient(Tensor[] target_tensor_ids, - Tensor[] source_tensor_ids, - UnorderedMap sources_that_are_targets, - Tensor[] output_gradients) + static Tape() { - var sources_set = new UnorderedSet(source_tensor_ids); - // var gradients_size = new UnorderedMap(); - var functionsAcceptingNoneForIndicesMap = FunctionsAcceptingNoneForIndicesMap(); - var state = PrepareBackprop( - target_tensor_ids, tensor_tape_, op_tape_, sources_set, _persistent); - var op_stack = InitialStack(state.op_tape, state.op_missing_tensor); - var gradients = InitialGradients(target_tensor_ids, sources_that_are_targets, - output_gradients, - tensor_tape_, - state.op_tape); + _functionsAcceptingNoneForIndicesMap = new(); + _functionsAcceptingNoneForIndicesMap.Add("SoftmaxCrossEntropyWithLogits", new UnorderedSet(new[] { 1 })); + _functionsAcceptingNoneForIndicesMap.Add("SparseSoftmaxCrossEntropyWithLogits", new UnorderedSet(new[] { 1 })); + _functionsAcceptingNoneForIndicesMap.Add("FusedBatchNorm", new UnorderedSet(new[] { 1, 2, 3, 4 })); + } - while (!op_stack.empty()) + public Tensor[] ComputeGradient(long[] target_tensor_ids, + long[] source_tensor_ids, + UnorderedMap sources_that_are_targets, + List output_gradients, + bool build_default_zeros_grads) + { + UnorderedSet sources_set = new(source_tensor_ids); + BackpropInitialState state = PrepareBackprop(target_tensor_ids, tensor_tape_, op_tape_, sources_set, Persistent); + var op_stack = InitialStack(state.op_tape, state.op_missing_tensor); + var gradients = InitialGradients(target_tensor_ids, sources_that_are_targets, output_gradients, tensor_tape_, state.op_tape); + UnorderedMap gradients_size = new(); + while(op_stack.Count > 0) { - var op = op_stack.Dequeue(); - if (!state.op_tape.find(op, out var trace)) + long op = op_stack.Dequeue(); + if(!state.op_tape.TryGetValue(op, out var op_it)) + { continue; - - // Console.WriteLine($"ComputeGradient: {state.op_tape[op].op_type}"); + } + var trace = op_it; state.op_tape.erase(op); - - var out_gradients = new List(trace.output_tensor_info.Length); - var unneeded_gradients = new List(); - for (int i = 0; i < trace.input_tensor_id.Length; i++) + List out_gradients = new(); + List unneeded_gradients = new(); + for(int i = 0, end = trace.input_tensor_id.Length; i < end; i++) { - var in_tensor_id = trace.input_tensor_id[i]; - if (!tensor_tape_.find(in_tensor_id) && - !sources_set.find(in_tensor_id)) + long in_tensor_id = trace.input_tensor_id[i]; + if(!tensor_tape_.find(in_tensor_id) && !sources_set.find(in_tensor_id)) + { unneeded_gradients.Add(i); + } } bool any_gradient_nonzero = false; - var zero_indices = new List(); - for (int i = 0; i < trace.output_tensor_info.Length; ++i) + List zero_indices = new(); + for(int i = 0, end = trace.output_tensor_info.Length; i < end; i++) { - var id = trace.output_tensor_info[i].GetTensor(); - if (!gradients.find(id, out var grad_it)) + long id = trace.output_tensor_info[i].GetID(); + if(!gradients.TryGetValue(id, out var grad_it)) { - if (functionsAcceptingNoneForIndicesMap.find(trace.op_type, out var func_name_it) && - func_name_it.find(i)) + out_gradients.Add(null); + if (build_default_zeros_grads) { - out_gradients.Add(null); - } - else - { - out_gradients.Add(null); - zero_indices.Add(i); + if(!_functionsAcceptingNoneForIndicesMap.TryGetValue(trace.op_type, out var func_name_it) || + !func_name_it.find(i)) + { + zero_indices.Add(i); + } } } else { any_gradient_nonzero = true; - var new_gradients = grad_it.Count == 1 ? - grad_it[0] : - gen_math_ops.add_n(grad_it.ToArray()); // vspace.AggregateGradients - + Tensor new_gradients; + if (grad_it.Count == 1) + { + new_gradients = grad_it[0]; + } + else + { + new_gradients = AggregateGradients(grad_it); + } if (!sources_set.find(id)) + { gradients.Remove(id); + } else { - // grad_it.Clear(); - // grad_it.Add(new_gradients); - // vspace.MarkAsResult(new_gradients); + grad_it.Clear(); + grad_it.Add(new_gradients); + // MarkAsResult } out_gradients.Add(new_gradients); } } - Tensor[] in_gradients; + Tensor[] in_gradients = new Tensor[0]; if (any_gradient_nonzero) { - // foreach (var i in zero_indices) - // out_gradients[i] = trace.output_tensor_info[i].ZerosLike(); - - in_gradients = trace.backward_function(out_gradients.ToArray(), unneeded_gradients.ToArray()); - - if (in_gradients.Length != trace.input_tensor_id.Length && in_gradients.Length + unneeded_gradients.Count != trace.input_tensor_id.Length) - throw new RuntimeError($"Recorded operation '{trace.op_type}' returned too few gradients. Expected {trace.input_tensor_id.Length} but received {in_gradients.Count()}"); - if (!_persistent) + foreach(var i in zero_indices) { - // trace.backward_function_deleter(trace.backward_function); - trace.backward_function = null; + out_gradients[i] = trace.output_tensor_info[i].ZerosLike(); } + in_gradients = CallBackwardFunction(trace.backward_function, unneeded_gradients, out_gradients); } else { - in_gradients = new Tensor[trace.input_tensor_id.Length]; + out_gradients.Clear(); } - - bool skip_unneeded_id = trace.input_tensor_id.Length > in_gradients.Length; - for (int i = 0, k = 0; i < in_gradients.Length && k < trace.input_tensor_id.Count(); ++i, ++k) + + for(int i = 0, end = in_gradients.Length; i < end; i++) { - if (skip_unneeded_id && unneeded_gradients.Contains(k)) ++k; - var id = trace.input_tensor_id[k]; - if (in_gradients[i] != null) + long id = trace.input_tensor_id[i]; + if (in_gradients[i] is not null) { - var unaggregated_grads = gradients[id]; + var unaggregated_grads = gradients.SetDefault(id, new List()); unaggregated_grads.Add(in_gradients[i]); - /*if (unaggregated_grads.Count > kMinAggregateCount) + if(unaggregated_grads.Count > kMinAggregateCount) { - if (!gradients_size.find(id, out var size)) + if(!gradients_size.TryGetValue(id, out var size)) { - size = (long)unaggregated_grads[0].size; + size = NumElements(unaggregated_grads[0]); gradients_size.emplace(id, size); } - - if (unaggregated_grads.Count * size * 4 > kMinAggregateBytes) + if(unaggregated_grads.Count * size * 4 > kMinAggregateBytes) { - throw new NotImplementedException(""); + Tensor grad = AggregateGradients(unaggregated_grads); + unaggregated_grads.Clear(); + unaggregated_grads.Add(grad); } - }*/ + } } - - if (!state.tensor_usage_counts.find(id)) + if(!state.tensor_usage_counts.find(id)) + { continue; - + } state.tensor_usage_counts[id]--; - if (state.tensor_usage_counts[id] > 0) + if(state.tensor_usage_counts[id] > 0) + { continue; - - if (!tensor_tape_.find(id, out var tape_it)) + } + if (!tensor_tape_.TryGetValue(id, out var tape_it)) { - if (gradients.find(id, out var grad_it)) + if (gradients.find(id)) { - // foreach (var g in grad_it) - // DeleteGradient(g); gradients.erase(id); } continue; } - - var op_id = tape_it; - if (op_id == -1) + long op_id = tape_it; + if(op_id == -1) + { continue; - - if (state.op_missing_tensor.find(op_id, out var missing_it)) + } + if(state.op_missing_tensor.find(op_id)) { state.op_missing_tensor[op_id]--; - if (state.op_missing_tensor[op_id] == 0) + if(state.op_missing_tensor[op_id] == 0) + { op_stack.Enqueue(op_id); + } } } } - if (state.op_tape.Count > 0) + if(state.op_tape.Count > 0) + { throw new RuntimeError("Invalid tape state."); - - var result = new Tensor[source_tensor_ids.Length]; - var j = 0; - foreach (var id in source_tensor_ids) + } + Tensor[] result = new Tensor[source_tensor_ids.Length]; + for(int i = 0; i < source_tensor_ids.Length; i++) { - if (gradients.find(id, out var grad_it)) + long tensor_id = source_tensor_ids[i]; + if(!gradients.TryGetValue(tensor_id, out var grad_it)) { - if (grad_it.Count > 1) - result[j] = gen_math_ops.add_n(grad_it.ToArray()); - else - result[j] = grad_it[0]; + result[i] = null; + } + else + { + if(grad_it.Count > 1) + { + Tensor grad = AggregateGradients(grad_it); + grad_it.Clear(); + grad_it.Add(grad); + } + result[i] = grad_it[0]; } - j++; } - return result; } UnorderedMap> FunctionsAcceptingNoneForIndicesMap() { - var m = new UnorderedMap>(); - m.Add("SoftmaxCrossEntropyWithLogits", new UnorderedSet(new[] { 1 })); - m.Add("SparseSoftmaxCrossEntropyWithLogits", new UnorderedSet(new[] { 1 })); - m.Add("FusedBatchNorm", new UnorderedSet(new[] { 1, 2, 3, 4 })); - return m; + return _functionsAcceptingNoneForIndicesMap; } - UnorderedMapEnumerable> InitialGradients(Tensor[] target_tensor_ids, - UnorderedMap sources_that_are_targets, - Tensor[] output_gradients, + UnorderedMap> InitialGradients(long[] target_tensor_ids, + UnorderedMap sources_that_are_targets, + List output_gradients, TensorTape tensor_tape, OpTape op_tape) { - var result = new UnorderedMapEnumerable>(); - for (int i = 0; i < target_tensor_ids.Length; ++i) + var result = new UnorderedMap>(); + for(int i = 0, end = target_tensor_ids.Length; i < end; i++) { - var id = target_tensor_ids[i]; - if (output_gradients.Length == 0 || output_gradients[i] == null) + long id = target_tensor_ids[i]; + if( output_gradients is null ||output_gradients.Count == 0 || output_gradients[i] is null) { - if (tensor_tape.find(id, out var tensor_id) && tensor_id != null) + if(tensor_tape.TryGetValue(id, out var tensor_it) && tensor_it != -1) { - if (!op_tape.find(tensor_tape[id], out var op_it)) + if(!op_tape.TryGetValue(tensor_it, out var op_it)) + { throw new RuntimeError("Internal state of the gradient tape is invalid: " + - "failed to find operation producing a tensor"); + "failed to find operation producing a tensor."); + } bool found = false; - for (int j = 0; j < op_it.output_tensor_info.Length; ++j) + for(int j = 0; j < op_it.output_tensor_info.Length; j++) { - if (op_it.output_tensor_info[j].GetTensor() == id) + if (op_it.output_tensor_info[j].GetID() == id) { found = true; - var ones = op_it.output_tensor_info[j].OnesLike(); - result[id].Add(ones); + Tensor ones_like = BuildOnesLike(op_it.output_tensor_info[j]); + result.SetDefault(id, new List()).Add(ones_like); break; } } - if (!found) { - throw new ValueError("Internal state of the gradient tape is invalid: " + - "none of operations outputs match expected tensor"); + throw new RuntimeError("Internal state of the gradient tape is invalid: " + + "none of operations outputs match expected tensor."); } } else { - if (sources_that_are_targets.find(id, out var source_tensor)) - result[id].Add(source_tensor.OnesLike()); + if(sources_that_are_targets.TryGetValue(id, out var source_tensor)) + { + Tensor ones_like = BuildOnesLike(source_tensor); + result.SetDefault(id, new List()).Add(ones_like); + } } } else { - result[id].Add(output_gradients[i]); + result.SetDefault(id, new List()).Add(output_gradients[i]); } } @@ -248,5 +259,26 @@ Queue InitialStack(OpTape op_tape, } return result; } + + Tensor BuildOnesLike(TapeTensor t) + { + return t.OnesLike(); + } + + Tensor AggregateGradients(List gradient_tensors) + { + if(gradient_tensors.Count == 0) + { + return gradient_tensors[0]; + } + return tf.add_n(gradient_tensors.ToArray()); + } + + void DeleteGradient(Tensor gradient) + { + // Do not do anything here. Because GC will collect it when it has no reference. + } + + long NumElements(Tensor tensor) => 1; } } diff --git a/src/TensorFlowNET.Core/Gradients/Tape.PrepareBackprop.cs b/src/TensorFlowNET.Core/Gradients/Tape.PrepareBackprop.cs index 2ab4ddbbe..f8f356e76 100644 --- a/src/TensorFlowNET.Core/Gradients/Tape.PrepareBackprop.cs +++ b/src/TensorFlowNET.Core/Gradients/Tape.PrepareBackprop.cs @@ -5,63 +5,62 @@ namespace Tensorflow.Gradients { public partial class Tape { - public BackpropInitialState PrepareBackprop(Tensor[] target, + public BackpropInitialState PrepareBackprop(long[] target, TensorTape tensor_tape, OpTape op_tape, - UnorderedSet sources_set, + UnorderedSet sources_set, bool persistent_tape) { + Stack tensor_stack = new Stack(); + foreach(var t in target) + { + tensor_stack.Push(t); + } BackpropInitialState result = new BackpropInitialState(); - var tensor_stack = new Queue(target); - while (tensor_stack.Count > 0) + while(tensor_stack.Count > 0) { - var tensor_id = tensor_stack.Dequeue(); - - if (!tensor_tape.find(tensor_id, out var op_id)) + long tensor_id = tensor_stack.Pop(); + if(!tensor_tape.TryGetValue(tensor_id, out var op_id)) + { continue; - - if (op_id == -1 || - !op_tape.find(op_id, out var op_it) || - result.op_tape.find(op_id, out var result_op_it)) + } + if(op_id == -1 || !op_tape.TryGetValue(op_id, out var op_it) + || result.op_tape.find(op_id)) + { continue; - + } result.op_tape.emplace(op_id, op_it); - - foreach (var it in op_it.input_tensor_id) + foreach(var it in op_it.input_tensor_id) { - if (result.tensor_usage_counts.find(it)) + if(result.tensor_usage_counts.find(it)) + { result.tensor_usage_counts[it]++; + } else { result.tensor_usage_counts[it] = 1; if (tensor_tape.find(it)) - tensor_stack.Enqueue(it); + { + tensor_stack.Push(it); + } } } - if (!persistent_tape) - op_tape.Remove(op_id); + { + op_tape.erase(op_id); + } } - - foreach (var pair in result.tensor_usage_counts) + foreach(var pair in result.tensor_usage_counts) { - if (tensor_tape.find(pair.Key, out var it) && it != -1) - result.op_missing_tensor[it] += 1; + if(tensor_tape.TryGetValue(pair.Key, out var it) && it != -1) + { + result.op_missing_tensor[it]++; + } } - if (!persistent_tape) { - // Call destructors for all unneeded gradient functions and - // clear the op_tape. We can clear the tape because ownership of - // backward functions that will be used for gradient computation - // has been transferred to `result`. - /*for (const auto&op_pair : *op_tape) { - op_pair.second.backward_function_deleter( - op_pair.second.backward_function); - }*/ op_tape.Clear(); } - return result; } } diff --git a/src/TensorFlowNET.Core/Gradients/Tape.RecordOperation.cs b/src/TensorFlowNET.Core/Gradients/Tape.RecordOperation.cs index a692f1f45..708b9121d 100644 --- a/src/TensorFlowNET.Core/Gradients/Tape.RecordOperation.cs +++ b/src/TensorFlowNET.Core/Gradients/Tape.RecordOperation.cs @@ -8,34 +8,45 @@ namespace Tensorflow.Gradients public partial class Tape { long next_op_id_ = 0; - UnorderedMap tensor_usage_; + UnorderedMap tensor_usage_; public void RecordOperation(string op_type, - Tensor[] input_tensors, TapeTensor[] output_tensors, + long[] input_tensor_id, + TF_DataType[] input_dtypes, BackwardFunction backward_function) { - if (!ShouldRecord(input_tensors)) + if (!ShouldRecord(input_tensor_id, input_dtypes)) return; - var op_id = next_op_id_++; - foreach (var i in input_tensors) + foreach (var i in input_tensor_id) + { tensor_usage_[i]++; - + } + long op_id = next_op_id_++; + foreach (var o in output_tensors) { tf.Logger.Debug($"RecordOperation: tensor_tape_[{o.GetID()}] = {op_id}"); - tensor_tape_[o.GetTensor()] = op_id; - tensor_usage_[o.GetTensor()] = 1; + tensor_tape_[o.GetID()] = op_id; + tensor_usage_[o.GetID()] = 1; } op_tape_[op_id] = new OpTapeEntry { op_type = op_type, - output_tensor_info = output_tensors, - input_tensor_id = input_tensors, + output_tensor_info = output_tensors.ToArray(), + input_tensor_id = input_tensor_id.ToArray(), backward_function = backward_function }; } + + public void RecordOperation(string op_type, + Tensor[] outputs, + Tensor[] inputs, + BackwardFunction backward_function) + { + tf.Runner.TFE_TapeSetRecordOperation(op_type, outputs, inputs, backward_function); + } } } diff --git a/src/TensorFlowNET.Core/Gradients/Tape.cs b/src/TensorFlowNET.Core/Gradients/Tape.cs index 15caf81b9..648666bbf 100644 --- a/src/TensorFlowNET.Core/Gradients/Tape.cs +++ b/src/TensorFlowNET.Core/Gradients/Tape.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using Tensorflow.Util; using static Tensorflow.Binding; @@ -29,7 +30,7 @@ public Tape(bool persistent, bool watch_accessed_variables) _created_eagerly = tf.Context.executing_eagerly(); tensor_tape_ = new TensorTape(); op_tape_ = new OpTape(); - tensor_usage_ = new UnorderedMap(); + tensor_usage_ = new UnorderedMap(); if(_created_eagerly) tf.Context.start_step(); // nesting_id = ++tape_nesting_id_counter; @@ -42,29 +43,28 @@ public Tape(bool persistent, bool watch_accessed_variables) public void Watch(Tensor x) { tf.Logger.Debug($"Watch tensor id={x.Id}, name={x.name}"); - tensor_tape_.emplace(x, -1); + tensor_tape_.emplace(x.Id, -1); } - public bool ShouldRecord(Tensor[] tensors) + public bool ShouldRecord(long[] tensor_ids, TF_DataType[] tensor_dtypes) { - var dtypes = tensors.Select(x => x.dtype).ToArray(); - for (int i = 0; i < tensors.Length; ++i) + Debug.Assert(tensor_ids.Length == tensor_dtypes.Length); + for (int i = 0; i < tensor_ids.Length; ++i) { - if (tensor_tape_.find(tensors[i])) + if (tensor_tape_.find(tensor_ids[i]) && IsDtypeTrainable(tensor_dtypes[i])) { - if (IsDtypeTrainable(dtypes[i])) - return true; + return true; } } return false; } - public void VariableAccessed(ResourceVariable variable) + public void VariableAccessed(IVariableV1 variable) { Watch(variable.Handle); } - public ResourceVariable[] WatchedVariables() + public IVariableV1[] WatchedVariables() { return null; } diff --git a/src/TensorFlowNET.Core/Gradients/TapeTensor.cs b/src/TensorFlowNET.Core/Gradients/TapeTensor.cs index 210794d86..3ad19768c 100644 --- a/src/TensorFlowNET.Core/Gradients/TapeTensor.cs +++ b/src/TensorFlowNET.Core/Gradients/TapeTensor.cs @@ -1,27 +1,63 @@ -using static Tensorflow.Binding; +using OneOf; +using static Tensorflow.Binding; namespace Tensorflow.Gradients { public class TapeTensor { - Tensor tensor; - long id => tensor.Id; - TF_DataType dtype => tensor.dtype; - Shape shape => tensor.shape; + internal Tensor tensor; + internal long id; + internal TF_DataType dtype; + internal OneOf shape; + + public TapeTensor(long id, TF_DataType dtype, Shape shape) + { + this.id = id; + this.dtype = dtype; + this.shape = shape; + } + + public TapeTensor(long id, TF_DataType dtype, Tensor shape) + { + this.id = id; + this.dtype = dtype; + this.shape = shape; + } public TapeTensor(Tensor tensor) { + this.id = tensor.Id; + this.dtype = tensor.dtype; + this.shape = tensor.shape; this.tensor = tensor; } - public long GetID() => tensor.Id; - public Tensor GetTensor() => tensor; + public long GetID() => id; public Tensor ZerosLike() - => tf.zeros(shape: shape, dtype: dtype); + { + if(dtype == dtypes.resource) + { + return null; + } + if(shape.Index == 1) + { + return tf.zeros_like(shape.AsT1); + } + return tf.zeros(shape.AsT0, dtype); + } public Tensor OnesLike() - => tf.ones(shape: shape, dtype: dtype); + { + if (shape.Index == 1) + { + return tf.ones_like(shape.AsT1); + } + return tf.ones(shape.AsT0, dtype); + } + + //public Tensor OnesLike() + // => tf.ones(shape: shape, dtype: dtype); public override string ToString() => $"{id}, {shape}, {dtype.as_numpy_name()}"; diff --git a/src/TensorFlowNET.Core/Gradients/TensorTape.cs b/src/TensorFlowNET.Core/Gradients/TensorTape.cs index b9424f91a..3f069082f 100644 --- a/src/TensorFlowNET.Core/Gradients/TensorTape.cs +++ b/src/TensorFlowNET.Core/Gradients/TensorTape.cs @@ -7,7 +7,7 @@ namespace Tensorflow.Gradients /// produced this tensor. A value of -1 means that the tensor was directly /// watched and not the result of any operation in the tape. /// - public class TensorTape : UnorderedMap + public class TensorTape : UnorderedMap { } diff --git a/src/TensorFlowNET.Core/Gradients/c_api.gradient.cs b/src/TensorFlowNET.Core/Gradients/c_api.gradient.cs index 70dcfd67f..901a33ca8 100644 --- a/src/TensorFlowNET.Core/Gradients/c_api.gradient.cs +++ b/src/TensorFlowNET.Core/Gradients/c_api.gradient.cs @@ -37,7 +37,7 @@ public partial class c_api /// TF_Status* /// TF_Output* [DllImport(TensorFlowLibName)] - public static extern void TF_AddGradientsWithPrefix(IntPtr g, string prefix, TF_Output[] y, int ny, + public static extern void TF_AddGradientsWithPrefix(SafeGraphHandle g, string prefix, TF_Output[] y, int ny, TF_Output[] x, int nx, TF_Output[] dx, SafeStatusHandle status, IntPtr[] dy); } } diff --git a/src/TensorFlowNET.Core/Gradients/custom_gradient.cs b/src/TensorFlowNET.Core/Gradients/custom_gradient.cs new file mode 100644 index 000000000..0a248086b --- /dev/null +++ b/src/TensorFlowNET.Core/Gradients/custom_gradient.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow.Gradients +{ + public class custom_gradient + { + public static string generate_name() + { + return $"CustomGradient-{ops.uid()}"; + } + } +} diff --git a/src/TensorFlowNET.Core/Gradients/default_gradient.cs b/src/TensorFlowNET.Core/Gradients/default_gradient.cs new file mode 100644 index 000000000..e6c22e369 --- /dev/null +++ b/src/TensorFlowNET.Core/Gradients/default_gradient.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow.Gradients +{ + internal static class default_gradient + { + public static (Shape, TF_DataType) shape_and_dtype(Tensor t) + { + if(t.dtype == dtypes.resource) + { + var handle_data = resource_variable_ops.get_eager_safe_handle_data(t); + if(handle_data is null || !handle_data.IsSet || handle_data.ShapeAndType.Count != 1) + { + throw new ValueError($"Internal error: Tried to take gradients (or similar) " + + $"of a variable without handle data:\n{t}"); + } + return (new Shape(handle_data.ShapeAndType[0].Shape), handle_data.ShapeAndType[0].Dtype.as_tf_dtype()); + } + return (t.shape, t.dtype); + } + + public static Tensor zeros_like(Tensor t) + { + if(t.dtype == dtypes.resource) + { + var (shape, dtype) = shape_and_dtype(t); + return array_ops.zeros(shape, dtype); + } + else + { + return array_ops.zeros_like(t); + } + } + + public static TF_DataType get_zeros_dtype(Tensor t) + { + if(t.dtype == dtypes.resource) + { + var handle_data = resource_variable_ops.get_eager_safe_handle_data(t); + if(handle_data is null || !handle_data.IsSet || handle_data.ShapeAndType.Count != 1) + { + throw new ValueError($"Internal error: Tried to take gradients (or similar) " + + $"of a variable without handle data:\n{t}"); + } + return handle_data.ShapeAndType[0].Dtype.as_tf_dtype(); + } + return t.dtype; + } + } +} diff --git a/src/TensorFlowNET.Core/Gradients/gradients_util.cs b/src/TensorFlowNET.Core/Gradients/gradients_util.cs index 40a834931..1fb327788 100644 --- a/src/TensorFlowNET.Core/Gradients/gradients_util.cs +++ b/src/TensorFlowNET.Core/Gradients/gradients_util.cs @@ -14,10 +14,15 @@ You may obtain a copy of the License at limitations under the License. ******************************************************************************/ +using Google.Protobuf; using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; +using Tensorflow.Functions; +using Tensorflow.Gradients; using Tensorflow.Graphs; +using Tensorflow.Operations; using Tensorflow.Operations.ControlFlows; using static Tensorflow.Binding; @@ -25,6 +30,11 @@ namespace Tensorflow { public class gradients_util { + // Represents the output of TFE_Py_TapeSetPossibleGradientTypes. Real enums are + // unfortunately too slow to use here. + public static int POSSIBLE_GRADIENT_TYPES_NONE = 0; + public static int POSSIBLE_GRADIENT_TYPES_FIRST_ORDER = 1; + public static int POSSIBLE_GRADIENT_TYPES_HIGHER_ORDER = 2; public static Tensor[] _GradientsHelper(Tensor[] ys, Tensor[] xs, Tensor[] grad_ys = null, @@ -143,7 +153,7 @@ public static Tensor[] _GradientsHelper(Tensor[] ys, Tensor[] in_grads = null; Func grad_fn = null; var is_partitioned_call = _IsPartitionedCall(op); - var is_func_call = false; + var is_func_call = src_graph.IsFunction(op.type) || is_partitioned_call; var has_out_grads = out_grads.Exists(x => x != null); if (has_out_grads && !stop_ops.Contains(op)) { @@ -157,14 +167,41 @@ public static Tensor[] _GradientsHelper(Tensor[] ys, { if (is_func_call) { + EagerDefinedFunction func_call = null; if (is_partitioned_call) { - + var func_attr = op.get_attr("f"); + Debug.Assert(func_attr is NameAttrList); + var func_name = ((NameAttrList)func_attr).Name; + func_call = src_graph._get_function(func_name); + if(func_call is null && src_graph.OuterGraph is not null) + { + var graph = src_graph.OuterGraph; + while(graph is not null) + { + func_call = graph._get_function(func_name); + if(func_call is not null) + { + break; + } + if(graph.OuterGraph is not null) + { + graph = graph.OuterGraph; + } + else + { + break; + } + } + } } else { - + func_call = src_graph._get_function(op.type); } + // skip the following codes: + // `func_call = getattr(op, "__defun", func_call)` + grad_fn = func_call.csharp_grad_func; } else { @@ -208,6 +245,8 @@ public static Tensor[] _GradientsHelper(Tensor[] ys, } else { + in_grads = _MaybeCompile(grad_scope, op, out_grads.Where(x => x != null).Select(x => x[0]).ToArray(), + null, (x, y) => _SymGrad(x, y)); throw new NotImplementedException("lambda: _SymGrad(op, out_grads)"); } _VerifyGeneratedGradients(in_grads, op); @@ -663,6 +702,11 @@ public static bool IsTrainable(Tensor tensor) dtypes.resource, dtypes.variant}.Contains(dtype); } + public static int PossibleTapeGradientTypes(Tensor[] tensors) + { + return tf.Runner.TFE_TapeSetPossibleGradientTypes(tensors); + } + /// /// Return true if op has real gradient. /// @@ -683,7 +727,7 @@ private static bool _HasAnyNotNoneGrads(Dictionary>> g private static Tensor[] _MaybeCompile(string scope, Operation op, Tensor[] out_grads, Action func, Func grad_fn) { - scope = scope.EndsWith("/") ? scope.Substring(0, scope.Length - 1) : scope; + // scope = scope.TrimEnd('/').Replace('/', '_'); return grad_fn(op, out_grads); } @@ -696,5 +740,28 @@ private static void _VerifyGeneratedGradients(Tensor[] grads, Operation op) throw new ValueError($"Num gradients {grads.Length} generated for op {op.node_def} do not match num " + $"inputs {op.inputs._inputs.Count()}"); } + + private static Tensor[] _SymGrad(Operation op, Tensor[] out_grads) + { + var f_in = ((Tensor[])op.inputs).Concat(out_grads).ToArray(); + var f_types = ((Tensor[])op.inputs).Select(x => default_gradient.get_zeros_dtype(x)).ToArray(); + NameAttrList f = new(); + if (_IsPartitionedCall(op)) + { + var func_attr = op.get_attr("f"); + Debug.Assert(func_attr is NameAttrList); + f.Name = ((NameAttrList)func_attr).Name; + } + else + { + f.Name = op.type; + } + foreach(var k in op.node_def.Attr.Keys) + { + f.Attr[k] = AttrValue.Parser.ParseFrom(op.node_def.Attr[k].ToByteArray()); + } + var in_grads = gen_functional_ops.symbolic_gradient(f_in, f_types, f); + return in_grads; + } } } diff --git a/src/TensorFlowNET.Core/Gradients/math_grad.cs b/src/TensorFlowNET.Core/Gradients/math_grad.cs index 22d3c641b..89699d6bc 100644 --- a/src/TensorFlowNET.Core/Gradients/math_grad.cs +++ b/src/TensorFlowNET.Core/Gradients/math_grad.cs @@ -840,7 +840,7 @@ public static Tensor[] _PowGrad(Operation op, Tensor[] grads) /// /// /// - private static (Tensor, Tensor, bool)[] SmartBroadcastGradientArgs(Tensor x, Tensor y, Tensor grad) + public static (Tensor, Tensor, bool)[] SmartBroadcastGradientArgs(Tensor x, Tensor y, Tensor grad) { Tensor sx, sy; if (x.shape.IsFullyDefined && diff --git a/src/TensorFlowNET.Core/Gradients/nn_grad.cs b/src/TensorFlowNET.Core/Gradients/nn_grad.cs index 15b72f55c..e95163930 100644 --- a/src/TensorFlowNET.Core/Gradients/nn_grad.cs +++ b/src/TensorFlowNET.Core/Gradients/nn_grad.cs @@ -15,6 +15,7 @@ limitations under the License. ******************************************************************************/ using System; +using System.Diagnostics; using System.Linq; using Tensorflow.Operations; using static Tensorflow.Binding; @@ -135,13 +136,35 @@ public static Tensor[] _SquaredDifferenceGrad(Operation op, Tensor[] grads) { Tensor x = op.inputs[0]; Tensor y = op.inputs[1]; + var grad = grads[0]; var scale = ops.convert_to_tensor(2.0f, dtype: x.dtype); - var x_grad = math_ops.scalar_mul(scale, grads[0]) * (x - y); - return new Tensor[] + var x_grad = math_ops.scalar_mul(scale, grad) * (x - y); + if (math_grad._ShapesFullySpecifiedAndEqual(x, y, grad)) { - x_grad, - -x_grad - }; + return new Tensor[] { x_grad, -x_grad }; + } + var broadcast_info = math_grad.SmartBroadcastGradientArgs(x, y, grad); + Debug.Assert(broadcast_info.Length == 2); + var (sx, rx, must_reduce_x) = broadcast_info[0]; + var (sy, ry, must_reduce_y) = broadcast_info[1]; + Tensor gx, gy; + if (must_reduce_x) + { + gx = array_ops.reshape(math_ops.reduce_sum(x_grad, rx), sx); + } + else + { + gx = x_grad; + } + if (must_reduce_y) + { + gy = -array_ops.reshape(math_ops.reduce_sum(x_grad, ry), sy); + } + else + { + gy = -x_grad; + } + return new Tensor[] { gx, gy }; } /// diff --git a/src/TensorFlowNET.Core/Gradients/ops.gradient_function_mapping.cs b/src/TensorFlowNET.Core/Gradients/ops.gradient_function_mapping.cs index e5831f252..7d3ea1715 100644 --- a/src/TensorFlowNET.Core/Gradients/ops.gradient_function_mapping.cs +++ b/src/TensorFlowNET.Core/Gradients/ops.gradient_function_mapping.cs @@ -98,12 +98,23 @@ public static Func get_gradient_function(Operatio { if (op.inputs == null) return null; - RegisterFromAssembly(); + var gradient_function = op._gradient_function; + if(gradient_function is null) + { + RegisterFromAssembly(); + + if (!gradientFunctions.ContainsKey(op.type)) + throw new LookupError($"can't get graident function through get_gradient_function {op.type}"); - if (!gradientFunctions.ContainsKey(op.type)) - throw new LookupError($"can't get graident function through get_gradient_function {op.type}"); + return gradientFunctions[op.type]; + } - return gradientFunctions[op.type]; + Tensor[] wrapped_gradient_function(Operation operation, Tensor[] args) + { + return gradient_function(operation, args); + } + // TODO(Rinne): check if this needs to be registered. + return wrapped_gradient_function; } } } diff --git a/src/TensorFlowNET.Core/GraphTransformation/GraphTransformer.cs b/src/TensorFlowNET.Core/GraphTransformation/GraphTransformer.cs index 8870e295f..f662b4486 100644 --- a/src/TensorFlowNET.Core/GraphTransformation/GraphTransformer.cs +++ b/src/TensorFlowNET.Core/GraphTransformation/GraphTransformer.cs @@ -22,21 +22,19 @@ public GraphDef TransformGraph(GraphDef input_graph_def, var inputs_string = string.Join(",", inputs); var outputs_string = string.Join(",", outputs); var transforms_string = string.Join(" ", transforms); - using (var status = new Status()) - { - var buffer = new Buffer(); - var len = c_api.TransformGraphWithStringInputs(input_graph_def_string, - input_graph_def_string.Length, - inputs_string, - outputs_string, - transforms_string, - buffer.Handle, - status.Handle); + var status = new Status(); + var buffer = new Buffer(); + var len = c_api.TransformGraphWithStringInputs(input_graph_def_string, + input_graph_def_string.Length, + inputs_string, + outputs_string, + transforms_string, + buffer, + status); - status.Check(false); - var bytes = buffer.ToArray(); - return GraphDef.Parser.ParseFrom(bytes); - } + status.Check(false); + var bytes = buffer.ToArray(); + return GraphDef.Parser.ParseFrom(bytes); } } } diff --git a/src/TensorFlowNET.Core/Graphs/AutoGraph.cs b/src/TensorFlowNET.Core/Graphs/AutoGraph.cs index ceeca8abf..48d14d6bd 100644 --- a/src/TensorFlowNET.Core/Graphs/AutoGraph.cs +++ b/src/TensorFlowNET.Core/Graphs/AutoGraph.cs @@ -37,11 +37,9 @@ public Func to_graph(Func func, TF_DataType dtyp 1); return result[0]; } - using (var s = tf.Session(input.graph)) - { - var output = func(input); - return output; - } + var s = tf.Session(input.graph); + var output = func(input); + return output; }; } @@ -75,12 +73,10 @@ public Func to_graph(Func func, 1); return result[0]; } - using (var s = tf.Session(a.graph)) - { - Debug.Assert(a.graph == b.graph); - var output = func(a, b); - return output; - } + var s = tf.Session(a.graph); + Debug.Assert(a.graph == b.graph); + var output = func(a, b); + return output; }; } } diff --git a/src/TensorFlowNET.Core/Graphs/AutoGraphAttribute.cs b/src/TensorFlowNET.Core/Graphs/AutoGraphAttribute.cs index 31cc9c0bd..cc283db4e 100644 --- a/src/TensorFlowNET.Core/Graphs/AutoGraphAttribute.cs +++ b/src/TensorFlowNET.Core/Graphs/AutoGraphAttribute.cs @@ -1,6 +1,7 @@ using MethodBoundaryAspect.Fody.Attributes; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using Tensorflow.Eager; using Tensorflow.Functions; @@ -22,7 +23,7 @@ public sealed class AutoGraphAttribute : OnMethodBoundaryAspect public override void OnEntry(MethodExecutionArgs args) { // TODO: func_name can be cache in FullName + Args - func_name = $"{args.Method.DeclaringType.FullName}.{args.Method.Name}_{ops.uid_function()}"; + func_name = $"{args.Method.DeclaringType.FullName}.{args.Method.Name}"; if (functions.ContainsKey(func_name)) { @@ -91,6 +92,7 @@ public override void OnExit(MethodExecutionArgs args) // cache function. function.ReturnType = args.ReturnValue.GetType(); + function._set_infer_function(); functions[func_name] = function; // run function diff --git a/src/TensorFlowNET.Core/Graphs/FuncGraph.cs b/src/TensorFlowNET.Core/Graphs/FuncGraph.cs index df750813d..3bce52ea5 100644 --- a/src/TensorFlowNET.Core/Graphs/FuncGraph.cs +++ b/src/TensorFlowNET.Core/Graphs/FuncGraph.cs @@ -1,258 +1,609 @@ using Google.Protobuf; using System; -using System.Collections.Generic; +using System.Buffers; +using System.Diagnostics; using System.Linq; using Tensorflow.Eager; using Tensorflow.Exceptions; +using Tensorflow.Framework; +using Tensorflow.Framework.Models; +using Tensorflow.Functions; +using Tensorflow.NumPy; +using Tensorflow.Operations; +using Tensorflow.Util; using static Tensorflow.Binding; -namespace Tensorflow.Graphs +namespace Tensorflow.Graphs; + +/// +/// Graph representing a function body. +/// +public class FuncGraph : Graph, IDisposable { + internal SafeFuncGraphHandle _func_graph_handle; + internal HashSet _resource_tensor_inputs; + internal HashSet> _watched_variables; + internal IEnumerable> _weak_variables; + internal object[] _structured_outputs; + internal Dictionary _output_names; + public string FuncName => _graph_key; + + public Tensors Inputs { get; set; } = new Tensors(); + public Tensors Outputs { get; set; } = new Tensors(); + public Tensors FlatStructuredOutputs + { + get + { + List res = new(); + foreach(var obj in _structured_outputs) + { + if(obj is Tensor tensor) + { + res.Add(tensor); + } + else if(obj is IEnumerable tensors) + { + res.AddRange(tensors); + } + else + { + throw new TypeError("The structured outputs member should be tensor or tensors."); + } + } + return res; + } + } + public string Name { get; set; } + public IEnumerable Variables + { + get + { + return _weak_variables.Select(v => + { + if (v.TryGetTarget(out var target)) + { + return target; + } + else + { + throw new AssertionError("Called a function referencing variables which have been deleted. " + + "This likely means that function-local variables were created and " + + "not referenced elsewhere in the program. This is generally a " + + "mistake; consider storing variables in an object attribute on first call."); + } + }); + } + internal set + { + _weak_variables = value.Select(x => new WeakReference(x)); + } + } + public IEnumerable TrainableVariables => Variables.Where(v => v.Trainable); + public Dictionary Attrs { get; set; } + + Dictionary _captures + = new Dictionary(); + + public Tensor[] external_captures + => _captures.Select(x => x.Value.Item1).ToArray(); + public (Tensor, Tensor)[] captures + => _captures.Values.Select(x => x).ToArray(); + + public Tensor[] internal_captures + => _captures.Select(x => x.Value.Item2).ToArray(); + + public Tensor[] captured_inputs + => external_captures; + /// - /// Graph representing a function body. + /// Construct a new FuncGraph. /// - public class FuncGraph : Graph + public FuncGraph(string name) : base() { - IntPtr _func_graph_handle; - public string FuncName => _graph_key; + outer_graph = ops.get_default_graph(); + while (outer_graph.building_function) + outer_graph = outer_graph.OuterGraph; + _graph_key = Name = name; + building_function = true; + _weak_variables = new List>(); + _resource_tensor_inputs = new HashSet(); + _watched_variables = new HashSet>(); + } - public Tensors Inputs { get; set; } = new Tensors(); - public Tensors Outputs { get; set; } = new Tensors(); - public Dictionary Attrs { get; set; } + public FuncGraph(SafeGraphHandle handle, string name, Dictionary attrs) : base() + { + outer_graph = ops.get_default_graph(); + while (outer_graph.building_function) + outer_graph = outer_graph.OuterGraph; + _graph_key = Name = name; + building_function = true; + Attrs = attrs; + // Will to test if FuncGraph has memory leak + // c_api.TF_DeleteGraph(_handle); + _handle = handle; + _weak_variables = new List>(); + _resource_tensor_inputs = new HashSet(); + _watched_variables = new HashSet>(); + } - Dictionary _captures - = new Dictionary(); + public void replace_capture(Tensor tensor, Tensor placeholder) + { + _captures[tensor.Id] = (tensor, placeholder); + } - public Tensor[] external_captures - => _captures.Select(x => x.Value.Item1).ToArray(); - public (Tensor, Tensor)[] captures - => _captures.Values.Select(x => x).ToArray(); + public unsafe void ToGraph(Operation[] opers, + Tensor[] inputs, Tensor[] outputs, + string[] output_names) + { + var status = new Status(); + if (output_names is null) + { + output_names = new string[0]; + }; + + _func_graph_handle = c_api.TF_GraphToFunction(_handle, + _graph_key, + false, + opers.Length, + opers.Select(x => (IntPtr)x).ToArray(), + inputs.Length, + inputs.Select(x => new TF_Output(x.op, 0)).ToArray(), + outputs.Length, + outputs.Select(x => new TF_Output(x.op, 0)).ToArray(), + output_names.Length != outputs.Length ? null : output_names, + IntPtr.Zero, + null, + status); + status.Check(true); + + SetAttrs(); + + // c_api.TF_GraphCopyFunction(outer_graph, _func_graph_handle, IntPtr.Zero, status.Handle); + // status.Check(true); + + c_api.TFE_ContextAddFunction(tf.Context, _func_graph_handle, status); + status.Check(true); + + _graph_key = c_api.StringPiece(c_api.TF_FunctionName(_func_graph_handle)); + + Inputs = inputs; + // mark_as_return + Outputs = outputs;// .Select(x => array_ops.identity(x)).ToArray(); + } - public Tensor[] internal_captures - => _captures.Select(x => x.Value.Item2).ToArray(); + public override Operation create_op(string op_type, Tensor[] inputs, TF_DataType[] dtypes, TF_DataType[] input_types = null, string name = null, Dictionary attrs = null, OpDef op_def = null, bool compute_device = true) + { + foreach(var (i, inp) in enumerate(inputs)) + inputs[i] = capture(inp); - public Tensor[] captured_inputs - => external_captures; + return base.create_op(op_type, inputs, dtypes, input_types, name, attrs, op_def, compute_device); + } - /// - /// Construct a new FuncGraph. - /// - public FuncGraph(string name) : base() + const int _EAGER_CONST_THRESHOLD = 128; + public Tensor capture(Tensor tensor, string name = null, Shape shape = null) + { + if(tensor is EagerTensor or NDArray) { - outer_graph = ops.get_default_graph(); - while (outer_graph.building_function) - outer_graph = outer_graph.OuterGraph; - _graph_key = name; - building_function = true; + if (name == null) + name = ops.uid().ToString(); + + // Small EagerTensors are captured with Const ops + if (dtypes.is_value_dtype(tensor.dtype) + && (tensor.rank == 0 || tensor.size < _EAGER_CONST_THRESHOLD)) + return capture_eager_tensor(tensor, name); + + // Large EagerTensors and resources are captured with Placeholder ops + return _capture_helper(tensor, name, shape: shape); } - public FuncGraph(IntPtr handle, string name, Dictionary attrs) : base() + if(tensor.graph != this) { - outer_graph = ops.get_default_graph(); - while (outer_graph.building_function) - outer_graph = outer_graph.OuterGraph; - _graph_key = name; - building_function = true; - Attrs = attrs; - // Will to test if FuncGraph has memory leak - // c_api.TF_DeleteGraph(_handle); - _handle = handle; + if (name == null) + name = tensor.op.name; + var inner_graph = tensor.graph; + while(inner_graph != null && inner_graph is FuncGraph inner_func_graph) + { + if (inner_graph == this) + throw new InaccessibleTensorError($"The tensor '{tensor.name}' cannot be accessed here: it is defined" + + " in another function or code block. Use return values," + + " explicit Python locals or TensorFlow collections to access" + + $" it. Defined in: {tensor.graph.graph_key}; accessed from: {graph_key}."); + inner_graph = inner_func_graph.outer_graph; + } + return _capture_helper(tensor, name); } - public void ToGraph(Operation[] opers, - Tensor[] inputs, Tensor[] outputs, - string[] output_names) + return tensor; + } + + public void watch_variable(IVariableV1 v) + { + if (_resource_tensor_inputs.Contains(v.Handle)) + { + return; + } + _watched_variables.Add(new WeakReference(v)); + //this = this.outer_graph; + } + + Tensor capture_eager_tensor(Tensor tensor, string name) + { + Tensor graph_const = null; + if (!_captures.ContainsKey(tensor.Id)) + { + graph_const = tf_with(ops.control_dependencies(null), ctl + => constant_op.constant(tensor.numpy(), dtype: tensor.dtype, shape: tensor.shape, name: name)); + add_capture(tensor, graph_const); + } + else { - var status = new Status(); - _func_graph_handle = c_api.TF_GraphToFunction(_handle, - _graph_key, - false, - opers.Length, - opers.Select(x => (IntPtr)x).ToArray(), - inputs.Length, - inputs.Select(x => new TF_Output(x.op, 0)).ToArray(), - outputs.Length, - outputs.Select(x => new TF_Output(x.op, 0)).ToArray(), - output_names == null || output_names.Length == 0 ? null : output_names, - IntPtr.Zero, - null, - status.Handle); - status.Check(true); - - SetAttrs(); - - // c_api.TF_GraphCopyFunction(outer_graph, _func_graph_handle, IntPtr.Zero, status.Handle); - // status.Check(true); - - c_api.TFE_ContextAddFunction(tf.Context.Handle, _func_graph_handle, status.Handle); - status.Check(true); - - _graph_key = c_api.StringPiece(c_api.TF_FunctionName(_func_graph_handle)); - - Inputs = inputs; - // mark_as_return - Outputs = outputs;// .Select(x => array_ops.identity(x)).ToArray(); + graph_const = _captures[tensor.Id].Item2; } - public override Operation create_op(string op_type, Tensor[] inputs, TF_DataType[] dtypes, TF_DataType[] input_types = null, string name = null, Dictionary attrs = null, OpDef op_def = null, bool compute_device = true) + BackwardFunction _backward_function_wrapper = (output_grads, unneeded_gradients) => { - foreach(var (i, inp) in enumerate(inputs)) - inputs[i] = capture(inp); + return output_grads; + }; - return base.create_op(op_type, inputs, dtypes, input_types, name, attrs, op_def, compute_device); + tf.Runner.RecordGradient("captured_value", + new[] { graph_const }, null, + new[] { tensor }, + getBackwardFunction: _backward_function_wrapper + /*getForwardFunction: forward_function*/); + + return graph_const; + } + + Tensor _capture_helper(Tensor tensor, string name, Shape shape = null) + { + Tensor placeholder = null; + if (!_captures.ContainsKey(tensor.Id)) + { + placeholder = _create_substitute_placeholder(tensor, + name: name, + dtype: tensor.dtype, + shape: shape); + add_capture(tensor, placeholder); + } + else + { + placeholder = _captures[tensor.Id].Item2; } - const int _EAGER_CONST_THRESHOLD = 128; - public Tensor capture(Tensor tensor, string name = null, Shape shape = null) + BackwardFunction _backward_function_wrapper = (output_grads, unneeded_gradients) => { - if(tensor is EagerTensor) - { - if (name == null) - name = ops.uid().ToString(); + return output_grads; + }; - // Small EagerTensors are captured with Const ops - if (dtypes.is_value_dtype(tensor.dtype) - && (tensor.rank == 0 || tensor.size < _EAGER_CONST_THRESHOLD)) - return capture_eager_tensor(tensor, name); + tf.Runner.RecordGradient("captured_value", + new[] { placeholder }, null, + new[] { tensor }, + getBackwardFunction: _backward_function_wrapper + /*getForwardFunction: forward_function*/); - // Large EagerTensors and resources are captured with Placeholder ops - return _capture_helper(tensor, name, shape: shape); - } + return placeholder; + } + + void add_capture(Tensor tensor, Tensor placeholder) + { + _captures.Add(tensor.Id, (tensor, placeholder)); + Inputs.Add(placeholder); + } + + Tensor pop_capture(Tensor tensor) + { + if(_captures.TryGetValue(tensor.Id, out var capture)) + { + _captures.Remove(tensor.Id); + return capture.Item2; + } + else + { + return null; + } + } + + Tensor _create_substitute_placeholder(Tensor value, + string name = null, + TF_DataType dtype = TF_DataType.DtInvalid, + Shape shape = null) + { + if (shape is null) + shape = value.shape; + if (dtype == TF_DataType.DtInvalid) + dtype = value.dtype; + + var placeholder = tf_with(ops.control_dependencies(null), ctl + => array_ops.placeholder(dtype, shape: shape, name: name)); + // custom_gradient.copy_handle_data(value, placeholder) + return placeholder; + } + + void SetAttrs() + { + if (Attrs == null) + return; + + foreach (var (_name, attr_value) in enumerate(Attrs)) + { + var serialized = attr_value.ToByteArray(); + c_api.TF_FunctionSetAttrValueProto(_func_graph_handle, _name, serialized, serialized.Length, tf.Status); + tf.Status.Check(true); + } + } + + public override Graph as_default() + { + tf.Context.graph_mode(isFunc: true); + ops.set_default_graph(this); + return this; + } + + public override void Exit() + { + tf.Context.restore_mode(); + ops.pop_graph(); + } + + public void Dispose() + { + c_api.TFE_ContextRemoveFunction(tf.Context, _graph_key, tf.Status); + } + + public static FuncGraph func_graph_from_func(string name, Func func, + object[] args, Dictionary kwargs, TensorSpec[] signature = null, + FuncGraph func_graph = null, bool autograph = false, object autograph_options = null, + bool add_control_dependencies = true, string[] arg_names = null, + Tensor op_return_value = null, bool capture_by_value = false, + bool acd_record_initial_resource_uses = false) + { + if(func_graph is null) + { + func_graph = new FuncGraph(name); + } - if(tensor.graph != this) + // TODO(Rinne): deal with control dependencies. + + func_graph.as_default(); + var current_scope = variable_scope.get_variable_scope(); + var default_use_resource = current_scope.use_resource; + current_scope.use_resource = true; + + if(signature is not null) + { + args = signature; + kwargs = new Dictionary(); + } + var func_args = _get_defun_inputs_from_args(args, arg_names); + var func_kwargs = _get_defun_inputs_from_kwargs(kwargs); + + if(func_kwargs is not null && func_kwargs.Count > 0) + { + throw new NotImplementedException("The keyword args has not been supported in `func_graph_from_func`."); + } + + foreach(var arg in nest.flatten(new object[] { func_args, func_kwargs })) + { + if(arg is Tensor tensor && tensor.dtype == dtypes.resource) { - if (name == null) - name = tensor.op.name; - var inner_graph = tensor.graph; - while(inner_graph != null && inner_graph is FuncGraph inner_func_graph) - { - if (inner_graph == this) - throw new InaccessibleTensorError($"The tensor '{tensor.name}' cannot be accessed here: it is defined" + - " in another function or code block. Use return values," + - " explicit Python locals or TensorFlow collections to access" + - $" it. Defined in: {tensor.graph.graph_key}; accessed from: {graph_key}."); - inner_graph = inner_func_graph.outer_graph; - } - return _capture_helper(tensor, name); + func_graph._resource_tensor_inputs.Add(tensor); + } + else if (arg is ResourceVariable variable) + { + func_graph._resource_tensor_inputs.Add(variable.Handle); } - - return tensor; } - Tensor capture_eager_tensor(Tensor tensor, string name) + // skip the assignment of `func_graph.structured_input_signature`. + + var flat_func_args = nest.flatten(func_args as object); + var flat_func_kwargs = nest.flatten(func_kwargs as object); + func_graph.Inputs = new Tensors(flat_func_args.concat(flat_func_kwargs) + .Where(x => x is Tensor).Select(x => (Tensor)x)); + + //var func_args_before = nest.pack_sequence_as(func_args, flat_func_args, true); + //var func_kwargs_before = nest.pack_sequence_as(func_kwargs, flat_func_kwargs, true); + + Tensor convert(object x) { - Tensor graph_const = null; - if (!_captures.ContainsKey(tensor.Id)) + if (x is null) return null; + Tensor res = null; + if(op_return_value is not null && x is Operation) { - graph_const = tf_with(ops.control_dependencies(null), ctl - => constant_op.constant(tensor.numpy(), dtype: tensor.dtype, shape: tensor.shape, name: name)); - add_capture(tensor, graph_const); + tf_with(ops.control_dependencies(new object[] { x }), _ => + { + res = array_ops.identity(op_return_value); + }); + } + else if(x is not TensorArray) + { + Debug.Assert(x is Tensor); + res = ops.convert_to_tensor_or_composite(x as Tensor); } else { - graph_const = _captures[tensor.Id].Item2; + throw new NotImplementedException($"The `TensorArray` is not supported here currently."); } - - BackwardFunction _backward_function_wrapper = (output_grads, unneeded_gradients) => + if (add_control_dependencies) { - return output_grads; - }; - - tf.Runner.RecordGradient("captured_value", - new[] { graph_const }, null, - new[] { tensor }, - getBackwardFunction: _backward_function_wrapper - /*getForwardFunction: forward_function*/); + // TODO(Rinne): `x = deps_ctx.mark_as_return(x)`. + } + return res; + } - return graph_const; + if (autograph) + { + throw new NotImplementedException("The autograph of `func_graph_from_func` has not been supported."); } - Tensor _capture_helper(Tensor tensor, string name, Shape shape = null) + var func_outputs = func(func_args); + func_outputs = variable_utils.convert_variables_to_tensors(func_outputs); + func_outputs = func_outputs.Select(x => convert(x)).ToArray(); + // TODO(Rinne): `check_func_mutation`. + + current_scope.use_resource = default_use_resource; + + var graph_variables = func_graph._watched_variables.ToList(); + HashSet arg_variables = new HashSet(); + List inputs = new(); + foreach(var arg in composite_tensor_utils.flatten_with_variables(func_args)) { - Tensor placeholder = null; - if (!_captures.ContainsKey(tensor.Id)) + if(arg is BaseResourceVariable variable) { - placeholder = _create_substitute_placeholder(tensor, - name: name, - dtype: tensor.dtype, - shape: shape); - add_capture(tensor, placeholder); + var resource_placeholder = func_graph.pop_capture(variable.Handle); + if(resource_placeholder is null) + { + continue; + } + Debug.Assert(variable is IVariableV1); + arg_variables.Add(variable as IVariableV1); + inputs.Add(resource_placeholder); + } + else if(arg is Tensor tensor) + { + inputs.Add(tensor); + } + } + var variables = graph_variables.Select(v => + { + if (v.TryGetTarget(out var target)) + { + return target; } else { - placeholder = _captures[tensor.Id].Item2; + return null; } + }).Where(v => v is not null && !arg_variables.Contains(v)); + func_graph.Inputs = inputs.Concat(func_graph.internal_captures).ToArray(); + func_graph._structured_outputs = func_outputs; + func_graph.Outputs.AddRange(func_graph.FlatStructuredOutputs.Where(x => x is not null) + .Select(x => func_graph.capture(x))); - BackwardFunction _backward_function_wrapper = (output_grads, unneeded_gradients) => - { - return output_grads; - }; + func_graph.Variables = variables; - tf.Runner.RecordGradient("captured_value", - new[] { placeholder }, null, - new[] { tensor }, - getBackwardFunction: _backward_function_wrapper - /*getForwardFunction: forward_function*/); + func_graph.Exit(); - return placeholder; + if (add_control_dependencies) + { + // TODO(Rinne): implement it. } + return func_graph; + } - void add_capture(Tensor tensor, Tensor placeholder) + private static object[] _get_defun_inputs_from_args(object[] args, string[] names) + { + return _get_defun_inputs(args, names, args) as object[]; + } + + private static Dictionary _get_defun_inputs_from_kwargs(Dictionary kwargs) + { + // TODO(Rinne): implement it. + Debug.Assert(kwargs is null || kwargs.Count == 0); + return kwargs; + //string[] names; + //object[] args; + //if(kwargs is not null && kwargs.Count > 0) + //{ + // var sorted_kwargs = kwargs.OrderBy(x => x.Key); + // names = sorted_kwargs.Select(x => x.Key).ToArray(); + // args = sorted_kwargs.Select(x => x.Value).ToArray(); + //} + //else + //{ + // names = new string[0]; + // args = new object[0]; + //} + //return _get_defun_inputs(args, names, kwargs) as Dictionary; + } + + private static object _get_defun_inputs(object[] args, string[] names, object structured_args) + { + List function_inputs = new(); + if(names is null) { - _captures.Add(tensor.Id, (tensor, placeholder)); - Inputs.Add(placeholder); + names = new string[args.Length]; } - Tensor _create_substitute_placeholder(Tensor value, - string name = null, - TF_DataType dtype = TF_DataType.DtInvalid, - Shape shape = null) + foreach(var (arg_value, name) in zip(args, names)) { - if (shape is null) - shape = value.shape; - if (dtype == TF_DataType.DtInvalid) - dtype = value.dtype; - - var placeholder = tf_with(ops.control_dependencies(null), ctl - => array_ops.placeholder(dtype, shape: shape, name: name)); - // custom_gradient.copy_handle_data(value, placeholder) - return placeholder; + foreach(var val in composite_tensor_utils.flatten_with_variables_or_variable_specs(arg_value)) + { + function_inputs.Add(_get_defun_input(val, name)); + } } + return nest.pack_sequence_as(structured_args, nest.flatten(function_inputs), true); + } - void SetAttrs() + private static object _get_defun_input(object arg, string name) + { + var func_graph = ops.get_default_graph() as FuncGraph; + Debug.Assert(func_graph is not null); + if (arg is Tensor tensor) { - if (Attrs == null) - return; - - foreach (var (_name, attr_value) in enumerate(Attrs)) + Tensor placeholder; + try + { + placeholder = tf.placeholder(tensor.dtype, tensor.shape, name); + } + catch (ValueError) + { + // TODO(Rinne): Add warning here. + placeholder = tf.placeholder(tensor.dtype, tensor.shape); + } + handle_data_util.copy_handle_data(tensor, placeholder); + if (name is not null) { - var serialized = new AttrValue + placeholder.op._set_attr("_user_specified_name", new AttrValue() { - S = ByteString.CopyFromUtf8(attr_value) - }.ToByteArray(); - c_api.TF_FunctionSetAttrValueProto(_func_graph_handle, _name, serialized, serialized.Length, tf.Status.Handle); - tf.Status.Check(true); + S = tf.compat.as_bytes(name) + }); } + return placeholder; } - - public override Graph as_default() + else if (arg is TensorSpec spec) { - tf.Context.graph_mode(isFunc: true); - ops.set_default_graph(this); - return this; + string requested_name; + if (!string.IsNullOrEmpty(spec.name)) + { + requested_name = spec.name; + } + else + { + requested_name = name; + } + Tensor placeholder; + try + { + placeholder = tf.placeholder(spec.dtype, spec.shape, requested_name); + } + catch (ValueError) + { + // TODO(Rinne): Add warning here. + placeholder = tf.placeholder(spec.dtype, spec.shape); + } + if (name is not null) + { + placeholder.op._set_attr("_user_specified_name", new AttrValue() + { + S = tf.compat.as_bytes(requested_name) + }); + } + return placeholder; } - - public override void Exit() + else if (arg is BaseResourceVariable variable) { - tf.Context.restore_mode(); - ops.pop_graph(); + var placeholder = func_graph.capture(variable.Handle, name); + placeholder.op._set_attr("_user_specified_name", new AttrValue() + { + S = tf.compat.as_bytes(name) + }); + return arg; } - - protected override void DisposeUnmanagedResources(IntPtr handle) + // TODO(Rinne): deal with `VariableSpec`. + else { - c_api.TFE_ContextRemoveFunction(tf.Context.Handle, _graph_key, tf.Status.Handle); - c_api.TF_DeleteFunction(_func_graph_handle); - base.DisposeUnmanagedResources(handle); + return arg; } } } diff --git a/src/TensorFlowNET.Core/Graphs/Graph.Export.cs b/src/TensorFlowNET.Core/Graphs/Graph.Export.cs index 612c74015..a11d91e73 100644 --- a/src/TensorFlowNET.Core/Graphs/Graph.Export.cs +++ b/src/TensorFlowNET.Core/Graphs/Graph.Export.cs @@ -24,7 +24,7 @@ public partial class Graph public Buffer ToGraphDef(Status s) { var buffer = new Buffer(); - c_api.TF_GraphToGraphDef(_handle, buffer.Handle, s.Handle); + c_api.TF_GraphToGraphDef(_handle, buffer, s); s.Check(true); return buffer; @@ -33,14 +33,12 @@ public Buffer ToGraphDef(Status s) private GraphDef _as_graph_def(bool add_shapes = false) { GraphDef def; - using (var status = new Status()) - using (var buffer = ToGraphDef(status)) - { - status.Check(true); - // limit size to 250M, recursion to max 100 - var inputStream = CodedInputStream.CreateWithLimits(buffer.DangerousMemoryBlock, 250 * 1024 * 1024, 100); - def = GraphDef.Parser.ParseFrom(inputStream); - } + var status = new Status(); + var buffer = ToGraphDef(status); + status.Check(true); + // limit size to 250M, recursion to max 100 + var inputStream = CodedInputStream.CreateWithLimits(buffer.DangerousMemoryBlock, 250 * 1024 * 1024, 100); + def = GraphDef.Parser.ParseFrom(inputStream); // Strip the experimental library field iff it's empty. // if(def.Library.Function.Count == 0) diff --git a/src/TensorFlowNET.Core/Graphs/Graph.Gradient.cs.cs b/src/TensorFlowNET.Core/Graphs/Graph.Gradient.cs.cs index 91aef2dcb..bed8b35ca 100644 --- a/src/TensorFlowNET.Core/Graphs/Graph.Gradient.cs.cs +++ b/src/TensorFlowNET.Core/Graphs/Graph.Gradient.cs.cs @@ -1,4 +1,6 @@ -namespace Tensorflow +using Tensorflow.Graphs; + +namespace Tensorflow { public partial class Graph { @@ -6,5 +8,10 @@ public void _colocate_with_for_gradient(Operation op, string gradient_uid, bool { } + + internal GraphOverrideGradientContext _override_gradient_function(Dictionary> gradient_function_map) + { + return new GraphOverrideGradientContext(this, gradient_function_map); + } } } diff --git a/src/TensorFlowNET.Core/Graphs/Graph.Import.cs b/src/TensorFlowNET.Core/Graphs/Graph.Import.cs index 28ecd64e4..b80e26590 100644 --- a/src/TensorFlowNET.Core/Graphs/Graph.Import.cs +++ b/src/TensorFlowNET.Core/Graphs/Graph.Import.cs @@ -29,7 +29,7 @@ public unsafe TF_Output[] ImportGraphDefWithReturnOutputs(Buffer graph_def, Impo int size = Marshal.SizeOf(); var return_output_handle = Marshal.AllocHGlobal(size * num_return_outputs); - c_api.TF_GraphImportGraphDefWithReturnOutputs(_handle, graph_def.Handle, opts.Handle, return_output_handle, num_return_outputs, s.Handle); + c_api.TF_GraphImportGraphDefWithReturnOutputs(_handle, graph_def, opts, return_output_handle, num_return_outputs, s); var tf_output_ptr = (TF_Output*)return_output_handle; for (int i = 0; i < num_return_outputs; i++) @@ -48,15 +48,14 @@ public bool Import(string file_path, string prefix = "") public bool Import(byte[] bytes, string prefix = "") { - using (var opts = new ImportGraphDefOptions()) - using (var status = new Status()) - using (var graph_def = new Buffer(bytes)) - { - c_api.TF_ImportGraphDefOptionsSetPrefix(opts.Handle, prefix); - c_api.TF_GraphImportGraphDef(_handle, graph_def.Handle, opts.Handle, status.Handle); - status.Check(true); - return status.Code == TF_Code.TF_OK; - } + var opts = new ImportGraphDefOptions(); + var status = new Status(); + var graph_def = new Buffer(bytes); + + c_api.TF_ImportGraphDefOptionsSetPrefix(opts, prefix); + c_api.TF_GraphImportGraphDef(_handle, graph_def, opts, status); + status.Check(true); + return status.Code == TF_Code.TF_OK; } public Graph ImportGraphDef(string file_path, string name = null) diff --git a/src/TensorFlowNET.Core/Graphs/Graph.Operation.cs b/src/TensorFlowNET.Core/Graphs/Graph.Operation.cs index fc3566875..c788aaf01 100644 --- a/src/TensorFlowNET.Core/Graphs/Graph.Operation.cs +++ b/src/TensorFlowNET.Core/Graphs/Graph.Operation.cs @@ -118,7 +118,7 @@ public ITensorOrOperation _get_operation_by_tf_operation(IntPtr tf_oper) /// (Optional.) If True, device functions will be executed /// to compute the device property of the Operation. /// An `Operation` object. - public Operation _create_op_from_tf_operation(IntPtr c_op, bool compute_device = true) + public Operation _create_op_from_tf_operation(IntPtr c_op, bool compute_device = true, OperationDescription desc = null) { var ret = new Operation(c_op, this); _add_op(ret); diff --git a/src/TensorFlowNET.Core/Graphs/Graph.cs b/src/TensorFlowNET.Core/Graphs/Graph.cs index 2a982274a..eb8df5812 100644 --- a/src/TensorFlowNET.Core/Graphs/Graph.cs +++ b/src/TensorFlowNET.Core/Graphs/Graph.cs @@ -19,6 +19,10 @@ limitations under the License. using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; +using Tensorflow.Framework; +using Tensorflow.Functions; +using Tensorflow.Common.Extensions; +using Tensorflow.Graphs; using static Tensorflow.Binding; namespace Tensorflow @@ -75,9 +79,9 @@ all variables that are created during the construction of a graph. The caller /// then create a TensorFlow session to run parts of the graph across a set of local and remote devices. /// /// https://www.tensorflow.org/guide/graphs

https://www.tensorflow.org/api_docs/python/tf/Graph
- public partial class Graph : DisposableObject - , IEnumerable + public partial class Graph : IEnumerable { + protected new SafeGraphHandle _handle; private Dictionary _nodes_by_id; public Dictionary _nodes_by_name; private Dictionary _names_in_use; @@ -85,6 +89,13 @@ public partial class Graph : DisposableObject private int _next_id_counter; private List _unfetchable_ops = new List(); private List _unfeedable_tensors = new List(); + private Dictionary _functions = new(); + internal Dictionary> _gradient_function_map = new(); + private VersionDef _graph_def_versions = new VersionDef() + { + Producer = versions.GRAPH_DEF_VERSION, + MinConsumer = versions.GRAPH_DEF_VERSION_MIN_CONSUMER + }; public string _name_stack = ""; protected string _graph_key; @@ -120,6 +131,8 @@ public int seed protected Graph outer_graph; public Graph OuterGraph => outer_graph; + public Dictionary Functions => _functions; + public SafeGraphHandle c_graph => _handle; public Graph() { @@ -130,15 +143,6 @@ public Graph() _graph_key = $"graph-{ops.GraphUniqueId()}/"; } - public Graph(IntPtr handle) - { - _handle = handle; - _nodes_by_id = new Dictionary(); - _nodes_by_name = new Dictionary(); - _names_in_use = new Dictionary(); - _graph_key = $"grap-{ops.GraphUniqueId()}/"; - } - public ITensorOrOperation as_graph_element(object obj, bool allow_tensor = true, bool allow_operation = true) { return _as_graph_element_locked(obj, allow_tensor, allow_operation); @@ -155,6 +159,44 @@ public virtual Graph as_default() return ops.set_default_graph(this); } + public bool IsFunction(string name) + { + return _functions.ContainsKey(tf.compat.as_str(name)); + } + + internal void AddFunction(EagerDefinedFunction function) + { + _check_not_finalized(); + + var name = function.Name; + if(function._grad_func_name is not null && function.csharp_grad_func is not null) + { + throw new ValueError($"Gradient defined twice for function {name}"); + } + + var c_graph = this.c_graph; + var func = function._c_func.Get(); + Status status = new(); + if (function._grad_func is not null) + { + var gradient = function._grad_func._c_func.Get(); + c_api.TF_GraphCopyFunction(c_graph, func, gradient, status); + status.Check(true); + } + else + { + c_api.TF_GraphCopyFunction(c_graph, func, new SafeFuncGraphHandle(IntPtr.Zero), status); + status.Check(true); + } + + _functions[tf.compat.as_str(name)] = function; + + if(_graph_def_versions.MinConsumer < 12) + { + _graph_def_versions.MinConsumer = 12; + } + } + private Tensor _as_graph_element(object obj) { if (obj is RefVariable var) @@ -303,13 +345,22 @@ public virtual Operation create_op(string op_type, Tensor[] inputs, TF_DataType[ return op; } - public void device(string device_name) + public ITensorFlowObject device(string device_name) + { + return new GraphDeviceContext(this, device_name); + } + + private void add_device_to_stack(string device_name, int offset = 0) { - + // TODO(Rinne): deal with device spec. + int total_offset = offset + 1; } private void _create_op_helper(Operation op, bool compute_device = true) { + // high priority + // TODO(Rinne): complete the implementation. + op._gradient_function = _gradient_function_map.GetOrDefault(op.type, null); _record_op_seen_by_control_dependencies(op); } @@ -486,16 +537,6 @@ public void prevent_fetching(Operation op) _unfetchable_ops.Add(op); } - protected override void DisposeManagedResources() - { - - } - - protected override void DisposeUnmanagedResources(IntPtr handle) - { - c_api.TF_DeleteGraph(handle); - } - public Tensor get_tensor_by_tf_output(TF_Output tf_output) { var op = _get_operation_by_tf_operation(tf_output.oper); @@ -517,14 +558,14 @@ public Tensor get_tensor_by_name(string name) public Shape GetTensorShape(TF_Output output) { var status = tf.Status; - var ndim = c_api.TF_GraphGetTensorNumDims(_handle, output, status.Handle); + var ndim = c_api.TF_GraphGetTensorNumDims(_handle, output, status); status.Check(); if (ndim == -1) return Shape.Null; var dims = new long[ndim]; - c_api.TF_GraphGetTensorShape(_handle, output, dims, dims.Length, status.Handle); + c_api.TF_GraphGetTensorShape(_handle, output, dims, dims.Length, status); status.Check(); return new Shape(dims.Select(x => (int)x).ToArray()); @@ -536,10 +577,15 @@ public virtual void Exit() ops.pop_graph(); } + internal EagerDefinedFunction _get_function(string name) + { + return _functions.GetOrDefault(name, null); + } + string debugString = string.Empty; public override string ToString() { - return $"{graph_key}, 0x{_handle.ToString("x16")}"; + return $"{graph_key}, 0x{_handle.DangerousGetHandle().ToString("x16")}"; /*if (string.IsNullOrEmpty(debugString)) { int len = 0; @@ -558,7 +604,7 @@ IEnumerator IEnumerable.GetEnumerator() IEnumerator IEnumerable.GetEnumerator() => throw new NotImplementedException(); - public static implicit operator IntPtr(Graph graph) + public static implicit operator SafeGraphHandle(Graph graph) { return graph._handle; } diff --git a/src/TensorFlowNET.Core/Graphs/GraphDeviceContext.cs b/src/TensorFlowNET.Core/Graphs/GraphDeviceContext.cs new file mode 100644 index 000000000..2754c2b36 --- /dev/null +++ b/src/TensorFlowNET.Core/Graphs/GraphDeviceContext.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow.Graphs +{ + public class GraphDeviceContext : ITensorFlowObject + { + private Graph _graph; + + public GraphDeviceContext(Graph graph, string device_name) + { + _graph = graph; + } + + public void __enter__() + { + + } + + public void __exit__() + { + + } + + public void Dispose() + { + + } + } +} diff --git a/src/TensorFlowNET.Core/Graphs/GraphOverrideGradientContext.cs b/src/TensorFlowNET.Core/Graphs/GraphOverrideGradientContext.cs new file mode 100644 index 000000000..2befbbff6 --- /dev/null +++ b/src/TensorFlowNET.Core/Graphs/GraphOverrideGradientContext.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Text; + +namespace Tensorflow.Graphs +{ + internal class GraphOverrideGradientContext: ITensorFlowObject + { + Graph _graph; + Dictionary> _new_gradient_function_map; + public GraphOverrideGradientContext(Graph graph, + Dictionary> new_gradient_function_map) + { + _graph = graph; + _new_gradient_function_map = new_gradient_function_map; + } + + [DebuggerStepThrough] + public void __enter__() + { + Debug.Assert(_graph._gradient_function_map.Count == 0); + _graph._gradient_function_map = _new_gradient_function_map; + } + + [DebuggerStepThrough] + public void __exit__() + { + _graph._gradient_function_map = new Dictionary>(); + } + + public void Dispose() + { + + } + } +} diff --git a/src/TensorFlowNET.Core/Graphs/ImportGraphDefOptions.cs b/src/TensorFlowNET.Core/Graphs/ImportGraphDefOptions.cs index a04cf55a4..a7ce6ff5f 100644 --- a/src/TensorFlowNET.Core/Graphs/ImportGraphDefOptions.cs +++ b/src/TensorFlowNET.Core/Graphs/ImportGraphDefOptions.cs @@ -14,28 +14,29 @@ You may obtain a copy of the License at limitations under the License. ******************************************************************************/ -using System; +namespace Tensorflow; -namespace Tensorflow +public sealed class ImportGraphDefOptions { - public sealed class ImportGraphDefOptions : IDisposable - { - public SafeImportGraphDefOptionsHandle Handle { get; } + SafeImportGraphDefOptionsHandle _handle { get; } - public int NumReturnOutputs - => c_api.TF_ImportGraphDefOptionsNumReturnOutputs(Handle); + public int NumReturnOutputs + => c_api.TF_ImportGraphDefOptionsNumReturnOutputs(_handle); - public ImportGraphDefOptions() - { - Handle = c_api.TF_NewImportGraphDefOptions(); - } + public ImportGraphDefOptions() + { + _handle = c_api.TF_NewImportGraphDefOptions(); + } - public void AddReturnOutput(string name, int index) - { - c_api.TF_ImportGraphDefOptionsAddReturnOutput(Handle, name, index); - } + public SafeImportGraphDefOptionsHandle Options => _handle; - public void Dispose() - => Handle.Dispose(); + public void AddReturnOutput(string name, int index) + { + c_api.TF_ImportGraphDefOptionsAddReturnOutput(_handle, name, index); + } + + public static implicit operator SafeImportGraphDefOptionsHandle(ImportGraphDefOptions opt) + { + return opt._handle; } } diff --git a/src/TensorFlowNET.Core/Graphs/SafeFuncGraphHandle.cs b/src/TensorFlowNET.Core/Graphs/SafeFuncGraphHandle.cs new file mode 100644 index 000000000..f38301b64 --- /dev/null +++ b/src/TensorFlowNET.Core/Graphs/SafeFuncGraphHandle.cs @@ -0,0 +1,22 @@ +using Tensorflow.Util; + +namespace Tensorflow; + +public sealed class SafeFuncGraphHandle : SafeTensorflowHandle +{ + private SafeFuncGraphHandle() + { + } + + public SafeFuncGraphHandle(IntPtr handle) + : base(handle) + { + } + + protected override bool ReleaseHandle() + { + c_api.TF_DeleteFunction(handle); + SetHandle(IntPtr.Zero); + return true; + } +} diff --git a/src/TensorFlowNET.Core/Graphs/SafeGraphHandle.cs b/src/TensorFlowNET.Core/Graphs/SafeGraphHandle.cs new file mode 100644 index 000000000..a6da01987 --- /dev/null +++ b/src/TensorFlowNET.Core/Graphs/SafeGraphHandle.cs @@ -0,0 +1,22 @@ +using Tensorflow.Util; + +namespace Tensorflow; + +public sealed class SafeGraphHandle : SafeTensorflowHandle +{ + private SafeGraphHandle() + { + } + + public SafeGraphHandle(IntPtr handle) + : base(handle) + { + } + + protected override bool ReleaseHandle() + { + c_api.TF_DeleteGraph(handle); + SetHandle(IntPtr.Zero); + return true; + } +} diff --git a/src/TensorFlowNET.Core/Graphs/c_api.graph.cs b/src/TensorFlowNET.Core/Graphs/c_api.graph.cs index 6eb8f367f..e0c58966d 100644 --- a/src/TensorFlowNET.Core/Graphs/c_api.graph.cs +++ b/src/TensorFlowNET.Core/Graphs/c_api.graph.cs @@ -60,7 +60,7 @@ public partial class c_api /// /// [DllImport(TensorFlowLibName)] - public static extern void TF_GraphGetTensorShape(IntPtr graph, TF_Output output, long[] dims, int num_dims, SafeStatusHandle status); + public static extern void TF_GraphGetTensorShape(SafeGraphHandle graph, TF_Output output, long[] dims, int num_dims, SafeStatusHandle status); /// /// Import the graph serialized in `graph_def` into `graph`. @@ -78,7 +78,7 @@ public partial class c_api /// int /// TF_Status* [DllImport(TensorFlowLibName)] - public static extern unsafe void TF_GraphImportGraphDefWithReturnOutputs(IntPtr graph, SafeBufferHandle graph_def, SafeImportGraphDefOptionsHandle options, IntPtr return_outputs, int num_return_outputs, SafeStatusHandle status); + public static extern unsafe void TF_GraphImportGraphDefWithReturnOutputs(SafeGraphHandle graph, SafeBufferHandle graph_def, SafeImportGraphDefOptionsHandle options, IntPtr return_outputs, int num_return_outputs, SafeStatusHandle status); /// /// Import the graph serialized in `graph_def` into `graph`. Returns nullptr and @@ -92,7 +92,7 @@ public partial class c_api /// TF_Status* /// TF_ImportGraphDefResults* [DllImport(TensorFlowLibName)] - public static extern SafeImportGraphDefResultsHandle TF_GraphImportGraphDefWithResults(IntPtr graph, SafeBufferHandle graph_def, SafeImportGraphDefOptionsHandle options, SafeStatusHandle status); + public static extern SafeImportGraphDefResultsHandle TF_GraphImportGraphDefWithResults(SafeGraphHandle graph, SafeBufferHandle graph_def, SafeImportGraphDefOptionsHandle options, SafeStatusHandle status); /// /// Import the graph serialized in `graph_def` into `graph`. @@ -102,7 +102,7 @@ public partial class c_api /// TF_ImportGraphDefOptions* /// TF_Status* [DllImport(TensorFlowLibName)] - public static extern void TF_GraphImportGraphDef(IntPtr graph, SafeBufferHandle graph_def, SafeImportGraphDefOptionsHandle options, SafeStatusHandle status); + public static extern void TF_GraphImportGraphDef(SafeGraphHandle graph, SafeBufferHandle graph_def, SafeImportGraphDefOptionsHandle options, SafeStatusHandle status); /// /// Iterate through the operations of a graph. @@ -111,7 +111,7 @@ public partial class c_api /// /// [DllImport(TensorFlowLibName)] - public static extern IntPtr TF_GraphNextOperation(IntPtr graph, ref uint pos); + public static extern IntPtr TF_GraphNextOperation(SafeGraphHandle graph, ref uint pos); /// /// Returns the operation in the graph with `oper_name`. Returns nullptr if @@ -121,14 +121,14 @@ public partial class c_api /// /// [DllImport(TensorFlowLibName)] - public static extern IntPtr TF_GraphOperationByName(IntPtr graph, string oper_name); + public static extern IntPtr TF_GraphOperationByName(SafeGraphHandle graph, string oper_name); /// /// Sets the shape of the Tensor referenced by `output` in `graph` to /// the shape described by `dims` and `num_dims`. /// [DllImport(TensorFlowLibName)] - public static extern void TF_GraphSetTensorShape(IntPtr graph, TF_Output output, long[] dims, int num_dims, SafeStatusHandle status); + public static extern void TF_GraphSetTensorShape(SafeGraphHandle graph, TF_Output output, long[] dims, int num_dims, SafeStatusHandle status); /// /// Write out a serialized representation of `graph` (as a GraphDef protocol @@ -138,7 +138,7 @@ public partial class c_api /// TF_Buffer* /// TF_Status* [DllImport(TensorFlowLibName)] - public static extern void TF_GraphToGraphDef(IntPtr graph, SafeBufferHandle output_graph_def, SafeStatusHandle status); + public static extern void TF_GraphToGraphDef(SafeGraphHandle graph, SafeBufferHandle output_graph_def, SafeStatusHandle status); /// /// Returns the number of dimensions of the Tensor referenced by `output` @@ -151,7 +151,7 @@ public partial class c_api /// /// [DllImport(TensorFlowLibName)] - public static extern int TF_GraphGetTensorNumDims(IntPtr graph, TF_Output output, SafeStatusHandle status); + public static extern int TF_GraphGetTensorNumDims(SafeGraphHandle graph, TF_Output output, SafeStatusHandle status); /// /// Cause the imported graph to have a control dependency on `oper`. `oper` @@ -185,6 +185,9 @@ public partial class c_api [DllImport(TensorFlowLibName)] public static extern void TF_ImportGraphDefOptionsAddReturnOperation(SafeImportGraphDefOptionsHandle opts, string oper_name); + [DllImport(TensorFlowLibName)] + public static extern void TF_ImportGraphDefOptionsSetValidateColocationConstraints(SafeImportGraphDefOptionsHandle options, bool validate_colocation_constraints); + /// /// 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 @@ -246,7 +249,7 @@ public partial class c_api /// TF_ImportGraphDefOptions* /// unsigned char [DllImport(TensorFlowLibName)] - public static extern void TF_ImportGraphDefOptionsSetUniquifyNames(SafeImportGraphDefOptionsHandle ops, char uniquify_prefix); + public static extern void TF_ImportGraphDefOptionsSetUniquifyNames(SafeImportGraphDefOptionsHandle ops, bool uniquify_prefix); /// /// Fetches the return operations requested via @@ -287,12 +290,12 @@ public partial class c_api /// TF_Status* /// [DllImport(TensorFlowLibName)] - public static extern IntPtr TF_LoadSessionFromSavedModel(SafeSessionOptionsHandle session_options, IntPtr run_options, + public static extern SafeSessionHandle TF_LoadSessionFromSavedModel(SafeSessionOptionsHandle session_options, IntPtr run_options, string export_dir, string[] tags, int tags_len, - IntPtr graph, IntPtr meta_graph_def, SafeStatusHandle status); + SafeGraphHandle graph, IntPtr meta_graph_def, SafeStatusHandle status); [DllImport(TensorFlowLibName)] - public static extern IntPtr TF_NewGraph(); + public static extern SafeGraphHandle TF_NewGraph(); [DllImport(TensorFlowLibName)] public static extern SafeImportGraphDefOptionsHandle TF_NewImportGraphDefOptions(); @@ -308,7 +311,7 @@ public static extern IntPtr TF_LoadSessionFromSavedModel(SafeSessionOptionsHandl /// const TF_DataType* /// TF_Status* [DllImport(TensorFlowLibName)] - public static extern void TF_GraphSetOutputHandleShapesAndTypes(IntPtr graph, TF_Output output, + public static extern void TF_GraphSetOutputHandleShapesAndTypes(SafeGraphHandle graph, TF_Output output, int num_shapes_and_types, IntPtr[] shapes, int[] ranks, DataType[] types, SafeStatusHandle status); @@ -334,6 +337,6 @@ public static extern void TF_GraphSetOutputHandleShapesAndTypes(IntPtr graph, TF /// /// [DllImport(TensorFlowLibName)] - public static extern bool TF_TryEvaluateConstant(IntPtr graph, TF_Output output, IntPtr[] result, SafeStatusHandle status); + public static extern bool TF_TryEvaluateConstant(SafeGraphHandle graph, TF_Output output, IntPtr[] result, SafeStatusHandle status); } } diff --git a/src/TensorFlowNET.Core/Keras/Activations/Activations.cs b/src/TensorFlowNET.Core/Keras/Activations/Activations.cs index b8f321e64..f0d59ed62 100644 --- a/src/TensorFlowNET.Core/Keras/Activations/Activations.cs +++ b/src/TensorFlowNET.Core/Keras/Activations/Activations.cs @@ -1,4 +1,44 @@ -namespace Tensorflow.Keras +using Newtonsoft.Json; +using System.Reflection; +using System.Runtime.Versioning; +using Tensorflow.Keras.Saving.Common; + +namespace Tensorflow.Keras { - public delegate Tensor Activation(Tensor features, string name = null); + [JsonConverter(typeof(CustomizedActivationJsonConverter))] + public class Activation + { + public string Name { get; set; } + /// + /// The parameters are `features` and `name`. + /// + public Func ActivationFunction { get; set; } + + public Tensor Apply(Tensor input, string name = null) => ActivationFunction(input, name); + + public static implicit operator Activation(Func func) + { + return new Activation() + { + Name = func.GetMethodInfo().Name, + ActivationFunction = func + }; + } + } + + public interface IActivationsApi + { + Activation GetActivationFromName(string name); + Activation Linear { get; } + + Activation Relu { get; } + + Activation Sigmoid { get; } + + Activation Softmax { get; } + + Activation Tanh { get; } + + Activation Mish { get; } + } } diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/AutoSerializeLayerArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/AutoSerializeLayerArgs.cs index 1a97b0135..583ab9322 100644 --- a/src/TensorFlowNET.Core/Keras/ArgsDefinition/AutoSerializeLayerArgs.cs +++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/AutoSerializeLayerArgs.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Text; +using Tensorflow.Keras.Saving; namespace Tensorflow.Keras.ArgsDefinition { @@ -9,7 +10,7 @@ namespace Tensorflow.Keras.ArgsDefinition /// This class has nothing but the attributes different from `LayerArgs`. /// It's used to serialize the model to `tf` format. /// If the `get_config` of a `Layer` in python code of tensorflow contains `super().get_config`, - /// then the Arg definition should inherit `utoSerializeLayerArgs` instead of `LayerArgs`. + /// then the Arg definition should inherit `AutoSerializeLayerArgs` instead of `LayerArgs`. /// public class AutoSerializeLayerArgs: LayerArgs { @@ -18,7 +19,7 @@ public class AutoSerializeLayerArgs: LayerArgs [JsonProperty("dtype")] public override TF_DataType DType { get => base.DType; set => base.DType = value; } [JsonProperty("batch_input_shape", NullValueHandling = NullValueHandling.Ignore)] - public override Shape BatchInputShape { get => base.BatchInputShape; set => base.BatchInputShape = value; } + public override KerasShapesWrapper BatchInputShape { get => base.BatchInputShape; set => base.BatchInputShape = value; } [JsonProperty("trainable")] public override bool Trainable { get => base.Trainable; set => base.Trainable = value; } } diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Convolution/ConvolutionalArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Convolution/ConvolutionalArgs.cs index 08d563c1a..f34c63d1b 100644 --- a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Convolution/ConvolutionalArgs.cs +++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Convolution/ConvolutionalArgs.cs @@ -6,53 +6,34 @@ namespace Tensorflow.Keras.ArgsDefinition { public class ConvolutionalArgs : AutoSerializeLayerArgs { - public int Rank { get; set; } = 2; + public int Rank { get; set; } [JsonProperty("filters")] public int Filters { get; set; } public int NumSpatialDims { get; set; } = Unknown; [JsonProperty("kernel_size")] - public Shape KernelSize { get; set; } = 5; + public Shape KernelSize { get; set; } /// /// specifying the stride length of the convolution. /// [JsonProperty("strides")] - public Shape Strides { get; set; } = (1, 1); + public Shape Strides { get; set; } [JsonProperty("padding")] - public string Padding { get; set; } = "valid"; + public string Padding { get; set; } [JsonProperty("data_format")] public string DataFormat { get; set; } [JsonProperty("dilation_rate")] - public Shape DilationRate { get; set; } = (1, 1); + public Shape DilationRate { get; set; } [JsonProperty("groups")] - public int Groups { get; set; } = 1; - public Activation Activation { get; set; } - private string _activationName; + public int Groups { get; set; } [JsonProperty("activation")] - public string ActivationName - { - get - { - if (string.IsNullOrEmpty(_activationName)) - { - return Activation.Method.Name; - } - else - { - return _activationName; - } - } - set - { - _activationName = value; - } - } + public Activation Activation { get; set; } [JsonProperty("use_bias")] public bool UseBias { get; set; } [JsonProperty("kernel_initializer")] - public IInitializer KernelInitializer { get; set; } = tf.glorot_uniform_initializer; + public IInitializer KernelInitializer { get; set; } [JsonProperty("bias_initializer")] - public IInitializer BiasInitializer { get; set; } = tf.zeros_initializer; + public IInitializer BiasInitializer { get; set; } [JsonProperty("kernel_regularizer")] public IRegularizer KernelRegularizer { get; set; } [JsonProperty("bias_regularizer")] diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Core/DenseArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Core/DenseArgs.cs index 8f4facbd4..0caa76ef5 100644 --- a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Core/DenseArgs.cs +++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Core/DenseArgs.cs @@ -18,28 +18,8 @@ public class DenseArgs : LayerArgs /// /// Activation function to use. /// - public Activation Activation { get; set; } - - private string _activationName; [JsonProperty("activation")] - public string ActivationName - { - get - { - if (string.IsNullOrEmpty(_activationName)) - { - return Activation.Method.Name; - } - else - { - return _activationName; - } - } - set - { - _activationName = value; - } - } + public Activation Activation { get; set; } /// /// Whether the layer uses a bias vector. diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Core/EinsumDenseArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Core/EinsumDenseArgs.cs index 9817e9c6d..e60309720 100644 --- a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Core/EinsumDenseArgs.cs +++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Core/EinsumDenseArgs.cs @@ -35,27 +35,8 @@ public class EinsumDenseArgs : AutoSerializeLayerArgs /// /// Activation function to use. /// - public Activation Activation { get; set; } - private string _activationName; [JsonProperty("activation")] - public string ActivationName - { - get - { - if (string.IsNullOrEmpty(_activationName)) - { - return Activation.Method.Name; - } - else - { - return _activationName; - } - } - set - { - _activationName = value; - } - } + public Activation Activation { get; set; } /// /// Initializer for the `kernel` weights matrix. diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Core/InputLayerArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Core/InputLayerArgs.cs index be43e0a62..e036e1912 100644 --- a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Core/InputLayerArgs.cs +++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Core/InputLayerArgs.cs @@ -1,6 +1,6 @@ using Newtonsoft.Json; using Newtonsoft.Json.Serialization; -using Tensorflow.Keras.Common; +using Tensorflow.Keras.Saving; namespace Tensorflow.Keras.ArgsDefinition { @@ -17,6 +17,6 @@ public class InputLayerArgs : LayerArgs [JsonProperty("dtype")] public override TF_DataType DType { get => base.DType; set => base.DType = value; } [JsonProperty("batch_input_shape", NullValueHandling = NullValueHandling.Ignore)] - public override Shape BatchInputShape { get => base.BatchInputShape; set => base.BatchInputShape = value; } + public override KerasShapesWrapper BatchInputShape { get => base.BatchInputShape; set => base.BatchInputShape = value; } } } diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/DataAdapterArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/DataAdapterArgs.cs index 8ce1ec655..78882e82d 100644 --- a/src/TensorFlowNET.Core/Keras/ArgsDefinition/DataAdapterArgs.cs +++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/DataAdapterArgs.cs @@ -5,8 +5,8 @@ namespace Tensorflow.Keras.ArgsDefinition { public class DataAdapterArgs: IKerasConfig { - public Tensor X { get; set; } - public Tensor Y { get; set; } + public Tensors X { get; set; } + public Tensors Y { get; set; } public IDatasetV2 Dataset { get; set; } public int BatchSize { get; set; } = 32; public int Steps { get; set; } diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/DataHandlerArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/DataHandlerArgs.cs index fd603a85e..82530e950 100644 --- a/src/TensorFlowNET.Core/Keras/ArgsDefinition/DataHandlerArgs.cs +++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/DataHandlerArgs.cs @@ -5,8 +5,8 @@ namespace Tensorflow.Keras.ArgsDefinition { public class DataHandlerArgs: IKerasConfig { - public Tensor X { get; set; } - public Tensor Y { get; set; } + public Tensors X { get; set; } + public Tensors Y { get; set; } public IDatasetV2 Dataset { get; set; } public int BatchSize { get; set; } = 32; public int StepsPerEpoch { get; set; } = -1; diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/LayerArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/LayerArgs.cs index febf14176..11b8ba39a 100644 --- a/src/TensorFlowNET.Core/Keras/ArgsDefinition/LayerArgs.cs +++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/LayerArgs.cs @@ -33,7 +33,7 @@ public class LayerArgs: IKerasConfig /// /// Only applicable to input layers. /// - public virtual Shape BatchInputShape { get; set; } + public virtual KerasShapesWrapper BatchInputShape { get; set; } public virtual int BatchSize { get; set; } = -1; diff --git a/src/TensorFlowNET.Core/Keras/ArgsDefinition/Normalization/NormalizationArgs.cs b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Normalization/NormalizationArgs.cs new file mode 100644 index 000000000..30c901453 --- /dev/null +++ b/src/TensorFlowNET.Core/Keras/ArgsDefinition/Normalization/NormalizationArgs.cs @@ -0,0 +1,15 @@ +using Newtonsoft.Json; + +namespace Tensorflow.Keras.ArgsDefinition; + +public class NormalizationArgs : PreprocessingLayerArgs +{ + [JsonProperty("axis")] + public Axis? Axis { get; set; } + [JsonProperty("mean")] + public float? Mean { get; set; } + [JsonProperty("variance")] + public float? Variance { get; set; } + + public bool Invert { get; set; } = false; +} diff --git a/src/TensorFlowNET.Core/Keras/Engine/ICallback.cs b/src/TensorFlowNET.Core/Keras/Engine/ICallback.cs new file mode 100644 index 000000000..096dbd2ef --- /dev/null +++ b/src/TensorFlowNET.Core/Keras/Engine/ICallback.cs @@ -0,0 +1,19 @@ +namespace Tensorflow.Keras.Engine; + +public interface ICallback +{ + Dictionary> history { get; set; } + void on_train_begin(); + void on_train_end(); + void on_epoch_begin(int epoch); + void on_train_batch_begin(long step); + void on_train_batch_end(long end_step, Dictionary logs); + void on_epoch_end(int epoch, Dictionary epoch_logs); + void on_predict_begin(); + void on_predict_batch_begin(long step); + void on_predict_batch_end(long end_step, Dictionary logs); + void on_predict_end(); + void on_test_begin(); + void on_test_batch_begin(long step); + void on_test_batch_end(long end_step, Dictionary logs); +} diff --git a/src/TensorFlowNET.Core/Keras/Engine/IModel.cs b/src/TensorFlowNET.Core/Keras/Engine/IModel.cs index a26d29741..19f3df9ba 100644 --- a/src/TensorFlowNET.Core/Keras/Engine/IModel.cs +++ b/src/TensorFlowNET.Core/Keras/Engine/IModel.cs @@ -1,6 +1,86 @@ -namespace Tensorflow.Keras.Engine +using Tensorflow.Functions; +using Tensorflow.Keras.Losses; +using Tensorflow.Keras.Metrics; +using Tensorflow.Keras.Saving; +using Tensorflow.NumPy; + +namespace Tensorflow.Keras.Engine; + +public interface IModel : ILayer { - public interface IModel - { - } + void compile(IOptimizer optimizer, ILossFunc loss); + + void compile(IOptimizer optimizer, ILossFunc loss, string[] metrics); + + void compile(string optimizer, string loss, string[] metrics); + + void compile(IOptimizer optimizer, ILossFunc loss, IMetricFunc[] metrics); + + ICallback fit(NDArray x, NDArray y, + int batch_size = -1, + int epochs = 1, + int verbose = 1, + List callbacks = null, + float validation_split = 0f, + (NDArray val_x, NDArray val_y)? validation_data = null, + bool shuffle = true, + int initial_epoch = 0, + int max_queue_size = 10, + int workers = 1, + bool use_multiprocessing = false); + + ICallback fit(IEnumerable x, NDArray y, + int batch_size = -1, + int epochs = 1, + int verbose = 1, + List callbacks = null, + float validation_split = 0f, + (IEnumerable val_x, NDArray val_y)? validation_data = null, + bool shuffle = true, + int initial_epoch = 0, + int max_queue_size = 10, + int workers = 1, + bool use_multiprocessing = false); + + void save(string filepath, + bool overwrite = true, + bool include_optimizer = true, + string save_format = "tf", + SaveOptions? options = null, + ConcreteFunction? signatures = null, + bool save_traces = true); + + void save_weights(string filepath, + bool overwrite = true, + string save_format = null, + object options = null); + + void load_weights(string filepath, + bool by_name = false, + bool skip_mismatch = false, + object options = null); + + Dictionary evaluate(NDArray x, NDArray y, + int batch_size = -1, + int verbose = 1, + int steps = -1, + int max_queue_size = 10, + int workers = 1, + bool use_multiprocessing = false, + bool return_dict = false, + bool is_val = false); + + Tensors predict(Tensors x, + int batch_size = -1, + int verbose = 0, + int steps = -1, + int max_queue_size = 10, + int workers = 1, + bool use_multiprocessing = false); + + void summary(int line_length = -1, float[] positions = null); + + IKerasConfig get_config(); + + bool Stop_training { get;set; } } diff --git a/src/TensorFlowNET.Core/Keras/Engine/IOptimizer.cs b/src/TensorFlowNET.Core/Keras/Engine/IOptimizer.cs new file mode 100644 index 000000000..1f989391b --- /dev/null +++ b/src/TensorFlowNET.Core/Keras/Engine/IOptimizer.cs @@ -0,0 +1,22 @@ +namespace Tensorflow.Keras.Engine; + +public interface IOptimizer +{ + Tensor[] aggregate_gradients(IEnumerable<(Tensor, IVariableV1)> grads_and_vars); + Tensor[] clip_gradients(Tensor[] grads); + void apply_gradients((Tensor, IVariableV1) grads_and_vars, + string name = null, + bool experimental_aggregate_gradients = true); + void apply_gradients(IEnumerable<(Tensor, IVariableV1)> grads_and_vars, + string name = null, + bool experimental_aggregate_gradients = true); + + void apply_gradients((Tensor, ResourceVariable) grads_and_vars, + string name = null, + bool experimental_aggregate_gradients = true); + void apply_gradients(IEnumerable<(Tensor, ResourceVariable)> grads_and_vars, + string name = null, + bool experimental_aggregate_gradients = true); + + IVariableV1 add_slot(IVariableV1 var, string slot_name, IInitializer initializer = null); +} diff --git a/src/TensorFlowNET.Core/Keras/IKerasApi.cs b/src/TensorFlowNET.Core/Keras/IKerasApi.cs index cffd3f797..db8deb24b 100644 --- a/src/TensorFlowNET.Core/Keras/IKerasApi.cs +++ b/src/TensorFlowNET.Core/Keras/IKerasApi.cs @@ -1,17 +1,61 @@ using System; using System.Collections.Generic; using System.Text; +using System.Threading; +using Tensorflow.Framework.Models; +using Tensorflow.Keras.Engine; using Tensorflow.Keras.Layers; using Tensorflow.Keras.Losses; using Tensorflow.Keras.Metrics; +using Tensorflow.Keras.Models; namespace Tensorflow.Keras { public interface IKerasApi { - public ILayersApi layers { get; } - public ILossesApi losses { get; } - public IMetricsApi metrics { get; } - public IInitializersApi initializers { get; } + IInitializersApi initializers { get; } + ILayersApi layers { get; } + ILossesApi losses { get; } + IActivationsApi activations { get; } + IOptimizerApi optimizers { get; } + IMetricsApi metrics { get; } + IModelsApi models { get; } + + /// + /// `Model` groups layers into an object with training and inference features. + /// + /// + /// + /// + IModel Model(Tensors inputs, Tensors outputs, string name = null); + + /// + /// Instantiate a Keras tensor. + /// + /// + /// + /// + /// + /// + /// A boolean specifying whether the placeholder to be created is sparse. + /// + /// + /// A boolean specifying whether the placeholder to be created is ragged. + /// + /// + /// Optional existing tensor to wrap into the `Input` layer. + /// If set, the layer will not create a placeholder tensor. + /// + /// + Tensors Input(Shape shape = null, + int batch_size = -1, + string name = null, + TF_DataType dtype = TF_DataType.DtInvalid, + bool sparse = false, + Tensor tensor = null, + bool ragged = false, + TypeSpec type_spec = null, + Shape batch_input_shape = null, + Shape batch_shape = null); } } diff --git a/src/TensorFlowNET.Core/Keras/IOptimizerApi.cs b/src/TensorFlowNET.Core/Keras/IOptimizerApi.cs new file mode 100644 index 000000000..961ce91ae --- /dev/null +++ b/src/TensorFlowNET.Core/Keras/IOptimizerApi.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Tensorflow.Keras.Engine; + +namespace Tensorflow.Keras +{ + public interface IOptimizerApi + { + /// + /// Adam optimization is a stochastic gradient descent method that is based on + /// adaptive estimation of first-order and second-order moments. + /// + /// + /// + /// + /// + /// + /// + /// + IOptimizer Adam(float learning_rate = 0.001f, + float beta_1 = 0.9f, + float beta_2 = 0.999f, + float epsilon = 1e-7f, + bool amsgrad = false, + string name = "Adam"); + + /// + /// Construct a new RMSprop optimizer. + /// + /// + /// + /// + /// + /// + /// + /// + IOptimizer RMSprop(float learning_rate = 0.001f, + float rho = 0.9f, + float momentum = 0.0f, + float epsilon = 1e-7f, + bool centered = false, + string name = "RMSprop"); + + IOptimizer SGD(float learning_rate); + } +} diff --git a/src/TensorFlowNET.Core/Keras/Layers/ILayer.cs b/src/TensorFlowNET.Core/Keras/Layers/ILayer.cs index 20a98e3d3..f76693945 100644 --- a/src/TensorFlowNET.Core/Keras/Layers/ILayer.cs +++ b/src/TensorFlowNET.Core/Keras/Layers/ILayer.cs @@ -1,7 +1,6 @@ -using System.Collections.Generic; -using Tensorflow.Keras.ArgsDefinition; -using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Engine; using Tensorflow.Keras.Saving; +using Tensorflow.NumPy; using Tensorflow.Training; namespace Tensorflow.Keras @@ -11,19 +10,22 @@ public interface ILayer: IWithTrackable, IKerasConfigable string Name { get; } bool Trainable { get; } bool Built { get; } - void build(Shape input_shape); + void build(KerasShapesWrapper input_shape); List Layers { get; } List InboundNodes { get; } List OutboundNodes { get; } - Tensors Apply(Tensors inputs, Tensor state = null, bool is_training = false); + Tensors Apply(Tensors inputs, Tensor state = null, bool training = false); List TrainableVariables { get; } List TrainableWeights { get; } List NonTrainableWeights { get; } - List Weights { get; } + List Weights { get; set; } + void set_weights(IEnumerable weights); + List get_weights(); Shape OutputShape { get; } - Shape BatchInputShape { get; } - TensorShapeConfig BuildInputShape { get; } + KerasShapesWrapper BatchInputShape { get; } + KerasShapesWrapper BuildInputShape { get; } TF_DataType DType { get; } int count_params(); + void adapt(Tensor data, int? batch_size = null, int? steps = null); } } diff --git a/src/TensorFlowNET.Core/Keras/Layers/ILayersApi.Activation.cs b/src/TensorFlowNET.Core/Keras/Layers/ILayersApi.Activation.cs index 73a6787c3..524798690 100644 --- a/src/TensorFlowNET.Core/Keras/Layers/ILayersApi.Activation.cs +++ b/src/TensorFlowNET.Core/Keras/Layers/ILayersApi.Activation.cs @@ -9,6 +9,7 @@ public partial interface ILayersApi { public ILayer ELU(float alpha = 0.1f); public ILayer SELU(); + public ILayer Softmax(int axis = -1); public ILayer Softmax(Axis axis); public ILayer Softplus(); public ILayer HardSigmoid(); diff --git a/src/TensorFlowNET.Core/Keras/Layers/ILayersApi.cs b/src/TensorFlowNET.Core/Keras/Layers/ILayersApi.cs index 6b2c38c32..6a29f9e5e 100644 --- a/src/TensorFlowNET.Core/Keras/Layers/ILayersApi.cs +++ b/src/TensorFlowNET.Core/Keras/Layers/ILayersApi.cs @@ -156,6 +156,7 @@ public ILayer LayerNormalization(Axis? axis, IInitializer beta_initializer = null, IInitializer gamma_initializer = null); + public ILayer Normalization(Shape? input_shape = null, int? axis = -1, float? mean = null, float? variance = null, bool invert = false); public ILayer LeakyReLU(float alpha = 0.3f); public ILayer LSTM(int units, diff --git a/src/TensorFlowNET.Core/Keras/Models/IModelsApi.cs b/src/TensorFlowNET.Core/Keras/Models/IModelsApi.cs new file mode 100644 index 000000000..007c82a17 --- /dev/null +++ b/src/TensorFlowNET.Core/Keras/Models/IModelsApi.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Tensorflow.Keras.Engine; + +namespace Tensorflow.Keras.Models +{ + public interface IModelsApi + { + public IModel load_model(string filepath, bool compile = true, LoadOptions? options = null); + } +} diff --git a/src/TensorFlowNET.Core/Keras/Common/CustomizedActivationJsonConverter.cs b/src/TensorFlowNET.Core/Keras/Saving/Json/CustomizedActivationJsonConverter.cs similarity index 69% rename from src/TensorFlowNET.Core/Keras/Common/CustomizedActivationJsonConverter.cs rename to src/TensorFlowNET.Core/Keras/Saving/Json/CustomizedActivationJsonConverter.cs index 1bc13caf3..b348780cf 100644 --- a/src/TensorFlowNET.Core/Keras/Common/CustomizedActivationJsonConverter.cs +++ b/src/TensorFlowNET.Core/Keras/Saving/Json/CustomizedActivationJsonConverter.cs @@ -4,8 +4,9 @@ using System; using System.Collections.Generic; using System.Text; +using static Tensorflow.Binding; -namespace Tensorflow.Keras.Common +namespace Tensorflow.Keras.Saving.Common { public class CustomizedActivationJsonConverter : JsonConverter { @@ -31,20 +32,19 @@ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer } else { - var token = JToken.FromObject((value as Activation)!.GetType().Name); + var token = JToken.FromObject(((Activation)value).Name); token.WriteTo(writer); } } public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) { - throw new NotImplementedException(); - //var dims = serializer.Deserialize(reader, typeof(string)); - //if (dims is null) - //{ - // throw new ValueError("Cannot deserialize 'null' to `Activation`."); - //} - //return new Shape((long[])(dims!)); + var activationName = serializer.Deserialize(reader); + if (tf.keras is null) + { + throw new RuntimeError("Tensorflow.Keras is not loaded, please install it first."); + } + return tf.keras.activations.GetActivationFromName(string.IsNullOrEmpty(activationName) ? "linear" : activationName); } } } diff --git a/src/TensorFlowNET.Core/Keras/Common/CustomizedAxisJsonConverter.cs b/src/TensorFlowNET.Core/Keras/Saving/Json/CustomizedAxisJsonConverter.cs similarity index 92% rename from src/TensorFlowNET.Core/Keras/Common/CustomizedAxisJsonConverter.cs rename to src/TensorFlowNET.Core/Keras/Saving/Json/CustomizedAxisJsonConverter.cs index f6087a43a..aea4af6d6 100644 --- a/src/TensorFlowNET.Core/Keras/Common/CustomizedAxisJsonConverter.cs +++ b/src/TensorFlowNET.Core/Keras/Saving/Json/CustomizedAxisJsonConverter.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Text; -namespace Tensorflow.Keras.Common +namespace Tensorflow.Keras.Saving.Common { public class CustomizedAxisJsonConverter : JsonConverter { @@ -38,7 +38,7 @@ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) { int[]? axis; - if(reader.ValueType == typeof(long)) + if (reader.ValueType == typeof(long)) { axis = new int[1]; axis[0] = (int)serializer.Deserialize(reader, typeof(int)); @@ -51,7 +51,7 @@ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer { throw new ValueError("Cannot deserialize 'null' to `Axis`."); } - return new Axis((int[])(axis!)); + return new Axis(axis!); } } } diff --git a/src/TensorFlowNET.Core/Keras/Common/CustomizedDTypeJsonConverter.cs b/src/TensorFlowNET.Core/Keras/Saving/Json/CustomizedDTypeJsonConverter.cs similarity index 89% rename from src/TensorFlowNET.Core/Keras/Common/CustomizedDTypeJsonConverter.cs rename to src/TensorFlowNET.Core/Keras/Saving/Json/CustomizedDTypeJsonConverter.cs index fce7bec58..29b3b094c 100644 --- a/src/TensorFlowNET.Core/Keras/Common/CustomizedDTypeJsonConverter.cs +++ b/src/TensorFlowNET.Core/Keras/Saving/Json/CustomizedDTypeJsonConverter.cs @@ -1,7 +1,7 @@ using Newtonsoft.Json.Linq; using Newtonsoft.Json; -namespace Tensorflow.Keras.Common +namespace Tensorflow.Keras.Saving.Common { public class CustomizedDTypeJsonConverter : JsonConverter { @@ -16,7 +16,7 @@ public override bool CanConvert(Type objectType) public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) { - var token = JToken.FromObject(dtypes.as_numpy_name((TF_DataType)value)); + var token = JToken.FromObject(((TF_DataType)value).as_numpy_name()); token.WriteTo(writer); } diff --git a/src/TensorFlowNET.Core/Keras/Saving/Json/CustomizedIInitializerJsonConverter.cs b/src/TensorFlowNET.Core/Keras/Saving/Json/CustomizedIInitializerJsonConverter.cs new file mode 100644 index 000000000..a7bae56d0 --- /dev/null +++ b/src/TensorFlowNET.Core/Keras/Saving/Json/CustomizedIInitializerJsonConverter.cs @@ -0,0 +1,69 @@ +using Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; +using Tensorflow.Operations; + +using Tensorflow.Operations.Initializers; + +namespace Tensorflow.Keras.Saving.Common +{ + class InitializerInfo + { + public string class_name { get; set; } + public JObject config { get; set; } + } + public class CustomizedIinitializerJsonConverter : JsonConverter + { + public override bool CanConvert(Type objectType) + { + return objectType == typeof(IInitializer); + } + + public override bool CanRead => true; + + public override bool CanWrite => true; + + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + var initializer = value as IInitializer; + if (initializer is null) + { + JToken.FromObject(null).WriteTo(writer); + return; + } + JToken.FromObject(new InitializerInfo() + { + class_name = initializer.ClassName, + config = JObject.FromObject(initializer.Config) + }, serializer).WriteTo(writer); + } + + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + { + var info = serializer.Deserialize(reader); + if (info is null) + { + return null; + } + return info.class_name switch + { + "Constant" => new Constant(info.config["value"].ToObject()), + "GlorotUniform" => new GlorotUniform(seed: info.config["seed"].ToObject()), + "Ones" => new Ones(), + "Orthogonal" => new Orthogonal(info.config["gain"].ToObject(), info.config["seed"].ToObject()), + "RandomNormal" => new RandomNormal(info.config["mean"].ToObject(), info.config["stddev"].ToObject(), + info.config["seed"].ToObject()), + "RandomUniform" => new RandomUniform(minval: info.config["minval"].ToObject(), + maxval: info.config["maxval"].ToObject(), seed: info.config["seed"].ToObject()), + "TruncatedNormal" => new TruncatedNormal(info.config["mean"].ToObject(), info.config["stddev"].ToObject(), + info.config["seed"].ToObject()), + "VarianceScaling" => new VarianceScaling(info.config["scale"].ToObject(), info.config["mode"].ToObject(), + info.config["distribution"].ToObject(), info.config["seed"].ToObject()), + "Zeros" => new Zeros(), + _ => throw new ValueError($"The specified initializer {info.class_name} cannot be recognized.") + }; + } + } +} diff --git a/src/TensorFlowNET.Core/Keras/Saving/Json/CustomizedKerasShapesWrapperJsonConverter.cs b/src/TensorFlowNET.Core/Keras/Saving/Json/CustomizedKerasShapesWrapperJsonConverter.cs new file mode 100644 index 000000000..1a4245bf2 --- /dev/null +++ b/src/TensorFlowNET.Core/Keras/Saving/Json/CustomizedKerasShapesWrapperJsonConverter.cs @@ -0,0 +1,75 @@ +using Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow.Keras.Saving.Json +{ + public class CustomizedKerasShapesWrapperJsonConverter : JsonConverter + { + public override bool CanConvert(Type objectType) + { + return objectType == typeof(KerasShapesWrapper); + } + + public override bool CanRead => true; + + public override bool CanWrite => true; + + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + if (value is null) + { + JToken.FromObject(null).WriteTo(writer); + return; + } + if (value is not KerasShapesWrapper wrapper) + { + throw new TypeError($"Expected `KerasShapesWrapper` to be serialized, bug got {value.GetType()}"); + } + if (wrapper.Shapes.Length == 0) + { + JToken.FromObject(null).WriteTo(writer); + } + else if (wrapper.Shapes.Length == 1) + { + JToken.FromObject(wrapper.Shapes[0]).WriteTo(writer); + } + else + { + JToken.FromObject(wrapper.Shapes).WriteTo(writer); + } + } + + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.StartArray) + { + TensorShapeConfig[] shapes = serializer.Deserialize(reader); + if (shapes is null) + { + return null; + } + return new KerasShapesWrapper(shapes); + } + else if (reader.TokenType == JsonToken.StartObject) + { + var shape = serializer.Deserialize(reader); + if (shape is null) + { + return null; + } + return new KerasShapesWrapper(shape); + } + else if (reader.TokenType == JsonToken.Null) + { + return null; + } + else + { + throw new ValueError($"Cannot deserialize the token type {reader.TokenType}"); + } + } + } +} diff --git a/src/TensorFlowNET.Core/Keras/Common/CustomizedNodeConfigJsonConverter.cs b/src/TensorFlowNET.Core/Keras/Saving/Json/CustomizedNodeConfigJsonConverter.cs similarity index 96% rename from src/TensorFlowNET.Core/Keras/Common/CustomizedNodeConfigJsonConverter.cs rename to src/TensorFlowNET.Core/Keras/Saving/Json/CustomizedNodeConfigJsonConverter.cs index cfd8ee8f7..51194a610 100644 --- a/src/TensorFlowNET.Core/Keras/Common/CustomizedNodeConfigJsonConverter.cs +++ b/src/TensorFlowNET.Core/Keras/Saving/Json/CustomizedNodeConfigJsonConverter.cs @@ -7,7 +7,7 @@ using System.Text; using Tensorflow.Keras.Saving; -namespace Tensorflow.Keras.Common +namespace Tensorflow.Keras.Saving.Common { public class CustomizedNodeConfigJsonConverter : JsonConverter { @@ -46,10 +46,10 @@ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer { throw new ValueError("Cannot deserialize 'null' to `Shape`."); } - if(values.Length == 1) + if (values.Length == 1) { var array = values[0] as JArray; - if(array is null) + if (array is null) { throw new ValueError($"The value ({string.Join(", ", values)}) cannot be deserialized to type `NodeConfig`."); } diff --git a/src/TensorFlowNET.Core/Keras/Common/CustomizedShapeJsonConverter.cs b/src/TensorFlowNET.Core/Keras/Saving/Json/CustomizedShapeJsonConverter.cs similarity index 58% rename from src/TensorFlowNET.Core/Keras/Common/CustomizedShapeJsonConverter.cs rename to src/TensorFlowNET.Core/Keras/Saving/Json/CustomizedShapeJsonConverter.cs index 198662afe..39799e929 100644 --- a/src/TensorFlowNET.Core/Keras/Common/CustomizedShapeJsonConverter.cs +++ b/src/TensorFlowNET.Core/Keras/Saving/Json/CustomizedShapeJsonConverter.cs @@ -5,9 +5,14 @@ using System.Collections.Generic; using System.Text; -namespace Tensorflow.Keras.Common +namespace Tensorflow.Keras.Saving.Common { - public class CustomizedShapeJsonConverter: JsonConverter + class ShapeInfoFromPython + { + public string class_name { get; set; } + public long?[] items { get; set; } + } + public class CustomizedShapeJsonConverter : JsonConverter { public override bool CanConvert(Type objectType) { @@ -20,12 +25,12 @@ public override bool CanConvert(Type objectType) public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) { - if(value is null) + if (value is null) { var token = JToken.FromObject(null); token.WriteTo(writer); } - else if(value is not Shape) + else if (value is not Shape) { throw new TypeError($"Unable to use `CustomizedShapeJsonConverter` to serialize the type {value.GetType()}."); } @@ -33,7 +38,7 @@ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer { var shape = (value as Shape)!; long?[] dims = new long?[shape.ndim]; - for(int i = 0; i < dims.Length; i++) + for (int i = 0; i < dims.Length; i++) { if (shape.dims[i] == -1) { @@ -44,7 +49,11 @@ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer dims[i] = shape.dims[i]; } } - var token = JToken.FromObject(dims); + var token = JToken.FromObject(new ShapeInfoFromPython() + { + class_name = "__tuple__", + items = dims + }); token.WriteTo(writer); } } @@ -52,32 +61,31 @@ public override void WriteJson(JsonWriter writer, object? value, JsonSerializer public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) { long?[] dims; - try + if (reader.TokenType == JsonToken.StartObject) { - dims = serializer.Deserialize(reader, typeof(long?[])) as long?[]; - } - catch (JsonSerializationException ex) - { - if (reader.Value.Equals("class_name")) - { - reader.Read(); - reader.Read(); - reader.Read(); - dims = serializer.Deserialize(reader, typeof(long?[])) as long?[]; - } - else + var shape_info_from_python = serializer.Deserialize(reader); + if (shape_info_from_python is null) { - throw ex; + return null; } + dims = shape_info_from_python.items; + } + else if (reader.TokenType == JsonToken.StartArray) + { + dims = serializer.Deserialize(reader); } - if (dims is null) + else if (reader.TokenType == JsonToken.Null) { return null; } + else + { + throw new ValueError($"Cannot deserialize the token {reader} as Shape."); + } long[] convertedDims = new long[dims.Length]; - for(int i = 0; i < dims.Length; i++) + for (int i = 0; i < dims.Length; i++) { - convertedDims[i] = dims[i] ?? (-1); + convertedDims[i] = dims[i] ?? -1; } return new Shape(convertedDims); } diff --git a/src/TensorFlowNET.Core/Keras/Saving/KerasShapesWrapper.cs b/src/TensorFlowNET.Core/Keras/Saving/KerasShapesWrapper.cs new file mode 100644 index 000000000..d91d3161d --- /dev/null +++ b/src/TensorFlowNET.Core/Keras/Saving/KerasShapesWrapper.cs @@ -0,0 +1,60 @@ +using Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; +using System.Diagnostics; +using OneOf.Types; +using Tensorflow.Keras.Saving.Json; + +namespace Tensorflow.Keras.Saving +{ + [JsonConverter(typeof(CustomizedKerasShapesWrapperJsonConverter))] + public class KerasShapesWrapper + { + public TensorShapeConfig[] Shapes { get; set; } + + public KerasShapesWrapper(Shape shape) + { + Shapes = new TensorShapeConfig[] { shape }; + } + + public KerasShapesWrapper(TensorShapeConfig shape) + { + Shapes = new TensorShapeConfig[] { shape }; + } + + public KerasShapesWrapper(TensorShapeConfig[] shapes) + { + Shapes = shapes; + } + + public KerasShapesWrapper(IEnumerable shape) + { + Shapes = shape.Select(x => (TensorShapeConfig)x).ToArray(); + } + + public Shape ToSingleShape() + { + Debug.Assert(Shapes.Length == 1); + var shape_config = Shapes[0]; + Debug.Assert(shape_config is not null); + return new Shape(shape_config.Items.Select(x => x is null ? -1 : x.Value).ToArray()); + } + + public Shape[] ToShapeArray() + { + return Shapes.Select(x => new Shape(x.Items.Select(y => y is null ? -1 : y.Value).ToArray())).ToArray(); + } + + public static implicit operator KerasShapesWrapper(Shape shape) + { + return new KerasShapesWrapper(shape); + } + public static implicit operator KerasShapesWrapper(TensorShapeConfig shape) + { + return new KerasShapesWrapper(shape); + } + + } +} diff --git a/src/TensorFlowNET.Core/Keras/Saving/ModelConfig.cs b/src/TensorFlowNET.Core/Keras/Saving/ModelConfig.cs index 934d3b151..8ddcd1f04 100644 --- a/src/TensorFlowNET.Core/Keras/Saving/ModelConfig.cs +++ b/src/TensorFlowNET.Core/Keras/Saving/ModelConfig.cs @@ -9,7 +9,7 @@ namespace Tensorflow.Keras.Saving { - public class ModelConfig : IKerasConfig + public class FunctionalConfig : IKerasConfig { [JsonProperty("name")] public string Name { get; set; } diff --git a/src/TensorFlowNET.Core/Keras/Saving/NodeConfig.cs b/src/TensorFlowNET.Core/Keras/Saving/NodeConfig.cs index 20e2fef59..8337ae018 100644 --- a/src/TensorFlowNET.Core/Keras/Saving/NodeConfig.cs +++ b/src/TensorFlowNET.Core/Keras/Saving/NodeConfig.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; using System.Text; -using Tensorflow.Keras.Common; +using Tensorflow.Keras.Saving.Common; namespace Tensorflow.Keras.Saving { diff --git a/src/TensorFlowNET.Core/NumPy/Axis.cs b/src/TensorFlowNET.Core/NumPy/Axis.cs index 709ca9b27..976c764f2 100644 --- a/src/TensorFlowNET.Core/NumPy/Axis.cs +++ b/src/TensorFlowNET.Core/NumPy/Axis.cs @@ -19,7 +19,7 @@ limitations under the License. using System.Collections.Generic; using System.Linq; using System.Text; -using Tensorflow.Keras.Common; +using Tensorflow.Keras.Saving.Common; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/NumPy/NDArray.Implicit.cs b/src/TensorFlowNET.Core/NumPy/NDArray.Implicit.cs index 53401a444..fd4f93fc1 100644 --- a/src/TensorFlowNET.Core/NumPy/NDArray.Implicit.cs +++ b/src/TensorFlowNET.Core/NumPy/NDArray.Implicit.cs @@ -14,7 +14,76 @@ public void Deconstruct(out byte blue, out byte green, out byte red) red = data[2]; } - public static implicit operator NDArray(Array array) + public static implicit operator NDArray(int[] array) + => new NDArray(array); + + public static implicit operator NDArray(byte[] array) + => new NDArray(array); + + public static implicit operator NDArray(float[] array) + => new NDArray(array); + + public static implicit operator NDArray(double[] array) + => new NDArray(array); + + public static implicit operator NDArray(long[] array) + => new NDArray(array); + + public static implicit operator NDArray(bool[] array) + => new NDArray(array); + + public static implicit operator NDArray(uint[] array) + => new NDArray(array); + + public static implicit operator NDArray(ulong[] array) + => new NDArray(array); + + public static implicit operator NDArray(int[,] array) + => new NDArray(array); + + public static implicit operator NDArray(byte[,] array) + => new NDArray(array); + + public static implicit operator NDArray(float[,] array) + => new NDArray(array); + + public static implicit operator NDArray(double[,] array) + => new NDArray(array); + + public static implicit operator NDArray(long[,] array) + => new NDArray(array); + + public static implicit operator NDArray(bool[,] array) + => new NDArray(array); + + public static implicit operator NDArray(uint[,] array) + => new NDArray(array); + + public static implicit operator NDArray(ulong[,] array) + => new NDArray(array); + + public static implicit operator NDArray(int[,,] array) + => new NDArray(array); + + public static implicit operator NDArray(byte[,,] array) + => new NDArray(array); + + public static implicit operator NDArray(float[,,] array) + => new NDArray(array); + + public static implicit operator NDArray(double[,,] array) + => new NDArray(array); + + public static implicit operator NDArray(long[,,] array) + => new NDArray(array); + + public static implicit operator NDArray(bool[,,] array) + => new NDArray(array); + + public static implicit operator NDArray(uint[,,] array) + => new NDArray(array); + + public static implicit operator NDArray(ulong[,,] array) => new NDArray(array); public unsafe static implicit operator bool(NDArray nd) diff --git a/src/TensorFlowNET.Core/NumPy/NDArray.Operators.cs b/src/TensorFlowNET.Core/NumPy/NDArray.Operators.cs index ef3b76f73..dd4577096 100644 --- a/src/TensorFlowNET.Core/NumPy/NDArray.Operators.cs +++ b/src/TensorFlowNET.Core/NumPy/NDArray.Operators.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using static Tensorflow.Binding; +using static Tensorflow.Binding; namespace Tensorflow.NumPy { @@ -14,35 +10,52 @@ public partial class NDArray public static NDArray operator -(NDArray lhs, NDArray rhs) => new NDArray(BinaryOpWrapper("sub", lhs, rhs)); [AutoNumPy] public static NDArray operator *(NDArray lhs, NDArray rhs) => new NDArray(BinaryOpWrapper("mul", lhs, rhs)); - [AutoNumPy] + [AutoNumPy] public static NDArray operator /(NDArray lhs, NDArray rhs) => new NDArray(BinaryOpWrapper("div", lhs, rhs)); [AutoNumPy] public static NDArray operator %(NDArray lhs, NDArray rhs) => new NDArray(BinaryOpWrapper("mod", lhs, rhs)); - [AutoNumPy] + [AutoNumPy] public static NDArray operator >(NDArray lhs, NDArray rhs) => new NDArray(gen_math_ops.greater(lhs, rhs)); - [AutoNumPy] + [AutoNumPy] public static NDArray operator <(NDArray lhs, NDArray rhs) => new NDArray(gen_math_ops.less(lhs, rhs)); - [AutoNumPy] + [AutoNumPy] public static NDArray operator -(NDArray lhs) => new NDArray(gen_math_ops.neg(lhs)); [AutoNumPy] public static NDArray operator ==(NDArray lhs, NDArray rhs) { - if(ReferenceEquals(lhs, rhs)) + if (ReferenceEquals(lhs, rhs)) return Scalar(true); - if(lhs is null) + if (lhs is null) return Scalar(false); - if(rhs is null) + if (rhs is null) return Scalar(false); - return new NDArray(math_ops.equal(lhs, rhs)); + // TODO(Rinne): use np.allclose instead. + if (lhs.dtype.is_floating() || rhs.dtype.is_floating()) + { + var diff = tf.abs(lhs - rhs); + return new NDArray(gen_math_ops.less(diff, new NDArray(1e-5).astype(diff.dtype))); + } + else + { + return new NDArray(math_ops.equal(lhs, rhs)); + } } [AutoNumPy] public static NDArray operator !=(NDArray lhs, NDArray rhs) { - if(ReferenceEquals(lhs, rhs)) + if (ReferenceEquals(lhs, rhs)) return Scalar(false); - if(lhs is null || rhs is null) + if (lhs is null || rhs is null) return Scalar(true); - return new NDArray(math_ops.not_equal(lhs, rhs)); + if (lhs.dtype.is_floating() || rhs.dtype.is_floating()) + { + var diff = tf.abs(lhs - rhs); + return new NDArray(gen_math_ops.greater_equal(diff, new NDArray(1e-5).astype(diff.dtype))); + } + else + { + return new NDArray(math_ops.not_equal(lhs, rhs)); + } } } } diff --git a/src/TensorFlowNET.Core/NumPy/Persistence/NpyFormat.cs b/src/TensorFlowNET.Core/NumPy/Persistence/NpyFormat.cs index 1886e4b4e..10de0e7d2 100644 --- a/src/TensorFlowNET.Core/NumPy/Persistence/NpyFormat.cs +++ b/src/TensorFlowNET.Core/NumPy/Persistence/NpyFormat.cs @@ -70,7 +70,7 @@ private static string GetDtypeName(NDArray array, out Type type, out int bytes) if (type == typeof(bool)) return "|b1"; else if (type == typeof(byte)) - return "|i1"; + return "|u1"; else if (type == typeof(short)) return " NewEagerTensorHandle(); public NDArray(byte value) : base(value) => NewEagerTensorHandle(); public NDArray(short value) : base(value) => NewEagerTensorHandle(); @@ -57,11 +58,25 @@ public static NDArray Scalar(T value) where T : unmanaged _ => throw new NotImplementedException("") }; + /// + /// Reuse the existing memory instead of copying it. + /// + /// + /// + /// + /// + protected void InitWithExistingMemory(IntPtr data_ptr, Shape shape, TF_DataType dtype, c_api.DeallocatorV2 deallocator) + { + _handle = c_api.TF_NewTensor(TF_DataType.TF_STRING, shape.dims, shape.ndim, data_ptr, (ulong)(shape.size * dtype.get_datatype_size()), deallocator, IntPtr.Zero); + tensor_util.DangerousManuallySetTensorDType(_handle, dtype); + NewEagerTensorHandle(); + } + void NewEagerTensorHandle() { if (_handle is not null) { - _eagerTensorHandle = c_api.TFE_NewTensorHandle(_handle, tf.Status.Handle); + _eagerTensorHandle = c_api.TFE_NewTensorHandle(_handle, tf.Status); } } } diff --git a/src/TensorFlowNET.Core/Numpy/NDArray.cs b/src/TensorFlowNET.Core/Numpy/NDArray.cs index 3a2cb3ee2..6e4c6b32c 100644 --- a/src/TensorFlowNET.Core/Numpy/NDArray.cs +++ b/src/TensorFlowNET.Core/Numpy/NDArray.cs @@ -49,5 +49,8 @@ public IEnumerator GetEnumerator() IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + + public static explicit operator NDArray(Array array) + => new NDArray(array); } } diff --git a/src/TensorFlowNET.Core/Numpy/Shape.cs b/src/TensorFlowNET.Core/Numpy/Shape.cs index ecf735869..c339f12de 100644 --- a/src/TensorFlowNET.Core/Numpy/Shape.cs +++ b/src/TensorFlowNET.Core/Numpy/Shape.cs @@ -19,7 +19,7 @@ limitations under the License. using System.Collections.Generic; using System.Linq; using System.Text; -using Tensorflow.Keras.Common; +using Tensorflow.Keras.Saving.Common; using Tensorflow.NumPy; namespace Tensorflow diff --git a/src/TensorFlowNET.Core/Operations/Initializers/GlorotUniform.cs b/src/TensorFlowNET.Core/Operations/Initializers/GlorotUniform.cs index def1cb7a0..7cd88cc68 100644 --- a/src/TensorFlowNET.Core/Operations/Initializers/GlorotUniform.cs +++ b/src/TensorFlowNET.Core/Operations/Initializers/GlorotUniform.cs @@ -26,12 +26,12 @@ public class GlorotUniform : VarianceScaling public override IDictionary Config => _config; public GlorotUniform(float scale = 1.0f, - string mode = "FAN_AVG", - bool uniform = true, + string mode = "fan_avg", + string distribution = "uniform", int? seed = null, - TF_DataType dtype = TF_DataType.TF_FLOAT) : base(factor: scale, + TF_DataType dtype = TF_DataType.TF_FLOAT) : base(scale: scale, mode: mode, - uniform: uniform, + distribution: distribution, seed: seed, dtype: dtype) { diff --git a/src/TensorFlowNET.Core/Operations/Initializers/IInitializer.cs b/src/TensorFlowNET.Core/Operations/Initializers/IInitializer.cs index 9748b1004..35b92448c 100644 --- a/src/TensorFlowNET.Core/Operations/Initializers/IInitializer.cs +++ b/src/TensorFlowNET.Core/Operations/Initializers/IInitializer.cs @@ -16,9 +16,11 @@ limitations under the License. using Newtonsoft.Json; using System.Collections.Generic; +using Tensorflow.Keras.Saving.Common; namespace Tensorflow { + [JsonConverter(typeof(CustomizedIinitializerJsonConverter))] public interface IInitializer { [JsonProperty("class_name")] diff --git a/src/TensorFlowNET.Core/Operations/Initializers/VarianceScaling.cs b/src/TensorFlowNET.Core/Operations/Initializers/VarianceScaling.cs index f104e8e83..37fdd764c 100644 --- a/src/TensorFlowNET.Core/Operations/Initializers/VarianceScaling.cs +++ b/src/TensorFlowNET.Core/Operations/Initializers/VarianceScaling.cs @@ -28,35 +28,42 @@ public class VarianceScaling : IInitializer { protected float _scale; protected string _mode; - protected string _distribution; protected int? _seed; protected TF_DataType _dtype; - protected bool _uniform; + protected string _distribution; private readonly Dictionary _config; public virtual string ClassName => "VarianceScaling"; public virtual IDictionary Config => _config; - public VarianceScaling(float factor = 2.0f, - string mode = "FAN_IN", - bool uniform = false, + public VarianceScaling(float scale = 1.0f, + string mode = "fan_in", + string distribution = "truncated_normal", int? seed = null, TF_DataType dtype = TF_DataType.TF_FLOAT) { if (!dtype.is_floating()) throw new TypeError("Cannot create initializer for non-floating point type."); - if (!new string[] { "FAN_IN", "FAN_OUT", "FAN_AVG" }.Contains(mode)) - throw new TypeError($"Unknown {mode} %s [FAN_IN, FAN_OUT, FAN_AVG]"); + if (!new string[] { "fan_in", "fan_out", "fan_avg" }.Contains(mode)) + throw new TypeError($"Unknown {mode} %s [fan_in, fan_out, fan_avg]"); + if(distribution == "normal") + { + distribution = "truncated_normal"; + } + if(!new string[] { "uniform", "truncated_normal", "untruncated_normal" }.Contains(distribution)) + { + throw new ValueError($"Invalid `distribution` argument: {distribution}"); + } - if (factor < 0) + if (scale <= 0) throw new ValueError("`scale` must be positive float."); - _scale = factor; + _scale = scale; _mode = mode; _seed = seed; _dtype = dtype; - _uniform = uniform; + _distribution = distribution; _config = new(); _config["scale"] = _scale; @@ -72,23 +79,28 @@ public Tensor Apply(InitializerArgs args) float n = 0; var (fan_in, fan_out) = _compute_fans(args.Shape); - if (_mode == "FAN_IN") - n = fan_in; - else if (_mode == "FAN_OUT") - n = fan_out; - else if (_mode == "FAN_AVG") - n = (fan_in + fan_out) / 2.0f; + var scale = this._scale; + if (_mode == "fan_in") + scale /= Math.Max(1.0f, fan_in); + else if (_mode == "fan_out") + scale /= Math.Max(1.0f, fan_out); + else + scale /= Math.Max(1.0f, (fan_in + fan_out) / 2); - if (_uniform) + if(_distribution == "truncated_normal") { - var limit = Convert.ToSingle(Math.Sqrt(3.0f * _scale / n)); - return random_ops.random_uniform(args.Shape, -limit, limit, args.DType); + var stddev = Math.Sqrt(scale) / .87962566103423978f; + return random_ops.truncated_normal(args.Shape, 0.0f, (float)stddev, args.DType); + } + else if(_distribution == "untruncated_normal") + { + var stddev = Math.Sqrt(scale); + return random_ops.random_normal(args.Shape, 0.0f, (float)stddev, args.DType); } else { - var trunc_stddev = Convert.ToSingle(Math.Sqrt(1.3f * _scale / n)); - return random_ops.truncated_normal(args.Shape, 0.0f, trunc_stddev, args.DType, - seed: _seed); + var limit = (float)Math.Sqrt(scale * 3.0f); + return random_ops.random_uniform(args.Shape, -limit, limit, args.DType); } } diff --git a/src/TensorFlowNET.Core/Operations/NnOps/RNNCell.cs b/src/TensorFlowNET.Core/Operations/NnOps/RNNCell.cs index 4e9369a8b..ecc9ca116 100644 --- a/src/TensorFlowNET.Core/Operations/NnOps/RNNCell.cs +++ b/src/TensorFlowNET.Core/Operations/NnOps/RNNCell.cs @@ -21,6 +21,7 @@ limitations under the License. using Tensorflow.Keras.ArgsDefinition.Rnn; using Tensorflow.Keras.Engine; using Tensorflow.Keras.Saving; +using Tensorflow.NumPy; using Tensorflow.Operations; using Tensorflow.Train; using Tensorflow.Util; @@ -71,14 +72,17 @@ public abstract class RnnCell : ILayer, RNNArgs.IRnnArgCell public List TrainableVariables => throw new NotImplementedException(); public List TrainableWeights => throw new NotImplementedException(); - public List Weights => throw new NotImplementedException(); + public List Weights { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + + public List get_weights() => throw new NotImplementedException(); + public void set_weights(IEnumerable weights) => throw new NotImplementedException(); public List NonTrainableWeights => throw new NotImplementedException(); public Shape OutputShape => throw new NotImplementedException(); - public Shape BatchInputShape => throw new NotImplementedException(); + public KerasShapesWrapper BatchInputShape => throw new NotImplementedException(); - public TensorShapeConfig BuildInputShape => throw new NotImplementedException(); + public KerasShapesWrapper BuildInputShape => throw new NotImplementedException(); public TF_DataType DType => throw new NotImplementedException(); protected bool built = false; @@ -158,6 +162,16 @@ public void build(Shape input_shape) throw new NotImplementedException(); } + public void build(KerasShapesWrapper input_shape) + { + throw new NotImplementedException(); + } + public Trackable GetTrackable() { throw new NotImplementedException(); } + + public void adapt(Tensor data, int? batch_size = null, int? steps = null) + { + throw new NotImplementedException(); + } } } diff --git a/src/TensorFlowNET.Core/Operations/Operation.Input.cs b/src/TensorFlowNET.Core/Operations/Operation.Input.cs index 44ac52e15..9aa6fde22 100644 --- a/src/TensorFlowNET.Core/Operations/Operation.Input.cs +++ b/src/TensorFlowNET.Core/Operations/Operation.Input.cs @@ -31,7 +31,7 @@ public partial class Operation public int InputListLength(string name) { int num = 0; - num = c_api.TF_OperationInputListLength(_handle, name, tf.Status.Handle); + num = c_api.TF_OperationInputListLength(_handle, name, tf.Status); tf.Status.Check(true); return num; } diff --git a/src/TensorFlowNET.Core/Operations/Operation.Output.cs b/src/TensorFlowNET.Core/Operations/Operation.Output.cs index b5d6191dc..2955a13fa 100644 --- a/src/TensorFlowNET.Core/Operations/Operation.Output.cs +++ b/src/TensorFlowNET.Core/Operations/Operation.Output.cs @@ -28,7 +28,7 @@ public partial class Operation public int OutputListLength(string name) { - int num = c_api.TF_OperationOutputListLength(_handle, name, tf.Status.Handle); + int num = c_api.TF_OperationOutputListLength(_handle, name, tf.Status); tf.Status.Check(true); return num; diff --git a/src/TensorFlowNET.Core/Operations/Operation.cs b/src/TensorFlowNET.Core/Operations/Operation.cs index fb9a4a274..311f2184f 100644 --- a/src/TensorFlowNET.Core/Operations/Operation.cs +++ b/src/TensorFlowNET.Core/Operations/Operation.cs @@ -20,6 +20,9 @@ limitations under the License. using System.Linq; using Tensorflow.Util; using static Tensorflow.Binding; +using Google.Protobuf; +using Google.Protobuf.WellKnownTypes; +using System.Diagnostics; namespace Tensorflow { @@ -47,6 +50,8 @@ public partial class Operation : ITensorOrOperation private readonly Graph _graph; + internal Func _gradient_function; + public string type => OpType; public Graph graph => _graph; @@ -61,7 +66,7 @@ public partial class Operation : ITensorOrOperation public string Device => _handle == IntPtr.Zero ? "" : c_api.StringPiece(c_api.TF_OperationDevice(_handle)); - // OperationDescription _opDesc; + //private OperationDescription _op_desc; public NodeDef node_def => GetNodeDef(); @@ -187,8 +192,8 @@ public virtual T[] get_attr_list(string name) if (tf.executing_eagerly()) return (T[])get_attr(name); - using var buf = new Buffer(); - c_api.TF_OperationGetAttrValueProto(_handle, name, buf.Handle, tf.Status.Handle); + var buf = new Buffer(); + c_api.TF_OperationGetAttrValueProto(_handle, name, buf, tf.Status); tf.Status.Check(true); var x = AttrValue.Parser.ParseFrom(buf.ToArray()); @@ -210,38 +215,51 @@ public virtual T[] get_attr_list(string name) public virtual object get_attr(string name) { - using var buf = new Buffer(); - c_api.TF_OperationGetAttrValueProto(_handle, name, buf.Handle, tf.Status.Handle); - tf.Status.Check(true); + var buf = new Buffer(); + Status status = new(); + c_api.TF_OperationGetAttrValueProto(_handle, name, buf, status); + status.Check(true); + var tf_buffer = c_api.TF_GetBuffer(buf); - var x = AttrValue.Parser.ParseFrom(buf.ToArray()); + var x = AttrValue.Parser.ParseFrom(tf_buffer.AsSpan()); - string oneof_value = x.ValueCase.ToString(); - if (string.IsNullOrEmpty(oneof_value)) - return null; + var oneof_value = x.ValueCase; + if (oneof_value == AttrValue.ValueOneofCase.None) + return new object[0]; - switch (oneof_value.ToLower()) + if(oneof_value == AttrValue.ValueOneofCase.List) { - case "list": - throw new NotImplementedException($"Unsupported field type in {oneof_value}"); - case "type": - return x.Type; - case "s": - return x.S.ToStringUtf8(); - default: - return x.GetType().GetProperty(oneof_value).GetValue(x); + throw new NotImplementedException($"Unsupported field type in {oneof_value}"); } + if(oneof_value == AttrValue.ValueOneofCase.Type) + { + return dtypes.as_tf_dtype(x.Type); + } + return ProtoUtils.GetSingleAttrValue(x, oneof_value); } public TF_AttrMetadata GetAttributeMetadata(string attr_name, Status s) { - return c_api.TF_OperationGetAttrMetadata(_handle, attr_name, s.Handle); + return c_api.TF_OperationGetAttrMetadata(_handle, attr_name, s); + } + + [Obsolete("The implementation is not complete.")] + internal void _set_device_from_string(string device_str) + { + // TODO(Rinne): complete it with new C API `SetRequestedDevice`. + //c_api.TF_SetDevice(_handle, device_str); + } + + [Obsolete("The implementation is not complete.")] + internal void _set_device(string device) + { + _set_device_from_string(device); } private NodeDef GetNodeDef() { - using var buffer = new Buffer(); - c_api.TF_OperationToNodeDef(_handle, buffer.Handle, tf.Status.Handle); + var buffer = new Buffer(); + c_api.TF_OperationToNodeDef(_handle, buffer, tf.Status); tf.Status.Check(throwException: true); return NodeDef.Parser.ParseFrom(buffer.ToArray()); } @@ -296,5 +314,60 @@ public TF_Input _tf_input(int input_idx) } public NDArray numpy() => throw new NotImplementedException(""); + + internal void _add_outputs(TF_DataType[] types, Shape[] shapes) + { + Debug.Assert(types.Length == shapes.Length); + int orig_num_outputs = this.outputs.Length; + var new_outputs = new List(_outputs); + + // Since the `_outputs` is defined as `Array`, when we add new output, we + // have to create a new array, which brings some performance concerns. + // In the future maybe the type of `outputs` should be reconsidered. + for(int i = 0; i < types.Length; i++) + { + var t = new Tensor(this, orig_num_outputs + i, types[i]); + t.shape = shapes[i]; + new_outputs.Add(t); + } + _outputs = new_outputs.ToArray(); + } + + internal void _set_func_attr(string attr_name, string func_name) + { + var func = new NameAttrList() { Name = func_name }; + _set_attr(attr_name, new AttrValue() { Func = func }); + } + + internal void _set_type_list_attr(string attr_name, DataType[] types) + { + if(types is null || types.Length == 0) + { + return; + } + var type_list = new AttrValue.Types.ListValue(); + type_list.Type.AddRange(types); + _set_attr(attr_name, new AttrValue() { List = type_list }); + } + + internal void _set_attr(string attr_name, AttrValue attr_value) + { + var buffer = new Buffer(attr_value.ToByteArray()); + try + { + _set_attr_with_buf(attr_name, buffer); + } + finally + { + buffer.Release(); + } + } + + internal void _set_attr_with_buf(string attr_name, Buffer attr_buf) + { + Status status = new(); + c_api.TFC_SetAttr(graph, _handle, attr_name, attr_buf, status); + status.Check(true); + } } } \ No newline at end of file diff --git a/src/TensorFlowNET.Core/Operations/OperationDescription.cs b/src/TensorFlowNET.Core/Operations/OperationDescription.cs index 384f5386f..28df548dd 100644 --- a/src/TensorFlowNET.Core/Operations/OperationDescription.cs +++ b/src/TensorFlowNET.Core/Operations/OperationDescription.cs @@ -50,7 +50,7 @@ public void SetAttrShape(string attr_name, long[] dims) public Operation FinishOperation(Status status) { - return c_api.TF_FinishOperation(_handle, status.Handle); + return c_api.TF_FinishOperation(_handle, status); } public static implicit operator OperationDescription(IntPtr handle) diff --git a/src/TensorFlowNET.Core/Operations/SafeOperationHandle.cs b/src/TensorFlowNET.Core/Operations/SafeOperationHandle.cs new file mode 100644 index 000000000..41364fe65 --- /dev/null +++ b/src/TensorFlowNET.Core/Operations/SafeOperationHandle.cs @@ -0,0 +1,40 @@ +/***************************************************************************** + Copyright 2018 The TensorFlow.NET Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +******************************************************************************/ + +using Tensorflow.Util; + +namespace Tensorflow; + +public sealed class SafeOperationHandle : SafeTensorflowHandle +{ + private SafeOperationHandle() + { + } + + public SafeOperationHandle(IntPtr handle) + : base(handle) + { + } + + protected override bool ReleaseHandle() + { + var status = new Status(); + // c_api.TF_CloseSession(handle, status); + c_api.TF_DeleteSession(handle, status); + SetHandle(IntPtr.Zero); + return true; + } +} diff --git a/src/TensorFlowNET.Core/Operations/array_ops.cs b/src/TensorFlowNET.Core/Operations/array_ops.cs index 0e888a0ab..2767e8219 100644 --- a/src/TensorFlowNET.Core/Operations/array_ops.cs +++ b/src/TensorFlowNET.Core/Operations/array_ops.cs @@ -417,7 +417,7 @@ public static Tensor ones(Shape shape, TF_DataType dtype = TF_DataType.TF_FLOAT, { TF_DataType.TF_DOUBLE => constant(1.0d), TF_DataType.TF_FLOAT => constant(1.0f), - _ => constant(1) + _ => constant(1, dtype) }; if (shape.ndim == 0) diff --git a/src/TensorFlowNET.Core/Operations/c_api.ops.cs b/src/TensorFlowNET.Core/Operations/c_api.ops.cs index 0fc924541..900db8cac 100644 --- a/src/TensorFlowNET.Core/Operations/c_api.ops.cs +++ b/src/TensorFlowNET.Core/Operations/c_api.ops.cs @@ -96,7 +96,7 @@ public partial class c_api /// const char* /// TF_OperationDescription* [DllImport(TensorFlowLibName)] - public static extern IntPtr TF_NewOperation(IntPtr graph, string opType, string oper_name); + public static extern IntPtr TF_NewOperation(SafeGraphHandle graph, string opType, string oper_name); [DllImport(TensorFlowLibName)] public static extern IntPtr TF_OperationDevice(IntPtr oper); diff --git a/src/TensorFlowNET.Core/Operations/dataset_ops.cs b/src/TensorFlowNET.Core/Operations/dataset_ops.cs index 9407fd5aa..c7e627772 100644 --- a/src/TensorFlowNET.Core/Operations/dataset_ops.cs +++ b/src/TensorFlowNET.Core/Operations/dataset_ops.cs @@ -1,6 +1,9 @@ using System; +using Tensorflow.Contexts; +using Tensorflow.Eager; using Tensorflow.Framework.Models; using Tensorflow.Functions; +using Tensorflow.Operations; using static Tensorflow.Binding; namespace Tensorflow @@ -220,6 +223,37 @@ public Tensor model_dataset(Tensor input_dataset, return (results[0], results[1]); } + public Tensor anonymous_iterator_v3(TF_DataType[] output_types, Shape[] output_shapes, string name = null) + { + var ctx = tf.Context; + Dictionary attrs = new(); + attrs["output_types"] = output_types; + attrs["output_shapes"] = output_shapes; + if (ctx.executing_eagerly()) + { + try + { + var result = tf.Runner.TFE_FastPathExecute(new FastPathOpExecInfo("AnonymousIteratorV3", name) + { + attrs = attrs + }); + return result[0]; + } + catch (Exception) + { + return anonymous_iterator_v3_eager_fallback(output_types, output_shapes, name, ctx); + } + } + return tf.OpDefLib._apply_op_helper("AnonymousIteratorV3", name, attrs).outputs[0]; + } + + public Tensor anonymous_iterator_v3_eager_fallback(TF_DataType[] output_types, Shape[] output_shapes, string name, Context ctx) + { + object[] attrs = new object[] { output_types, output_shapes }; + var result = execute.quick_execute("AnonymousIteratorV3", 1, new Tensor[] { }, attrs, ctx, name); + return result[0]; + } + /// /// Makes a new iterator from the given `dataset` and stores it in `iterator`. /// diff --git a/src/TensorFlowNET.Core/Operations/functional_ops.cs b/src/TensorFlowNET.Core/Operations/functional_ops.cs index 908029f5d..105479216 100644 --- a/src/TensorFlowNET.Core/Operations/functional_ops.cs +++ b/src/TensorFlowNET.Core/Operations/functional_ops.cs @@ -14,10 +14,14 @@ You may obtain a copy of the License at limitations under the License. ******************************************************************************/ +using Google.Protobuf; +using Google.Protobuf.WellKnownTypes; using System; using System.Collections.Generic; using System.Linq; using Tensorflow.Framework; +using Tensorflow.Functions; +using Tensorflow.Operations; using Tensorflow.Util; using static Tensorflow.Binding; @@ -25,6 +29,74 @@ namespace Tensorflow { public class functional_ops { + public static Tensor[] partitioned_call(Tensors args, EagerDefinedFunction f, DataType[] tout, + bool executing_eagerly, string config, string executor_type) + { + if (tout is null) + { + throw new NotImplementedException(); + } + + if (config is null) + { + config = function_utils.get_disabled_rewriter_config().ToStringUtf8(); + } + + if (executor_type is null) + { + executor_type = ""; + } + + if (executing_eagerly) + { + // TODO(Rinne): implement it. + + throw new NotImplementedException(); + } + + var converted_args = args.Select(x => ops.convert_to_tensor(x)).ToArray(); + AttrValue tin_attr = new() + { + List = new AttrValue.Types.ListValue() + }; + tin_attr.List.Type.AddRange(args.Select(x => x.dtype.as_datatype_enum())); + AttrValue tout_attr = new() + { + List = new AttrValue.Types.ListValue() + }; + tout_attr.List.Type.AddRange(tout); + AttrValue func_attr = new() + { + Func = new NameAttrList() + }; + func_attr.Func.Name = f.Name; + AttrValue executor_type_attr = new AttrValue() + { + S = tf.compat.as_bytes(executor_type) + }; + AttrValue config_proto = new AttrValue() + { + S = ByteString.CopyFromUtf8(executor_type) + }; + + var graph = ops.get_default_graph(); + f.AddToGraph(graph); + // TODO(Rinne): complete it with `f.stateful` + var op_name = "PartitionedCall"; + string xla_compile_attr = "_XlaMustCompile"; + Dictionary op_attrs = new(); + op_attrs["Tin"] = tin_attr; + op_attrs["Tout"] = tout_attr; + op_attrs["f"] = func_attr; + op_attrs["config_proto"] = config_proto; + op_attrs["executor_type"] = executor_type_attr; + // TODO(Rinne): deal with `f.definition`. + var op = graph.create_op(op_name, args, tout.Select(x => x.as_tf_dtype()).ToArray(), + name: op_name, attrs: op_attrs); + var outputs = op.outputs; + // TODO(Rinne): deal with `f.graph`. + return outputs; + } public static Tensor scan( Func fn, Tensor elems, diff --git a/src/TensorFlowNET.Core/Operations/gen_array_ops.cs b/src/TensorFlowNET.Core/Operations/gen_array_ops.cs index 93a54af00..1dc6504ab 100644 --- a/src/TensorFlowNET.Core/Operations/gen_array_ops.cs +++ b/src/TensorFlowNET.Core/Operations/gen_array_ops.cs @@ -17,6 +17,7 @@ limitations under the License. using System; using System.Linq; using Tensorflow.Contexts; +using Tensorflow.Eager; using static Tensorflow.Binding; namespace Tensorflow @@ -210,7 +211,51 @@ public static Tensor rank(Tensor input, string name = null) /// A name for the operation (optional). /// A `Tensor`. Has the same type as `value`. public static Tensor fill(Tensor dims, T value, string name = null) - => tf.Context.ExecuteOp("Fill", name, new ExecuteOpArgs(dims, value)); + { + var ctx = tf.Context; + if (ctx.executing_eagerly()) + { + try + { + var _result = tf.Runner.TFE_FastPathExecute(new FastPathOpExecInfo("Fill", name, dims, value)); + return _result[0]; + } + catch (Exception) + { + + } + try + { + return fill_eager_fallback(dims, value as Tensor, name, ctx); + } + catch (Exception) + { + + } + } + Dictionary attrs = new Dictionary(); + attrs["dims"] = dims; + attrs["value"] = value; + var result = tf.OpDefLib._apply_op_helper("Fill", name, attrs); + if (execute.must_record_gradient()) + { + throw new NotImplementedException(); + } + return result.output; + } + + public static Tensor fill_eager_fallback(Tensor dims, Tensor value, string name, Context ctx) + { + object[] attrs = new object[] { "T", dims.dtype.as_datatype_enum(), "index_type", dims.dtype.as_datatype_enum() }; + var _result = execute.executes("Fill", 1, new Tensor[] { dims, value }, attrs, ctx, name); + + if (execute.must_record_gradient()) + { + throw new NotImplementedException(); + } + return _result[0]; + } + //=> tf.Context.ExecuteOp("Fill", name, new ExecuteOpArgs(dims, value)); /// /// Return the reduction indices for computing gradients of s0 op s1 with broadcast. diff --git a/src/TensorFlowNET.Core/Operations/gen_functional_ops.cs b/src/TensorFlowNET.Core/Operations/gen_functional_ops.cs new file mode 100644 index 000000000..bb84ac390 --- /dev/null +++ b/src/TensorFlowNET.Core/Operations/gen_functional_ops.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Linq; +using Tensorflow.Contexts; +using Tensorflow.Eager; +using Tensorflow.Functions; +using static Tensorflow.Binding; + +namespace Tensorflow.Operations +{ + public class gen_functional_ops + { + public static Tensor[] partitioned_call(Tensors args, TF_DataType[] tout, EagerDefinedFunction f, + string config = "", string config_proto = "", string executor_type = "", string name = null) + { + var ctx = tf.Context; + if (ctx.executing_eagerly()) + { + try + { + return tf.Runner.TFE_FastPathExecute(new FastPathOpExecInfo("PartitionedCall", name, + args, tout, f, config, config_proto, executor_type)); + } + catch (Exception) + { + + } + } + + if (config is null) + { + config = ""; + } + if (config_proto is null) + { + config_proto = ""; + } + if (executor_type is null) + { + executor_type = ""; + } + Dictionary kwargs = new(); + kwargs["args"] = args; + kwargs["Tout"] = tout; + kwargs["f"] = f; + kwargs["config"] = config; + kwargs["config_proto"] = config_proto; + kwargs["executor_type"] = executor_type; + var output = tf.OpDefLib._apply_op_helper("PartitionedCall", + name, kwargs); + var result = output.outputs; + if (execute.must_record_gradient()) + { + throw new NotImplementedException(); + } + return result; + } + + public static Tensor[] partitioned_call_eager_fallback(Tensors args, TF_DataType[] tout, EagerDefinedFunction f, + string config, string config_proto, string executor_type, string name, Context ctx) + { + // TODO(Rinne): implement it. + throw new NotImplementedException(); + if(config is null) + { + config = ""; + } + if(config_proto is null) + { + config_proto = ""; + } + if(executor_type is null) + { + executor_type = ""; + } + object[] attrs = new object[] + { + + }; + } + + public static Tensor[] symbolic_gradient(Tensor[] input, TF_DataType[] Tout, NameAttrList f, string name = null) + { + var ctx = tf.Context; + if (ctx.executing_eagerly()) + { + try + { + var _result = tf.Runner.TFE_FastPathExecute(new FastPathOpExecInfo( + "SymbolicGradient", name, input, Tout, f)); + return _result; + } + catch (Exception) + { + + } + + try + { + return symbolic_gradient_eager_fallback(input, Tout, f, name, ctx); + } + catch (Exception) + { + + } + } + var op = tf.OpDefLib._apply_op_helper("SymbolicGradient", name, new object[] { input, Tout, f }); + var result = op.outputs; + if (execute.must_record_gradient()) + { + throw new NotImplementedException(); + } + return result; + } + + public static Tensor[] symbolic_gradient_eager_fallback(Tensor[] input, TF_DataType[] Tout, NameAttrList f, string name, Context ctx) + { + object[] attrs = new object[] { "Tin", input, "Tout", Tout, "f", f }; + var result = execute.executes("SymbolicGradient", Tout.Length, input, attrs, ctx, name); + if (execute.must_record_gradient()) + { + throw new NotImplementedException(); + } + return result; + } + } +} diff --git a/src/TensorFlowNET.Core/Operations/gen_ops.cs b/src/TensorFlowNET.Core/Operations/gen_ops.cs index 26a9b5be8..fe67c2b84 100644 --- a/src/TensorFlowNET.Core/Operations/gen_ops.cs +++ b/src/TensorFlowNET.Core/Operations/gen_ops.cs @@ -730,12 +730,7 @@ public static (Tensor sampled_candidates, Tensor true_expected_count, Tensor sam /// public static Tensor angle(Tensor input, TF_DataType? Tout = null, string name = "Angle") { - var dict = new Dictionary(); - dict["input"] = input; - if (Tout.HasValue) - dict["Tout"] = Tout.Value; - var op = tf.OpDefLib._apply_op_helper("Angle", name: name, keywords: dict); - return op.output; + return tf.Context.ExecuteOp("Angle", name, new ExecuteOpArgs(input).SetAttributes(new { Tout = Tout })); } /// @@ -4976,15 +4971,14 @@ public static Tensor compare_and_bitpack(Tensor input, Tensor threshold, string /// tf.complex(real, imag) ==&gt; [[2.25 + 4.75j], [3.25 + 5.75j]] /// /// - public static Tensor complex(Tensor real, Tensor imag, TF_DataType? Tout = null, string name = "Complex") + public static Tensor complex(Tensor real, Tensor imag, TF_DataType? a_Tout = null, string name = "Complex") { - var dict = new Dictionary(); - dict["real"] = real; - dict["imag"] = imag; - if (Tout.HasValue) - dict["Tout"] = Tout.Value; - var op = tf.OpDefLib._apply_op_helper("Complex", name: name, keywords: dict); - return op.output; + TF_DataType Tin = real.GetDataType(); + if (a_Tout is null) + { + a_Tout = (Tin == TF_DataType.TF_DOUBLE)? TF_DataType.TF_COMPLEX128: TF_DataType.TF_COMPLEX64; + } + return tf.Context.ExecuteOp("Complex", name, new ExecuteOpArgs(real, imag).SetAttributes(new { T=Tin, Tout=a_Tout })); } /// @@ -5008,12 +5002,7 @@ public static Tensor complex(Tensor real, Tensor imag, TF_DataType? Tout = null, /// public static Tensor complex_abs(Tensor x, TF_DataType? Tout = null, string name = "ComplexAbs") { - var dict = new Dictionary(); - dict["x"] = x; - if (Tout.HasValue) - dict["Tout"] = Tout.Value; - var op = tf.OpDefLib._apply_op_helper("ComplexAbs", name: name, keywords: dict); - return op.output; + return tf.Context.ExecuteOp("ComplexAbs", name, new ExecuteOpArgs(x).SetAttributes(new { Tout = Tout })); } /// @@ -5313,10 +5302,7 @@ public static Tensor configure_distributed_t_p_u(string embedding_config = null, /// public static Tensor conj(Tensor input, string name = "Conj") { - var dict = new Dictionary(); - dict["input"] = input; - var op = tf.OpDefLib._apply_op_helper("Conj", name: name, keywords: dict); - return op.output; + return tf.Context.ExecuteOp("Conj", name, new ExecuteOpArgs(new object[] { input })); } /// @@ -10064,13 +10050,51 @@ public static Tensor encode_wav(Tensor audio, Tensor sample_rate, string name = /// public static Tensor ensure_shape(Tensor input, Shape shape, string name = "EnsureShape") { + var ctx = tf.Context; + if (ctx.executing_eagerly()) + { + try + { + var _result = tf.Runner.TFE_FastPathExecute(new FastPathOpExecInfo("EnsureShape", name, input, shape)); + return _result[0]; + } + catch (Exception) + { + + } + try + { + return ensure_shape_eager_fallback(input, shape, name, ctx); + } + catch (Exception) + { + + } + } + var dict = new Dictionary(); dict["input"] = input; dict["shape"] = shape; var op = tf.OpDefLib._apply_op_helper("EnsureShape", name: name, keywords: dict); + if (execute.must_record_gradient()) + { + throw new NotImplementedException(); + } return op.output; } + public static Tensor ensure_shape_eager_fallback(Tensor input, Shape shape, string name, Context ctx) + { + object[] attrs = new object[4] { "shape", shape, "T", input.dtype.as_datatype_enum() }; + var _result = execute.executes("EnsureShape", 1, new Tensor[] { input }, + attrs, ctx, name); + if (execute.must_record_gradient()) + { + throw new NotImplementedException(); + } + return _result[0]; + } + /// /// Creates or finds a child frame, and makes data available to the child frame. /// @@ -10489,10 +10513,7 @@ public static Tensor extract_jpeg_shape(Tensor contents, TF_DataType? output_typ /// public static Tensor f_f_t(Tensor input, string name = "FFT") { - var dict = new Dictionary(); - dict["input"] = input; - var op = tf.OpDefLib._apply_op_helper("FFT", name: name, keywords: dict); - return op.output; + return tf.Context.ExecuteOp("FFT", name, new ExecuteOpArgs(input)); } /// @@ -10519,10 +10540,7 @@ public static Tensor f_f_t(Tensor input, string name = "FFT") /// public static Tensor f_f_t2d(Tensor input, string name = "FFT2D") { - var dict = new Dictionary(); - dict["input"] = input; - var op = tf.OpDefLib._apply_op_helper("FFT2D", name: name, keywords: dict); - return op.output; + return tf.Context.ExecuteOp("FFT2D", name, new ExecuteOpArgs(input)); } /// @@ -10549,10 +10567,7 @@ public static Tensor f_f_t2d(Tensor input, string name = "FFT2D") /// public static Tensor f_f_t3d(Tensor input, string name = "FFT3D") { - var dict = new Dictionary(); - dict["input"] = input; - var op = tf.OpDefLib._apply_op_helper("FFT3D", name: name, keywords: dict); - return op.output; + return tf.Context.ExecuteOp("FFT3D", name, new ExecuteOpArgs(input)); } /// @@ -12875,10 +12890,7 @@ public static Tensor host_const(Tensor value, TF_DataType dtype, string name = " /// public static Tensor i_f_f_t(Tensor input, string name = "IFFT") { - var dict = new Dictionary(); - dict["input"] = input; - var op = tf.OpDefLib._apply_op_helper("IFFT", name: name, keywords: dict); - return op.output; + return tf.Context.ExecuteOp("IFFT", name, new ExecuteOpArgs(input)); } /// @@ -12905,10 +12917,7 @@ public static Tensor i_f_f_t(Tensor input, string name = "IFFT") /// public static Tensor i_f_f_t2d(Tensor input, string name = "IFFT2D") { - var dict = new Dictionary(); - dict["input"] = input; - var op = tf.OpDefLib._apply_op_helper("IFFT2D", name: name, keywords: dict); - return op.output; + return tf.Context.ExecuteOp("IFFT2D", name, new ExecuteOpArgs(input)); } /// @@ -12935,10 +12944,7 @@ public static Tensor i_f_f_t2d(Tensor input, string name = "IFFT2D") /// public static Tensor i_f_f_t3d(Tensor input, string name = "IFFT3D") { - var dict = new Dictionary(); - dict["input"] = input; - var op = tf.OpDefLib._apply_op_helper("IFFT3D", name: name, keywords: dict); - return op.output; + return tf.Context.ExecuteOp("IFFT3D", name, new ExecuteOpArgs(input)); } /// @@ -13325,14 +13331,12 @@ public static Tensor igammac(Tensor a, Tensor x, string name = "Igammac") /// tf.imag(input) ==&gt; [4.75, 5.75] /// /// - public static Tensor imag(Tensor input, TF_DataType? Tout = null, string name = "Imag") + public static Tensor imag(Tensor input, TF_DataType? a_Tout = null, string name = "Imag") { - var dict = new Dictionary(); - dict["input"] = input; - if (Tout.HasValue) - dict["Tout"] = Tout.Value; - var op = tf.OpDefLib._apply_op_helper("Imag", name: name, keywords: dict); - return op.output; + TF_DataType Tin = input.GetDataType(); + return tf.Context.ExecuteOp("Imag", name, new ExecuteOpArgs(input).SetAttributes(new { T = Tin, Tout = a_Tout })); + + // return tf.Context.ExecuteOp("Imag", name, new ExecuteOpArgs(new object[] { input })); } /// @@ -23863,14 +23867,12 @@ public static Tensor reader_serialize_state_v2(Tensor reader_handle, string name /// tf.real(input) ==&gt; [-2.25, 3.25] /// /// - public static Tensor real(Tensor input, TF_DataType? Tout = null, string name = "Real") + public static Tensor real(Tensor input, TF_DataType? a_Tout = null, string name = "Real") { - var dict = new Dictionary(); - dict["input"] = input; - if (Tout.HasValue) - dict["Tout"] = Tout.Value; - var op = tf.OpDefLib._apply_op_helper("Real", name: name, keywords: dict); - return op.output; + TF_DataType Tin = input.GetDataType(); + return tf.Context.ExecuteOp("Real", name, new ExecuteOpArgs(input).SetAttributes(new { T = Tin, Tout = a_Tout })); + +// return tf.Context.ExecuteOp("Real", name, new ExecuteOpArgs(new object[] {input})); } /// @@ -29541,7 +29543,7 @@ public static (Tensor e, Tensor v) self_adjoint_eig_v2(Tensor input, bool? compu /// if &lt; 0, scale * features otherwise. /// /// To be used together with - /// initializer = tf.variance_scaling_initializer(factor=1.0, mode='FAN_IN'). + /// initializer = tf.variance_scaling_initializer(scale=1.0, mode='fan_in'). /// For correct dropout, use tf.contrib.nn.alpha_dropout. /// /// See [Self-Normalizing Neural Networks](https://arxiv.org/abs/1706.02515) diff --git a/src/TensorFlowNET.Core/Operations/handle_data_util.cs b/src/TensorFlowNET.Core/Operations/handle_data_util.cs new file mode 100644 index 000000000..a01efc520 --- /dev/null +++ b/src/TensorFlowNET.Core/Operations/handle_data_util.cs @@ -0,0 +1,60 @@ +using Google.Protobuf; +using System; +using System.Collections.Generic; +using System.Text; +using Tensorflow.Eager; +using static Tensorflow.CppShapeInferenceResult.Types; + +namespace Tensorflow.Operations +{ + public static class handle_data_util + { + public static void copy_handle_data(Tensor source_t, Tensor target_t) + { + if(target_t.dtype == dtypes.resource || target_t.dtype == dtypes.variant) + { + HandleData handle_data; + if(source_t is EagerTensor) + { + handle_data = source_t.HandleData; + } + else + { + handle_data = ops.get_resource_handle_data(source_t); + } + if(handle_data is not null && handle_data.IsSet && handle_data.ShapeAndType is not null + && handle_data.ShapeAndType.Count > 0) + { + set_handle_data(target_t, handle_data); + } + } + } + + public static HandleData create_handle_data(Shape shape, TF_DataType dtype) + { + HandleData handle_data = new(); + handle_data.IsSet = true; + handle_data.ShapeAndType.Add(new HandleShapeAndType() + { + Shape = shape.as_proto(), + Dtype = dtype.as_datatype_enum() + }); + return handle_data; + } + + public static void set_handle_data(Tensor target_t, HandleData handle_data) + { + if(target_t is EagerTensor) + { + target_t.HandleData = handle_data; + return; + } + Status status = new(); + var proto = handle_data.ToByteArray(); + c_api.TFC_SetHandleShapeAndType(target_t.graph.c_graph, target_t._as_tf_output(), proto, proto.Length, status); + status.Check(true); + } + + public static HandleData get_resource_handle_data(Tensor graph_op) => ops.get_resource_handle_data(graph_op); + } +} diff --git a/src/TensorFlowNET.Core/Operations/image_ops_impl.cs b/src/TensorFlowNET.Core/Operations/image_ops_impl.cs index de74b2814..e0bc037d2 100644 --- a/src/TensorFlowNET.Core/Operations/image_ops_impl.cs +++ b/src/TensorFlowNET.Core/Operations/image_ops_impl.cs @@ -542,32 +542,32 @@ public static Tensor crop_to_bounding_box(Tensor image, int offset_height, int o image_shape)); } - var assert_ops = _CheckAtLeast3DImage(image, require_static: false); + var assert_ops = _CheckAtLeast3DImage(image, require_static: false).ToList(); // batch: [0], height: [1], width: [2], depth: [3] var bhwd = _ImageDimensions(image, rank: 4); - assert_ops[assert_ops.Length] = _assert(check_ops.assert_greater_equal(tf.constant(offset_height), + assert_ops.Add(_assert(check_ops.assert_greater_equal(tf.constant(offset_height), tf.constant(0)), typeof(ValueError), - "offset_height must be >= 0."); - assert_ops[assert_ops.Length] = _assert(check_ops.assert_greater_equal(tf.constant(offset_width), + "offset_height must be >= 0.")); + assert_ops.Add(_assert(check_ops.assert_greater_equal(tf.constant(offset_width), tf.constant(0)), typeof(ValueError), - "offset_width must be >= 0."); - assert_ops[assert_ops.Length] = _assert(check_ops.assert_less(tf.constant(0), + "offset_width must be >= 0.")); + assert_ops.Add(_assert(check_ops.assert_less(tf.constant(0), tf.constant(target_width)), typeof(ValueError), - "target_width must be > 0."); - assert_ops[assert_ops.Length] = _assert(check_ops.assert_less(tf.constant(0), + "target_width must be > 0.")); + assert_ops.Add(_assert(check_ops.assert_less(tf.constant(0), tf.constant(target_height)), typeof(ValueError), - "target_height must be > 0."); - assert_ops[assert_ops.Length] = _assert(check_ops.assert_greater_equal(tf.constant(bhwd[2]), + "target_height must be > 0.")); + assert_ops.Add(_assert(check_ops.assert_greater_equal(tf.constant(bhwd[2]), tf.constant(target_width + offset_width)), typeof(ValueError), - "width must be >= target + offset."); - assert_ops[assert_ops.Length] = _assert(check_ops.assert_greater_equal(tf.constant(bhwd[1]), + "width must be >= target + offset.")); + assert_ops.Add(_assert(check_ops.assert_greater_equal(tf.constant(bhwd[1]), tf.constant(target_height + offset_height)), typeof(ValueError), - "height must be >= target + offset."); - image = control_flow_ops.with_dependencies(assert_ops, image); + "height must be >= target + offset.")); + image = control_flow_ops.with_dependencies(assert_ops.ToArray(), image); var cropped = array_ops.slice( image, array_ops.stack(new[] { 0, offset_height, offset_width, 0 }), @@ -575,12 +575,16 @@ public static Tensor crop_to_bounding_box(Tensor image, int offset_height, int o Shape cropped_shape_result() { - long[] i_remnants = { }; + long[] i_remnants = new long[4]; + int idx = 0; foreach (var i in new[] { bhwd[0], target_height, target_width, bhwd[3] }) + { if (_is_tensor(i)) - return null; + i_remnants[idx] = -1; else - i_remnants[i_remnants.Length] = i; + i_remnants[idx] = i; + idx++; + } return new Shape(i_remnants); }; var cropped_shape = cropped_shape_result(); diff --git a/src/TensorFlowNET.Core/Operations/math_ops.cs b/src/TensorFlowNET.Core/Operations/math_ops.cs index 36f7db794..f7b428bb4 100644 --- a/src/TensorFlowNET.Core/Operations/math_ops.cs +++ b/src/TensorFlowNET.Core/Operations/math_ops.cs @@ -20,6 +20,7 @@ limitations under the License. using System.Linq; using Tensorflow.Framework; using static Tensorflow.Binding; +using Tensorflow.Operations; namespace Tensorflow { @@ -35,8 +36,9 @@ public static Tensor abs(Tensor x, string name = null) name = scope; x = ops.convert_to_tensor(x, name: "x"); if (x.dtype.is_complex()) - throw new NotImplementedException("math_ops.abs for dtype.is_complex"); - //return gen_math_ops.complex_abs(x, Tout: x.dtype.real_dtype, name: name); + { + return gen_ops.complex_abs(x, Tout: x.dtype.real_dtype(), name: name); + } return gen_math_ops._abs(x, name: name); }); } @@ -903,13 +905,29 @@ public static Tensor tensordot(Tensor a, Tensor b, NDArray axes, string name = n var (a_reshape, a_free_dims, a_free_dims_static) = _tensordot_reshape(a, a_axes); var (b_reshape, b_free_dims, b_free_dims_static) = _tensordot_reshape(b, b_axes, true); var ab_matmul = matmul(a_reshape, b_reshape); - var dims = new List(); - dims.AddRange(a_free_dims); - dims.AddRange(b_free_dims); - if (ab_matmul.shape.Equals(dims)) - return ab_matmul; + if(a_free_dims is int[] a_free_dims_list && b_free_dims is int[] b_free_dims_list) + { + var total_free_dims = a_free_dims_list.Concat(b_free_dims_list).ToArray(); + if (ab_matmul.shape.IsFullyDefined && ab_matmul.shape.as_int_list().SequenceEqual(total_free_dims)) + { + return ab_matmul; + } + else + { + return array_ops.reshape(ab_matmul, ops.convert_to_tensor(total_free_dims), name); + } + } else - return array_ops.reshape(ab_matmul, tf.constant(dims.ToArray()), name: name); + { + var a_free_dims_tensor = ops.convert_to_tensor(a_free_dims, dtype: dtypes.int32); + var b_free_dims_tensor = ops.convert_to_tensor(b_free_dims, dtype: dtypes.int32); + var product = array_ops.reshape(ab_matmul, array_ops.concat(new[] { a_free_dims_tensor, b_free_dims_tensor }, 0), name); + if(a_free_dims_static is not null && b_free_dims_static is not null) + { + product.shape = new Shape(a_free_dims_static.Concat(b_free_dims_static).ToArray()); + } + return product; + } }); } @@ -925,14 +943,42 @@ public static Tensor tensordot(Tensor a, Tensor b, NDArray axes, string name = n return (Binding.range(a.shape.ndim - axe, a.shape.ndim).ToArray(), Binding.range(0, axe).ToArray()); } - else + else if(axes.rank == 1) { + if (axes.shape[0] != 2) + { + throw new ValueError($"`axes` must be an integer or have length 2. Received {axes}."); + } (int a_axe, int b_axe) = (axes[0], axes[1]); return (new[] { a_axe }, new[] { b_axe }); } + else if(axes.rank == 2) + { + if (axes.shape[0] != 2) + { + throw new ValueError($"`axes` must be an integer or have length 2. Received {axes}."); + } + int[] a_axes = new int[axes.shape[1]]; + int[] b_axes = new int[axes.shape[1]]; + for(int i = 0; i < a_axes.Length; i++) + { + a_axes[i] = axes[0, i]; + b_axes[i] = axes[1, i]; + if (a_axes[i] == -1 || b_axes[i] == -1) + { + throw new ValueError($"Different number of contraction axes `a` and `b`," + + $"{len(a_axes)} != {len(b_axes)}."); + } + } + return (a_axes, b_axes); + } + else + { + throw new ValueError($"Invalid rank {axes.rank} to make tensor dot."); + } } - static (Tensor, int[], int[]) _tensordot_reshape(Tensor a, int[] axes, bool flipped = false) + static (Tensor, object, int[]) _tensordot_reshape(Tensor a, int[] axes, bool flipped = false) { if (a.shape.IsFullyDefined && isinstance(axes, (typeof(int[]), typeof(Tuple)))) { @@ -975,6 +1021,58 @@ public static Tensor tensordot(Tensor a, Tensor b, NDArray axes, string name = n var reshaped_a = array_ops.reshape(a_trans, new_shape); return (reshaped_a, free_dims, free_dims); } + else + { + int[] free_dims_static; + Tensor converted_shape_a, converted_axes, converted_free; + if (a.shape.ndim != -1) + { + var shape_a = a.shape.as_int_list(); + for(int i = 0; i < axes.Length; i++) + { + if (axes[i] < 0) + { + axes[i] += shape_a.Length; + } + } + var free = Enumerable.Range(0, shape_a.Length).Where(i => !axes.Contains(i)).ToArray(); + + var axes_dims = axes.Select(i => shape_a[i]); + var free_dims = free.Select(i => shape_a[i]).ToArray(); + free_dims_static = free_dims; + converted_axes = ops.convert_to_tensor(axes, dtypes.int32, "axes"); + converted_free = ops.convert_to_tensor(free, dtypes.int32, "free"); + converted_shape_a = array_ops.shape(a); + } + else + { + free_dims_static = null; + converted_shape_a = array_ops.shape(a); + var rank_a = array_ops.rank(a); + converted_axes = ops.convert_to_tensor(axes, dtypes.int32, "axes"); + converted_axes = array_ops.where_v2(converted_axes >= 0, converted_axes, converted_axes + rank_a); + (converted_free, var _) = gen_ops.list_diff(gen_math_ops.range(ops.convert_to_tensor(0), rank_a, ops.convert_to_tensor(1)), + converted_axes, dtypes.int32); + } + var converted_free_dims = array_ops.gather(converted_shape_a, converted_free); + var converted_axes_dims = array_ops.gather(converted_shape_a, converted_axes); + var prod_free_dims = reduce_prod(converted_free_dims); + var prod_axes_dims = reduce_prod(converted_axes_dims); + Tensor reshaped_a; + if (flipped) + { + var perm = array_ops.concat(new[] { converted_axes, converted_free }, 0); + var new_shape = array_ops.stack(new[] { prod_axes_dims, prod_free_dims }); + reshaped_a = array_ops.reshape(array_ops.transpose(a, perm), new_shape); + } + else + { + var perm = array_ops.concat(new[] { converted_free, converted_axes }, 0); + var new_shape = array_ops.stack(new[] { prod_free_dims, prod_axes_dims }); + reshaped_a = array_ops.reshape(array_ops.transpose(a, perm), new_shape); + } + return (reshaped_a, converted_free_dims, free_dims_static); + } throw new NotImplementedException("_tensordot_reshape"); } diff --git a/src/TensorFlowNET.Core/Operations/resource_variable_ops.cs b/src/TensorFlowNET.Core/Operations/resource_variable_ops.cs index 6ce7a0b00..c06e822d2 100644 --- a/src/TensorFlowNET.Core/Operations/resource_variable_ops.cs +++ b/src/TensorFlowNET.Core/Operations/resource_variable_ops.cs @@ -21,6 +21,11 @@ limitations under the License. using Tensorflow.Training.Saving.SavedModel; using Tensorflow.Variables; using static Tensorflow.CppShapeInferenceResult.Types; +using static Tensorflow.Binding; +using Tensorflow.Operations; +using System.Buffers; +using Tensorflow.Eager; +using Tensorflow.Graphs; namespace Tensorflow { @@ -31,18 +36,14 @@ public static class resource_variable_ops { public static Operation shape_safe_assign_variable_handle(Tensor handle, int[] shape, Tensor value, string name = null) { + // TODO(Rinne): deal with `_handle_graph`. var value_tensor = ops.convert_to_tensor(value); return gen_resource_variable_ops.assign_variable_op(handle, value_tensor, name: name); } - public static bool is_resource_variable(IVariableV1 var) - { - return var is ResourceVariable; - } - - public static bool is_resource_variable(Trackable var) + public static bool is_resource_variable(object var) { return var is BaseResourceVariable; } @@ -78,6 +79,18 @@ public static Tensor variable_handle_from_shape_and_dtype(Shape shape, TF_DataTy string shared_name, string name, bool graph_mode, Tensor initial_value = null) { var container = ops.get_default_graph().Container; + if(container is null) + { + container = ""; + } + if (!graph_mode) + { + if(shared_name is not null) + { + throw new Exception("Using an explicit shared_name is not allowed when executing eagerly."); + } + shared_name = tf.Context.anonymous_name(); + } var handle = gen_resource_variable_ops.var_handle_op(shape: shape, dtype: dtype, shared_name: shared_name, @@ -95,26 +108,20 @@ public static Tensor variable_handle_from_shape_and_dtype(Shape shape, TF_DataTy } else { - // We do not want two distinct ResourceVariable objects for the same - // underlying resource in the runtime. - // When in eager mode, explicitly ensure so here. When in graph mode, it's - // ensured by always generating different variable names. - var exists = gen_resource_variable_ops.var_is_initialized_op(handle); - - // We create an assert Op instead of checking right away in order to be - // compatible with ASYNC execution mode. Further, since not all devices - // support string tensors, we encode the assertion string in the Op name - /*gen_logging_ops.assert(gen_math_ops.logical_not(exists), - new[] { exists }, - name: "EagerVariableNameReuse");*/ - - var handle_data = new HandleData(); - handle_data.IsSet = true; - handle_data.ShapeAndType.Add(new HandleShapeAndType + var handle_data = handle_data_util.create_handle_data(shape, dtype); + if (initial_value is not null && initial_value.dtype == dtypes.variant) { - Dtype = dtype.as_datatype_enum(), - Shape = shape.as_proto() - }); + var extra_handle_data = get_eager_safe_handle_data(initial_value); + if (extra_handle_data is not null && extra_handle_data.IsSet) + { + if (!handle_data.IsSet || handle_data.ShapeAndType.Count != 1) + { + throw new RuntimeError($"Expected VarHandleOp to return a length==1 shape_and_type, " + + $"but saw: '{handle_data}'"); + } + handle_data.ShapeAndType.AddRange(extra_handle_data.ShapeAndType); + } + } _set_handle_shapes_and_types(handle, handle_data, graph_mode); return handle; } @@ -126,7 +133,7 @@ public static Tensor variable_handle_from_shape_and_dtype(Shape shape, TF_DataTy /// /// /// - private static void _set_handle_shapes_and_types(Tensor tensor, HandleData handle_data, bool graph_mode) + internal unsafe static void _set_handle_shapes_and_types(Tensor tensor, HandleData handle_data, bool graph_mode) { if (!graph_mode) return; @@ -144,6 +151,47 @@ private static void _set_handle_shapes_and_types(Tensor tensor, HandleData handl ranks[i] = shapeAndType.Shape.UnknownRank ? -1 : shapeAndType.Shape.Dim.Count; var dims = shapeAndType.Shape.Dim.Select(x => x.Size).ToArray(); } + + //tensor.HandleData = handle_data; + //if (!graph_mode) + // return; + + //var shapes = handle_data.ShapeAndType.Select(x => x.Shape); + //var types = handle_data.ShapeAndType.Select(x => x.Dtype).ToArray(); + //var ranks = shapes.Select(s => s.UnknownRank ? -1 : s.Dim.Count).ToArray(); + //var converted_shapes = shapes.Select>(s => + //{ + // if (!s.UnknownRank) + // { + // return s.Dim.Select(d => (int)d.Size).ToArray(); + // } + // else + // { + // return Memory.Empty; + // } + //}).ToArray(); + + //List handles = new(); + //IntPtr[] shapes_with_ptr = new IntPtr[converted_shapes.Length]; + //foreach(var (i, m) in enumerate(converted_shapes)) + //{ + // if(m.IsEmpty) + // { + // shapes_with_ptr[i] = IntPtr.Zero; + // } + // else + // { + // var handle = m.Pin(); + // handles.Add(handle); + // shapes_with_ptr[i] = new IntPtr(handle.Pointer); + // } + //} + + //Status status = new(); + //// TODO(Rinne): enable it. + //c_api.TF_GraphSetOutputHandleShapesAndTypes(tensor.op.graph.c_graph, tensor._as_tf_output(), + // shapes_with_ptr.Length, shapes_with_ptr, ranks, types, status); + //handles = null; } /// @@ -162,24 +210,6 @@ private static HandleData _combine_handle_data(Tensor handle, Tensor initial_val throw new NotImplementedException(""); } - private static HandleData get_eager_safe_handle_data(Tensor handle) - { - if (handle.Handle == null) - { - var data = new HandleData(); - data.ShapeAndType.Add(new HandleShapeAndType - { - Shape = handle.shape.as_shape_proto(), - Dtype = handle.dtype.as_datatype_enum() - }); - return data; - } - else - { - return HandleData.Parser.ParseFrom(handle.BufferToArray()); - } - } - /// /// Copies an existing variable to a new graph, with no initializer. /// @@ -231,5 +261,60 @@ public static void write_object_proto_for_resource_variable(BaseResourceVariable } } } + + public static void _maybe_set_handle_data(TF_DataType dtype, Tensor handle, Tensor tensor) + { + if(dtype == dtypes.variant) + { + var handle_data = get_eager_safe_handle_data(handle); + if(handle_data.IsSet && handle_data.ShapeAndType.Count > 1) + { + tensor.HandleData = new HandleData() + { + IsSet = true + }; + tensor.HandleData.ShapeAndType.AddRange(handle_data.ShapeAndType.Skip(1)); + } + } + } + + public static HandleData get_eager_safe_handle_data(Tensor handle) + { + if (handle.Handle == null) + { + var data = new HandleData(); + data.ShapeAndType.Add(new HandleShapeAndType + { + Shape = handle.shape.as_shape_proto(), + Dtype = handle.dtype.as_datatype_enum() + }); + return data; + } + else + { + return HandleData.Parser.ParseFrom(handle.BufferToArray()); + } + //if(handle is EagerTensor) + //{ + // return handle.HandleData; + //} + //else + //{ + // return handle_data_util.get_resource_handle_data(handle); + //} + } + + public static void variable_accessed(IVariableV1 variable) + { + if (ops.get_default_graph() is FuncGraph func_graph) + { + func_graph.watch_variable(variable); + } + if (variable.Trainable) + { + foreach (var tape in tf.GetTapeSet()) + tape.VariableAccessed(variable); + } + } } } diff --git a/src/TensorFlowNET.Core/Protobuf/AllocationDescription.cs b/src/TensorFlowNET.Core/Protobuf/AllocationDescription.cs index fe484d997..bac94eb7e 100644 --- a/src/TensorFlowNET.Core/Protobuf/AllocationDescription.cs +++ b/src/TensorFlowNET.Core/Protobuf/AllocationDescription.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/allocation_description.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -43,23 +43,31 @@ static AllocationDescriptionReflection() { } #region Messages - public sealed partial class AllocationDescription : pb::IMessage { + public sealed partial class AllocationDescription : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AllocationDescription()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.AllocationDescriptionReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AllocationDescription() { OnConstruction(); } @@ -67,6 +75,7 @@ public AllocationDescription() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AllocationDescription(AllocationDescription other) : this() { requestedBytes_ = other.requestedBytes_; allocatedBytes_ = other.allocatedBytes_; @@ -78,6 +87,7 @@ public AllocationDescription(AllocationDescription other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AllocationDescription Clone() { return new AllocationDescription(this); } @@ -89,6 +99,7 @@ public AllocationDescription Clone() { /// Total number of bytes requested /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long RequestedBytes { get { return requestedBytes_; } set { @@ -103,6 +114,7 @@ public long RequestedBytes { /// Total number of bytes allocated if known /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long AllocatedBytes { get { return allocatedBytes_; } set { @@ -117,6 +129,7 @@ public long AllocatedBytes { /// Name of the allocator used /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string AllocatorName { get { return allocatorName_; } set { @@ -131,6 +144,7 @@ public string AllocatorName { /// Identifier of the allocated buffer if known /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long AllocationId { get { return allocationId_; } set { @@ -145,6 +159,7 @@ public long AllocationId { /// Set if this tensor only has one remaining reference /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool HasSingleReference { get { return hasSingleReference_; } set { @@ -159,6 +174,7 @@ public bool HasSingleReference { /// Address of the allocation. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ulong Ptr { get { return ptr_; } set { @@ -167,11 +183,13 @@ public ulong Ptr { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as AllocationDescription); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(AllocationDescription other) { if (ReferenceEquals(other, null)) { return false; @@ -189,6 +207,7 @@ public bool Equals(AllocationDescription other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (RequestedBytes != 0L) hash ^= RequestedBytes.GetHashCode(); @@ -204,12 +223,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (RequestedBytes != 0L) { output.WriteRawTag(8); output.WriteInt64(RequestedBytes); @@ -237,9 +261,45 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (RequestedBytes != 0L) { + output.WriteRawTag(8); + output.WriteInt64(RequestedBytes); + } + if (AllocatedBytes != 0L) { + output.WriteRawTag(16); + output.WriteInt64(AllocatedBytes); + } + if (AllocatorName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(AllocatorName); + } + if (AllocationId != 0L) { + output.WriteRawTag(32); + output.WriteInt64(AllocationId); + } + if (HasSingleReference != false) { + output.WriteRawTag(40); + output.WriteBool(HasSingleReference); + } + if (Ptr != 0UL) { + output.WriteRawTag(48); + output.WriteUInt64(Ptr); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (RequestedBytes != 0L) { @@ -267,6 +327,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(AllocationDescription other) { if (other == null) { return; @@ -293,7 +354,11 @@ public void MergeFrom(AllocationDescription other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -326,7 +391,47 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + RequestedBytes = input.ReadInt64(); + break; + } + case 16: { + AllocatedBytes = input.ReadInt64(); + break; + } + case 26: { + AllocatorName = input.ReadString(); + break; + } + case 32: { + AllocationId = input.ReadInt64(); + break; + } + case 40: { + HasSingleReference = input.ReadBool(); + break; + } + case 48: { + Ptr = input.ReadUInt64(); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/ApiDef.cs b/src/TensorFlowNET.Core/Protobuf/ApiDef.cs index 57c5898d9..b7bc58294 100644 --- a/src/TensorFlowNET.Core/Protobuf/ApiDef.cs +++ b/src/TensorFlowNET.Core/Protobuf/ApiDef.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/api_def.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -69,7 +69,7 @@ static ApiDefReflection() { /// common ApiDefs which it can either replace or modify. /// /// We separate the API definition from the OpDef so we can evolve the - /// API while remaining backwards compatible when interpretting old + /// API while remaining backwards compatible when interpreting old /// graphs. Overrides go in an "api_def.pbtxt" file with a text-format /// ApiDefs message. /// @@ -78,23 +78,31 @@ static ApiDefReflection() { /// need to wait until a major release of TensorFlow to avoid breaking /// our compatibility promises. /// - public sealed partial class ApiDef : pb::IMessage { + public sealed partial class ApiDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ApiDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ApiDefReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ApiDef() { OnConstruction(); } @@ -102,6 +110,7 @@ public ApiDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ApiDef(ApiDef other) : this() { graphOpName_ = other.graphOpName_; deprecationMessage_ = other.deprecationMessage_; @@ -120,6 +129,7 @@ public ApiDef(ApiDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ApiDef Clone() { return new ApiDef(this); } @@ -131,6 +141,7 @@ public ApiDef Clone() { /// Name of the op (in the OpDef) to specify the API for. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string GraphOpName { get { return graphOpName_; } set { @@ -147,6 +158,7 @@ public string GraphOpName { /// The message should indicate alternative op to use, if any. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string DeprecationMessage { get { return deprecationMessage_; } set { @@ -163,6 +175,7 @@ public string DeprecationMessage { /// deprecated in versions before that. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int DeprecationVersion { get { return deprecationVersion_; } set { @@ -174,6 +187,7 @@ public int DeprecationVersion { public const int VisibilityFieldNumber = 2; private global::Tensorflow.ApiDef.Types.Visibility visibility_ = global::Tensorflow.ApiDef.Types.Visibility.DefaultVisibility; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.ApiDef.Types.Visibility Visibility { get { return visibility_; } set { @@ -187,6 +201,7 @@ public int DeprecationVersion { = pb::FieldCodec.ForMessage(26, global::Tensorflow.ApiDef.Types.Endpoint.Parser); private readonly pbc::RepeatedField endpoint_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Endpoint { get { return endpoint_; } } @@ -197,6 +212,7 @@ public int DeprecationVersion { = pb::FieldCodec.ForMessage(34, global::Tensorflow.ApiDef.Types.Arg.Parser); private readonly pbc::RepeatedField inArg_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField InArg { get { return inArg_; } } @@ -207,6 +223,7 @@ public int DeprecationVersion { = pb::FieldCodec.ForMessage(42, global::Tensorflow.ApiDef.Types.Arg.Parser); private readonly pbc::RepeatedField outArg_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField OutArg { get { return outArg_; } } @@ -222,6 +239,7 @@ public int DeprecationVersion { /// or match size of in_arg. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField ArgOrder { get { return argOrder_; } } @@ -232,6 +250,7 @@ public int DeprecationVersion { = pb::FieldCodec.ForMessage(50, global::Tensorflow.ApiDef.Types.Attr.Parser); private readonly pbc::RepeatedField attr_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Attr { get { return attr_; } } @@ -243,6 +262,7 @@ public int DeprecationVersion { /// One-line human-readable description of what the Op does. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Summary { get { return summary_; } set { @@ -257,6 +277,7 @@ public string Summary { /// Additional, longer human-readable description of what the Op does. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Description { get { return description_; } set { @@ -272,6 +293,7 @@ public string Description { /// or end. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string DescriptionPrefix { get { return descriptionPrefix_; } set { @@ -283,6 +305,7 @@ public string DescriptionPrefix { public const int DescriptionSuffixFieldNumber = 10; private string descriptionSuffix_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string DescriptionSuffix { get { return descriptionSuffix_; } set { @@ -291,11 +314,13 @@ public string DescriptionSuffix { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as ApiDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(ApiDef other) { if (ReferenceEquals(other, null)) { return false; @@ -320,6 +345,7 @@ public bool Equals(ApiDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (GraphOpName.Length != 0) hash ^= GraphOpName.GetHashCode(); @@ -342,12 +368,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (GraphOpName.Length != 0) { output.WriteRawTag(10); output.WriteString(GraphOpName); @@ -388,9 +419,58 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (GraphOpName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(GraphOpName); + } + if (Visibility != global::Tensorflow.ApiDef.Types.Visibility.DefaultVisibility) { + output.WriteRawTag(16); + output.WriteEnum((int) Visibility); + } + endpoint_.WriteTo(ref output, _repeated_endpoint_codec); + inArg_.WriteTo(ref output, _repeated_inArg_codec); + outArg_.WriteTo(ref output, _repeated_outArg_codec); + attr_.WriteTo(ref output, _repeated_attr_codec); + if (Summary.Length != 0) { + output.WriteRawTag(58); + output.WriteString(Summary); + } + if (Description.Length != 0) { + output.WriteRawTag(66); + output.WriteString(Description); + } + if (DescriptionPrefix.Length != 0) { + output.WriteRawTag(74); + output.WriteString(DescriptionPrefix); + } + if (DescriptionSuffix.Length != 0) { + output.WriteRawTag(82); + output.WriteString(DescriptionSuffix); + } + argOrder_.WriteTo(ref output, _repeated_argOrder_codec); + if (DeprecationMessage.Length != 0) { + output.WriteRawTag(98); + output.WriteString(DeprecationMessage); + } + if (DeprecationVersion != 0) { + output.WriteRawTag(104); + output.WriteInt32(DeprecationVersion); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (GraphOpName.Length != 0) { @@ -429,6 +509,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(ApiDef other) { if (other == null) { return; @@ -466,7 +547,11 @@ public void MergeFrom(ApiDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -527,11 +612,80 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + GraphOpName = input.ReadString(); + break; + } + case 16: { + Visibility = (global::Tensorflow.ApiDef.Types.Visibility) input.ReadEnum(); + break; + } + case 26: { + endpoint_.AddEntriesFrom(ref input, _repeated_endpoint_codec); + break; + } + case 34: { + inArg_.AddEntriesFrom(ref input, _repeated_inArg_codec); + break; + } + case 42: { + outArg_.AddEntriesFrom(ref input, _repeated_outArg_codec); + break; + } + case 50: { + attr_.AddEntriesFrom(ref input, _repeated_attr_codec); + break; + } + case 58: { + Summary = input.ReadString(); + break; + } + case 66: { + Description = input.ReadString(); + break; + } + case 74: { + DescriptionPrefix = input.ReadString(); + break; + } + case 82: { + DescriptionSuffix = input.ReadString(); + break; + } + case 90: { + argOrder_.AddEntriesFrom(ref input, _repeated_argOrder_codec); + break; + } + case 98: { + DeprecationMessage = input.ReadString(); + break; + } + case 104: { + DeprecationVersion = input.ReadInt32(); + break; + } + } + } } + #endif #region Nested types /// Container for nested types declared in the ApiDef message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { public enum Visibility { /// @@ -561,23 +715,31 @@ public enum Visibility { /// "canonical" endpoint, and should not be deprecated (unless all /// endpoints are deprecated). /// - public sealed partial class Endpoint : pb::IMessage { + public sealed partial class Endpoint : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Endpoint()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ApiDef.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Endpoint() { OnConstruction(); } @@ -585,6 +747,7 @@ public Endpoint() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Endpoint(Endpoint other) : this() { name_ = other.name_; deprecated_ = other.deprecated_; @@ -593,6 +756,7 @@ public Endpoint(Endpoint other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Endpoint Clone() { return new Endpoint(this); } @@ -606,6 +770,7 @@ public Endpoint Clone() { /// use a snake_case convention instead of CamelCase. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -622,6 +787,7 @@ public string Name { /// endpoints are deprecated, set deprecation_message in ApiDef instead. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Deprecated { get { return deprecated_; } set { @@ -638,6 +804,7 @@ public bool Deprecated { /// deprecated in versions before that. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int DeprecationVersion { get { return deprecationVersion_; } set { @@ -646,11 +813,13 @@ public int DeprecationVersion { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as Endpoint); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(Endpoint other) { if (ReferenceEquals(other, null)) { return false; @@ -665,6 +834,7 @@ public bool Equals(Endpoint other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -677,12 +847,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -698,9 +873,33 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (Deprecated != false) { + output.WriteRawTag(24); + output.WriteBool(Deprecated); + } + if (DeprecationVersion != 0) { + output.WriteRawTag(32); + output.WriteInt32(DeprecationVersion); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -719,6 +918,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(Endpoint other) { if (other == null) { return; @@ -736,7 +936,11 @@ public void MergeFrom(Endpoint other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -757,27 +961,63 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 24: { + Deprecated = input.ReadBool(); + break; + } + case 32: { + DeprecationVersion = input.ReadInt32(); + break; + } + } + } } + #endif } - public sealed partial class Arg : pb::IMessage { + public sealed partial class Arg : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Arg()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ApiDef.Descriptor.NestedTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Arg() { OnConstruction(); } @@ -785,6 +1025,7 @@ public Arg() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Arg(Arg other) : this() { name_ = other.name_; renameTo_ = other.renameTo_; @@ -793,6 +1034,7 @@ public Arg(Arg other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Arg Clone() { return new Arg(this); } @@ -801,6 +1043,7 @@ public Arg Clone() { public const int NameFieldNumber = 1; private string name_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -817,6 +1060,7 @@ public string Name { /// will also be replaced in the summary & description fields. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string RenameTo { get { return renameTo_; } set { @@ -833,6 +1077,7 @@ public string RenameTo { /// them entirely) as can be done with op descriptions. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Description { get { return description_; } set { @@ -841,11 +1086,13 @@ public string Description { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as Arg); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(Arg other) { if (ReferenceEquals(other, null)) { return false; @@ -860,6 +1107,7 @@ public bool Equals(Arg other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -872,12 +1120,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -893,9 +1146,33 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (RenameTo.Length != 0) { + output.WriteRawTag(18); + output.WriteString(RenameTo); + } + if (Description.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Description); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -914,6 +1191,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(Arg other) { if (other == null) { return; @@ -931,7 +1209,11 @@ public void MergeFrom(Arg other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -952,8 +1234,36 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + RenameTo = input.ReadString(); + break; + } + case 26: { + Description = input.ReadString(); + break; + } + } + } + } + #endif + } /// @@ -961,23 +1271,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// Op. That is to say, this describes the attr fields that will /// be specified in the NodeDef. /// - public sealed partial class Attr : pb::IMessage { + public sealed partial class Attr : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Attr()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ApiDef.Descriptor.NestedTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Attr() { OnConstruction(); } @@ -985,6 +1303,7 @@ public Attr() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Attr(Attr other) : this() { name_ = other.name_; renameTo_ = other.renameTo_; @@ -994,6 +1313,7 @@ public Attr(Attr other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Attr Clone() { return new Attr(this); } @@ -1002,6 +1322,7 @@ public Attr Clone() { public const int NameFieldNumber = 1; private string name_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -1018,6 +1339,7 @@ public string Name { /// will also be replaced in the summary & description fields. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string RenameTo { get { return renameTo_; } set { @@ -1035,6 +1357,7 @@ public string RenameTo { /// GraphDefs. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.AttrValue DefaultValue { get { return defaultValue_; } set { @@ -1050,6 +1373,7 @@ public string RenameTo { /// way of modifying attr descriptions as can be done with op descriptions. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Description { get { return description_; } set { @@ -1058,11 +1382,13 @@ public string Description { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as Attr); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(Attr other) { if (ReferenceEquals(other, null)) { return false; @@ -1078,6 +1404,7 @@ public bool Equals(Attr other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -1091,12 +1418,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -1116,9 +1448,37 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (RenameTo.Length != 0) { + output.WriteRawTag(18); + output.WriteString(RenameTo); + } + if (defaultValue_ != null) { + output.WriteRawTag(26); + output.WriteMessage(DefaultValue); + } + if (Description.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Description); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -1140,6 +1500,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(Attr other) { if (other == null) { return; @@ -1163,7 +1524,11 @@ public void MergeFrom(Attr other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1191,7 +1556,42 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + RenameTo = input.ReadString(); + break; + } + case 26: { + if (defaultValue_ == null) { + DefaultValue = new global::Tensorflow.AttrValue(); + } + input.ReadMessage(DefaultValue); + break; + } + case 34: { + Description = input.ReadString(); + break; + } + } + } } + #endif } @@ -1200,23 +1600,31 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class ApiDefs : pb::IMessage { + public sealed partial class ApiDefs : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ApiDefs()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ApiDefReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ApiDefs() { OnConstruction(); } @@ -1224,12 +1632,14 @@ public ApiDefs() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ApiDefs(ApiDefs other) : this() { op_ = other.op_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ApiDefs Clone() { return new ApiDefs(this); } @@ -1240,16 +1650,19 @@ public ApiDefs Clone() { = pb::FieldCodec.ForMessage(10, global::Tensorflow.ApiDef.Parser); private readonly pbc::RepeatedField op_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Op { get { return op_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as ApiDefs); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(ApiDefs other) { if (ReferenceEquals(other, null)) { return false; @@ -1262,6 +1675,7 @@ public bool Equals(ApiDefs other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= op_.GetHashCode(); @@ -1272,19 +1686,37 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else op_.WriteTo(output, _repeated_op_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + op_.WriteTo(ref output, _repeated_op_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += op_.CalculateSize(_repeated_op_codec); @@ -1295,6 +1727,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(ApiDefs other) { if (other == null) { return; @@ -1304,7 +1737,11 @@ public void MergeFrom(ApiDefs other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1317,7 +1754,27 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + op_.AddEntriesFrom(ref input, _repeated_op_codec); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/AttrValue.cs b/src/TensorFlowNET.Core/Protobuf/AttrValue.cs index 2a737f697..fbccba222 100644 --- a/src/TensorFlowNET.Core/Protobuf/AttrValue.cs +++ b/src/TensorFlowNET.Core/Protobuf/AttrValue.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/attr_value.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -63,23 +63,31 @@ static AttrValueReflection() { /// Comment indicates the corresponding attr type. Only the field matching the /// attr type may be filled. /// - public sealed partial class AttrValue : pb::IMessage { + public sealed partial class AttrValue : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AttrValue()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.AttrValueReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AttrValue() { OnConstruction(); } @@ -87,6 +95,7 @@ public AttrValue() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AttrValue(AttrValue other) : this() { switch (other.ValueCase) { case ValueOneofCase.S: @@ -125,6 +134,7 @@ public AttrValue(AttrValue other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AttrValue Clone() { return new AttrValue(this); } @@ -135,6 +145,7 @@ public AttrValue Clone() { /// "string" /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pb::ByteString S { get { return valueCase_ == ValueOneofCase.S ? (pb::ByteString) value_ : pb::ByteString.Empty; } set { @@ -149,6 +160,7 @@ public AttrValue Clone() { /// "int" /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long I { get { return valueCase_ == ValueOneofCase.I ? (long) value_ : 0L; } set { @@ -163,6 +175,7 @@ public long I { /// "float" /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public float F { get { return valueCase_ == ValueOneofCase.F ? (float) value_ : 0F; } set { @@ -177,6 +190,7 @@ public float F { /// "bool" /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool B { get { return valueCase_ == ValueOneofCase.B ? (bool) value_ : false; } set { @@ -191,6 +205,7 @@ public bool B { /// "type" /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.DataType Type { get { return valueCase_ == ValueOneofCase.Type ? (global::Tensorflow.DataType) value_ : global::Tensorflow.DataType.DtInvalid; } set { @@ -205,6 +220,7 @@ public bool B { /// "shape" /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorShapeProto Shape { get { return valueCase_ == ValueOneofCase.Shape ? (global::Tensorflow.TensorShapeProto) value_ : null; } set { @@ -219,6 +235,7 @@ public bool B { /// "tensor" /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorProto Tensor { get { return valueCase_ == ValueOneofCase.Tensor ? (global::Tensorflow.TensorProto) value_ : null; } set { @@ -233,6 +250,7 @@ public bool B { /// any "list(...)" /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.AttrValue.Types.ListValue List { get { return valueCase_ == ValueOneofCase.List ? (global::Tensorflow.AttrValue.Types.ListValue) value_ : null; } set { @@ -250,6 +268,7 @@ public bool B { /// that attr in the instantiation. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.NameAttrList Func { get { return valueCase_ == ValueOneofCase.Func ? (global::Tensorflow.NameAttrList) value_ : null; } set { @@ -270,6 +289,7 @@ public bool B { /// given the value "bar". /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Placeholder { get { return valueCase_ == ValueOneofCase.Placeholder ? (string) value_ : ""; } set { @@ -295,22 +315,26 @@ public enum ValueOneofCase { } private ValueOneofCase valueCase_ = ValueOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ValueOneofCase ValueCase { get { return valueCase_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void ClearValue() { valueCase_ = ValueOneofCase.None; value_ = null; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as AttrValue); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(AttrValue other) { if (ReferenceEquals(other, null)) { return false; @@ -333,6 +357,7 @@ public bool Equals(AttrValue other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (valueCase_ == ValueOneofCase.S) hash ^= S.GetHashCode(); @@ -353,12 +378,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (valueCase_ == ValueOneofCase.List) { output.WriteRawTag(10); output.WriteMessage(List); @@ -402,9 +432,61 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (valueCase_ == ValueOneofCase.List) { + output.WriteRawTag(10); + output.WriteMessage(List); + } + if (valueCase_ == ValueOneofCase.S) { + output.WriteRawTag(18); + output.WriteBytes(S); + } + if (valueCase_ == ValueOneofCase.I) { + output.WriteRawTag(24); + output.WriteInt64(I); + } + if (valueCase_ == ValueOneofCase.F) { + output.WriteRawTag(37); + output.WriteFloat(F); + } + if (valueCase_ == ValueOneofCase.B) { + output.WriteRawTag(40); + output.WriteBool(B); + } + if (valueCase_ == ValueOneofCase.Type) { + output.WriteRawTag(48); + output.WriteEnum((int) Type); + } + if (valueCase_ == ValueOneofCase.Shape) { + output.WriteRawTag(58); + output.WriteMessage(Shape); + } + if (valueCase_ == ValueOneofCase.Tensor) { + output.WriteRawTag(66); + output.WriteMessage(Tensor); + } + if (valueCase_ == ValueOneofCase.Placeholder) { + output.WriteRawTag(74); + output.WriteString(Placeholder); + } + if (valueCase_ == ValueOneofCase.Func) { + output.WriteRawTag(82); + output.WriteMessage(Func); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (valueCase_ == ValueOneofCase.S) { @@ -444,6 +526,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(AttrValue other) { if (other == null) { return; @@ -497,7 +580,11 @@ public void MergeFrom(AttrValue other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -567,32 +654,118 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + global::Tensorflow.AttrValue.Types.ListValue subBuilder = new global::Tensorflow.AttrValue.Types.ListValue(); + if (valueCase_ == ValueOneofCase.List) { + subBuilder.MergeFrom(List); + } + input.ReadMessage(subBuilder); + List = subBuilder; + break; + } + case 18: { + S = input.ReadBytes(); + break; + } + case 24: { + I = input.ReadInt64(); + break; + } + case 37: { + F = input.ReadFloat(); + break; + } + case 40: { + B = input.ReadBool(); + break; + } + case 48: { + value_ = input.ReadEnum(); + valueCase_ = ValueOneofCase.Type; + break; + } + case 58: { + global::Tensorflow.TensorShapeProto subBuilder = new global::Tensorflow.TensorShapeProto(); + if (valueCase_ == ValueOneofCase.Shape) { + subBuilder.MergeFrom(Shape); + } + input.ReadMessage(subBuilder); + Shape = subBuilder; + break; + } + case 66: { + global::Tensorflow.TensorProto subBuilder = new global::Tensorflow.TensorProto(); + if (valueCase_ == ValueOneofCase.Tensor) { + subBuilder.MergeFrom(Tensor); + } + input.ReadMessage(subBuilder); + Tensor = subBuilder; + break; + } + case 74: { + Placeholder = input.ReadString(); + break; + } + case 82: { + global::Tensorflow.NameAttrList subBuilder = new global::Tensorflow.NameAttrList(); + if (valueCase_ == ValueOneofCase.Func) { + subBuilder.MergeFrom(Func); + } + input.ReadMessage(subBuilder); + Func = subBuilder; + break; + } + } + } + } + #endif + #region Nested types /// Container for nested types declared in the AttrValue message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { /// /// LINT.IfChange /// - public sealed partial class ListValue : pb::IMessage { + public sealed partial class ListValue : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ListValue()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.AttrValue.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ListValue() { OnConstruction(); } @@ -600,6 +773,7 @@ public ListValue() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ListValue(ListValue other) : this() { s_ = other.s_.Clone(); i_ = other.i_.Clone(); @@ -613,6 +787,7 @@ public ListValue(ListValue other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ListValue Clone() { return new ListValue(this); } @@ -626,6 +801,7 @@ public ListValue Clone() { /// "list(string)" /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField S { get { return s_; } } @@ -639,6 +815,7 @@ public ListValue Clone() { /// "list(int)" /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField I { get { return i_; } } @@ -652,6 +829,7 @@ public ListValue Clone() { /// "list(float)" /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField F { get { return f_; } } @@ -665,6 +843,7 @@ public ListValue Clone() { /// "list(bool)" /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField B { get { return b_; } } @@ -678,6 +857,7 @@ public ListValue Clone() { /// "list(type)" /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Type { get { return type_; } } @@ -691,6 +871,7 @@ public ListValue Clone() { /// "list(shape)" /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Shape { get { return shape_; } } @@ -704,6 +885,7 @@ public ListValue Clone() { /// "list(tensor)" /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Tensor { get { return tensor_; } } @@ -717,16 +899,19 @@ public ListValue Clone() { /// "list(attr)" /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Func { get { return func_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as ListValue); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(ListValue other) { if (ReferenceEquals(other, null)) { return false; @@ -746,6 +931,7 @@ public bool Equals(ListValue other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= s_.GetHashCode(); @@ -763,12 +949,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else s_.WriteTo(output, _repeated_s_codec); i_.WriteTo(output, _repeated_i_codec); f_.WriteTo(output, _repeated_f_codec); @@ -780,9 +971,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + s_.WriteTo(ref output, _repeated_s_codec); + i_.WriteTo(ref output, _repeated_i_codec); + f_.WriteTo(ref output, _repeated_f_codec); + b_.WriteTo(ref output, _repeated_b_codec); + type_.WriteTo(ref output, _repeated_type_codec); + shape_.WriteTo(ref output, _repeated_shape_codec); + tensor_.WriteTo(ref output, _repeated_tensor_codec); + func_.WriteTo(ref output, _repeated_func_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += s_.CalculateSize(_repeated_s_codec); @@ -800,6 +1011,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(ListValue other) { if (other == null) { return; @@ -816,7 +1028,11 @@ public void MergeFrom(ListValue other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -861,7 +1077,59 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 18: { + s_.AddEntriesFrom(ref input, _repeated_s_codec); + break; + } + case 26: + case 24: { + i_.AddEntriesFrom(ref input, _repeated_i_codec); + break; + } + case 34: + case 37: { + f_.AddEntriesFrom(ref input, _repeated_f_codec); + break; + } + case 42: + case 40: { + b_.AddEntriesFrom(ref input, _repeated_b_codec); + break; + } + case 50: + case 48: { + type_.AddEntriesFrom(ref input, _repeated_type_codec); + break; + } + case 58: { + shape_.AddEntriesFrom(ref input, _repeated_shape_codec); + break; + } + case 66: { + tensor_.AddEntriesFrom(ref input, _repeated_tensor_codec); + break; + } + case 74: { + func_.AddEntriesFrom(ref input, _repeated_func_codec); + break; + } + } + } } + #endif } @@ -874,23 +1142,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// A list of attr names and their values. The whole list is attached /// with a string name. E.g., MatMul[T=float]. /// - public sealed partial class NameAttrList : pb::IMessage { + public sealed partial class NameAttrList : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NameAttrList()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.AttrValueReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NameAttrList() { OnConstruction(); } @@ -898,6 +1174,7 @@ public NameAttrList() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NameAttrList(NameAttrList other) : this() { name_ = other.name_; attr_ = other.attr_.Clone(); @@ -905,6 +1182,7 @@ public NameAttrList(NameAttrList other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NameAttrList Clone() { return new NameAttrList(this); } @@ -913,6 +1191,7 @@ public NameAttrList Clone() { public const int NameFieldNumber = 1; private string name_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -926,16 +1205,19 @@ public string Name { = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Tensorflow.AttrValue.Parser), 18); private readonly pbc::MapField attr_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField Attr { get { return attr_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as NameAttrList); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(NameAttrList other) { if (ReferenceEquals(other, null)) { return false; @@ -949,6 +1231,7 @@ public bool Equals(NameAttrList other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -960,12 +1243,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -974,9 +1262,26 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + attr_.WriteTo(ref output, _map_attr_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -990,6 +1295,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(NameAttrList other) { if (other == null) { return; @@ -1002,7 +1308,11 @@ public void MergeFrom(NameAttrList other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1019,7 +1329,31 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + attr_.AddEntriesFrom(ref input, _map_attr_codec); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/CheckpointState.cs b/src/TensorFlowNET.Core/Protobuf/CheckpointState.cs index 42cefa714..26d929e24 100644 --- a/src/TensorFlowNET.Core/Protobuf/CheckpointState.cs +++ b/src/TensorFlowNET.Core/Protobuf/CheckpointState.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/python/training/checkpoint_state.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -43,23 +43,31 @@ static CheckpointStateReflection() { /// /// Protocol buffer representing the checkpoint state. /// - public sealed partial class CheckpointState : pb::IMessage { + public sealed partial class CheckpointState : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CheckpointState()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.CheckpointStateReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CheckpointState() { OnConstruction(); } @@ -67,6 +75,7 @@ public CheckpointState() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CheckpointState(CheckpointState other) : this() { modelCheckpointPath_ = other.modelCheckpointPath_; allModelCheckpointPaths_ = other.allModelCheckpointPaths_.Clone(); @@ -76,6 +85,7 @@ public CheckpointState(CheckpointState other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CheckpointState Clone() { return new CheckpointState(this); } @@ -87,6 +97,7 @@ public CheckpointState Clone() { /// Path to the most-recent model checkpoint. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string ModelCheckpointPath { get { return modelCheckpointPath_; } set { @@ -106,6 +117,7 @@ public string ModelCheckpointPath { /// this list. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField AllModelCheckpointPaths { get { return allModelCheckpointPaths_; } } @@ -120,6 +132,7 @@ public string ModelCheckpointPath { /// when each checkpoint was created. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField AllModelCheckpointTimestamps { get { return allModelCheckpointTimestamps_; } } @@ -132,6 +145,7 @@ public string ModelCheckpointPath { /// checkpoint. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public double LastPreservedTimestamp { get { return lastPreservedTimestamp_; } set { @@ -140,11 +154,13 @@ public double LastPreservedTimestamp { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as CheckpointState); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(CheckpointState other) { if (ReferenceEquals(other, null)) { return false; @@ -160,6 +176,7 @@ public bool Equals(CheckpointState other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (ModelCheckpointPath.Length != 0) hash ^= ModelCheckpointPath.GetHashCode(); @@ -173,12 +190,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (ModelCheckpointPath.Length != 0) { output.WriteRawTag(10); output.WriteString(ModelCheckpointPath); @@ -192,9 +214,31 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ModelCheckpointPath.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ModelCheckpointPath); + } + allModelCheckpointPaths_.WriteTo(ref output, _repeated_allModelCheckpointPaths_codec); + allModelCheckpointTimestamps_.WriteTo(ref output, _repeated_allModelCheckpointTimestamps_codec); + if (LastPreservedTimestamp != 0D) { + output.WriteRawTag(33); + output.WriteDouble(LastPreservedTimestamp); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (ModelCheckpointPath.Length != 0) { @@ -212,6 +256,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(CheckpointState other) { if (other == null) { return; @@ -228,7 +273,11 @@ public void MergeFrom(CheckpointState other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -254,7 +303,40 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + ModelCheckpointPath = input.ReadString(); + break; + } + case 18: { + allModelCheckpointPaths_.AddEntriesFrom(ref input, _repeated_allModelCheckpointPaths_codec); + break; + } + case 26: + case 25: { + allModelCheckpointTimestamps_.AddEntriesFrom(ref input, _repeated_allModelCheckpointTimestamps_codec); + break; + } + case 33: { + LastPreservedTimestamp = input.ReadDouble(); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/Cluster.cs b/src/TensorFlowNET.Core/Protobuf/Cluster.cs index ca645ec1c..4c398c824 100644 --- a/src/TensorFlowNET.Core/Protobuf/Cluster.cs +++ b/src/TensorFlowNET.Core/Protobuf/Cluster.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/protobuf/cluster.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -47,23 +47,31 @@ static ClusterReflection() { /// /// Defines a single job in a TensorFlow cluster. /// - public sealed partial class JobDef : pb::IMessage { + public sealed partial class JobDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new JobDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ClusterReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public JobDef() { OnConstruction(); } @@ -71,6 +79,7 @@ public JobDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public JobDef(JobDef other) : this() { name_ = other.name_; tasks_ = other.tasks_.Clone(); @@ -78,6 +87,7 @@ public JobDef(JobDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public JobDef Clone() { return new JobDef(this); } @@ -89,6 +99,7 @@ public JobDef Clone() { /// The name of this job. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -109,16 +120,19 @@ public string Name { /// "/job:worker/task:7" will be assigned to "example.org:2222". /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField Tasks { get { return tasks_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as JobDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(JobDef other) { if (ReferenceEquals(other, null)) { return false; @@ -132,6 +146,7 @@ public bool Equals(JobDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -143,12 +158,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -157,9 +177,26 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + tasks_.WriteTo(ref output, _map_tasks_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -173,6 +210,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(JobDef other) { if (other == null) { return; @@ -185,7 +223,11 @@ public void MergeFrom(JobDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -202,30 +244,62 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + tasks_.AddEntriesFrom(ref input, _map_tasks_codec); + break; + } + } + } } + #endif } /// /// Defines a TensorFlow cluster as a set of jobs. /// - public sealed partial class ClusterDef : pb::IMessage { + public sealed partial class ClusterDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ClusterDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ClusterReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ClusterDef() { OnConstruction(); } @@ -233,12 +307,14 @@ public ClusterDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ClusterDef(ClusterDef other) : this() { job_ = other.job_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ClusterDef Clone() { return new ClusterDef(this); } @@ -252,16 +328,19 @@ public ClusterDef Clone() { /// The jobs that comprise the cluster. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Job { get { return job_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as ClusterDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(ClusterDef other) { if (ReferenceEquals(other, null)) { return false; @@ -274,6 +353,7 @@ public bool Equals(ClusterDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= job_.GetHashCode(); @@ -284,19 +364,37 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else job_.WriteTo(output, _repeated_job_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + job_.WriteTo(ref output, _repeated_job_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += job_.CalculateSize(_repeated_job_codec); @@ -307,6 +405,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(ClusterDef other) { if (other == null) { return; @@ -316,7 +415,11 @@ public void MergeFrom(ClusterDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -329,7 +432,27 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + job_.AddEntriesFrom(ref input, _repeated_job_codec); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/Config.cs b/src/TensorFlowNET.Core/Protobuf/Config.cs index cd34fd784..de7b38637 100644 --- a/src/TensorFlowNET.Core/Protobuf/Config.cs +++ b/src/TensorFlowNET.Core/Protobuf/Config.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/protobuf/config.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -28,139 +28,145 @@ static ConfigReflection() { "b3JmbG93Gip0ZW5zb3JmbG93L2NvcmUvZnJhbWV3b3JrL2Nvc3RfZ3JhcGgu", "cHJvdG8aJXRlbnNvcmZsb3cvY29yZS9mcmFtZXdvcmsvZ3JhcGgucHJvdG8a", "KnRlbnNvcmZsb3cvY29yZS9mcmFtZXdvcmsvc3RlcF9zdGF0cy5wcm90bxom", - "dGVuc29yZmxvdy9jb3JlL3Byb3RvYnVmL2NsdXN0ZXIucHJvdG8aJHRlbnNv", - "cmZsb3cvY29yZS9wcm90b2J1Zi9kZWJ1Zy5wcm90bxoudGVuc29yZmxvdy9j", - "b3JlL3Byb3RvYnVmL3Jld3JpdGVyX2NvbmZpZy5wcm90byKRBgoKR1BVT3B0", - "aW9ucxInCh9wZXJfcHJvY2Vzc19ncHVfbWVtb3J5X2ZyYWN0aW9uGAEgASgB", - "EhQKDGFsbG93X2dyb3d0aBgEIAEoCBIWCg5hbGxvY2F0b3JfdHlwZRgCIAEo", - "CRIfChdkZWZlcnJlZF9kZWxldGlvbl9ieXRlcxgDIAEoAxIbChN2aXNpYmxl", - "X2RldmljZV9saXN0GAUgASgJEiIKGnBvbGxpbmdfYWN0aXZlX2RlbGF5X3Vz", - "ZWNzGAYgASgFEiQKHHBvbGxpbmdfaW5hY3RpdmVfZGVsYXlfbXNlY3MYByAB", - "KAUSHAoUZm9yY2VfZ3B1X2NvbXBhdGlibGUYCCABKAgSOQoMZXhwZXJpbWVu", - "dGFsGAkgASgLMiMudGVuc29yZmxvdy5HUFVPcHRpb25zLkV4cGVyaW1lbnRh", - "bBrKAwoMRXhwZXJpbWVudGFsEksKD3ZpcnR1YWxfZGV2aWNlcxgBIAMoCzIy", - "LnRlbnNvcmZsb3cuR1BVT3B0aW9ucy5FeHBlcmltZW50YWwuVmlydHVhbERl", - "dmljZXMSGgoSdXNlX3VuaWZpZWRfbWVtb3J5GAIgASgIEiMKG251bV9kZXZf", - "dG9fZGV2X2NvcHlfc3RyZWFtcxgDIAEoBRIdChVjb2xsZWN0aXZlX3Jpbmdf", - "b3JkZXIYBCABKAkSHQoVdGltZXN0YW1wZWRfYWxsb2NhdG9yGAUgASgIEiMK", - "G2tlcm5lbF90cmFja2VyX21heF9pbnRlcnZhbBgHIAEoBRIgChhrZXJuZWxf", - "dHJhY2tlcl9tYXhfYnl0ZXMYCCABKAUSIgoaa2VybmVsX3RyYWNrZXJfbWF4", - "X3BlbmRpbmcYCSABKAUSJwofaW50ZXJuYWxfZnJhZ21lbnRhdGlvbl9mcmFj", - "dGlvbhgKIAEoARIdChV1c2VfY3VkYV9tYWxsb2NfYXN5bmMYCyABKAgaOwoO", - "VmlydHVhbERldmljZXMSFwoPbWVtb3J5X2xpbWl0X21iGAEgAygCEhAKCHBy", - "aW9yaXR5GAIgAygFIoUDChBPcHRpbWl6ZXJPcHRpb25zEisKI2RvX2NvbW1v", - "bl9zdWJleHByZXNzaW9uX2VsaW1pbmF0aW9uGAEgASgIEhsKE2RvX2NvbnN0", - "YW50X2ZvbGRpbmcYAiABKAgSJAocbWF4X2ZvbGRlZF9jb25zdGFudF9pbl9i", - "eXRlcxgGIAEoAxIcChRkb19mdW5jdGlvbl9pbmxpbmluZxgEIAEoCBI1Cglv", - "cHRfbGV2ZWwYAyABKA4yIi50ZW5zb3JmbG93Lk9wdGltaXplck9wdGlvbnMu", - "TGV2ZWwSRQoQZ2xvYmFsX2ppdF9sZXZlbBgFIAEoDjIrLnRlbnNvcmZsb3cu", - "T3B0aW1pemVyT3B0aW9ucy5HbG9iYWxKaXRMZXZlbCIgCgVMZXZlbBIGCgJM", - "MRAAEg8KAkwwEP///////////wEiQwoOR2xvYmFsSml0TGV2ZWwSCwoHREVG", - "QVVMVBAAEhAKA09GRhD///////////8BEggKBE9OXzEQARIICgRPTl8yEAIi", - "7gIKDEdyYXBoT3B0aW9ucxIeChZlbmFibGVfcmVjdl9zY2hlZHVsaW5nGAIg", - "ASgIEjcKEW9wdGltaXplcl9vcHRpb25zGAMgASgLMhwudGVuc29yZmxvdy5P", - "cHRpbWl6ZXJPcHRpb25zEhgKEGJ1aWxkX2Nvc3RfbW9kZWwYBCABKAMSHgoW", - "YnVpbGRfY29zdF9tb2RlbF9hZnRlchgJIAEoAxIUCgxpbmZlcl9zaGFwZXMY", - "BSABKAgSGgoScGxhY2VfcHJ1bmVkX2dyYXBoGAYgASgIEiAKGGVuYWJsZV9i", - "ZmxvYXQxNl9zZW5kcmVjdhgHIAEoCBIVCg10aW1lbGluZV9zdGVwGAggASgF", - "EjMKD3Jld3JpdGVfb3B0aW9ucxgKIAEoCzIaLnRlbnNvcmZsb3cuUmV3cml0", - "ZXJDb25maWdKBAgBEAJSJXNraXBfY29tbW9uX3N1YmV4cHJlc3Npb25fZWxp", - "bWluYXRpb24iQQoVVGhyZWFkUG9vbE9wdGlvblByb3RvEhMKC251bV90aHJl", - "YWRzGAEgASgFEhMKC2dsb2JhbF9uYW1lGAIgASgJItUBCgpSUENPcHRpb25z", - "EiQKHHVzZV9ycGNfZm9yX2lucHJvY2Vzc19tYXN0ZXIYASABKAgSHQoVY29t", - "cHJlc3Npb25fYWxnb3JpdGhtGAIgASgJEhkKEWNvbXByZXNzaW9uX2xldmVs", - "GAMgASgFEhoKEmNhY2hlX3JwY19yZXNwb25zZRgEIAEoCBIqCiJkaXNhYmxl", - "X3Nlc3Npb25fY29ubmVjdGlvbl9zaGFyaW5nGAUgASgIEh8KF251bV9jaGFu", - "bmVsc19wZXJfdGFyZ2V0GAYgASgFIjAKD1Nlc3Npb25NZXRhZGF0YRIMCgRu", - "YW1lGAEgASgJEg8KB3ZlcnNpb24YAiABKAMi2A0KC0NvbmZpZ1Byb3RvEj4K", - "DGRldmljZV9jb3VudBgBIAMoCzIoLnRlbnNvcmZsb3cuQ29uZmlnUHJvdG8u", - "RGV2aWNlQ291bnRFbnRyeRIkChxpbnRyYV9vcF9wYXJhbGxlbGlzbV90aHJl", - "YWRzGAIgASgFEiQKHGludGVyX29wX3BhcmFsbGVsaXNtX3RocmVhZHMYBSAB", - "KAUSHwoXdXNlX3Blcl9zZXNzaW9uX3RocmVhZHMYCSABKAgSRwocc2Vzc2lv", - "bl9pbnRlcl9vcF90aHJlYWRfcG9vbBgMIAMoCzIhLnRlbnNvcmZsb3cuVGhy", - "ZWFkUG9vbE9wdGlvblByb3RvEhgKEHBsYWNlbWVudF9wZXJpb2QYAyABKAUS", - "FgoOZGV2aWNlX2ZpbHRlcnMYBCADKAkSKwoLZ3B1X29wdGlvbnMYBiABKAsy", - "Fi50ZW5zb3JmbG93LkdQVU9wdGlvbnMSHAoUYWxsb3dfc29mdF9wbGFjZW1l", - "bnQYByABKAgSHAoUbG9nX2RldmljZV9wbGFjZW1lbnQYCCABKAgSLwoNZ3Jh", - "cGhfb3B0aW9ucxgKIAEoCzIYLnRlbnNvcmZsb3cuR3JhcGhPcHRpb25zEh8K", - "F29wZXJhdGlvbl90aW1lb3V0X2luX21zGAsgASgDEisKC3JwY19vcHRpb25z", - "GA0gASgLMhYudGVuc29yZmxvdy5SUENPcHRpb25zEisKC2NsdXN0ZXJfZGVm", - "GA4gASgLMhYudGVuc29yZmxvdy5DbHVzdGVyRGVmEh0KFWlzb2xhdGVfc2Vz", - "c2lvbl9zdGF0ZRgPIAEoCBIoCiBzaGFyZV9jbHVzdGVyX2RldmljZXNfaW5f", - "c2Vzc2lvbhgRIAEoCBI6CgxleHBlcmltZW50YWwYECABKAsyJC50ZW5zb3Jm", - "bG93LkNvbmZpZ1Byb3RvLkV4cGVyaW1lbnRhbBoyChBEZXZpY2VDb3VudEVu", - "dHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoBToCOAEa0gcKDEV4cGVy", - "aW1lbnRhbBIfChdjb2xsZWN0aXZlX2dyb3VwX2xlYWRlchgBIAEoCRIVCg1l", - "eGVjdXRvcl90eXBlGAMgASgJEhoKEnJlY3ZfYnVmX21heF9jaHVuaxgEIAEo", - "BRIZChF1c2VfbnVtYV9hZmZpbml0eRgFIAEoCBI1Ci1jb2xsZWN0aXZlX2Rl", - "dGVybWluaXN0aWNfc2VxdWVudGlhbF9leGVjdXRpb24YBiABKAgSFwoPY29s", - "bGVjdGl2ZV9uY2NsGAcgASgIEjYKLnNoYXJlX3Nlc3Npb25fc3RhdGVfaW5f", - "Y2x1c3RlcnNwZWNfcHJvcGFnYXRpb24YCCABKAgSHwoXZGlzYWJsZV90aHJl", - "YWRfc3Bpbm5pbmcYCSABKAgSKAogc2hhcmVfY2x1c3Rlcl9kZXZpY2VzX2lu", - "X3Nlc3Npb24YCiABKAgSNQoQc2Vzc2lvbl9tZXRhZGF0YRgLIAEoCzIbLnRl", - "bnNvcmZsb3cuU2Vzc2lvbk1ldGFkYXRhEiEKGW9wdGltaXplX2Zvcl9zdGF0", - "aWNfZ3JhcGgYDCABKAgSGgoSZW5hYmxlX21saXJfYnJpZGdlGA0gASgIElMK", - "E21saXJfYnJpZGdlX3JvbGxvdXQYESABKA4yNi50ZW5zb3JmbG93LkNvbmZp", - "Z1Byb3RvLkV4cGVyaW1lbnRhbC5NbGlyQnJpZGdlUm9sbG91dBImCh5lbmFi", - "bGVfbWxpcl9ncmFwaF9vcHRpbWl6YXRpb24YECABKAgSJwofZGlzYWJsZV9v", - "dXRwdXRfcGFydGl0aW9uX2dyYXBocxgOIAEoCBIjCht4bGFfZnVzaW9uX2F1", - "dG90dW5lcl90aHJlc2gYDyABKAMSEAoIdXNlX3RmcnQYEiABKAgSHAoUY29v", - "cmRpbmF0aW9uX3NlcnZpY2UYEyABKAkSLAokZmV0Y2hfcmVtb3RlX2Rldmlj", - "ZXNfaW5fbXVsdGlfY2xpZW50GBQgASgIItoBChFNbGlyQnJpZGdlUm9sbG91", - "dBIjCh9NTElSX0JSSURHRV9ST0xMT1VUX1VOU1BFQ0lGSUVEEAASHwobTUxJ", - "Ul9CUklER0VfUk9MTE9VVF9FTkFCTEVEEAESIAocTUxJUl9CUklER0VfUk9M", - "TE9VVF9ESVNBQkxFRBACEikKJU1MSVJfQlJJREdFX1JPTExPVVRfU0FGRV9N", - "T0RFX0VOQUJMRUQQAxIyCi5NTElSX0JSSURHRV9ST0xMT1VUX1NBRkVfTU9E", - "RV9GQUxMQkFDS19FTkFCTEVEEARKBAgCEAMi4QQKClJ1bk9wdGlvbnMSNgoL", - "dHJhY2VfbGV2ZWwYASABKA4yIS50ZW5zb3JmbG93LlJ1bk9wdGlvbnMuVHJh", - "Y2VMZXZlbBIVCg10aW1lb3V0X2luX21zGAIgASgDEhwKFGludGVyX29wX3Ro", - "cmVhZF9wb29sGAMgASgFEh8KF291dHB1dF9wYXJ0aXRpb25fZ3JhcGhzGAUg", - "ASgIEi8KDWRlYnVnX29wdGlvbnMYBiABKAsyGC50ZW5zb3JmbG93LkRlYnVn", - "T3B0aW9ucxIqCiJyZXBvcnRfdGVuc29yX2FsbG9jYXRpb25zX3Vwb25fb29t", - "GAcgASgIEjkKDGV4cGVyaW1lbnRhbBgIIAEoCzIjLnRlbnNvcmZsb3cuUnVu", - "T3B0aW9ucy5FeHBlcmltZW50YWwa0gEKDEV4cGVyaW1lbnRhbBIcChRjb2xs", - "ZWN0aXZlX2dyYXBoX2tleRgBIAEoAxIcChR1c2VfcnVuX2hhbmRsZXJfcG9v", - "bBgCIAEoCBJbChhydW5faGFuZGxlcl9wb29sX29wdGlvbnMYAyABKAsyOS50", - "ZW5zb3JmbG93LlJ1bk9wdGlvbnMuRXhwZXJpbWVudGFsLlJ1bkhhbmRsZXJQ", - "b29sT3B0aW9ucxopChVSdW5IYW5kbGVyUG9vbE9wdGlvbnMSEAoIcHJpb3Jp", - "dHkYASABKAMiUgoKVHJhY2VMZXZlbBIMCghOT19UUkFDRRAAEhIKDlNPRlRX", - "QVJFX1RSQUNFEAESEgoOSEFSRFdBUkVfVFJBQ0UQAhIOCgpGVUxMX1RSQUNF", - "EANKBAgEEAUihwMKC1J1bk1ldGFkYXRhEikKCnN0ZXBfc3RhdHMYASABKAsy", - "FS50ZW5zb3JmbG93LlN0ZXBTdGF0cxIsCgpjb3N0X2dyYXBoGAIgASgLMhgu", - "dGVuc29yZmxvdy5Db3N0R3JhcGhEZWYSLgoQcGFydGl0aW9uX2dyYXBocxgD", - "IAMoCzIULnRlbnNvcmZsb3cuR3JhcGhEZWYSPwoPZnVuY3Rpb25fZ3JhcGhz", - "GAQgAygLMiYudGVuc29yZmxvdy5SdW5NZXRhZGF0YS5GdW5jdGlvbkdyYXBo", - "cxqtAQoORnVuY3Rpb25HcmFwaHMSLgoQcGFydGl0aW9uX2dyYXBocxgBIAMo", - "CzIULnRlbnNvcmZsb3cuR3JhcGhEZWYSNAoWcHJlX29wdGltaXphdGlvbl9n", - "cmFwaBgCIAEoCzIULnRlbnNvcmZsb3cuR3JhcGhEZWYSNQoXcG9zdF9vcHRp", - "bWl6YXRpb25fZ3JhcGgYAyABKAsyFC50ZW5zb3JmbG93LkdyYXBoRGVmIjoK", - "EFRlbnNvckNvbm5lY3Rpb24SEwoLZnJvbV90ZW5zb3IYASABKAkSEQoJdG9f", - "dGVuc29yGAIgASgJIrADCg9DYWxsYWJsZU9wdGlvbnMSDAoEZmVlZBgBIAMo", - "CRINCgVmZXRjaBgCIAMoCRIOCgZ0YXJnZXQYAyADKAkSKwoLcnVuX29wdGlv", - "bnMYBCABKAsyFi50ZW5zb3JmbG93LlJ1bk9wdGlvbnMSNwoRdGVuc29yX2Nv", - "bm5lY3Rpb24YBSADKAsyHC50ZW5zb3JmbG93LlRlbnNvckNvbm5lY3Rpb24S", - "QgoMZmVlZF9kZXZpY2VzGAYgAygLMiwudGVuc29yZmxvdy5DYWxsYWJsZU9w", - "dGlvbnMuRmVlZERldmljZXNFbnRyeRJECg1mZXRjaF9kZXZpY2VzGAcgAygL", - "Mi0udGVuc29yZmxvdy5DYWxsYWJsZU9wdGlvbnMuRmV0Y2hEZXZpY2VzRW50", - "cnkSFwoPZmV0Y2hfc2tpcF9zeW5jGAggASgIGjIKEEZlZWREZXZpY2VzRW50", - "cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ARozChFGZXRjaERl", - "dmljZXNFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgBQoQB", - "ChhvcmcudGVuc29yZmxvdy5mcmFtZXdvcmtCDENvbmZpZ1Byb3Rvc1ABWlVn", - "aXRodWIuY29tL3RlbnNvcmZsb3cvdGVuc29yZmxvdy90ZW5zb3JmbG93L2dv", - "L2NvcmUvcHJvdG9idWYvZm9yX2NvcmVfcHJvdG9zX2dvX3Byb3Rv+AEBYgZw", - "cm90bzM=")); + "dGVuc29yZmxvdy9jb3JlL3Byb3RvYnVmL2NsdXN0ZXIucHJvdG8aMnRlbnNv", + "cmZsb3cvY29yZS9wcm90b2J1Zi9jb29yZGluYXRpb25fY29uZmlnLnByb3Rv", + "GiR0ZW5zb3JmbG93L2NvcmUvcHJvdG9idWYvZGVidWcucHJvdG8aLnRlbnNv", + "cmZsb3cvY29yZS9wcm90b2J1Zi9yZXdyaXRlcl9jb25maWcucHJvdG8i1wYK", + "CkdQVU9wdGlvbnMSJwofcGVyX3Byb2Nlc3NfZ3B1X21lbW9yeV9mcmFjdGlv", + "bhgBIAEoARIUCgxhbGxvd19ncm93dGgYBCABKAgSFgoOYWxsb2NhdG9yX3R5", + "cGUYAiABKAkSHwoXZGVmZXJyZWRfZGVsZXRpb25fYnl0ZXMYAyABKAMSGwoT", + "dmlzaWJsZV9kZXZpY2VfbGlzdBgFIAEoCRIiChpwb2xsaW5nX2FjdGl2ZV9k", + "ZWxheV91c2VjcxgGIAEoBRIkChxwb2xsaW5nX2luYWN0aXZlX2RlbGF5X21z", + "ZWNzGAcgASgFEhwKFGZvcmNlX2dwdV9jb21wYXRpYmxlGAggASgIEjkKDGV4", + "cGVyaW1lbnRhbBgJIAEoCzIjLnRlbnNvcmZsb3cuR1BVT3B0aW9ucy5FeHBl", + "cmltZW50YWwakAQKDEV4cGVyaW1lbnRhbBJLCg92aXJ0dWFsX2RldmljZXMY", + "ASADKAsyMi50ZW5zb3JmbG93LkdQVU9wdGlvbnMuRXhwZXJpbWVudGFsLlZp", + "cnR1YWxEZXZpY2VzEhoKEnVzZV91bmlmaWVkX21lbW9yeRgCIAEoCBIjChtu", + "dW1fZGV2X3RvX2Rldl9jb3B5X3N0cmVhbXMYAyABKAUSHQoVY29sbGVjdGl2", + "ZV9yaW5nX29yZGVyGAQgASgJEh0KFXRpbWVzdGFtcGVkX2FsbG9jYXRvchgF", + "IAEoCBIjChtrZXJuZWxfdHJhY2tlcl9tYXhfaW50ZXJ2YWwYByABKAUSIAoY", + "a2VybmVsX3RyYWNrZXJfbWF4X2J5dGVzGAggASgFEiIKGmtlcm5lbF90cmFj", + "a2VyX21heF9wZW5kaW5nGAkgASgFEicKH2ludGVybmFsX2ZyYWdtZW50YXRp", + "b25fZnJhY3Rpb24YCiABKAESHQoVdXNlX2N1ZGFfbWFsbG9jX2FzeW5jGAsg", + "ASgIEiwKJGRpc2FsbG93X3JldHJ5X29uX2FsbG9jYXRpb25fZmFpbHVyZRgM", + "IAEoCBpTCg5WaXJ0dWFsRGV2aWNlcxIXCg9tZW1vcnlfbGltaXRfbWIYASAD", + "KAISEAoIcHJpb3JpdHkYAiADKAUSFgoOZGV2aWNlX29yZGluYWwYAyADKAUi", + "nQMKEE9wdGltaXplck9wdGlvbnMSKwojZG9fY29tbW9uX3N1YmV4cHJlc3Np", + "b25fZWxpbWluYXRpb24YASABKAgSGwoTZG9fY29uc3RhbnRfZm9sZGluZxgC", + "IAEoCBIkChxtYXhfZm9sZGVkX2NvbnN0YW50X2luX2J5dGVzGAYgASgDEhwK", + "FGRvX2Z1bmN0aW9uX2lubGluaW5nGAQgASgIEjUKCW9wdF9sZXZlbBgDIAEo", + "DjIiLnRlbnNvcmZsb3cuT3B0aW1pemVyT3B0aW9ucy5MZXZlbBJFChBnbG9i", + "YWxfaml0X2xldmVsGAUgASgOMisudGVuc29yZmxvdy5PcHRpbWl6ZXJPcHRp", + "b25zLkdsb2JhbEppdExldmVsEhYKDmNwdV9nbG9iYWxfaml0GAcgASgIIiAK", + "BUxldmVsEgYKAkwxEAASDwoCTDAQ////////////ASJDCg5HbG9iYWxKaXRM", + "ZXZlbBILCgdERUZBVUxUEAASEAoDT0ZGEP///////////wESCAoET05fMRAB", + "EggKBE9OXzIQAiLuAgoMR3JhcGhPcHRpb25zEh4KFmVuYWJsZV9yZWN2X3Nj", + "aGVkdWxpbmcYAiABKAgSNwoRb3B0aW1pemVyX29wdGlvbnMYAyABKAsyHC50", + "ZW5zb3JmbG93Lk9wdGltaXplck9wdGlvbnMSGAoQYnVpbGRfY29zdF9tb2Rl", + "bBgEIAEoAxIeChZidWlsZF9jb3N0X21vZGVsX2FmdGVyGAkgASgDEhQKDGlu", + "ZmVyX3NoYXBlcxgFIAEoCBIaChJwbGFjZV9wcnVuZWRfZ3JhcGgYBiABKAgS", + "IAoYZW5hYmxlX2JmbG9hdDE2X3NlbmRyZWN2GAcgASgIEhUKDXRpbWVsaW5l", + "X3N0ZXAYCCABKAUSMwoPcmV3cml0ZV9vcHRpb25zGAogASgLMhoudGVuc29y", + "Zmxvdy5SZXdyaXRlckNvbmZpZ0oECAEQAlIlc2tpcF9jb21tb25fc3ViZXhw", + "cmVzc2lvbl9lbGltaW5hdGlvbiJBChVUaHJlYWRQb29sT3B0aW9uUHJvdG8S", + "EwoLbnVtX3RocmVhZHMYASABKAUSEwoLZ2xvYmFsX25hbWUYAiABKAki1QEK", + "ClJQQ09wdGlvbnMSJAocdXNlX3JwY19mb3JfaW5wcm9jZXNzX21hc3RlchgB", + "IAEoCBIdChVjb21wcmVzc2lvbl9hbGdvcml0aG0YAiABKAkSGQoRY29tcHJl", + "c3Npb25fbGV2ZWwYAyABKAUSGgoSY2FjaGVfcnBjX3Jlc3BvbnNlGAQgASgI", + "EioKImRpc2FibGVfc2Vzc2lvbl9jb25uZWN0aW9uX3NoYXJpbmcYBSABKAgS", + "HwoXbnVtX2NoYW5uZWxzX3Blcl90YXJnZXQYBiABKAUiMAoPU2Vzc2lvbk1l", + "dGFkYXRhEgwKBG5hbWUYASABKAkSDwoHdmVyc2lvbhgCIAEoAyKuDgoLQ29u", + "ZmlnUHJvdG8SPgoMZGV2aWNlX2NvdW50GAEgAygLMigudGVuc29yZmxvdy5D", + "b25maWdQcm90by5EZXZpY2VDb3VudEVudHJ5EiQKHGludHJhX29wX3BhcmFs", + "bGVsaXNtX3RocmVhZHMYAiABKAUSJAocaW50ZXJfb3BfcGFyYWxsZWxpc21f", + "dGhyZWFkcxgFIAEoBRIfChd1c2VfcGVyX3Nlc3Npb25fdGhyZWFkcxgJIAEo", + "CBJHChxzZXNzaW9uX2ludGVyX29wX3RocmVhZF9wb29sGAwgAygLMiEudGVu", + "c29yZmxvdy5UaHJlYWRQb29sT3B0aW9uUHJvdG8SGAoQcGxhY2VtZW50X3Bl", + "cmlvZBgDIAEoBRIWCg5kZXZpY2VfZmlsdGVycxgEIAMoCRIrCgtncHVfb3B0", + "aW9ucxgGIAEoCzIWLnRlbnNvcmZsb3cuR1BVT3B0aW9ucxIcChRhbGxvd19z", + "b2Z0X3BsYWNlbWVudBgHIAEoCBIcChRsb2dfZGV2aWNlX3BsYWNlbWVudBgI", + "IAEoCBIvCg1ncmFwaF9vcHRpb25zGAogASgLMhgudGVuc29yZmxvdy5HcmFw", + "aE9wdGlvbnMSHwoXb3BlcmF0aW9uX3RpbWVvdXRfaW5fbXMYCyABKAMSKwoL", + "cnBjX29wdGlvbnMYDSABKAsyFi50ZW5zb3JmbG93LlJQQ09wdGlvbnMSKwoL", + "Y2x1c3Rlcl9kZWYYDiABKAsyFi50ZW5zb3JmbG93LkNsdXN0ZXJEZWYSHQoV", + "aXNvbGF0ZV9zZXNzaW9uX3N0YXRlGA8gASgIEigKIHNoYXJlX2NsdXN0ZXJf", + "ZGV2aWNlc19pbl9zZXNzaW9uGBEgASgIEjoKDGV4cGVyaW1lbnRhbBgQIAEo", + "CzIkLnRlbnNvcmZsb3cuQ29uZmlnUHJvdG8uRXhwZXJpbWVudGFsGjIKEERl", + "dmljZUNvdW50RW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgFOgI4", + "ARqoCAoMRXhwZXJpbWVudGFsEh8KF2NvbGxlY3RpdmVfZ3JvdXBfbGVhZGVy", + "GAEgASgJEhUKDWV4ZWN1dG9yX3R5cGUYAyABKAkSGgoScmVjdl9idWZfbWF4", + "X2NodW5rGAQgASgFEhkKEXVzZV9udW1hX2FmZmluaXR5GAUgASgIEjUKLWNv", + "bGxlY3RpdmVfZGV0ZXJtaW5pc3RpY19zZXF1ZW50aWFsX2V4ZWN1dGlvbhgG", + "IAEoCBIXCg9jb2xsZWN0aXZlX25jY2wYByABKAgSNgouc2hhcmVfc2Vzc2lv", + "bl9zdGF0ZV9pbl9jbHVzdGVyc3BlY19wcm9wYWdhdGlvbhgIIAEoCBIfChdk", + "aXNhYmxlX3RocmVhZF9zcGlubmluZxgJIAEoCBIoCiBzaGFyZV9jbHVzdGVy", + "X2RldmljZXNfaW5fc2Vzc2lvbhgKIAEoCBI1ChBzZXNzaW9uX21ldGFkYXRh", + "GAsgASgLMhsudGVuc29yZmxvdy5TZXNzaW9uTWV0YWRhdGESIQoZb3B0aW1p", + "emVfZm9yX3N0YXRpY19ncmFwaBgMIAEoCBIaChJlbmFibGVfbWxpcl9icmlk", + "Z2UYDSABKAgSUwoTbWxpcl9icmlkZ2Vfcm9sbG91dBgRIAEoDjI2LnRlbnNv", + "cmZsb3cuQ29uZmlnUHJvdG8uRXhwZXJpbWVudGFsLk1saXJCcmlkZ2VSb2xs", + "b3V0EiYKHmVuYWJsZV9tbGlyX2dyYXBoX29wdGltaXphdGlvbhgQIAEoCBIn", + "Ch9kaXNhYmxlX291dHB1dF9wYXJ0aXRpb25fZ3JhcGhzGA4gASgIEiMKG3hs", + "YV9mdXNpb25fYXV0b3R1bmVyX3RocmVzaBgPIAEoAxIQCgh1c2VfdGZydBgS", + "IAEoCBInCh9kaXNhYmxlX2Z1bmN0aW9uYWxfb3BzX2xvd2VyaW5nGBUgASgI", + "EicKH3hsYV9wcmVmZXJfc2luZ2xlX2dyYXBoX2NsdXN0ZXIYFiABKAgSQgoT", + "Y29vcmRpbmF0aW9uX2NvbmZpZxgXIAEoCzIlLnRlbnNvcmZsb3cuQ29vcmRp", + "bmF0aW9uU2VydmljZUNvbmZpZyLaAQoRTWxpckJyaWRnZVJvbGxvdXQSIwof", + "TUxJUl9CUklER0VfUk9MTE9VVF9VTlNQRUNJRklFRBAAEh8KG01MSVJfQlJJ", + "REdFX1JPTExPVVRfRU5BQkxFRBABEiAKHE1MSVJfQlJJREdFX1JPTExPVVRf", + "RElTQUJMRUQQAhIpCiVNTElSX0JSSURHRV9ST0xMT1VUX1NBRkVfTU9ERV9F", + "TkFCTEVEEAMSMgouTUxJUl9CUklER0VfUk9MTE9VVF9TQUZFX01PREVfRkFM", + "TEJBQ0tfRU5BQkxFRBAESgQIAhADSgQIExAUSgQIFBAVIuEECgpSdW5PcHRp", + "b25zEjYKC3RyYWNlX2xldmVsGAEgASgOMiEudGVuc29yZmxvdy5SdW5PcHRp", + "b25zLlRyYWNlTGV2ZWwSFQoNdGltZW91dF9pbl9tcxgCIAEoAxIcChRpbnRl", + "cl9vcF90aHJlYWRfcG9vbBgDIAEoBRIfChdvdXRwdXRfcGFydGl0aW9uX2dy", + "YXBocxgFIAEoCBIvCg1kZWJ1Z19vcHRpb25zGAYgASgLMhgudGVuc29yZmxv", + "dy5EZWJ1Z09wdGlvbnMSKgoicmVwb3J0X3RlbnNvcl9hbGxvY2F0aW9uc191", + "cG9uX29vbRgHIAEoCBI5CgxleHBlcmltZW50YWwYCCABKAsyIy50ZW5zb3Jm", + "bG93LlJ1bk9wdGlvbnMuRXhwZXJpbWVudGFsGtIBCgxFeHBlcmltZW50YWwS", + "HAoUY29sbGVjdGl2ZV9ncmFwaF9rZXkYASABKAMSHAoUdXNlX3J1bl9oYW5k", + "bGVyX3Bvb2wYAiABKAgSWwoYcnVuX2hhbmRsZXJfcG9vbF9vcHRpb25zGAMg", + "ASgLMjkudGVuc29yZmxvdy5SdW5PcHRpb25zLkV4cGVyaW1lbnRhbC5SdW5I", + "YW5kbGVyUG9vbE9wdGlvbnMaKQoVUnVuSGFuZGxlclBvb2xPcHRpb25zEhAK", + "CHByaW9yaXR5GAEgASgDIlIKClRyYWNlTGV2ZWwSDAoITk9fVFJBQ0UQABIS", + "Cg5TT0ZUV0FSRV9UUkFDRRABEhIKDkhBUkRXQVJFX1RSQUNFEAISDgoKRlVM", + "TF9UUkFDRRADSgQIBBAFIr4DCgtSdW5NZXRhZGF0YRIpCgpzdGVwX3N0YXRz", + "GAEgASgLMhUudGVuc29yZmxvdy5TdGVwU3RhdHMSLAoKY29zdF9ncmFwaBgC", + "IAEoCzIYLnRlbnNvcmZsb3cuQ29zdEdyYXBoRGVmEi4KEHBhcnRpdGlvbl9n", + "cmFwaHMYAyADKAsyFC50ZW5zb3JmbG93LkdyYXBoRGVmEj8KD2Z1bmN0aW9u", + "X2dyYXBocxgEIAMoCzImLnRlbnNvcmZsb3cuUnVuTWV0YWRhdGEuRnVuY3Rp", + "b25HcmFwaHMSNQoQc2Vzc2lvbl9tZXRhZGF0YRgFIAEoCzIbLnRlbnNvcmZs", + "b3cuU2Vzc2lvbk1ldGFkYXRhGq0BCg5GdW5jdGlvbkdyYXBocxIuChBwYXJ0", + "aXRpb25fZ3JhcGhzGAEgAygLMhQudGVuc29yZmxvdy5HcmFwaERlZhI0ChZw", + "cmVfb3B0aW1pemF0aW9uX2dyYXBoGAIgASgLMhQudGVuc29yZmxvdy5HcmFw", + "aERlZhI1Chdwb3N0X29wdGltaXphdGlvbl9ncmFwaBgDIAEoCzIULnRlbnNv", + "cmZsb3cuR3JhcGhEZWYiOgoQVGVuc29yQ29ubmVjdGlvbhITCgtmcm9tX3Rl", + "bnNvchgBIAEoCRIRCgl0b190ZW5zb3IYAiABKAkisAMKD0NhbGxhYmxlT3B0", + "aW9ucxIMCgRmZWVkGAEgAygJEg0KBWZldGNoGAIgAygJEg4KBnRhcmdldBgD", + "IAMoCRIrCgtydW5fb3B0aW9ucxgEIAEoCzIWLnRlbnNvcmZsb3cuUnVuT3B0", + "aW9ucxI3ChF0ZW5zb3JfY29ubmVjdGlvbhgFIAMoCzIcLnRlbnNvcmZsb3cu", + "VGVuc29yQ29ubmVjdGlvbhJCCgxmZWVkX2RldmljZXMYBiADKAsyLC50ZW5z", + "b3JmbG93LkNhbGxhYmxlT3B0aW9ucy5GZWVkRGV2aWNlc0VudHJ5EkQKDWZl", + "dGNoX2RldmljZXMYByADKAsyLS50ZW5zb3JmbG93LkNhbGxhYmxlT3B0aW9u", + "cy5GZXRjaERldmljZXNFbnRyeRIXCg9mZXRjaF9za2lwX3N5bmMYCCABKAga", + "MgoQRmVlZERldmljZXNFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiAB", + "KAk6AjgBGjMKEUZldGNoRGV2aWNlc0VudHJ5EgsKA2tleRgBIAEoCRINCgV2", + "YWx1ZRgCIAEoCToCOAFChAEKGG9yZy50ZW5zb3JmbG93LmZyYW1ld29ya0IM", + "Q29uZmlnUHJvdG9zUAFaVWdpdGh1Yi5jb20vdGVuc29yZmxvdy90ZW5zb3Jm", + "bG93L3RlbnNvcmZsb3cvZ28vY29yZS9wcm90b2J1Zi9mb3JfY29yZV9wcm90", + "b3NfZ29fcHJvdG/4AQFiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Tensorflow.CostGraphReflection.Descriptor, global::Tensorflow.GraphReflection.Descriptor, global::Tensorflow.StepStatsReflection.Descriptor, global::Tensorflow.ClusterReflection.Descriptor, global::Tensorflow.DebugReflection.Descriptor, global::Tensorflow.RewriterConfigReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::Tensorflow.CostGraphReflection.Descriptor, global::Tensorflow.GraphReflection.Descriptor, global::Tensorflow.StepStatsReflection.Descriptor, global::Tensorflow.ClusterReflection.Descriptor, global::Tensorflow.CoordinationConfigReflection.Descriptor, global::Tensorflow.DebugReflection.Descriptor, global::Tensorflow.RewriterConfigReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.GPUOptions), global::Tensorflow.GPUOptions.Parser, new[]{ "PerProcessGpuMemoryFraction", "AllowGrowth", "AllocatorType", "DeferredDeletionBytes", "VisibleDeviceList", "PollingActiveDelayUsecs", "PollingInactiveDelayMsecs", "ForceGpuCompatible", "Experimental" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.GPUOptions.Types.Experimental), global::Tensorflow.GPUOptions.Types.Experimental.Parser, new[]{ "VirtualDevices", "UseUnifiedMemory", "NumDevToDevCopyStreams", "CollectiveRingOrder", "TimestampedAllocator", "KernelTrackerMaxInterval", "KernelTrackerMaxBytes", "KernelTrackerMaxPending", "InternalFragmentationFraction", "UseCudaMallocAsync" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.GPUOptions.Types.Experimental.Types.VirtualDevices), global::Tensorflow.GPUOptions.Types.Experimental.Types.VirtualDevices.Parser, new[]{ "MemoryLimitMb", "Priority" }, null, null, null, null)})}), - new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.OptimizerOptions), global::Tensorflow.OptimizerOptions.Parser, new[]{ "DoCommonSubexpressionElimination", "DoConstantFolding", "MaxFoldedConstantInBytes", "DoFunctionInlining", "OptLevel", "GlobalJitLevel" }, null, new[]{ typeof(global::Tensorflow.OptimizerOptions.Types.Level), typeof(global::Tensorflow.OptimizerOptions.Types.GlobalJitLevel) }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.GPUOptions), global::Tensorflow.GPUOptions.Parser, new[]{ "PerProcessGpuMemoryFraction", "AllowGrowth", "AllocatorType", "DeferredDeletionBytes", "VisibleDeviceList", "PollingActiveDelayUsecs", "PollingInactiveDelayMsecs", "ForceGpuCompatible", "Experimental" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.GPUOptions.Types.Experimental), global::Tensorflow.GPUOptions.Types.Experimental.Parser, new[]{ "VirtualDevices", "UseUnifiedMemory", "NumDevToDevCopyStreams", "CollectiveRingOrder", "TimestampedAllocator", "KernelTrackerMaxInterval", "KernelTrackerMaxBytes", "KernelTrackerMaxPending", "InternalFragmentationFraction", "UseCudaMallocAsync", "DisallowRetryOnAllocationFailure" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.GPUOptions.Types.Experimental.Types.VirtualDevices), global::Tensorflow.GPUOptions.Types.Experimental.Types.VirtualDevices.Parser, new[]{ "MemoryLimitMb", "Priority", "DeviceOrdinal" }, null, null, null, null)})}), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.OptimizerOptions), global::Tensorflow.OptimizerOptions.Parser, new[]{ "DoCommonSubexpressionElimination", "DoConstantFolding", "MaxFoldedConstantInBytes", "DoFunctionInlining", "OptLevel", "GlobalJitLevel", "CpuGlobalJit" }, null, new[]{ typeof(global::Tensorflow.OptimizerOptions.Types.Level), typeof(global::Tensorflow.OptimizerOptions.Types.GlobalJitLevel) }, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.GraphOptions), global::Tensorflow.GraphOptions.Parser, new[]{ "EnableRecvScheduling", "OptimizerOptions", "BuildCostModel", "BuildCostModelAfter", "InferShapes", "PlacePrunedGraph", "EnableBfloat16Sendrecv", "TimelineStep", "RewriteOptions" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.ThreadPoolOptionProto), global::Tensorflow.ThreadPoolOptionProto.Parser, new[]{ "NumThreads", "GlobalName" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.RPCOptions), global::Tensorflow.RPCOptions.Parser, new[]{ "UseRpcForInprocessMaster", "CompressionAlgorithm", "CompressionLevel", "CacheRpcResponse", "DisableSessionConnectionSharing", "NumChannelsPerTarget" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.SessionMetadata), global::Tensorflow.SessionMetadata.Parser, new[]{ "Name", "Version" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.ConfigProto), global::Tensorflow.ConfigProto.Parser, new[]{ "DeviceCount", "IntraOpParallelismThreads", "InterOpParallelismThreads", "UsePerSessionThreads", "SessionInterOpThreadPool", "PlacementPeriod", "DeviceFilters", "GpuOptions", "AllowSoftPlacement", "LogDevicePlacement", "GraphOptions", "OperationTimeoutInMs", "RpcOptions", "ClusterDef", "IsolateSessionState", "ShareClusterDevicesInSession", "Experimental" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.ConfigProto.Types.Experimental), global::Tensorflow.ConfigProto.Types.Experimental.Parser, new[]{ "CollectiveGroupLeader", "ExecutorType", "RecvBufMaxChunk", "UseNumaAffinity", "CollectiveDeterministicSequentialExecution", "CollectiveNccl", "ShareSessionStateInClusterspecPropagation", "DisableThreadSpinning", "ShareClusterDevicesInSession", "SessionMetadata", "OptimizeForStaticGraph", "EnableMlirBridge", "MlirBridgeRollout", "EnableMlirGraphOptimization", "DisableOutputPartitionGraphs", "XlaFusionAutotunerThresh", "UseTfrt", "CoordinationService", "FetchRemoteDevicesInMultiClient" }, null, new[]{ typeof(global::Tensorflow.ConfigProto.Types.Experimental.Types.MlirBridgeRollout) }, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.ConfigProto), global::Tensorflow.ConfigProto.Parser, new[]{ "DeviceCount", "IntraOpParallelismThreads", "InterOpParallelismThreads", "UsePerSessionThreads", "SessionInterOpThreadPool", "PlacementPeriod", "DeviceFilters", "GpuOptions", "AllowSoftPlacement", "LogDevicePlacement", "GraphOptions", "OperationTimeoutInMs", "RpcOptions", "ClusterDef", "IsolateSessionState", "ShareClusterDevicesInSession", "Experimental" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.ConfigProto.Types.Experimental), global::Tensorflow.ConfigProto.Types.Experimental.Parser, new[]{ "CollectiveGroupLeader", "ExecutorType", "RecvBufMaxChunk", "UseNumaAffinity", "CollectiveDeterministicSequentialExecution", "CollectiveNccl", "ShareSessionStateInClusterspecPropagation", "DisableThreadSpinning", "ShareClusterDevicesInSession", "SessionMetadata", "OptimizeForStaticGraph", "EnableMlirBridge", "MlirBridgeRollout", "EnableMlirGraphOptimization", "DisableOutputPartitionGraphs", "XlaFusionAutotunerThresh", "UseTfrt", "DisableFunctionalOpsLowering", "XlaPreferSingleGraphCluster", "CoordinationConfig" }, null, new[]{ typeof(global::Tensorflow.ConfigProto.Types.Experimental.Types.MlirBridgeRollout) }, null, null)}), new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.RunOptions), global::Tensorflow.RunOptions.Parser, new[]{ "TraceLevel", "TimeoutInMs", "InterOpThreadPool", "OutputPartitionGraphs", "DebugOptions", "ReportTensorAllocationsUponOom", "Experimental" }, null, new[]{ typeof(global::Tensorflow.RunOptions.Types.TraceLevel) }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.RunOptions.Types.Experimental), global::Tensorflow.RunOptions.Types.Experimental.Parser, new[]{ "CollectiveGraphKey", "UseRunHandlerPool", "RunHandlerPoolOptions" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.RunOptions.Types.Experimental.Types.RunHandlerPoolOptions), global::Tensorflow.RunOptions.Types.Experimental.Types.RunHandlerPoolOptions.Parser, new[]{ "Priority" }, null, null, null, null)})}), - new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.RunMetadata), global::Tensorflow.RunMetadata.Parser, new[]{ "StepStats", "CostGraph", "PartitionGraphs", "FunctionGraphs" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.RunMetadata.Types.FunctionGraphs), global::Tensorflow.RunMetadata.Types.FunctionGraphs.Parser, new[]{ "PartitionGraphs", "PreOptimizationGraph", "PostOptimizationGraph" }, null, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.RunMetadata), global::Tensorflow.RunMetadata.Parser, new[]{ "StepStats", "CostGraph", "PartitionGraphs", "FunctionGraphs", "SessionMetadata" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.RunMetadata.Types.FunctionGraphs), global::Tensorflow.RunMetadata.Types.FunctionGraphs.Parser, new[]{ "PartitionGraphs", "PreOptimizationGraph", "PostOptimizationGraph" }, null, null, null, null)}), new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.TensorConnection), global::Tensorflow.TensorConnection.Parser, new[]{ "FromTensor", "ToTensor" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.CallableOptions), global::Tensorflow.CallableOptions.Parser, new[]{ "Feed", "Fetch", "Target", "RunOptions", "TensorConnection", "FeedDevices", "FetchDevices", "FetchSkipSync" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, }) })); @@ -169,23 +175,31 @@ static ConfigReflection() { } #region Messages - public sealed partial class GPUOptions : pb::IMessage { + public sealed partial class GPUOptions : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GPUOptions()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ConfigReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GPUOptions() { OnConstruction(); } @@ -193,6 +207,7 @@ public GPUOptions() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GPUOptions(GPUOptions other) : this() { perProcessGpuMemoryFraction_ = other.perProcessGpuMemoryFraction_; allowGrowth_ = other.allowGrowth_; @@ -207,6 +222,7 @@ public GPUOptions(GPUOptions other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GPUOptions Clone() { return new GPUOptions(this); } @@ -234,6 +250,7 @@ public GPUOptions Clone() { /// for the detailed requirements. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public double PerProcessGpuMemoryFraction { get { return perProcessGpuMemoryFraction_; } set { @@ -249,6 +266,7 @@ public double PerProcessGpuMemoryFraction { /// GPU memory region, instead starting small and growing as needed. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool AllowGrowth { get { return allowGrowth_; } set { @@ -270,6 +288,7 @@ public bool AllowGrowth { /// version of dlmalloc. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string AllocatorType { get { return allocatorType_; } set { @@ -286,6 +305,7 @@ public string AllocatorType { /// a reasonable default (several MBs). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long DeferredDeletionBytes { get { return deferredDeletionBytes_; } set { @@ -320,6 +340,7 @@ public long DeferredDeletionBytes { /// for more information. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string VisibleDeviceList { get { return visibleDeviceList_; } set { @@ -336,6 +357,7 @@ public string VisibleDeviceList { /// set or set to 0, gets set to a non-zero default. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int PollingActiveDelayUsecs { get { return pollingActiveDelayUsecs_; } set { @@ -350,6 +372,7 @@ public int PollingActiveDelayUsecs { /// This field is deprecated and ignored. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int PollingInactiveDelayMsecs { get { return pollingInactiveDelayMsecs_; } set { @@ -373,6 +396,7 @@ public int PollingInactiveDelayMsecs { /// the overall host system performance. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool ForceGpuCompatible { get { return forceGpuCompatible_; } set { @@ -389,6 +413,7 @@ public bool ForceGpuCompatible { /// https://www.tensorflow.org/guide/version_compat. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.GPUOptions.Types.Experimental Experimental { get { return experimental_; } set { @@ -397,11 +422,13 @@ public bool ForceGpuCompatible { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as GPUOptions); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(GPUOptions other) { if (ReferenceEquals(other, null)) { return false; @@ -422,6 +449,7 @@ public bool Equals(GPUOptions other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (PerProcessGpuMemoryFraction != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(PerProcessGpuMemoryFraction); @@ -440,12 +468,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (PerProcessGpuMemoryFraction != 0D) { output.WriteRawTag(9); output.WriteDouble(PerProcessGpuMemoryFraction); @@ -485,9 +518,57 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (PerProcessGpuMemoryFraction != 0D) { + output.WriteRawTag(9); + output.WriteDouble(PerProcessGpuMemoryFraction); + } + if (AllocatorType.Length != 0) { + output.WriteRawTag(18); + output.WriteString(AllocatorType); + } + if (DeferredDeletionBytes != 0L) { + output.WriteRawTag(24); + output.WriteInt64(DeferredDeletionBytes); + } + if (AllowGrowth != false) { + output.WriteRawTag(32); + output.WriteBool(AllowGrowth); + } + if (VisibleDeviceList.Length != 0) { + output.WriteRawTag(42); + output.WriteString(VisibleDeviceList); + } + if (PollingActiveDelayUsecs != 0) { + output.WriteRawTag(48); + output.WriteInt32(PollingActiveDelayUsecs); + } + if (PollingInactiveDelayMsecs != 0) { + output.WriteRawTag(56); + output.WriteInt32(PollingInactiveDelayMsecs); + } + if (ForceGpuCompatible != false) { + output.WriteRawTag(64); + output.WriteBool(ForceGpuCompatible); + } + if (experimental_ != null) { + output.WriteRawTag(74); + output.WriteMessage(Experimental); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (PerProcessGpuMemoryFraction != 0D) { @@ -524,6 +605,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(GPUOptions other) { if (other == null) { return; @@ -562,7 +644,11 @@ public void MergeFrom(GPUOptions other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -610,29 +696,93 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 9: { + PerProcessGpuMemoryFraction = input.ReadDouble(); + break; + } + case 18: { + AllocatorType = input.ReadString(); + break; + } + case 24: { + DeferredDeletionBytes = input.ReadInt64(); + break; + } + case 32: { + AllowGrowth = input.ReadBool(); + break; + } + case 42: { + VisibleDeviceList = input.ReadString(); + break; + } + case 48: { + PollingActiveDelayUsecs = input.ReadInt32(); + break; + } + case 56: { + PollingInactiveDelayMsecs = input.ReadInt32(); + break; + } + case 64: { + ForceGpuCompatible = input.ReadBool(); + break; + } + case 74: { + if (experimental_ == null) { + Experimental = new global::Tensorflow.GPUOptions.Types.Experimental(); + } + input.ReadMessage(Experimental); + break; + } + } + } } + #endif #region Nested types /// Container for nested types declared in the GPUOptions message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { - public sealed partial class Experimental : pb::IMessage { + public sealed partial class Experimental : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Experimental()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.GPUOptions.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Experimental() { OnConstruction(); } @@ -640,6 +790,7 @@ public Experimental() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Experimental(Experimental other) : this() { virtualDevices_ = other.virtualDevices_.Clone(); useUnifiedMemory_ = other.useUnifiedMemory_; @@ -651,10 +802,12 @@ public Experimental(Experimental other) : this() { kernelTrackerMaxPending_ = other.kernelTrackerMaxPending_; internalFragmentationFraction_ = other.internalFragmentationFraction_; useCudaMallocAsync_ = other.useCudaMallocAsync_; + disallowRetryOnAllocationFailure_ = other.disallowRetryOnAllocationFailure_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Experimental Clone() { return new Experimental(this); } @@ -672,15 +825,30 @@ public Experimental Clone() { /// "visible_device_list" filtering if it is set), and the string represented /// device names (e.g. /device:GPU:<id>) will refer to the virtual /// devices and have the <id> field assigned sequentially starting from 0, - /// according to the order they appear in this list and the "memory_limit" - /// list inside each element. For example, + /// according to the order of the virtual devices determined by + /// device_ordinal and the location in the virtual device list. + /// + /// For example, /// visible_device_list = "1,0" /// virtual_devices { memory_limit: 1GB memory_limit: 2GB } - /// virtual_devices {} - /// will create three virtual devices as: + /// virtual_devices { memory_limit: 3GB memory_limit: 4GB } + /// will create 4 virtual devices as: /// /device:GPU:0 -> visible GPU 1 with 1GB memory /// /device:GPU:1 -> visible GPU 1 with 2GB memory - /// /device:GPU:2 -> visible GPU 0 with all available memory + /// /device:GPU:2 -> visible GPU 0 with 3GB memory + /// /device:GPU:3 -> visible GPU 0 with 4GB memory + /// + /// but + /// visible_device_list = "1,0" + /// virtual_devices { memory_limit: 1GB memory_limit: 2GB + /// device_ordinal: 10 device_ordinal: 20} + /// virtual_devices { memory_limit: 3GB memory_limit: 4GB + /// device_ordinal: 10 device_ordinal: 20} + /// will create 4 virtual devices as: + /// /device:GPU:0 -> visible GPU 1 with 1GB memory (ordinal 10) + /// /device:GPU:1 -> visible GPU 0 with 3GB memory (ordinal 10) + /// /device:GPU:2 -> visible GPU 1 with 2GB memory (ordinal 20) + /// /device:GPU:3 -> visible GPU 0 with 4GB memory (ordinal 20) /// /// NOTE: /// 1. It's invalid to set both this and "per_process_gpu_memory_fraction" @@ -690,6 +858,7 @@ public Experimental Clone() { /// result in undefined behavior. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField VirtualDevices { get { return virtualDevices_; } } @@ -707,6 +876,7 @@ public Experimental Clone() { /// than 1.0 per process memory fraction. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool UseUnifiedMemory { get { return useUnifiedMemory_; } set { @@ -723,6 +893,7 @@ public bool UseUnifiedMemory { /// converted to 1. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int NumDevToDevCopyStreams { get { return numDevToDevCopyStreams_; } set { @@ -742,6 +913,7 @@ public int NumDevToDevCopyStreams { /// generation in OrderTaskDeviceMap() during CollectiveParam resolution. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string CollectiveRingOrder { get { return collectiveRingOrder_; } set { @@ -759,6 +931,7 @@ public string CollectiveRingOrder { /// is really not subject to pending use. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool TimestampedAllocator { get { return timestampedAllocator_; } set { @@ -778,6 +951,7 @@ public bool TimestampedAllocator { /// is inserted after every n kernels without an event. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int KernelTrackerMaxInterval { get { return kernelTrackerMaxInterval_; } set { @@ -796,6 +970,7 @@ public int KernelTrackerMaxInterval { /// the pending limit. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int KernelTrackerMaxBytes { get { return kernelTrackerMaxBytes_; } set { @@ -813,6 +988,7 @@ public int KernelTrackerMaxBytes { /// completes. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int KernelTrackerMaxPending { get { return kernelTrackerMaxPending_; } set { @@ -835,6 +1011,7 @@ public int KernelTrackerMaxPending { /// memory size. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public double InternalFragmentationFraction { get { return internalFragmentationFraction_; } set { @@ -849,6 +1026,7 @@ public double InternalFragmentationFraction { /// When true, use CUDA cudaMallocAsync API instead of TF gpu allocator. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool UseCudaMallocAsync { get { return useCudaMallocAsync_; } set { @@ -856,12 +1034,31 @@ public bool UseCudaMallocAsync { } } + /// Field number for the "disallow_retry_on_allocation_failure" field. + public const int DisallowRetryOnAllocationFailureFieldNumber = 12; + private bool disallowRetryOnAllocationFailure_; + /// + /// By default, BFCAllocator may sleep when it runs out of memory, in the + /// hopes that another thread will free up memory in the meantime. Setting + /// this to true disables the sleep; instead we'll OOM immediately. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool DisallowRetryOnAllocationFailure { + get { return disallowRetryOnAllocationFailure_; } + set { + disallowRetryOnAllocationFailure_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as Experimental); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(Experimental other) { if (ReferenceEquals(other, null)) { return false; @@ -879,10 +1076,12 @@ public bool Equals(Experimental other) { if (KernelTrackerMaxPending != other.KernelTrackerMaxPending) return false; if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(InternalFragmentationFraction, other.InternalFragmentationFraction)) return false; if (UseCudaMallocAsync != other.UseCudaMallocAsync) return false; + if (DisallowRetryOnAllocationFailure != other.DisallowRetryOnAllocationFailure) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= virtualDevices_.GetHashCode(); @@ -895,6 +1094,7 @@ public override int GetHashCode() { if (KernelTrackerMaxPending != 0) hash ^= KernelTrackerMaxPending.GetHashCode(); if (InternalFragmentationFraction != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(InternalFragmentationFraction); if (UseCudaMallocAsync != false) hash ^= UseCudaMallocAsync.GetHashCode(); + if (DisallowRetryOnAllocationFailure != false) hash ^= DisallowRetryOnAllocationFailure.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -902,12 +1102,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else virtualDevices_.WriteTo(output, _repeated_virtualDevices_codec); if (UseUnifiedMemory != false) { output.WriteRawTag(16); @@ -945,12 +1150,69 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(88); output.WriteBool(UseCudaMallocAsync); } + if (DisallowRetryOnAllocationFailure != false) { + output.WriteRawTag(96); + output.WriteBool(DisallowRetryOnAllocationFailure); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + virtualDevices_.WriteTo(ref output, _repeated_virtualDevices_codec); + if (UseUnifiedMemory != false) { + output.WriteRawTag(16); + output.WriteBool(UseUnifiedMemory); + } + if (NumDevToDevCopyStreams != 0) { + output.WriteRawTag(24); + output.WriteInt32(NumDevToDevCopyStreams); + } + if (CollectiveRingOrder.Length != 0) { + output.WriteRawTag(34); + output.WriteString(CollectiveRingOrder); + } + if (TimestampedAllocator != false) { + output.WriteRawTag(40); + output.WriteBool(TimestampedAllocator); + } + if (KernelTrackerMaxInterval != 0) { + output.WriteRawTag(56); + output.WriteInt32(KernelTrackerMaxInterval); + } + if (KernelTrackerMaxBytes != 0) { + output.WriteRawTag(64); + output.WriteInt32(KernelTrackerMaxBytes); + } + if (KernelTrackerMaxPending != 0) { + output.WriteRawTag(72); + output.WriteInt32(KernelTrackerMaxPending); + } + if (InternalFragmentationFraction != 0D) { + output.WriteRawTag(81); + output.WriteDouble(InternalFragmentationFraction); + } + if (UseCudaMallocAsync != false) { + output.WriteRawTag(88); + output.WriteBool(UseCudaMallocAsync); + } + if (DisallowRetryOnAllocationFailure != false) { + output.WriteRawTag(96); + output.WriteBool(DisallowRetryOnAllocationFailure); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += virtualDevices_.CalculateSize(_repeated_virtualDevices_codec); @@ -981,6 +1243,9 @@ public int CalculateSize() { if (UseCudaMallocAsync != false) { size += 1 + 1; } + if (DisallowRetryOnAllocationFailure != false) { + size += 1 + 1; + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -988,6 +1253,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(Experimental other) { if (other == null) { return; @@ -1020,11 +1286,18 @@ public void MergeFrom(Experimental other) { if (other.UseCudaMallocAsync != false) { UseCudaMallocAsync = other.UseCudaMallocAsync; } + if (other.DisallowRetryOnAllocationFailure != false) { + DisallowRetryOnAllocationFailure = other.DisallowRetryOnAllocationFailure; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1071,35 +1344,108 @@ public void MergeFrom(pb::CodedInputStream input) { UseCudaMallocAsync = input.ReadBool(); break; } + case 96: { + DisallowRetryOnAllocationFailure = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + virtualDevices_.AddEntriesFrom(ref input, _repeated_virtualDevices_codec); + break; + } + case 16: { + UseUnifiedMemory = input.ReadBool(); + break; + } + case 24: { + NumDevToDevCopyStreams = input.ReadInt32(); + break; + } + case 34: { + CollectiveRingOrder = input.ReadString(); + break; + } + case 40: { + TimestampedAllocator = input.ReadBool(); + break; + } + case 56: { + KernelTrackerMaxInterval = input.ReadInt32(); + break; + } + case 64: { + KernelTrackerMaxBytes = input.ReadInt32(); + break; + } + case 72: { + KernelTrackerMaxPending = input.ReadInt32(); + break; + } + case 81: { + InternalFragmentationFraction = input.ReadDouble(); + break; + } + case 88: { + UseCudaMallocAsync = input.ReadBool(); + break; + } + case 96: { + DisallowRetryOnAllocationFailure = input.ReadBool(); + break; + } } } } + #endif #region Nested types /// Container for nested types declared in the Experimental message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { /// /// Configuration for breaking down a visible GPU into multiple "virtual" /// devices. /// - public sealed partial class VirtualDevices : pb::IMessage { + public sealed partial class VirtualDevices : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new VirtualDevices()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.GPUOptions.Types.Experimental.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public VirtualDevices() { OnConstruction(); } @@ -1107,13 +1453,16 @@ public VirtualDevices() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public VirtualDevices(VirtualDevices other) : this() { memoryLimitMb_ = other.memoryLimitMb_.Clone(); priority_ = other.priority_.Clone(); + deviceOrdinal_ = other.deviceOrdinal_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public VirtualDevices Clone() { return new VirtualDevices(this); } @@ -1134,6 +1483,7 @@ public VirtualDevices Clone() { /// "visible_device_list" above for more information. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField MemoryLimitMb { get { return memoryLimitMb_; } } @@ -1156,16 +1506,36 @@ public VirtualDevices Clone() { /// of this must match with the above memory_limit_mb. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Priority { get { return priority_; } } + /// Field number for the "device_ordinal" field. + public const int DeviceOrdinalFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_deviceOrdinal_codec + = pb::FieldCodec.ForInt32(26); + private readonly pbc::RepeatedField deviceOrdinal_ = new pbc::RepeatedField(); + /// + /// Virtual Device ordinal number determines the device ID of the device. + /// A Virtual device with a lower ordinal number always receives the a + /// smaller device id. The phyiscal device id and location in the + /// virtual device list is used to break ties. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField DeviceOrdinal { + get { return deviceOrdinal_; } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as VirtualDevices); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(VirtualDevices other) { if (ReferenceEquals(other, null)) { return false; @@ -1175,14 +1545,17 @@ public bool Equals(VirtualDevices other) { } if(!memoryLimitMb_.Equals(other.memoryLimitMb_)) return false; if(!priority_.Equals(other.priority_)) return false; + if(!deviceOrdinal_.Equals(other.deviceOrdinal_)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= memoryLimitMb_.GetHashCode(); hash ^= priority_.GetHashCode(); + hash ^= deviceOrdinal_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1190,24 +1563,46 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else memoryLimitMb_.WriteTo(output, _repeated_memoryLimitMb_codec); priority_.WriteTo(output, _repeated_priority_codec); + deviceOrdinal_.WriteTo(output, _repeated_deviceOrdinal_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + memoryLimitMb_.WriteTo(ref output, _repeated_memoryLimitMb_codec); + priority_.WriteTo(ref output, _repeated_priority_codec); + deviceOrdinal_.WriteTo(ref output, _repeated_deviceOrdinal_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += memoryLimitMb_.CalculateSize(_repeated_memoryLimitMb_codec); size += priority_.CalculateSize(_repeated_priority_codec); + size += deviceOrdinal_.CalculateSize(_repeated_deviceOrdinal_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -1215,17 +1610,23 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(VirtualDevices other) { if (other == null) { return; } memoryLimitMb_.Add(other.memoryLimitMb_); priority_.Add(other.priority_); + deviceOrdinal_.Add(other.deviceOrdinal_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1242,9 +1643,45 @@ public void MergeFrom(pb::CodedInputStream input) { priority_.AddEntriesFrom(input, _repeated_priority_codec); break; } + case 26: + case 24: { + deviceOrdinal_.AddEntriesFrom(input, _repeated_deviceOrdinal_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: + case 13: { + memoryLimitMb_.AddEntriesFrom(ref input, _repeated_memoryLimitMb_codec); + break; + } + case 18: + case 16: { + priority_.AddEntriesFrom(ref input, _repeated_priority_codec); + break; + } + case 26: + case 24: { + deviceOrdinal_.AddEntriesFrom(ref input, _repeated_deviceOrdinal_codec); + break; + } } } } + #endif } @@ -1261,23 +1698,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// /// Options passed to the graph optimizer /// - public sealed partial class OptimizerOptions : pb::IMessage { + public sealed partial class OptimizerOptions : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OptimizerOptions()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ConfigReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public OptimizerOptions() { OnConstruction(); } @@ -1285,6 +1730,7 @@ public OptimizerOptions() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public OptimizerOptions(OptimizerOptions other) : this() { doCommonSubexpressionElimination_ = other.doCommonSubexpressionElimination_; doConstantFolding_ = other.doConstantFolding_; @@ -1292,10 +1738,12 @@ public OptimizerOptions(OptimizerOptions other) : this() { doFunctionInlining_ = other.doFunctionInlining_; optLevel_ = other.optLevel_; globalJitLevel_ = other.globalJitLevel_; + cpuGlobalJit_ = other.cpuGlobalJit_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public OptimizerOptions Clone() { return new OptimizerOptions(this); } @@ -1310,6 +1758,7 @@ public OptimizerOptions Clone() { /// set to L0. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool DoCommonSubexpressionElimination { get { return doCommonSubexpressionElimination_; } set { @@ -1326,6 +1775,7 @@ public bool DoCommonSubexpressionElimination { /// order to disable constant folding the opt_level has to be set to L0. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool DoConstantFolding { get { return doConstantFolding_; } set { @@ -1344,6 +1794,7 @@ public bool DoConstantFolding { /// is disabled, this value is ignored. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long MaxFoldedConstantInBytes { get { return maxFoldedConstantInBytes_; } set { @@ -1358,6 +1809,7 @@ public long MaxFoldedConstantInBytes { /// If true, perform function inlining on the graph. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool DoFunctionInlining { get { return doFunctionInlining_; } set { @@ -1373,6 +1825,7 @@ public bool DoFunctionInlining { /// logical OR of the flags that this level implies and any flags already set. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.OptimizerOptions.Types.Level OptLevel { get { return optLevel_; } set { @@ -1384,6 +1837,7 @@ public bool DoFunctionInlining { public const int GlobalJitLevelFieldNumber = 5; private global::Tensorflow.OptimizerOptions.Types.GlobalJitLevel globalJitLevel_ = global::Tensorflow.OptimizerOptions.Types.GlobalJitLevel.Default; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.OptimizerOptions.Types.GlobalJitLevel GlobalJitLevel { get { return globalJitLevel_; } set { @@ -1391,12 +1845,31 @@ public bool DoFunctionInlining { } } + /// Field number for the "cpu_global_jit" field. + public const int CpuGlobalJitFieldNumber = 7; + private bool cpuGlobalJit_; + /// + /// CPU code will be autoclustered only if global_jit_level >= ON_1 and either: + /// - this flag is true, or + /// - TF_XLA_FLAGS contains --tf_xla_cpu_global_jit=true. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool CpuGlobalJit { + get { return cpuGlobalJit_; } + set { + cpuGlobalJit_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as OptimizerOptions); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(OptimizerOptions other) { if (ReferenceEquals(other, null)) { return false; @@ -1410,10 +1883,12 @@ public bool Equals(OptimizerOptions other) { if (DoFunctionInlining != other.DoFunctionInlining) return false; if (OptLevel != other.OptLevel) return false; if (GlobalJitLevel != other.GlobalJitLevel) return false; + if (CpuGlobalJit != other.CpuGlobalJit) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (DoCommonSubexpressionElimination != false) hash ^= DoCommonSubexpressionElimination.GetHashCode(); @@ -1422,6 +1897,7 @@ public override int GetHashCode() { if (DoFunctionInlining != false) hash ^= DoFunctionInlining.GetHashCode(); if (OptLevel != global::Tensorflow.OptimizerOptions.Types.Level.L1) hash ^= OptLevel.GetHashCode(); if (GlobalJitLevel != global::Tensorflow.OptimizerOptions.Types.GlobalJitLevel.Default) hash ^= GlobalJitLevel.GetHashCode(); + if (CpuGlobalJit != false) hash ^= CpuGlobalJit.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1429,12 +1905,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (DoCommonSubexpressionElimination != false) { output.WriteRawTag(8); output.WriteBool(DoCommonSubexpressionElimination); @@ -1459,24 +1940,68 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(48); output.WriteInt64(MaxFoldedConstantInBytes); } + if (CpuGlobalJit != false) { + output.WriteRawTag(56); + output.WriteBool(CpuGlobalJit); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (DoCommonSubexpressionElimination != false) { - size += 1 + 1; + output.WriteRawTag(8); + output.WriteBool(DoCommonSubexpressionElimination); } if (DoConstantFolding != false) { - size += 1 + 1; - } - if (MaxFoldedConstantInBytes != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(MaxFoldedConstantInBytes); + output.WriteRawTag(16); + output.WriteBool(DoConstantFolding); } - if (DoFunctionInlining != false) { + if (OptLevel != global::Tensorflow.OptimizerOptions.Types.Level.L1) { + output.WriteRawTag(24); + output.WriteEnum((int) OptLevel); + } + if (DoFunctionInlining != false) { + output.WriteRawTag(32); + output.WriteBool(DoFunctionInlining); + } + if (GlobalJitLevel != global::Tensorflow.OptimizerOptions.Types.GlobalJitLevel.Default) { + output.WriteRawTag(40); + output.WriteEnum((int) GlobalJitLevel); + } + if (MaxFoldedConstantInBytes != 0L) { + output.WriteRawTag(48); + output.WriteInt64(MaxFoldedConstantInBytes); + } + if (CpuGlobalJit != false) { + output.WriteRawTag(56); + output.WriteBool(CpuGlobalJit); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (DoCommonSubexpressionElimination != false) { + size += 1 + 1; + } + if (DoConstantFolding != false) { + size += 1 + 1; + } + if (MaxFoldedConstantInBytes != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(MaxFoldedConstantInBytes); + } + if (DoFunctionInlining != false) { size += 1 + 1; } if (OptLevel != global::Tensorflow.OptimizerOptions.Types.Level.L1) { @@ -1485,6 +2010,9 @@ public int CalculateSize() { if (GlobalJitLevel != global::Tensorflow.OptimizerOptions.Types.GlobalJitLevel.Default) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) GlobalJitLevel); } + if (CpuGlobalJit != false) { + size += 1 + 1; + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -1492,6 +2020,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(OptimizerOptions other) { if (other == null) { return; @@ -1514,11 +2043,18 @@ public void MergeFrom(OptimizerOptions other) { if (other.GlobalJitLevel != global::Tensorflow.OptimizerOptions.Types.GlobalJitLevel.Default) { GlobalJitLevel = other.GlobalJitLevel; } + if (other.CpuGlobalJit != false) { + CpuGlobalJit = other.CpuGlobalJit; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1549,13 +2085,62 @@ public void MergeFrom(pb::CodedInputStream input) { MaxFoldedConstantInBytes = input.ReadInt64(); break; } + case 56: { + CpuGlobalJit = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + DoCommonSubexpressionElimination = input.ReadBool(); + break; + } + case 16: { + DoConstantFolding = input.ReadBool(); + break; + } + case 24: { + OptLevel = (global::Tensorflow.OptimizerOptions.Types.Level) input.ReadEnum(); + break; + } + case 32: { + DoFunctionInlining = input.ReadBool(); + break; + } + case 40: { + GlobalJitLevel = (global::Tensorflow.OptimizerOptions.Types.GlobalJitLevel) input.ReadEnum(); + break; + } + case 48: { + MaxFoldedConstantInBytes = input.ReadInt64(); + break; + } + case 56: { + CpuGlobalJit = input.ReadBool(); + break; + } } } } + #endif #region Nested types /// Container for nested types declared in the OptimizerOptions message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { /// /// Optimization level @@ -1598,23 +2183,31 @@ public enum GlobalJitLevel { } - public sealed partial class GraphOptions : pb::IMessage { + public sealed partial class GraphOptions : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GraphOptions()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ConfigReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphOptions() { OnConstruction(); } @@ -1622,6 +2215,7 @@ public GraphOptions() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphOptions(GraphOptions other) : this() { enableRecvScheduling_ = other.enableRecvScheduling_; optimizerOptions_ = other.optimizerOptions_ != null ? other.optimizerOptions_.Clone() : null; @@ -1636,6 +2230,7 @@ public GraphOptions(GraphOptions other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphOptions Clone() { return new GraphOptions(this); } @@ -1648,6 +2243,7 @@ public GraphOptions Clone() { /// (Currently ignored.) /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool EnableRecvScheduling { get { return enableRecvScheduling_; } set { @@ -1662,6 +2258,7 @@ public bool EnableRecvScheduling { /// Options controlling how graph is optimized. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.OptimizerOptions OptimizerOptions { get { return optimizerOptions_; } set { @@ -1678,6 +2275,7 @@ public bool EnableRecvScheduling { /// no cost model. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long BuildCostModel { get { return buildCostModel_; } set { @@ -1693,6 +2291,7 @@ public long BuildCostModel { /// cost model. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long BuildCostModelAfter { get { return buildCostModelAfter_; } set { @@ -1708,6 +2307,7 @@ public long BuildCostModelAfter { /// be statically inferred. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool InferShapes { get { return inferShapes_; } set { @@ -1728,6 +2328,7 @@ public bool InferShapes { /// constraints are unsatisfiable. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool PlacePrunedGraph { get { return placePrunedGraph_; } set { @@ -1742,6 +2343,7 @@ public bool PlacePrunedGraph { /// If true, transfer float values between processes as bfloat16. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool EnableBfloat16Sendrecv { get { return enableBfloat16Sendrecv_; } set { @@ -1757,6 +2359,7 @@ public bool EnableBfloat16Sendrecv { /// EXPERIMENTAL: This currently has no effect in MasterSession. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int TimelineStep { get { return timelineStep_; } set { @@ -1773,6 +2376,7 @@ public int TimelineStep { /// stability guarantee if you import RewriterConfig explicitly). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RewriterConfig RewriteOptions { get { return rewriteOptions_; } set { @@ -1781,11 +2385,13 @@ public int TimelineStep { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as GraphOptions); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(GraphOptions other) { if (ReferenceEquals(other, null)) { return false; @@ -1806,6 +2412,7 @@ public bool Equals(GraphOptions other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (EnableRecvScheduling != false) hash ^= EnableRecvScheduling.GetHashCode(); @@ -1824,12 +2431,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (EnableRecvScheduling != false) { output.WriteRawTag(16); output.WriteBool(EnableRecvScheduling); @@ -1869,9 +2481,57 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (EnableRecvScheduling != false) { + output.WriteRawTag(16); + output.WriteBool(EnableRecvScheduling); + } + if (optimizerOptions_ != null) { + output.WriteRawTag(26); + output.WriteMessage(OptimizerOptions); + } + if (BuildCostModel != 0L) { + output.WriteRawTag(32); + output.WriteInt64(BuildCostModel); + } + if (InferShapes != false) { + output.WriteRawTag(40); + output.WriteBool(InferShapes); + } + if (PlacePrunedGraph != false) { + output.WriteRawTag(48); + output.WriteBool(PlacePrunedGraph); + } + if (EnableBfloat16Sendrecv != false) { + output.WriteRawTag(56); + output.WriteBool(EnableBfloat16Sendrecv); + } + if (TimelineStep != 0) { + output.WriteRawTag(64); + output.WriteInt32(TimelineStep); + } + if (BuildCostModelAfter != 0L) { + output.WriteRawTag(72); + output.WriteInt64(BuildCostModelAfter); + } + if (rewriteOptions_ != null) { + output.WriteRawTag(82); + output.WriteMessage(RewriteOptions); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (EnableRecvScheduling != false) { @@ -1908,6 +2568,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(GraphOptions other) { if (other == null) { return; @@ -1949,7 +2610,11 @@ public void MergeFrom(GraphOptions other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -2000,27 +2665,93 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 16: { + EnableRecvScheduling = input.ReadBool(); + break; + } + case 26: { + if (optimizerOptions_ == null) { + OptimizerOptions = new global::Tensorflow.OptimizerOptions(); + } + input.ReadMessage(OptimizerOptions); + break; + } + case 32: { + BuildCostModel = input.ReadInt64(); + break; + } + case 40: { + InferShapes = input.ReadBool(); + break; + } + case 48: { + PlacePrunedGraph = input.ReadBool(); + break; + } + case 56: { + EnableBfloat16Sendrecv = input.ReadBool(); + break; + } + case 64: { + TimelineStep = input.ReadInt32(); + break; + } + case 72: { + BuildCostModelAfter = input.ReadInt64(); + break; + } + case 82: { + if (rewriteOptions_ == null) { + RewriteOptions = new global::Tensorflow.RewriterConfig(); + } + input.ReadMessage(RewriteOptions); + break; + } + } + } } + #endif } - public sealed partial class ThreadPoolOptionProto : pb::IMessage { + public sealed partial class ThreadPoolOptionProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ThreadPoolOptionProto()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ConfigReflection.Descriptor.MessageTypes[3]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ThreadPoolOptionProto() { OnConstruction(); } @@ -2028,6 +2759,7 @@ public ThreadPoolOptionProto() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ThreadPoolOptionProto(ThreadPoolOptionProto other) : this() { numThreads_ = other.numThreads_; globalName_ = other.globalName_; @@ -2035,6 +2767,7 @@ public ThreadPoolOptionProto(ThreadPoolOptionProto other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ThreadPoolOptionProto Clone() { return new ThreadPoolOptionProto(this); } @@ -2049,6 +2782,7 @@ public ThreadPoolOptionProto Clone() { /// (see the declaration of the specific field for more info). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int NumThreads { get { return numThreads_; } set { @@ -2077,6 +2811,7 @@ public int NumThreads { /// - threadpools created this way are never garbage collected. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string GlobalName { get { return globalName_; } set { @@ -2085,11 +2820,13 @@ public string GlobalName { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as ThreadPoolOptionProto); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(ThreadPoolOptionProto other) { if (ReferenceEquals(other, null)) { return false; @@ -2103,6 +2840,7 @@ public bool Equals(ThreadPoolOptionProto other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (NumThreads != 0) hash ^= NumThreads.GetHashCode(); @@ -2114,12 +2852,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (NumThreads != 0) { output.WriteRawTag(8); output.WriteInt32(NumThreads); @@ -2131,9 +2874,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (NumThreads != 0) { + output.WriteRawTag(8); + output.WriteInt32(NumThreads); + } + if (GlobalName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(GlobalName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (NumThreads != 0) { @@ -2149,6 +2912,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(ThreadPoolOptionProto other) { if (other == null) { return; @@ -2163,7 +2927,11 @@ public void MergeFrom(ThreadPoolOptionProto other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -2180,27 +2948,59 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + NumThreads = input.ReadInt32(); + break; + } + case 18: { + GlobalName = input.ReadString(); + break; + } + } + } } + #endif } - public sealed partial class RPCOptions : pb::IMessage { + public sealed partial class RPCOptions : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RPCOptions()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ConfigReflection.Descriptor.MessageTypes[4]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public RPCOptions() { OnConstruction(); } @@ -2208,6 +3008,7 @@ public RPCOptions() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public RPCOptions(RPCOptions other) : this() { useRpcForInprocessMaster_ = other.useRpcForInprocessMaster_; compressionAlgorithm_ = other.compressionAlgorithm_; @@ -2219,6 +3020,7 @@ public RPCOptions(RPCOptions other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public RPCOptions Clone() { return new RPCOptions(this); } @@ -2234,6 +3036,7 @@ public RPCOptions Clone() { /// stack. This option is primarily for used testing the RPC stack. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool UseRpcForInprocessMaster { get { return useRpcForInprocessMaster_; } set { @@ -2248,6 +3051,7 @@ public bool UseRpcForInprocessMaster { /// The compression algorithm to be used. One of "deflate", "gzip". /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string CompressionAlgorithm { get { return compressionAlgorithm_; } set { @@ -2263,6 +3067,7 @@ public string CompressionAlgorithm { /// From 0 (no compression), up to 3. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CompressionLevel { get { return compressionLevel_; } set { @@ -2282,6 +3087,7 @@ public int CompressionLevel { /// initializations) in the face of some network errors during RecvTensor. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool CacheRpcResponse { get { return cacheRpcResponse_; } set { @@ -2296,6 +3102,7 @@ public bool CacheRpcResponse { /// Disables TCP connection sharing when opening a new RPC channel. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool DisableSessionConnectionSharing { get { return disableSessionConnectionSharing_; } set { @@ -2315,6 +3122,7 @@ public bool DisableSessionConnectionSharing { /// transfers to the same target overlapping in time. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int NumChannelsPerTarget { get { return numChannelsPerTarget_; } set { @@ -2323,11 +3131,13 @@ public int NumChannelsPerTarget { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as RPCOptions); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(RPCOptions other) { if (ReferenceEquals(other, null)) { return false; @@ -2345,6 +3155,7 @@ public bool Equals(RPCOptions other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (UseRpcForInprocessMaster != false) hash ^= UseRpcForInprocessMaster.GetHashCode(); @@ -2360,12 +3171,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (UseRpcForInprocessMaster != false) { output.WriteRawTag(8); output.WriteBool(UseRpcForInprocessMaster); @@ -2393,9 +3209,45 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (UseRpcForInprocessMaster != false) { + output.WriteRawTag(8); + output.WriteBool(UseRpcForInprocessMaster); + } + if (CompressionAlgorithm.Length != 0) { + output.WriteRawTag(18); + output.WriteString(CompressionAlgorithm); + } + if (CompressionLevel != 0) { + output.WriteRawTag(24); + output.WriteInt32(CompressionLevel); + } + if (CacheRpcResponse != false) { + output.WriteRawTag(32); + output.WriteBool(CacheRpcResponse); + } + if (DisableSessionConnectionSharing != false) { + output.WriteRawTag(40); + output.WriteBool(DisableSessionConnectionSharing); + } + if (NumChannelsPerTarget != 0) { + output.WriteRawTag(48); + output.WriteInt32(NumChannelsPerTarget); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (UseRpcForInprocessMaster != false) { @@ -2423,6 +3275,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(RPCOptions other) { if (other == null) { return; @@ -2449,7 +3302,11 @@ public void MergeFrom(RPCOptions other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -2482,37 +3339,85 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } - } - - /// - /// Metadata about the session. - /// - /// This can be used by the runtime and the Ops for debugging, monitoring, etc. - /// - /// The (name, version) tuple is expected to be a unique identifier for - /// sessions within the same process. - /// - /// NOTE: This is currently used and propagated only by the direct session. - /// - public sealed partial class SessionMetadata : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SessionMetadata()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Tensorflow.ConfigReflection.Descriptor.MessageTypes[5]; } - } - + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + UseRpcForInprocessMaster = input.ReadBool(); + break; + } + case 18: { + CompressionAlgorithm = input.ReadString(); + break; + } + case 24: { + CompressionLevel = input.ReadInt32(); + break; + } + case 32: { + CacheRpcResponse = input.ReadBool(); + break; + } + case 40: { + DisableSessionConnectionSharing = input.ReadBool(); + break; + } + case 48: { + NumChannelsPerTarget = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + /// + /// Metadata about the session. + /// + /// This can be used by the runtime and the Ops for debugging, monitoring, etc. + /// + /// The (name, version) tuple is expected to be a unique identifier for + /// sessions within the same process. + /// + /// NOTE: This is currently used and propagated only by the direct session. + /// + public sealed partial class SessionMetadata : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SessionMetadata()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.ConfigReflection.Descriptor.MessageTypes[5]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SessionMetadata() { OnConstruction(); } @@ -2520,6 +3425,7 @@ public SessionMetadata() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SessionMetadata(SessionMetadata other) : this() { name_ = other.name_; version_ = other.version_; @@ -2527,6 +3433,7 @@ public SessionMetadata(SessionMetadata other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SessionMetadata Clone() { return new SessionMetadata(this); } @@ -2535,6 +3442,7 @@ public SessionMetadata Clone() { public const int NameFieldNumber = 1; private string name_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -2549,6 +3457,7 @@ public string Name { /// The version is optional. If set, needs to be >= 0. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long Version { get { return version_; } set { @@ -2557,11 +3466,13 @@ public long Version { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as SessionMetadata); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(SessionMetadata other) { if (ReferenceEquals(other, null)) { return false; @@ -2575,6 +3486,7 @@ public bool Equals(SessionMetadata other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -2586,12 +3498,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -2603,9 +3520,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (Version != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Version); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -2621,6 +3558,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(SessionMetadata other) { if (other == null) { return; @@ -2635,7 +3573,11 @@ public void MergeFrom(SessionMetadata other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -2652,7 +3594,31 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 16: { + Version = input.ReadInt64(); + break; + } + } + } } + #endif } @@ -2660,23 +3626,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// Session configuration parameters. /// The system picks appropriate values for fields that are not set. /// - public sealed partial class ConfigProto : pb::IMessage { + public sealed partial class ConfigProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ConfigProto()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ConfigReflection.Descriptor.MessageTypes[6]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ConfigProto() { OnConstruction(); } @@ -2684,6 +3658,7 @@ public ConfigProto() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ConfigProto(ConfigProto other) : this() { deviceCount_ = other.deviceCount_.Clone(); intraOpParallelismThreads_ = other.intraOpParallelismThreads_; @@ -2706,6 +3681,7 @@ public ConfigProto(ConfigProto other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ConfigProto Clone() { return new ConfigProto(this); } @@ -2722,6 +3698,7 @@ public ConfigProto Clone() { /// number. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField DeviceCount { get { return deviceCount_; } } @@ -2746,6 +3723,7 @@ public ConfigProto Clone() { /// instance, then this option will be ignored altogether. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int IntraOpParallelismThreads { get { return intraOpParallelismThreads_; } set { @@ -2768,6 +3746,7 @@ public int IntraOpParallelismThreads { /// true or session_inter_op_thread_pool is configured. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int InterOpParallelismThreads { get { return interOpParallelismThreads_; } set { @@ -2790,6 +3769,7 @@ public int InterOpParallelismThreads { /// inter_op_parallelism_threads. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool UsePerSessionThreads { get { return usePerSessionThreads_; } set { @@ -2824,6 +3804,7 @@ public bool UsePerSessionThreads { /// pool. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField SessionInterOpThreadPool { get { return sessionInterOpThreadPool_; } } @@ -2837,6 +3818,7 @@ public bool UsePerSessionThreads { /// typically slows down automatically). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int PlacementPeriod { get { return placementPeriod_; } set { @@ -2855,6 +3837,7 @@ public int PlacementPeriod { /// "/job:worker/replica:3", etc. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField DeviceFilters { get { return deviceFilters_; } } @@ -2866,6 +3849,7 @@ public int PlacementPeriod { /// Options that apply to all GPUs. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.GPUOptions GpuOptions { get { return gpuOptions_; } set { @@ -2886,6 +3870,7 @@ public int PlacementPeriod { /// 3. need to co-locate with reftype input(s) which are from CPU. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool AllowSoftPlacement { get { return allowSoftPlacement_; } set { @@ -2900,6 +3885,7 @@ public bool AllowSoftPlacement { /// Whether device placements should be logged. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool LogDevicePlacement { get { return logDevicePlacement_; } set { @@ -2914,6 +3900,7 @@ public bool LogDevicePlacement { /// Options that apply to all graphs. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.GraphOptions GraphOptions { get { return graphOptions_; } set { @@ -2930,6 +3917,7 @@ public bool LogDevicePlacement { /// deadline for all blocking operations. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long OperationTimeoutInMs { get { return operationTimeoutInMs_; } set { @@ -2944,6 +3932,7 @@ public long OperationTimeoutInMs { /// Options that apply when this session uses the distributed runtime. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RPCOptions RpcOptions { get { return rpcOptions_; } set { @@ -2958,6 +3947,7 @@ public long OperationTimeoutInMs { /// Optional list of all workers to use in this session. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.ClusterDef ClusterDef { get { return clusterDef_; } set { @@ -2974,6 +3964,7 @@ public long OperationTimeoutInMs { /// enabled, this field is ignored and sessions are always isolated. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool IsolateSessionState { get { return isolateSessionState_; } set { @@ -2991,6 +3982,7 @@ public bool IsolateSessionState { /// (for example during a PartitionedCallOp). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool ShareClusterDevicesInSession { get { return shareClusterDevicesInSession_; } set { @@ -3002,6 +3994,7 @@ public bool ShareClusterDevicesInSession { public const int ExperimentalFieldNumber = 16; private global::Tensorflow.ConfigProto.Types.Experimental experimental_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.ConfigProto.Types.Experimental Experimental { get { return experimental_; } set { @@ -3010,11 +4003,13 @@ public bool ShareClusterDevicesInSession { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as ConfigProto); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(ConfigProto other) { if (ReferenceEquals(other, null)) { return false; @@ -3043,6 +4038,7 @@ public bool Equals(ConfigProto other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= DeviceCount.GetHashCode(); @@ -3069,12 +4065,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else deviceCount_.WriteTo(output, _map_deviceCount_codec); if (IntraOpParallelismThreads != 0) { output.WriteRawTag(16); @@ -3137,9 +4138,80 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + deviceCount_.WriteTo(ref output, _map_deviceCount_codec); + if (IntraOpParallelismThreads != 0) { + output.WriteRawTag(16); + output.WriteInt32(IntraOpParallelismThreads); + } + if (PlacementPeriod != 0) { + output.WriteRawTag(24); + output.WriteInt32(PlacementPeriod); + } + deviceFilters_.WriteTo(ref output, _repeated_deviceFilters_codec); + if (InterOpParallelismThreads != 0) { + output.WriteRawTag(40); + output.WriteInt32(InterOpParallelismThreads); + } + if (gpuOptions_ != null) { + output.WriteRawTag(50); + output.WriteMessage(GpuOptions); + } + if (AllowSoftPlacement != false) { + output.WriteRawTag(56); + output.WriteBool(AllowSoftPlacement); + } + if (LogDevicePlacement != false) { + output.WriteRawTag(64); + output.WriteBool(LogDevicePlacement); + } + if (UsePerSessionThreads != false) { + output.WriteRawTag(72); + output.WriteBool(UsePerSessionThreads); + } + if (graphOptions_ != null) { + output.WriteRawTag(82); + output.WriteMessage(GraphOptions); + } + if (OperationTimeoutInMs != 0L) { + output.WriteRawTag(88); + output.WriteInt64(OperationTimeoutInMs); + } + sessionInterOpThreadPool_.WriteTo(ref output, _repeated_sessionInterOpThreadPool_codec); + if (rpcOptions_ != null) { + output.WriteRawTag(106); + output.WriteMessage(RpcOptions); + } + if (clusterDef_ != null) { + output.WriteRawTag(114); + output.WriteMessage(ClusterDef); + } + if (IsolateSessionState != false) { + output.WriteRawTag(120); + output.WriteBool(IsolateSessionState); + } + if (experimental_ != null) { + output.WriteRawTag(130, 1); + output.WriteMessage(Experimental); + } + if (ShareClusterDevicesInSession != false) { + output.WriteRawTag(136, 1); + output.WriteBool(ShareClusterDevicesInSession); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += deviceCount_.CalculateSize(_map_deviceCount_codec); @@ -3194,6 +4266,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(ConfigProto other) { if (other == null) { return; @@ -3262,7 +4335,11 @@ public void MergeFrom(ConfigProto other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -3354,34 +4431,142 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + deviceCount_.AddEntriesFrom(ref input, _map_deviceCount_codec); + break; + } + case 16: { + IntraOpParallelismThreads = input.ReadInt32(); + break; + } + case 24: { + PlacementPeriod = input.ReadInt32(); + break; + } + case 34: { + deviceFilters_.AddEntriesFrom(ref input, _repeated_deviceFilters_codec); + break; + } + case 40: { + InterOpParallelismThreads = input.ReadInt32(); + break; + } + case 50: { + if (gpuOptions_ == null) { + GpuOptions = new global::Tensorflow.GPUOptions(); + } + input.ReadMessage(GpuOptions); + break; + } + case 56: { + AllowSoftPlacement = input.ReadBool(); + break; + } + case 64: { + LogDevicePlacement = input.ReadBool(); + break; + } + case 72: { + UsePerSessionThreads = input.ReadBool(); + break; + } + case 82: { + if (graphOptions_ == null) { + GraphOptions = new global::Tensorflow.GraphOptions(); + } + input.ReadMessage(GraphOptions); + break; + } + case 88: { + OperationTimeoutInMs = input.ReadInt64(); + break; + } + case 98: { + sessionInterOpThreadPool_.AddEntriesFrom(ref input, _repeated_sessionInterOpThreadPool_codec); + break; + } + case 106: { + if (rpcOptions_ == null) { + RpcOptions = new global::Tensorflow.RPCOptions(); + } + input.ReadMessage(RpcOptions); + break; + } + case 114: { + if (clusterDef_ == null) { + ClusterDef = new global::Tensorflow.ClusterDef(); + } + input.ReadMessage(ClusterDef); + break; + } + case 120: { + IsolateSessionState = input.ReadBool(); + break; + } + case 130: { + if (experimental_ == null) { + Experimental = new global::Tensorflow.ConfigProto.Types.Experimental(); + } + input.ReadMessage(Experimental); + break; + } + case 136: { + ShareClusterDevicesInSession = input.ReadBool(); + break; + } + } + } } + #endif #region Nested types /// Container for nested types declared in the ConfigProto message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { /// /// Everything inside Experimental is subject to change and is not subject /// to API stability guarantees in /// https://www.tensorflow.org/guide/version_compat. /// - public sealed partial class Experimental : pb::IMessage { + public sealed partial class Experimental : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Experimental()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ConfigProto.Descriptor.NestedTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Experimental() { OnConstruction(); } @@ -3389,6 +4574,7 @@ public Experimental() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Experimental(Experimental other) : this() { collectiveGroupLeader_ = other.collectiveGroupLeader_; executorType_ = other.executorType_; @@ -3407,12 +4593,14 @@ public Experimental(Experimental other) : this() { disableOutputPartitionGraphs_ = other.disableOutputPartitionGraphs_; xlaFusionAutotunerThresh_ = other.xlaFusionAutotunerThresh_; useTfrt_ = other.useTfrt_; - coordinationService_ = other.coordinationService_; - fetchRemoteDevicesInMultiClient_ = other.fetchRemoteDevicesInMultiClient_; + disableFunctionalOpsLowering_ = other.disableFunctionalOpsLowering_; + xlaPreferSingleGraphCluster_ = other.xlaPreferSingleGraphCluster_; + coordinationConfig_ = other.coordinationConfig_ != null ? other.coordinationConfig_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Experimental Clone() { return new Experimental(this); } @@ -3424,6 +4612,7 @@ public Experimental Clone() { /// Task name for group resolution. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string CollectiveGroupLeader { get { return collectiveGroupLeader_; } set { @@ -3439,6 +4628,7 @@ public string CollectiveGroupLeader { /// if it is an empty string or "DEFAULT" /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string ExecutorType { get { return executorType_; } set { @@ -3455,6 +4645,7 @@ public string ExecutorType { /// Any negative value indicates no max, i.e. one chunk only. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int RecvBufMaxChunk { get { return recvBufMaxChunk_; } set { @@ -3471,6 +4662,7 @@ public int RecvBufMaxChunk { /// existence of as many CPU devices as there are available NUMA nodes. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool UseNumaAffinity { get { return useNumaAffinity_; } set { @@ -3486,6 +4678,7 @@ public bool UseNumaAffinity { /// for potentially concurrent collective instances. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool CollectiveDeterministicSequentialExecution { get { return collectiveDeterministicSequentialExecution_; } set { @@ -3501,6 +4694,7 @@ public bool CollectiveDeterministicSequentialExecution { /// experimental. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool CollectiveNccl { get { return collectiveNccl_; } set { @@ -3534,6 +4728,7 @@ public bool CollectiveNccl { /// isolate_session_state and ClusterSpec propagation. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool ShareSessionStateInClusterspecPropagation { get { return shareSessionStateInClusterspecPropagation_; } set { @@ -3551,6 +4746,7 @@ public bool ShareSessionStateInClusterspecPropagation { /// CPU usage. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool DisableThreadSpinning { get { return disableThreadSpinning_; } set { @@ -3566,6 +4762,7 @@ public bool DisableThreadSpinning { /// ConfigProto.share_cluster_devices_in_session instead. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool ShareClusterDevicesInSession { get { return shareClusterDevicesInSession_; } set { @@ -3585,6 +4782,7 @@ public bool ShareClusterDevicesInSession { /// NOTE: This is currently used and propagated only by the direct session. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.SessionMetadata SessionMetadata { get { return sessionMetadata_; } set { @@ -3604,6 +4802,7 @@ public bool ShareClusterDevicesInSession { /// Session::Extend() may not be supported. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool OptimizeForStaticGraph { get { return optimizeForStaticGraph_; } set { @@ -3631,6 +4830,7 @@ public bool OptimizeForStaticGraph { /// to lower the encapsulated graph to a particular device. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool EnableMlirBridge { get { return enableMlirBridge_; } set { @@ -3648,6 +4848,7 @@ public bool EnableMlirBridge { /// Whether to enable the MLIR-based TF->XLA bridge. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.ConfigProto.Types.Experimental.Types.MlirBridgeRollout MlirBridgeRollout { get { return mlirBridgeRollout_; } set { @@ -3666,6 +4867,7 @@ public bool EnableMlirBridge { /// new passes that are replacing existing optimizations in Grappler. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool EnableMlirGraphOptimization { get { return enableMlirGraphOptimization_; } set { @@ -3684,6 +4886,7 @@ public bool EnableMlirGraphOptimization { /// `RunOptions.output_partition_graphs` options must not be set. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool DisableOutputPartitionGraphs { get { return disableOutputPartitionGraphs_; } set { @@ -3702,6 +4905,7 @@ public bool DisableOutputPartitionGraphs { /// search on the compiler parameters. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long XlaFusionAutotunerThresh { get { return xlaFusionAutotunerThresh_; } set { @@ -3716,6 +4920,7 @@ public long XlaFusionAutotunerThresh { /// Whether runtime execution uses TFRT. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool UseTfrt { get { return useTfrt_; } set { @@ -3723,44 +4928,62 @@ public bool UseTfrt { } } - /// Field number for the "coordination_service" field. - public const int CoordinationServiceFieldNumber = 19; - private string coordinationService_ = ""; + /// Field number for the "disable_functional_ops_lowering" field. + public const int DisableFunctionalOpsLoweringFieldNumber = 21; + private bool disableFunctionalOpsLowering_; + /// + /// Whether functional control flow op lowering should be disabled. This is + /// useful when executing within a portable runtime where control flow op + /// kernels may not be loaded due to selective registration. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool DisableFunctionalOpsLowering { + get { return disableFunctionalOpsLowering_; } + set { + disableFunctionalOpsLowering_ = value; + } + } + + /// Field number for the "xla_prefer_single_graph_cluster" field. + public const int XlaPreferSingleGraphClusterFieldNumber = 22; + private bool xlaPreferSingleGraphCluster_; /// - /// Distributed coordination service to be enabled if set. - /// Currently only effective in multi-client setup. + /// Provides a hint to XLA auto clustering to prefer forming a single large + /// cluster that encompases most of the graph. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string CoordinationService { - get { return coordinationService_; } + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaPreferSingleGraphCluster { + get { return xlaPreferSingleGraphCluster_; } set { - coordinationService_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + xlaPreferSingleGraphCluster_ = value; } } - /// Field number for the "fetch_remote_devices_in_multi_client" field. - public const int FetchRemoteDevicesInMultiClientFieldNumber = 20; - private bool fetchRemoteDevicesInMultiClient_; + /// Field number for the "coordination_config" field. + public const int CoordinationConfigFieldNumber = 23; + private global::Tensorflow.CoordinationServiceConfig coordinationConfig_; /// - /// Whether the remote devices in the cluster should be fetched during setup - /// of multi-client cluster. If enabled, the workers will run an extra device - /// information exchange step during startup and the workers' EagerContexts - /// will become aware of remote devices in the cluster as well. + /// Distributed coordination service configurations. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool FetchRemoteDevicesInMultiClient { - get { return fetchRemoteDevicesInMultiClient_; } + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.CoordinationServiceConfig CoordinationConfig { + get { return coordinationConfig_; } set { - fetchRemoteDevicesInMultiClient_ = value; + coordinationConfig_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as Experimental); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(Experimental other) { if (ReferenceEquals(other, null)) { return false; @@ -3785,12 +5008,14 @@ public bool Equals(Experimental other) { if (DisableOutputPartitionGraphs != other.DisableOutputPartitionGraphs) return false; if (XlaFusionAutotunerThresh != other.XlaFusionAutotunerThresh) return false; if (UseTfrt != other.UseTfrt) return false; - if (CoordinationService != other.CoordinationService) return false; - if (FetchRemoteDevicesInMultiClient != other.FetchRemoteDevicesInMultiClient) return false; + if (DisableFunctionalOpsLowering != other.DisableFunctionalOpsLowering) return false; + if (XlaPreferSingleGraphCluster != other.XlaPreferSingleGraphCluster) return false; + if (!object.Equals(CoordinationConfig, other.CoordinationConfig)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (CollectiveGroupLeader.Length != 0) hash ^= CollectiveGroupLeader.GetHashCode(); @@ -3810,8 +5035,9 @@ public override int GetHashCode() { if (DisableOutputPartitionGraphs != false) hash ^= DisableOutputPartitionGraphs.GetHashCode(); if (XlaFusionAutotunerThresh != 0L) hash ^= XlaFusionAutotunerThresh.GetHashCode(); if (UseTfrt != false) hash ^= UseTfrt.GetHashCode(); - if (CoordinationService.Length != 0) hash ^= CoordinationService.GetHashCode(); - if (FetchRemoteDevicesInMultiClient != false) hash ^= FetchRemoteDevicesInMultiClient.GetHashCode(); + if (DisableFunctionalOpsLowering != false) hash ^= DisableFunctionalOpsLowering.GetHashCode(); + if (XlaPreferSingleGraphCluster != false) hash ^= XlaPreferSingleGraphCluster.GetHashCode(); + if (coordinationConfig_ != null) hash ^= CoordinationConfig.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -3819,12 +5045,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (CollectiveGroupLeader.Length != 0) { output.WriteRawTag(10); output.WriteString(CollectiveGroupLeader); @@ -3893,28 +5124,124 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(144, 1); output.WriteBool(UseTfrt); } - if (CoordinationService.Length != 0) { - output.WriteRawTag(154, 1); - output.WriteString(CoordinationService); + if (DisableFunctionalOpsLowering != false) { + output.WriteRawTag(168, 1); + output.WriteBool(DisableFunctionalOpsLowering); } - if (FetchRemoteDevicesInMultiClient != false) { - output.WriteRawTag(160, 1); - output.WriteBool(FetchRemoteDevicesInMultiClient); + if (XlaPreferSingleGraphCluster != false) { + output.WriteRawTag(176, 1); + output.WriteBool(XlaPreferSingleGraphCluster); + } + if (coordinationConfig_ != null) { + output.WriteRawTag(186, 1); + output.WriteMessage(CoordinationConfig); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (CollectiveGroupLeader.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(CollectiveGroupLeader); + output.WriteRawTag(10); + output.WriteString(CollectiveGroupLeader); } if (ExecutorType.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(ExecutorType); - } + output.WriteRawTag(26); + output.WriteString(ExecutorType); + } + if (RecvBufMaxChunk != 0) { + output.WriteRawTag(32); + output.WriteInt32(RecvBufMaxChunk); + } + if (UseNumaAffinity != false) { + output.WriteRawTag(40); + output.WriteBool(UseNumaAffinity); + } + if (CollectiveDeterministicSequentialExecution != false) { + output.WriteRawTag(48); + output.WriteBool(CollectiveDeterministicSequentialExecution); + } + if (CollectiveNccl != false) { + output.WriteRawTag(56); + output.WriteBool(CollectiveNccl); + } + if (ShareSessionStateInClusterspecPropagation != false) { + output.WriteRawTag(64); + output.WriteBool(ShareSessionStateInClusterspecPropagation); + } + if (DisableThreadSpinning != false) { + output.WriteRawTag(72); + output.WriteBool(DisableThreadSpinning); + } + if (ShareClusterDevicesInSession != false) { + output.WriteRawTag(80); + output.WriteBool(ShareClusterDevicesInSession); + } + if (sessionMetadata_ != null) { + output.WriteRawTag(90); + output.WriteMessage(SessionMetadata); + } + if (OptimizeForStaticGraph != false) { + output.WriteRawTag(96); + output.WriteBool(OptimizeForStaticGraph); + } + if (EnableMlirBridge != false) { + output.WriteRawTag(104); + output.WriteBool(EnableMlirBridge); + } + if (DisableOutputPartitionGraphs != false) { + output.WriteRawTag(112); + output.WriteBool(DisableOutputPartitionGraphs); + } + if (XlaFusionAutotunerThresh != 0L) { + output.WriteRawTag(120); + output.WriteInt64(XlaFusionAutotunerThresh); + } + if (EnableMlirGraphOptimization != false) { + output.WriteRawTag(128, 1); + output.WriteBool(EnableMlirGraphOptimization); + } + if (MlirBridgeRollout != global::Tensorflow.ConfigProto.Types.Experimental.Types.MlirBridgeRollout.Unspecified) { + output.WriteRawTag(136, 1); + output.WriteEnum((int) MlirBridgeRollout); + } + if (UseTfrt != false) { + output.WriteRawTag(144, 1); + output.WriteBool(UseTfrt); + } + if (DisableFunctionalOpsLowering != false) { + output.WriteRawTag(168, 1); + output.WriteBool(DisableFunctionalOpsLowering); + } + if (XlaPreferSingleGraphCluster != false) { + output.WriteRawTag(176, 1); + output.WriteBool(XlaPreferSingleGraphCluster); + } + if (coordinationConfig_ != null) { + output.WriteRawTag(186, 1); + output.WriteMessage(CoordinationConfig); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (CollectiveGroupLeader.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(CollectiveGroupLeader); + } + if (ExecutorType.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ExecutorType); + } if (RecvBufMaxChunk != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(RecvBufMaxChunk); } @@ -3960,12 +5287,15 @@ public int CalculateSize() { if (UseTfrt != false) { size += 2 + 1; } - if (CoordinationService.Length != 0) { - size += 2 + pb::CodedOutputStream.ComputeStringSize(CoordinationService); + if (DisableFunctionalOpsLowering != false) { + size += 2 + 1; } - if (FetchRemoteDevicesInMultiClient != false) { + if (XlaPreferSingleGraphCluster != false) { size += 2 + 1; } + if (coordinationConfig_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(CoordinationConfig); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -3973,6 +5303,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(Experimental other) { if (other == null) { return; @@ -4031,17 +5362,27 @@ public void MergeFrom(Experimental other) { if (other.UseTfrt != false) { UseTfrt = other.UseTfrt; } - if (other.CoordinationService.Length != 0) { - CoordinationService = other.CoordinationService; + if (other.DisableFunctionalOpsLowering != false) { + DisableFunctionalOpsLowering = other.DisableFunctionalOpsLowering; } - if (other.FetchRemoteDevicesInMultiClient != false) { - FetchRemoteDevicesInMultiClient = other.FetchRemoteDevicesInMultiClient; + if (other.XlaPreferSingleGraphCluster != false) { + XlaPreferSingleGraphCluster = other.XlaPreferSingleGraphCluster; + } + if (other.coordinationConfig_ != null) { + if (coordinationConfig_ == null) { + CoordinationConfig = new global::Tensorflow.CoordinationServiceConfig(); + } + CoordinationConfig.MergeFrom(other.CoordinationConfig); } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -4119,21 +5460,131 @@ public void MergeFrom(pb::CodedInputStream input) { UseTfrt = input.ReadBool(); break; } - case 154: { - CoordinationService = input.ReadString(); + case 168: { + DisableFunctionalOpsLowering = input.ReadBool(); + break; + } + case 176: { + XlaPreferSingleGraphCluster = input.ReadBool(); + break; + } + case 186: { + if (coordinationConfig_ == null) { + CoordinationConfig = new global::Tensorflow.CoordinationServiceConfig(); + } + input.ReadMessage(CoordinationConfig); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + CollectiveGroupLeader = input.ReadString(); + break; + } + case 26: { + ExecutorType = input.ReadString(); + break; + } + case 32: { + RecvBufMaxChunk = input.ReadInt32(); + break; + } + case 40: { + UseNumaAffinity = input.ReadBool(); + break; + } + case 48: { + CollectiveDeterministicSequentialExecution = input.ReadBool(); + break; + } + case 56: { + CollectiveNccl = input.ReadBool(); + break; + } + case 64: { + ShareSessionStateInClusterspecPropagation = input.ReadBool(); + break; + } + case 72: { + DisableThreadSpinning = input.ReadBool(); + break; + } + case 80: { + ShareClusterDevicesInSession = input.ReadBool(); + break; + } + case 90: { + if (sessionMetadata_ == null) { + SessionMetadata = new global::Tensorflow.SessionMetadata(); + } + input.ReadMessage(SessionMetadata); + break; + } + case 96: { + OptimizeForStaticGraph = input.ReadBool(); + break; + } + case 104: { + EnableMlirBridge = input.ReadBool(); + break; + } + case 112: { + DisableOutputPartitionGraphs = input.ReadBool(); + break; + } + case 120: { + XlaFusionAutotunerThresh = input.ReadInt64(); + break; + } + case 128: { + EnableMlirGraphOptimization = input.ReadBool(); + break; + } + case 136: { + MlirBridgeRollout = (global::Tensorflow.ConfigProto.Types.Experimental.Types.MlirBridgeRollout) input.ReadEnum(); + break; + } + case 144: { + UseTfrt = input.ReadBool(); + break; + } + case 168: { + DisableFunctionalOpsLowering = input.ReadBool(); break; } - case 160: { - FetchRemoteDevicesInMultiClient = input.ReadBool(); + case 176: { + XlaPreferSingleGraphCluster = input.ReadBool(); + break; + } + case 186: { + if (coordinationConfig_ == null) { + CoordinationConfig = new global::Tensorflow.CoordinationServiceConfig(); + } + input.ReadMessage(CoordinationConfig); break; } } } } + #endif #region Nested types /// Container for nested types declared in the Experimental message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { /// /// An enum that describes the state of the MLIR bridge rollout. @@ -4183,23 +5634,31 @@ public enum MlirBridgeRollout { /// /// Options for a single Run() call. /// - public sealed partial class RunOptions : pb::IMessage { + public sealed partial class RunOptions : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RunOptions()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ConfigReflection.Descriptor.MessageTypes[7]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public RunOptions() { OnConstruction(); } @@ -4207,6 +5666,7 @@ public RunOptions() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public RunOptions(RunOptions other) : this() { traceLevel_ = other.traceLevel_; timeoutInMs_ = other.timeoutInMs_; @@ -4219,6 +5679,7 @@ public RunOptions(RunOptions other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public RunOptions Clone() { return new RunOptions(this); } @@ -4227,6 +5688,7 @@ public RunOptions Clone() { public const int TraceLevelFieldNumber = 1; private global::Tensorflow.RunOptions.Types.TraceLevel traceLevel_ = global::Tensorflow.RunOptions.Types.TraceLevel.NoTrace; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RunOptions.Types.TraceLevel TraceLevel { get { return traceLevel_; } set { @@ -4241,6 +5703,7 @@ public RunOptions Clone() { /// Time to wait for operation to complete in milliseconds. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long TimeoutInMs { get { return timeoutInMs_; } set { @@ -4260,6 +5723,7 @@ public long TimeoutInMs { /// comparable with the overhead of Session::Run(). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int InterOpThreadPool { get { return interOpThreadPool_; } set { @@ -4275,6 +5739,7 @@ public int InterOpThreadPool { /// outputted via RunMetadata. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool OutputPartitionGraphs { get { return outputPartitionGraphs_; } set { @@ -4289,6 +5754,7 @@ public bool OutputPartitionGraphs { /// EXPERIMENTAL. Options used to initialize DebuggerState, if enabled. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.DebugOptions DebugOptions { get { return debugOptions_; } set { @@ -4307,6 +5773,7 @@ public bool OutputPartitionGraphs { /// Enabling this option can slow down the Run() call. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool ReportTensorAllocationsUponOom { get { return reportTensorAllocationsUponOom_; } set { @@ -4318,6 +5785,7 @@ public bool ReportTensorAllocationsUponOom { public const int ExperimentalFieldNumber = 8; private global::Tensorflow.RunOptions.Types.Experimental experimental_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RunOptions.Types.Experimental Experimental { get { return experimental_; } set { @@ -4326,11 +5794,13 @@ public bool ReportTensorAllocationsUponOom { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as RunOptions); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(RunOptions other) { if (ReferenceEquals(other, null)) { return false; @@ -4349,6 +5819,7 @@ public bool Equals(RunOptions other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (TraceLevel != global::Tensorflow.RunOptions.Types.TraceLevel.NoTrace) hash ^= TraceLevel.GetHashCode(); @@ -4365,12 +5836,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (TraceLevel != global::Tensorflow.RunOptions.Types.TraceLevel.NoTrace) { output.WriteRawTag(8); output.WriteEnum((int) TraceLevel); @@ -4402,9 +5878,49 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (TraceLevel != global::Tensorflow.RunOptions.Types.TraceLevel.NoTrace) { + output.WriteRawTag(8); + output.WriteEnum((int) TraceLevel); + } + if (TimeoutInMs != 0L) { + output.WriteRawTag(16); + output.WriteInt64(TimeoutInMs); + } + if (InterOpThreadPool != 0) { + output.WriteRawTag(24); + output.WriteInt32(InterOpThreadPool); + } + if (OutputPartitionGraphs != false) { + output.WriteRawTag(40); + output.WriteBool(OutputPartitionGraphs); + } + if (debugOptions_ != null) { + output.WriteRawTag(50); + output.WriteMessage(DebugOptions); + } + if (ReportTensorAllocationsUponOom != false) { + output.WriteRawTag(56); + output.WriteBool(ReportTensorAllocationsUponOom); + } + if (experimental_ != null) { + output.WriteRawTag(66); + output.WriteMessage(Experimental); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (TraceLevel != global::Tensorflow.RunOptions.Types.TraceLevel.NoTrace) { @@ -4435,6 +5951,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(RunOptions other) { if (other == null) { return; @@ -4470,7 +5987,11 @@ public void MergeFrom(RunOptions other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -4513,11 +6034,62 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + TraceLevel = (global::Tensorflow.RunOptions.Types.TraceLevel) input.ReadEnum(); + break; + } + case 16: { + TimeoutInMs = input.ReadInt64(); + break; + } + case 24: { + InterOpThreadPool = input.ReadInt32(); + break; + } + case 40: { + OutputPartitionGraphs = input.ReadBool(); + break; + } + case 50: { + if (debugOptions_ == null) { + DebugOptions = new global::Tensorflow.DebugOptions(); + } + input.ReadMessage(DebugOptions); + break; + } + case 56: { + ReportTensorAllocationsUponOom = input.ReadBool(); + break; + } + case 66: { + if (experimental_ == null) { + Experimental = new global::Tensorflow.RunOptions.Types.Experimental(); + } + input.ReadMessage(Experimental); + break; + } + } + } + } + #endif + #region Nested types /// Container for nested types declared in the RunOptions message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { /// /// TODO(pbar) Turn this into a TraceOptions proto which allows @@ -4535,23 +6107,31 @@ public enum TraceLevel { /// to API stability guarantees in /// https://www.tensorflow.org/guide/version_compat. /// - public sealed partial class Experimental : pb::IMessage { + public sealed partial class Experimental : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Experimental()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.RunOptions.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Experimental() { OnConstruction(); } @@ -4559,6 +6139,7 @@ public Experimental() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Experimental(Experimental other) : this() { collectiveGraphKey_ = other.collectiveGraphKey_; useRunHandlerPool_ = other.useRunHandlerPool_; @@ -4567,6 +6148,7 @@ public Experimental(Experimental other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Experimental Clone() { return new Experimental(this); } @@ -4581,6 +6163,7 @@ public Experimental Clone() { /// run disjoint graphs). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long CollectiveGraphKey { get { return collectiveGraphKey_; } set { @@ -4598,6 +6181,7 @@ public long CollectiveGraphKey { /// Consider using this option for CPU-bound workloads like inference. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool UseRunHandlerPool { get { return useRunHandlerPool_; } set { @@ -4609,6 +6193,7 @@ public bool UseRunHandlerPool { public const int RunHandlerPoolOptionsFieldNumber = 3; private global::Tensorflow.RunOptions.Types.Experimental.Types.RunHandlerPoolOptions runHandlerPoolOptions_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RunOptions.Types.Experimental.Types.RunHandlerPoolOptions RunHandlerPoolOptions { get { return runHandlerPoolOptions_; } set { @@ -4617,11 +6202,13 @@ public bool UseRunHandlerPool { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as Experimental); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(Experimental other) { if (ReferenceEquals(other, null)) { return false; @@ -4636,24 +6223,52 @@ public bool Equals(Experimental other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (CollectiveGraphKey != 0L) hash ^= CollectiveGraphKey.GetHashCode(); if (UseRunHandlerPool != false) hash ^= UseRunHandlerPool.GetHashCode(); if (runHandlerPoolOptions_ != null) hash ^= RunHandlerPoolOptions.GetHashCode(); if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (CollectiveGraphKey != 0L) { + output.WriteRawTag(8); + output.WriteInt64(CollectiveGraphKey); + } + if (UseRunHandlerPool != false) { + output.WriteRawTag(16); + output.WriteBool(UseRunHandlerPool); + } + if (runHandlerPoolOptions_ != null) { + output.WriteRawTag(26); + output.WriteMessage(RunHandlerPoolOptions); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (CollectiveGraphKey != 0L) { output.WriteRawTag(8); output.WriteInt64(CollectiveGraphKey); @@ -4667,11 +6282,13 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteMessage(RunHandlerPoolOptions); } if (_unknownFields != null) { - _unknownFields.WriteTo(output); + _unknownFields.WriteTo(ref output); } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (CollectiveGraphKey != 0L) { @@ -4690,6 +6307,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(Experimental other) { if (other == null) { return; @@ -4710,7 +6328,11 @@ public void MergeFrom(Experimental other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -4734,32 +6356,72 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + CollectiveGraphKey = input.ReadInt64(); + break; + } + case 16: { + UseRunHandlerPool = input.ReadBool(); + break; + } + case 26: { + if (runHandlerPoolOptions_ == null) { + RunHandlerPoolOptions = new global::Tensorflow.RunOptions.Types.Experimental.Types.RunHandlerPoolOptions(); + } + input.ReadMessage(RunHandlerPoolOptions); + break; + } + } + } } + #endif #region Nested types /// Container for nested types declared in the Experimental message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { /// /// Options for run handler thread pool. /// - public sealed partial class RunHandlerPoolOptions : pb::IMessage { + public sealed partial class RunHandlerPoolOptions : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RunHandlerPoolOptions()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.RunOptions.Types.Experimental.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public RunHandlerPoolOptions() { OnConstruction(); } @@ -4767,12 +6429,14 @@ public RunHandlerPoolOptions() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public RunHandlerPoolOptions(RunHandlerPoolOptions other) : this() { priority_ = other.priority_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public RunHandlerPoolOptions Clone() { return new RunHandlerPoolOptions(this); } @@ -4785,6 +6449,7 @@ public RunHandlerPoolOptions Clone() { /// based on the priority number. The larger number means higher priority. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long Priority { get { return priority_; } set { @@ -4793,11 +6458,13 @@ public long Priority { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as RunHandlerPoolOptions); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(RunHandlerPoolOptions other) { if (ReferenceEquals(other, null)) { return false; @@ -4810,6 +6477,7 @@ public bool Equals(RunHandlerPoolOptions other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Priority != 0L) hash ^= Priority.GetHashCode(); @@ -4820,12 +6488,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Priority != 0L) { output.WriteRawTag(8); output.WriteInt64(Priority); @@ -4833,9 +6506,25 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Priority != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Priority); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Priority != 0L) { @@ -4848,6 +6537,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(RunHandlerPoolOptions other) { if (other == null) { return; @@ -4859,7 +6549,11 @@ public void MergeFrom(RunHandlerPoolOptions other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -4872,7 +6566,27 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Priority = input.ReadInt64(); + break; + } + } + } } + #endif } @@ -4889,23 +6603,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// /// Metadata output (i.e., non-Tensor) for a single Run() call. /// - public sealed partial class RunMetadata : pb::IMessage { + public sealed partial class RunMetadata : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RunMetadata()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ConfigReflection.Descriptor.MessageTypes[8]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public RunMetadata() { OnConstruction(); } @@ -4913,15 +6635,18 @@ public RunMetadata() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public RunMetadata(RunMetadata other) : this() { stepStats_ = other.stepStats_ != null ? other.stepStats_.Clone() : null; costGraph_ = other.costGraph_ != null ? other.costGraph_.Clone() : null; partitionGraphs_ = other.partitionGraphs_.Clone(); functionGraphs_ = other.functionGraphs_.Clone(); + sessionMetadata_ = other.sessionMetadata_ != null ? other.sessionMetadata_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public RunMetadata Clone() { return new RunMetadata(this); } @@ -4935,6 +6660,7 @@ public RunMetadata Clone() { /// EXPERIMENTAL: The format and set of events may change in future versions. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.StepStats StepStats { get { return stepStats_; } set { @@ -4949,6 +6675,7 @@ public RunMetadata Clone() { /// The cost graph for the computation defined by the run call. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.CostGraphDef CostGraph { get { return costGraph_; } set { @@ -4965,6 +6692,7 @@ public RunMetadata Clone() { /// Graphs of the partitions executed by executors. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField PartitionGraphs { get { return partitionGraphs_; } } @@ -4987,16 +6715,34 @@ public RunMetadata Clone() { /// optimization passes might change the structure of the graph significantly). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField FunctionGraphs { get { return functionGraphs_; } } + /// Field number for the "session_metadata" field. + public const int SessionMetadataFieldNumber = 5; + private global::Tensorflow.SessionMetadata sessionMetadata_; + /// + /// Metadata about the session. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.SessionMetadata SessionMetadata { + get { return sessionMetadata_; } + set { + sessionMetadata_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as RunMetadata); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(RunMetadata other) { if (ReferenceEquals(other, null)) { return false; @@ -5008,16 +6754,19 @@ public bool Equals(RunMetadata other) { if (!object.Equals(CostGraph, other.CostGraph)) return false; if(!partitionGraphs_.Equals(other.partitionGraphs_)) return false; if(!functionGraphs_.Equals(other.functionGraphs_)) return false; + if (!object.Equals(SessionMetadata, other.SessionMetadata)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (stepStats_ != null) hash ^= StepStats.GetHashCode(); if (costGraph_ != null) hash ^= CostGraph.GetHashCode(); hash ^= partitionGraphs_.GetHashCode(); hash ^= functionGraphs_.GetHashCode(); + if (sessionMetadata_ != null) hash ^= SessionMetadata.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -5025,12 +6774,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (stepStats_ != null) { output.WriteRawTag(10); output.WriteMessage(StepStats); @@ -5041,12 +6795,42 @@ public void WriteTo(pb::CodedOutputStream output) { } partitionGraphs_.WriteTo(output, _repeated_partitionGraphs_codec); functionGraphs_.WriteTo(output, _repeated_functionGraphs_codec); + if (sessionMetadata_ != null) { + output.WriteRawTag(42); + output.WriteMessage(SessionMetadata); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (stepStats_ != null) { + output.WriteRawTag(10); + output.WriteMessage(StepStats); + } + if (costGraph_ != null) { + output.WriteRawTag(18); + output.WriteMessage(CostGraph); + } + partitionGraphs_.WriteTo(ref output, _repeated_partitionGraphs_codec); + functionGraphs_.WriteTo(ref output, _repeated_functionGraphs_codec); + if (sessionMetadata_ != null) { + output.WriteRawTag(42); + output.WriteMessage(SessionMetadata); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (stepStats_ != null) { @@ -5057,6 +6841,9 @@ public int CalculateSize() { } size += partitionGraphs_.CalculateSize(_repeated_partitionGraphs_codec); size += functionGraphs_.CalculateSize(_repeated_functionGraphs_codec); + if (sessionMetadata_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(SessionMetadata); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -5064,6 +6851,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(RunMetadata other) { if (other == null) { return; @@ -5082,11 +6870,21 @@ public void MergeFrom(RunMetadata other) { } partitionGraphs_.Add(other.partitionGraphs_); functionGraphs_.Add(other.functionGraphs_); + if (other.sessionMetadata_ != null) { + if (sessionMetadata_ == null) { + SessionMetadata = new global::Tensorflow.SessionMetadata(); + } + SessionMetadata.MergeFrom(other.SessionMetadata); + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -5115,31 +6913,92 @@ public void MergeFrom(pb::CodedInputStream input) { functionGraphs_.AddEntriesFrom(input, _repeated_functionGraphs_codec); break; } + case 42: { + if (sessionMetadata_ == null) { + SessionMetadata = new global::Tensorflow.SessionMetadata(); + } + input.ReadMessage(SessionMetadata); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (stepStats_ == null) { + StepStats = new global::Tensorflow.StepStats(); + } + input.ReadMessage(StepStats); + break; + } + case 18: { + if (costGraph_ == null) { + CostGraph = new global::Tensorflow.CostGraphDef(); + } + input.ReadMessage(CostGraph); + break; + } + case 26: { + partitionGraphs_.AddEntriesFrom(ref input, _repeated_partitionGraphs_codec); + break; + } + case 34: { + functionGraphs_.AddEntriesFrom(ref input, _repeated_functionGraphs_codec); + break; + } + case 42: { + if (sessionMetadata_ == null) { + SessionMetadata = new global::Tensorflow.SessionMetadata(); + } + input.ReadMessage(SessionMetadata); + break; + } } } } + #endif #region Nested types /// Container for nested types declared in the RunMetadata message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { - public sealed partial class FunctionGraphs : pb::IMessage { + public sealed partial class FunctionGraphs : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FunctionGraphs()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.RunMetadata.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public FunctionGraphs() { OnConstruction(); } @@ -5147,6 +7006,7 @@ public FunctionGraphs() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public FunctionGraphs(FunctionGraphs other) : this() { partitionGraphs_ = other.partitionGraphs_.Clone(); preOptimizationGraph_ = other.preOptimizationGraph_ != null ? other.preOptimizationGraph_.Clone() : null; @@ -5155,6 +7015,7 @@ public FunctionGraphs(FunctionGraphs other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public FunctionGraphs Clone() { return new FunctionGraphs(this); } @@ -5168,6 +7029,7 @@ public FunctionGraphs Clone() { /// TODO(nareshmodi): Include some sort of function/cache-key identifier? /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField PartitionGraphs { get { return partitionGraphs_; } } @@ -5176,6 +7038,7 @@ public FunctionGraphs Clone() { public const int PreOptimizationGraphFieldNumber = 2; private global::Tensorflow.GraphDef preOptimizationGraph_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.GraphDef PreOptimizationGraph { get { return preOptimizationGraph_; } set { @@ -5187,6 +7050,7 @@ public FunctionGraphs Clone() { public const int PostOptimizationGraphFieldNumber = 3; private global::Tensorflow.GraphDef postOptimizationGraph_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.GraphDef PostOptimizationGraph { get { return postOptimizationGraph_; } set { @@ -5195,11 +7059,13 @@ public FunctionGraphs Clone() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as FunctionGraphs); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(FunctionGraphs other) { if (ReferenceEquals(other, null)) { return false; @@ -5214,6 +7080,7 @@ public bool Equals(FunctionGraphs other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= partitionGraphs_.GetHashCode(); @@ -5226,12 +7093,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else partitionGraphs_.WriteTo(output, _repeated_partitionGraphs_codec); if (preOptimizationGraph_ != null) { output.WriteRawTag(18); @@ -5244,9 +7116,30 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + partitionGraphs_.WriteTo(ref output, _repeated_partitionGraphs_codec); + if (preOptimizationGraph_ != null) { + output.WriteRawTag(18); + output.WriteMessage(PreOptimizationGraph); + } + if (postOptimizationGraph_ != null) { + output.WriteRawTag(26); + output.WriteMessage(PostOptimizationGraph); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += partitionGraphs_.CalculateSize(_repeated_partitionGraphs_codec); @@ -5263,6 +7156,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(FunctionGraphs other) { if (other == null) { return; @@ -5284,7 +7178,11 @@ public void MergeFrom(FunctionGraphs other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -5311,7 +7209,41 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + partitionGraphs_.AddEntriesFrom(ref input, _repeated_partitionGraphs_codec); + break; + } + case 18: { + if (preOptimizationGraph_ == null) { + PreOptimizationGraph = new global::Tensorflow.GraphDef(); + } + input.ReadMessage(PreOptimizationGraph); + break; + } + case 26: { + if (postOptimizationGraph_ == null) { + PostOptimizationGraph = new global::Tensorflow.GraphDef(); + } + input.ReadMessage(PostOptimizationGraph); + break; + } + } + } } + #endif } @@ -5323,23 +7255,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// /// Defines a connection between two tensors in a `GraphDef`. /// - public sealed partial class TensorConnection : pb::IMessage { + public sealed partial class TensorConnection : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TensorConnection()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ConfigReflection.Descriptor.MessageTypes[9]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TensorConnection() { OnConstruction(); } @@ -5347,6 +7287,7 @@ public TensorConnection() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TensorConnection(TensorConnection other) : this() { fromTensor_ = other.fromTensor_; toTensor_ = other.toTensor_; @@ -5354,6 +7295,7 @@ public TensorConnection(TensorConnection other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TensorConnection Clone() { return new TensorConnection(this); } @@ -5366,6 +7308,7 @@ public TensorConnection Clone() { /// the tensor named in `to_tensor`. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string FromTensor { get { return fromTensor_; } set { @@ -5381,6 +7324,7 @@ public string FromTensor { /// value of the tensor named in `from_tensor`. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string ToTensor { get { return toTensor_; } set { @@ -5389,11 +7333,13 @@ public string ToTensor { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as TensorConnection); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(TensorConnection other) { if (ReferenceEquals(other, null)) { return false; @@ -5407,6 +7353,7 @@ public bool Equals(TensorConnection other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (FromTensor.Length != 0) hash ^= FromTensor.GetHashCode(); @@ -5418,12 +7365,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (FromTensor.Length != 0) { output.WriteRawTag(10); output.WriteString(FromTensor); @@ -5435,9 +7387,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (FromTensor.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FromTensor); + } + if (ToTensor.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ToTensor); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (FromTensor.Length != 0) { @@ -5453,6 +7425,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(TensorConnection other) { if (other == null) { return; @@ -5467,7 +7440,11 @@ public void MergeFrom(TensorConnection other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -5484,7 +7461,31 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + FromTensor = input.ReadString(); + break; + } + case 18: { + ToTensor = input.ReadString(); + break; + } + } + } } + #endif } @@ -5494,23 +7495,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// /// Compare with the arguments to `Session::Run()`. /// - public sealed partial class CallableOptions : pb::IMessage { + public sealed partial class CallableOptions : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CallableOptions()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ConfigReflection.Descriptor.MessageTypes[10]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CallableOptions() { OnConstruction(); } @@ -5518,6 +7527,7 @@ public CallableOptions() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CallableOptions(CallableOptions other) : this() { feed_ = other.feed_.Clone(); fetch_ = other.fetch_.Clone(); @@ -5531,6 +7541,7 @@ public CallableOptions(CallableOptions other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CallableOptions Clone() { return new CallableOptions(this); } @@ -5544,6 +7555,7 @@ public CallableOptions Clone() { /// Tensors to be fed in the callable. Each feed is the name of a tensor. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Feed { get { return feed_; } } @@ -5559,6 +7571,7 @@ public CallableOptions Clone() { /// order of specified fetches does not change the execution order. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Fetch { get { return fetch_; } } @@ -5573,6 +7586,7 @@ public CallableOptions Clone() { /// callable but their outputs will not be returned. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Target { get { return target_; } } @@ -5584,6 +7598,7 @@ public CallableOptions Clone() { /// Options that will be applied to each run. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RunOptions RunOptions { get { return runOptions_; } set { @@ -5602,6 +7617,7 @@ public CallableOptions Clone() { /// in the callable. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField TensorConnection { get { return tensorConnection_; } } @@ -5661,6 +7677,7 @@ public CallableOptions Clone() { /// cuStreamSynchronize()). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField FeedDevices { get { return feedDevices_; } } @@ -5671,6 +7688,7 @@ public CallableOptions Clone() { = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForString(18, ""), 58); private readonly pbc::MapField fetchDevices_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField FetchDevices { get { return fetchDevices_; } } @@ -5691,6 +7709,7 @@ public CallableOptions Clone() { /// `feed_devices` with the same corresponding device name. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool FetchSkipSync { get { return fetchSkipSync_; } set { @@ -5699,11 +7718,13 @@ public bool FetchSkipSync { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as CallableOptions); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(CallableOptions other) { if (ReferenceEquals(other, null)) { return false; @@ -5723,6 +7744,7 @@ public bool Equals(CallableOptions other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= feed_.GetHashCode(); @@ -5740,12 +7762,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else feed_.WriteTo(output, _repeated_feed_codec); fetch_.WriteTo(output, _repeated_fetch_codec); target_.WriteTo(output, _repeated_target_codec); @@ -5763,9 +7790,35 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + feed_.WriteTo(ref output, _repeated_feed_codec); + fetch_.WriteTo(ref output, _repeated_fetch_codec); + target_.WriteTo(ref output, _repeated_target_codec); + if (runOptions_ != null) { + output.WriteRawTag(34); + output.WriteMessage(RunOptions); + } + tensorConnection_.WriteTo(ref output, _repeated_tensorConnection_codec); + feedDevices_.WriteTo(ref output, _map_feedDevices_codec); + fetchDevices_.WriteTo(ref output, _map_fetchDevices_codec); + if (FetchSkipSync != false) { + output.WriteRawTag(64); + output.WriteBool(FetchSkipSync); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += feed_.CalculateSize(_repeated_feed_codec); @@ -5787,6 +7840,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(CallableOptions other) { if (other == null) { return; @@ -5810,7 +7864,11 @@ public void MergeFrom(CallableOptions other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -5854,7 +7912,58 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + feed_.AddEntriesFrom(ref input, _repeated_feed_codec); + break; + } + case 18: { + fetch_.AddEntriesFrom(ref input, _repeated_fetch_codec); + break; + } + case 26: { + target_.AddEntriesFrom(ref input, _repeated_target_codec); + break; + } + case 34: { + if (runOptions_ == null) { + RunOptions = new global::Tensorflow.RunOptions(); + } + input.ReadMessage(RunOptions); + break; + } + case 42: { + tensorConnection_.AddEntriesFrom(ref input, _repeated_tensorConnection_codec); + break; + } + case 50: { + feedDevices_.AddEntriesFrom(ref input, _map_feedDevices_codec); + break; + } + case 58: { + fetchDevices_.AddEntriesFrom(ref input, _map_fetchDevices_codec); + break; + } + case 64: { + FetchSkipSync = input.ReadBool(); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/ControlFlow.cs b/src/TensorFlowNET.Core/Protobuf/ControlFlow.cs index a3ed1eecd..3ede374cb 100644 --- a/src/TensorFlowNET.Core/Protobuf/ControlFlow.cs +++ b/src/TensorFlowNET.Core/Protobuf/ControlFlow.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/protobuf/control_flow.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -64,23 +64,31 @@ static ControlFlowReflection() { /// /// Protocol buffer representing the values in ControlFlowContext. /// - public sealed partial class ValuesDef : pb::IMessage { + public sealed partial class ValuesDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ValuesDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ControlFlowReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ValuesDef() { OnConstruction(); } @@ -88,6 +96,7 @@ public ValuesDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ValuesDef(ValuesDef other) : this() { values_ = other.values_.Clone(); externalValues_ = other.externalValues_.Clone(); @@ -95,6 +104,7 @@ public ValuesDef(ValuesDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ValuesDef Clone() { return new ValuesDef(this); } @@ -108,6 +118,7 @@ public ValuesDef Clone() { /// Value names that have been seen in this context. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Values { get { return values_; } } @@ -121,16 +132,19 @@ public ValuesDef Clone() { /// Value names referenced by but external to this context. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField ExternalValues { get { return externalValues_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as ValuesDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(ValuesDef other) { if (ReferenceEquals(other, null)) { return false; @@ -144,6 +158,7 @@ public bool Equals(ValuesDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= values_.GetHashCode(); @@ -155,20 +170,39 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else values_.WriteTo(output, _repeated_values_codec); externalValues_.WriteTo(output, _map_externalValues_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + values_.WriteTo(ref output, _repeated_values_codec); + externalValues_.WriteTo(ref output, _map_externalValues_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += values_.CalculateSize(_repeated_values_codec); @@ -180,6 +214,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(ValuesDef other) { if (other == null) { return; @@ -190,7 +225,11 @@ public void MergeFrom(ValuesDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -207,7 +246,31 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + values_.AddEntriesFrom(ref input, _repeated_values_codec); + break; + } + case 18: { + externalValues_.AddEntriesFrom(ref input, _map_externalValues_codec); + break; + } + } + } } + #endif } @@ -215,23 +278,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// Container for any kind of control flow context. Any other control flow /// contexts that are added below should also be added here. /// - public sealed partial class ControlFlowContextDef : pb::IMessage { + public sealed partial class ControlFlowContextDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ControlFlowContextDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ControlFlowReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ControlFlowContextDef() { OnConstruction(); } @@ -239,6 +310,7 @@ public ControlFlowContextDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ControlFlowContextDef(ControlFlowContextDef other) : this() { switch (other.CtxtCase) { case CtxtOneofCase.CondCtxt: @@ -253,6 +325,7 @@ public ControlFlowContextDef(ControlFlowContextDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ControlFlowContextDef Clone() { return new ControlFlowContextDef(this); } @@ -260,6 +333,7 @@ public ControlFlowContextDef Clone() { /// Field number for the "cond_ctxt" field. public const int CondCtxtFieldNumber = 1; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.CondContextDef CondCtxt { get { return ctxtCase_ == CtxtOneofCase.CondCtxt ? (global::Tensorflow.CondContextDef) ctxt_ : null; } set { @@ -271,6 +345,7 @@ public ControlFlowContextDef Clone() { /// Field number for the "while_ctxt" field. public const int WhileCtxtFieldNumber = 2; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.WhileContextDef WhileCtxt { get { return ctxtCase_ == CtxtOneofCase.WhileCtxt ? (global::Tensorflow.WhileContextDef) ctxt_ : null; } set { @@ -288,22 +363,26 @@ public enum CtxtOneofCase { } private CtxtOneofCase ctxtCase_ = CtxtOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CtxtOneofCase CtxtCase { get { return ctxtCase_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void ClearCtxt() { ctxtCase_ = CtxtOneofCase.None; ctxt_ = null; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as ControlFlowContextDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(ControlFlowContextDef other) { if (ReferenceEquals(other, null)) { return false; @@ -318,6 +397,7 @@ public bool Equals(ControlFlowContextDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (ctxtCase_ == CtxtOneofCase.CondCtxt) hash ^= CondCtxt.GetHashCode(); @@ -330,12 +410,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (ctxtCase_ == CtxtOneofCase.CondCtxt) { output.WriteRawTag(10); output.WriteMessage(CondCtxt); @@ -347,9 +432,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ctxtCase_ == CtxtOneofCase.CondCtxt) { + output.WriteRawTag(10); + output.WriteMessage(CondCtxt); + } + if (ctxtCase_ == CtxtOneofCase.WhileCtxt) { + output.WriteRawTag(18); + output.WriteMessage(WhileCtxt); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (ctxtCase_ == CtxtOneofCase.CondCtxt) { @@ -365,6 +470,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(ControlFlowContextDef other) { if (other == null) { return; @@ -388,7 +494,11 @@ public void MergeFrom(ControlFlowContextDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -415,30 +525,72 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + global::Tensorflow.CondContextDef subBuilder = new global::Tensorflow.CondContextDef(); + if (ctxtCase_ == CtxtOneofCase.CondCtxt) { + subBuilder.MergeFrom(CondCtxt); + } + input.ReadMessage(subBuilder); + CondCtxt = subBuilder; + break; + } + case 18: { + global::Tensorflow.WhileContextDef subBuilder = new global::Tensorflow.WhileContextDef(); + if (ctxtCase_ == CtxtOneofCase.WhileCtxt) { + subBuilder.MergeFrom(WhileCtxt); + } + input.ReadMessage(subBuilder); + WhileCtxt = subBuilder; + break; + } + } + } + } + #endif + } /// /// Protocol buffer representing a CondContext object. /// - public sealed partial class CondContextDef : pb::IMessage { + public sealed partial class CondContextDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CondContextDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ControlFlowReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CondContextDef() { OnConstruction(); } @@ -446,6 +598,7 @@ public CondContextDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CondContextDef(CondContextDef other) : this() { contextName_ = other.contextName_; predName_ = other.predName_; @@ -457,6 +610,7 @@ public CondContextDef(CondContextDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CondContextDef Clone() { return new CondContextDef(this); } @@ -468,6 +622,7 @@ public CondContextDef Clone() { /// Name of the context. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string ContextName { get { return contextName_; } set { @@ -482,6 +637,7 @@ public string ContextName { /// Name of the pred tensor. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string PredName { get { return predName_; } set { @@ -496,6 +652,7 @@ public string PredName { /// Name of the pivot tensor. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string PivotName { get { return pivotName_; } set { @@ -510,6 +667,7 @@ public string PivotName { /// Branch prediction. 0 or 1. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int Branch { get { return branch_; } set { @@ -524,6 +682,7 @@ public int Branch { /// Values and external values in control flow context. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.ValuesDef ValuesDef { get { return valuesDef_; } set { @@ -540,16 +699,19 @@ public int Branch { /// Contexts contained inside this context (e.g. nested conds). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField NestedContexts { get { return nestedContexts_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as CondContextDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(CondContextDef other) { if (ReferenceEquals(other, null)) { return false; @@ -567,6 +729,7 @@ public bool Equals(CondContextDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (ContextName.Length != 0) hash ^= ContextName.GetHashCode(); @@ -582,12 +745,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (ContextName.Length != 0) { output.WriteRawTag(10); output.WriteString(ContextName); @@ -612,9 +780,42 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ContextName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ContextName); + } + if (PredName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(PredName); + } + if (PivotName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(PivotName); + } + if (Branch != 0) { + output.WriteRawTag(32); + output.WriteInt32(Branch); + } + if (valuesDef_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ValuesDef); + } + nestedContexts_.WriteTo(ref output, _repeated_nestedContexts_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (ContextName.Length != 0) { @@ -640,6 +841,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(CondContextDef other) { if (other == null) { return; @@ -667,7 +869,11 @@ public void MergeFrom(CondContextDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -703,30 +909,81 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + ContextName = input.ReadString(); + break; + } + case 18: { + PredName = input.ReadString(); + break; + } + case 26: { + PivotName = input.ReadString(); + break; + } + case 32: { + Branch = input.ReadInt32(); + break; + } + case 42: { + if (valuesDef_ == null) { + ValuesDef = new global::Tensorflow.ValuesDef(); + } + input.ReadMessage(ValuesDef); + break; + } + case 50: { + nestedContexts_.AddEntriesFrom(ref input, _repeated_nestedContexts_codec); + break; + } + } + } } + #endif } /// /// Protocol buffer representing a WhileContext object. /// - public sealed partial class WhileContextDef : pb::IMessage { + public sealed partial class WhileContextDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WhileContextDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ControlFlowReflection.Descriptor.MessageTypes[3]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public WhileContextDef() { OnConstruction(); } @@ -734,6 +991,7 @@ public WhileContextDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public WhileContextDef(WhileContextDef other) : this() { contextName_ = other.contextName_; parallelIterations_ = other.parallelIterations_; @@ -751,6 +1009,7 @@ public WhileContextDef(WhileContextDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public WhileContextDef Clone() { return new WhileContextDef(this); } @@ -762,6 +1021,7 @@ public WhileContextDef Clone() { /// Name of the context. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string ContextName { get { return contextName_; } set { @@ -776,6 +1036,7 @@ public string ContextName { /// The number of iterations allowed to run in parallel. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int ParallelIterations { get { return parallelIterations_; } set { @@ -790,6 +1051,7 @@ public int ParallelIterations { /// Whether backprop is enabled for this while loop. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool BackProp { get { return backProp_; } set { @@ -804,6 +1066,7 @@ public bool BackProp { /// Whether GPU-CPU memory swap is enabled for this loop. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool SwapMemory { get { return swapMemory_; } set { @@ -818,6 +1081,7 @@ public bool SwapMemory { /// Name of the pivot tensor. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string PivotName { get { return pivotName_; } set { @@ -832,6 +1096,7 @@ public string PivotName { /// Name of the pivot_for_pred tensor. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string PivotForPredName { get { return pivotForPredName_; } set { @@ -846,6 +1111,7 @@ public string PivotForPredName { /// Name of the pivot_for_body tensor. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string PivotForBodyName { get { return pivotForBodyName_; } set { @@ -862,6 +1128,7 @@ public string PivotForBodyName { /// List of names for exit tensors. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField LoopExitNames { get { return loopExitNames_; } } @@ -875,6 +1142,7 @@ public string PivotForBodyName { /// List of names for enter tensors. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField LoopEnterNames { get { return loopEnterNames_; } } @@ -886,6 +1154,7 @@ public string PivotForBodyName { /// Values and external values in control flow context. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.ValuesDef ValuesDef { get { return valuesDef_; } set { @@ -900,6 +1169,7 @@ public string PivotForBodyName { /// Optional name of the maximum_iterations tensor. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string MaximumIterationsName { get { return maximumIterationsName_; } set { @@ -916,16 +1186,19 @@ public string MaximumIterationsName { /// Contexts contained inside this context (e.g. nested whiles). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField NestedContexts { get { return nestedContexts_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as WhileContextDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(WhileContextDef other) { if (ReferenceEquals(other, null)) { return false; @@ -949,6 +1222,7 @@ public bool Equals(WhileContextDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (ContextName.Length != 0) hash ^= ContextName.GetHashCode(); @@ -970,12 +1244,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (ContextName.Length != 0) { output.WriteRawTag(10); output.WriteString(ContextName); @@ -1018,9 +1297,60 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ContextName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ContextName); + } + if (ParallelIterations != 0) { + output.WriteRawTag(16); + output.WriteInt32(ParallelIterations); + } + if (BackProp != false) { + output.WriteRawTag(24); + output.WriteBool(BackProp); + } + if (SwapMemory != false) { + output.WriteRawTag(32); + output.WriteBool(SwapMemory); + } + if (PivotName.Length != 0) { + output.WriteRawTag(42); + output.WriteString(PivotName); + } + if (PivotForPredName.Length != 0) { + output.WriteRawTag(50); + output.WriteString(PivotForPredName); + } + if (PivotForBodyName.Length != 0) { + output.WriteRawTag(58); + output.WriteString(PivotForBodyName); + } + loopExitNames_.WriteTo(ref output, _repeated_loopExitNames_codec); + if (valuesDef_ != null) { + output.WriteRawTag(74); + output.WriteMessage(ValuesDef); + } + loopEnterNames_.WriteTo(ref output, _repeated_loopEnterNames_codec); + if (MaximumIterationsName.Length != 0) { + output.WriteRawTag(90); + output.WriteString(MaximumIterationsName); + } + nestedContexts_.WriteTo(ref output, _repeated_nestedContexts_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (ContextName.Length != 0) { @@ -1060,6 +1390,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(WhileContextDef other) { if (other == null) { return; @@ -1101,7 +1432,11 @@ public void MergeFrom(WhileContextDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1161,7 +1496,74 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + ContextName = input.ReadString(); + break; + } + case 16: { + ParallelIterations = input.ReadInt32(); + break; + } + case 24: { + BackProp = input.ReadBool(); + break; + } + case 32: { + SwapMemory = input.ReadBool(); + break; + } + case 42: { + PivotName = input.ReadString(); + break; + } + case 50: { + PivotForPredName = input.ReadString(); + break; + } + case 58: { + PivotForBodyName = input.ReadString(); + break; + } + case 66: { + loopExitNames_.AddEntriesFrom(ref input, _repeated_loopExitNames_codec); + break; + } + case 74: { + if (valuesDef_ == null) { + ValuesDef = new global::Tensorflow.ValuesDef(); + } + input.ReadMessage(ValuesDef); + break; + } + case 82: { + loopEnterNames_.AddEntriesFrom(ref input, _repeated_loopEnterNames_codec); + break; + } + case 90: { + MaximumIterationsName = input.ReadString(); + break; + } + case 98: { + nestedContexts_.AddEntriesFrom(ref input, _repeated_nestedContexts_codec); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/CoordinationConfig.cs b/src/TensorFlowNET.Core/Protobuf/CoordinationConfig.cs new file mode 100644 index 000000000..c949067cd --- /dev/null +++ b/src/TensorFlowNET.Core/Protobuf/CoordinationConfig.cs @@ -0,0 +1,791 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tensorflow/core/protobuf/coordination_config.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tensorflow { + + /// Holder for reflection information generated from tensorflow/core/protobuf/coordination_config.proto + public static partial class CoordinationConfigReflection { + + #region Descriptor + /// File descriptor for tensorflow/core/protobuf/coordination_config.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static CoordinationConfigReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CjJ0ZW5zb3JmbG93L2NvcmUvcHJvdG9idWYvY29vcmRpbmF0aW9uX2NvbmZp", + "Zy5wcm90bxIKdGVuc29yZmxvdyIxCg5Db29yZGluYXRlZEpvYhIMCgRuYW1l", + "GAEgASgJEhEKCW51bV90YXNrcxgCIAEoBSLdAgoZQ29vcmRpbmF0aW9uU2Vy", + "dmljZUNvbmZpZxIUCgxzZXJ2aWNlX3R5cGUYASABKAkSFgoOc2VydmljZV9s", + "ZWFkZXIYAiABKAkSGwoTZW5hYmxlX2hlYWx0aF9jaGVjaxgDIAEoCBImCh5j", + "bHVzdGVyX3JlZ2lzdGVyX3RpbWVvdXRfaW5fbXMYBCABKAMSHwoXaGVhcnRi", + "ZWF0X3RpbWVvdXRfaW5fbXMYBSABKAMSOAoUY29vcmRpbmF0ZWRfam9iX2xp", + "c3QYCiADKAsyGi50ZW5zb3JmbG93LkNvb3JkaW5hdGVkSm9iEiYKHnNodXRk", + "b3duX2JhcnJpZXJfdGltZW91dF9pbl9tcxgHIAEoAxIqCiJhZ2VudF9kZXN0", + "cnVjdGlvbl93aXRob3V0X3NodXRkb3duGAggASgIEhgKEHJlY292ZXJhYmxl", + "X2pvYnMYCSADKAlKBAgGEAdCV1pVZ2l0aHViLmNvbS90ZW5zb3JmbG93L3Rl", + "bnNvcmZsb3cvdGVuc29yZmxvdy9nby9jb3JlL3Byb3RvYnVmL2Zvcl9jb3Jl", + "X3Byb3Rvc19nb19wcm90b2IGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.CoordinatedJob), global::Tensorflow.CoordinatedJob.Parser, new[]{ "Name", "NumTasks" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.CoordinationServiceConfig), global::Tensorflow.CoordinationServiceConfig.Parser, new[]{ "ServiceType", "ServiceLeader", "EnableHealthCheck", "ClusterRegisterTimeoutInMs", "HeartbeatTimeoutInMs", "CoordinatedJobList", "ShutdownBarrierTimeoutInMs", "AgentDestructionWithoutShutdown", "RecoverableJobs" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + /// + /// Represents a job type and the number of tasks under this job. + /// For example, ("worker", 20) implies that there will be 20 worker tasks. + /// + public sealed partial class CoordinatedJob : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CoordinatedJob()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationConfigReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CoordinatedJob() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CoordinatedJob(CoordinatedJob other) : this() { + name_ = other.name_; + numTasks_ = other.numTasks_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CoordinatedJob Clone() { + return new CoordinatedJob(this); + } + + /// Field number for the "name" field. + public const int NameFieldNumber = 1; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "num_tasks" field. + public const int NumTasksFieldNumber = 2; + private int numTasks_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int NumTasks { + get { return numTasks_; } + set { + numTasks_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as CoordinatedJob); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(CoordinatedJob other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + if (NumTasks != other.NumTasks) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (NumTasks != 0) hash ^= NumTasks.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (NumTasks != 0) { + output.WriteRawTag(16); + output.WriteInt32(NumTasks); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (NumTasks != 0) { + output.WriteRawTag(16); + output.WriteInt32(NumTasks); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (NumTasks != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(NumTasks); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(CoordinatedJob other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + if (other.NumTasks != 0) { + NumTasks = other.NumTasks; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 16: { + NumTasks = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 16: { + NumTasks = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + /// + /// Coordination service configuration parameters. + /// The system picks appropriate values for fields that are not set. + /// + public sealed partial class CoordinationServiceConfig : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CoordinationServiceConfig()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationConfigReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CoordinationServiceConfig() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CoordinationServiceConfig(CoordinationServiceConfig other) : this() { + serviceType_ = other.serviceType_; + serviceLeader_ = other.serviceLeader_; + enableHealthCheck_ = other.enableHealthCheck_; + clusterRegisterTimeoutInMs_ = other.clusterRegisterTimeoutInMs_; + heartbeatTimeoutInMs_ = other.heartbeatTimeoutInMs_; + coordinatedJobList_ = other.coordinatedJobList_.Clone(); + shutdownBarrierTimeoutInMs_ = other.shutdownBarrierTimeoutInMs_; + agentDestructionWithoutShutdown_ = other.agentDestructionWithoutShutdown_; + recoverableJobs_ = other.recoverableJobs_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CoordinationServiceConfig Clone() { + return new CoordinationServiceConfig(this); + } + + /// Field number for the "service_type" field. + public const int ServiceTypeFieldNumber = 1; + private string serviceType_ = ""; + /// + /// Type of coordination service implementation to enable. + /// For example, setting the service type as "standalone" starts a service + /// instance on the leader task to provide the coordination services such as + /// heartbeats and consistent key-value store. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string ServiceType { + get { return serviceType_; } + set { + serviceType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "service_leader" field. + public const int ServiceLeaderFieldNumber = 2; + private string serviceLeader_ = ""; + /// + /// Address where the coordination service instance is hosted. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string ServiceLeader { + get { return serviceLeader_; } + set { + serviceLeader_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "enable_health_check" field. + public const int EnableHealthCheckFieldNumber = 3; + private bool enableHealthCheck_; + /// + /// Whether to enable the health check mechanism. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool EnableHealthCheck { + get { return enableHealthCheck_; } + set { + enableHealthCheck_ = value; + } + } + + /// Field number for the "cluster_register_timeout_in_ms" field. + public const int ClusterRegisterTimeoutInMsFieldNumber = 4; + private long clusterRegisterTimeoutInMs_; + /// + /// Maximum wait time for all members in the cluster to be registered. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long ClusterRegisterTimeoutInMs { + get { return clusterRegisterTimeoutInMs_; } + set { + clusterRegisterTimeoutInMs_ = value; + } + } + + /// Field number for the "heartbeat_timeout_in_ms" field. + public const int HeartbeatTimeoutInMsFieldNumber = 5; + private long heartbeatTimeoutInMs_; + /// + /// Heartbeat timeout, if a task does not record heartbeat in this time + /// window, it will be considered disconnected. + /// Note: This is also used as a grace period to accept any heartbeats after + /// the agent has disconnected, to account for the lag time between the service + /// recording the state change and the agent stopping heartbeats. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long HeartbeatTimeoutInMs { + get { return heartbeatTimeoutInMs_; } + set { + heartbeatTimeoutInMs_ = value; + } + } + + /// Field number for the "coordinated_job_list" field. + public const int CoordinatedJobListFieldNumber = 10; + private static readonly pb::FieldCodec _repeated_coordinatedJobList_codec + = pb::FieldCodec.ForMessage(82, global::Tensorflow.CoordinatedJob.Parser); + private readonly pbc::RepeatedField coordinatedJobList_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField CoordinatedJobList { + get { return coordinatedJobList_; } + } + + /// Field number for the "shutdown_barrier_timeout_in_ms" field. + public const int ShutdownBarrierTimeoutInMsFieldNumber = 7; + private long shutdownBarrierTimeoutInMs_; + /// + /// Denotes how long to wait for all coordination agents to reach the barriers + /// (after the first shutdown request) before disconnecting together. If + /// set to 0, no barrier is imposed upon shutdown and each worker can + /// disconnect individually. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long ShutdownBarrierTimeoutInMs { + get { return shutdownBarrierTimeoutInMs_; } + set { + shutdownBarrierTimeoutInMs_ = value; + } + } + + /// Field number for the "agent_destruction_without_shutdown" field. + public const int AgentDestructionWithoutShutdownFieldNumber = 8; + private bool agentDestructionWithoutShutdown_; + /// + /// If set, agents do not make an explicit Shutdown() call. Service will only + /// find out about the disconnecte agent via stale heartbeats. Used for + /// testing. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool AgentDestructionWithoutShutdown { + get { return agentDestructionWithoutShutdown_; } + set { + agentDestructionWithoutShutdown_ = value; + } + } + + /// Field number for the "recoverable_jobs" field. + public const int RecoverableJobsFieldNumber = 9; + private static readonly pb::FieldCodec _repeated_recoverableJobs_codec + = pb::FieldCodec.ForString(74); + private readonly pbc::RepeatedField recoverableJobs_ = new pbc::RepeatedField(); + /// + /// The list of jobs which are recoverable. If a task in this list fails, + /// it will not propagate error to other tasks. + /// If empty, no jobs will be recoverable and every task failure will cause + /// error propagation to other tasks. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField RecoverableJobs { + get { return recoverableJobs_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as CoordinationServiceConfig); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(CoordinationServiceConfig other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ServiceType != other.ServiceType) return false; + if (ServiceLeader != other.ServiceLeader) return false; + if (EnableHealthCheck != other.EnableHealthCheck) return false; + if (ClusterRegisterTimeoutInMs != other.ClusterRegisterTimeoutInMs) return false; + if (HeartbeatTimeoutInMs != other.HeartbeatTimeoutInMs) return false; + if(!coordinatedJobList_.Equals(other.coordinatedJobList_)) return false; + if (ShutdownBarrierTimeoutInMs != other.ShutdownBarrierTimeoutInMs) return false; + if (AgentDestructionWithoutShutdown != other.AgentDestructionWithoutShutdown) return false; + if(!recoverableJobs_.Equals(other.recoverableJobs_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (ServiceType.Length != 0) hash ^= ServiceType.GetHashCode(); + if (ServiceLeader.Length != 0) hash ^= ServiceLeader.GetHashCode(); + if (EnableHealthCheck != false) hash ^= EnableHealthCheck.GetHashCode(); + if (ClusterRegisterTimeoutInMs != 0L) hash ^= ClusterRegisterTimeoutInMs.GetHashCode(); + if (HeartbeatTimeoutInMs != 0L) hash ^= HeartbeatTimeoutInMs.GetHashCode(); + hash ^= coordinatedJobList_.GetHashCode(); + if (ShutdownBarrierTimeoutInMs != 0L) hash ^= ShutdownBarrierTimeoutInMs.GetHashCode(); + if (AgentDestructionWithoutShutdown != false) hash ^= AgentDestructionWithoutShutdown.GetHashCode(); + hash ^= recoverableJobs_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ServiceType.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ServiceType); + } + if (ServiceLeader.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ServiceLeader); + } + if (EnableHealthCheck != false) { + output.WriteRawTag(24); + output.WriteBool(EnableHealthCheck); + } + if (ClusterRegisterTimeoutInMs != 0L) { + output.WriteRawTag(32); + output.WriteInt64(ClusterRegisterTimeoutInMs); + } + if (HeartbeatTimeoutInMs != 0L) { + output.WriteRawTag(40); + output.WriteInt64(HeartbeatTimeoutInMs); + } + if (ShutdownBarrierTimeoutInMs != 0L) { + output.WriteRawTag(56); + output.WriteInt64(ShutdownBarrierTimeoutInMs); + } + if (AgentDestructionWithoutShutdown != false) { + output.WriteRawTag(64); + output.WriteBool(AgentDestructionWithoutShutdown); + } + recoverableJobs_.WriteTo(output, _repeated_recoverableJobs_codec); + coordinatedJobList_.WriteTo(output, _repeated_coordinatedJobList_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ServiceType.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ServiceType); + } + if (ServiceLeader.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ServiceLeader); + } + if (EnableHealthCheck != false) { + output.WriteRawTag(24); + output.WriteBool(EnableHealthCheck); + } + if (ClusterRegisterTimeoutInMs != 0L) { + output.WriteRawTag(32); + output.WriteInt64(ClusterRegisterTimeoutInMs); + } + if (HeartbeatTimeoutInMs != 0L) { + output.WriteRawTag(40); + output.WriteInt64(HeartbeatTimeoutInMs); + } + if (ShutdownBarrierTimeoutInMs != 0L) { + output.WriteRawTag(56); + output.WriteInt64(ShutdownBarrierTimeoutInMs); + } + if (AgentDestructionWithoutShutdown != false) { + output.WriteRawTag(64); + output.WriteBool(AgentDestructionWithoutShutdown); + } + recoverableJobs_.WriteTo(ref output, _repeated_recoverableJobs_codec); + coordinatedJobList_.WriteTo(ref output, _repeated_coordinatedJobList_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (ServiceType.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ServiceType); + } + if (ServiceLeader.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ServiceLeader); + } + if (EnableHealthCheck != false) { + size += 1 + 1; + } + if (ClusterRegisterTimeoutInMs != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(ClusterRegisterTimeoutInMs); + } + if (HeartbeatTimeoutInMs != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(HeartbeatTimeoutInMs); + } + size += coordinatedJobList_.CalculateSize(_repeated_coordinatedJobList_codec); + if (ShutdownBarrierTimeoutInMs != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(ShutdownBarrierTimeoutInMs); + } + if (AgentDestructionWithoutShutdown != false) { + size += 1 + 1; + } + size += recoverableJobs_.CalculateSize(_repeated_recoverableJobs_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(CoordinationServiceConfig other) { + if (other == null) { + return; + } + if (other.ServiceType.Length != 0) { + ServiceType = other.ServiceType; + } + if (other.ServiceLeader.Length != 0) { + ServiceLeader = other.ServiceLeader; + } + if (other.EnableHealthCheck != false) { + EnableHealthCheck = other.EnableHealthCheck; + } + if (other.ClusterRegisterTimeoutInMs != 0L) { + ClusterRegisterTimeoutInMs = other.ClusterRegisterTimeoutInMs; + } + if (other.HeartbeatTimeoutInMs != 0L) { + HeartbeatTimeoutInMs = other.HeartbeatTimeoutInMs; + } + coordinatedJobList_.Add(other.coordinatedJobList_); + if (other.ShutdownBarrierTimeoutInMs != 0L) { + ShutdownBarrierTimeoutInMs = other.ShutdownBarrierTimeoutInMs; + } + if (other.AgentDestructionWithoutShutdown != false) { + AgentDestructionWithoutShutdown = other.AgentDestructionWithoutShutdown; + } + recoverableJobs_.Add(other.recoverableJobs_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + ServiceType = input.ReadString(); + break; + } + case 18: { + ServiceLeader = input.ReadString(); + break; + } + case 24: { + EnableHealthCheck = input.ReadBool(); + break; + } + case 32: { + ClusterRegisterTimeoutInMs = input.ReadInt64(); + break; + } + case 40: { + HeartbeatTimeoutInMs = input.ReadInt64(); + break; + } + case 56: { + ShutdownBarrierTimeoutInMs = input.ReadInt64(); + break; + } + case 64: { + AgentDestructionWithoutShutdown = input.ReadBool(); + break; + } + case 74: { + recoverableJobs_.AddEntriesFrom(input, _repeated_recoverableJobs_codec); + break; + } + case 82: { + coordinatedJobList_.AddEntriesFrom(input, _repeated_coordinatedJobList_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + ServiceType = input.ReadString(); + break; + } + case 18: { + ServiceLeader = input.ReadString(); + break; + } + case 24: { + EnableHealthCheck = input.ReadBool(); + break; + } + case 32: { + ClusterRegisterTimeoutInMs = input.ReadInt64(); + break; + } + case 40: { + HeartbeatTimeoutInMs = input.ReadInt64(); + break; + } + case 56: { + ShutdownBarrierTimeoutInMs = input.ReadInt64(); + break; + } + case 64: { + AgentDestructionWithoutShutdown = input.ReadBool(); + break; + } + case 74: { + recoverableJobs_.AddEntriesFrom(ref input, _repeated_recoverableJobs_codec); + break; + } + case 82: { + coordinatedJobList_.AddEntriesFrom(ref input, _repeated_coordinatedJobList_codec); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/TensorFlowNET.Core/Protobuf/CoordinationService.cs b/src/TensorFlowNET.Core/Protobuf/CoordinationService.cs new file mode 100644 index 000000000..a974d724d --- /dev/null +++ b/src/TensorFlowNET.Core/Protobuf/CoordinationService.cs @@ -0,0 +1,7964 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tensorflow/core/protobuf/coordination_service.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tensorflow { + + /// Holder for reflection information generated from tensorflow/core/protobuf/coordination_service.proto + public static partial class CoordinationServiceReflection { + + #region Descriptor + /// File descriptor for tensorflow/core/protobuf/coordination_service.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static CoordinationServiceReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CjN0ZW5zb3JmbG93L2NvcmUvcHJvdG9idWYvY29vcmRpbmF0aW9uX3NlcnZp", + "Y2UucHJvdG8SCnRlbnNvcmZsb3caN3RlbnNvcmZsb3cvY29tcGlsZXIveGxh", + "L3BqcnQvZGlzdHJpYnV0ZWQvcHJvdG9jb2wucHJvdG8aMXRlbnNvcmZsb3cv", + "Y29yZS9mcmFtZXdvcmsvZGV2aWNlX2F0dHJpYnV0ZXMucHJvdG8iNAoPQ29v", + "cmRpbmF0ZWRUYXNrEhAKCGpvYl9uYW1lGAEgASgJEg8KB3Rhc2tfaWQYAiAB", + "KAUicwoYQ29vcmRpbmF0aW9uU2VydmljZUVycm9yEhkKEWlzX3JlcG9ydGVk", + "X2Vycm9yGAMgASgIEjAKC3NvdXJjZV90YXNrGAQgASgLMhsudGVuc29yZmxv", + "dy5Db29yZGluYXRlZFRhc2tKBAgBEAJKBAgCEAMi3gEKGENvb3JkaW5hdGVk", + "VGFza1N0YXRlSW5mbxIpCgR0YXNrGAEgASgLMhsudGVuc29yZmxvdy5Db29y", + "ZGluYXRlZFRhc2sSLwoFc3RhdGUYAiABKA4yIC50ZW5zb3JmbG93LkNvb3Jk", + "aW5hdGVkVGFza1N0YXRlEhIKCmVycm9yX2NvZGUYAyABKAUSFQoNZXJyb3Jf", + "bWVzc2FnZRgEIAEoCRI7Cg1lcnJvcl9wYXlsb2FkGAUgASgLMiQudGVuc29y", + "Zmxvdy5Db29yZGluYXRpb25TZXJ2aWNlRXJyb3IiPQoMVGZEZXZpY2VMaXN0", + "Ei0KB2RldmljZXMYASADKAsyHC50ZW5zb3JmbG93LkRldmljZUF0dHJpYnV0", + "ZXMiOgoNWGxhRGV2aWNlTGlzdBIpCgdkZXZpY2VzGAEgASgLMhgueGxhLkds", + "b2JhbFRvcG9sb2d5UHJvdG8ieQodQ29vcmRpbmF0aW9uU2VydmljZURldmlj", + "ZUluZm8SJgoCdGYYASABKAsyGC50ZW5zb3JmbG93LlRmRGV2aWNlTGlzdEgA", + "EigKA3hsYRgCIAEoCzIZLnRlbnNvcmZsb3cuWGxhRGV2aWNlTGlzdEgAQgYK", + "BHR5cGUibgoTUmVnaXN0ZXJUYXNrUmVxdWVzdBITCgtpbmNhcm5hdGlvbhgD", + "IAEoBhIwCgtzb3VyY2VfdGFzaxgFIAEoCzIbLnRlbnNvcmZsb3cuQ29vcmRp", + "bmF0ZWRUYXNrSgQIARACSgQIAhADSgQIBBAFIjIKFFJlZ2lzdGVyVGFza1Jl", + "c3BvbnNlEhoKEmxlYWRlcl9pbmNhcm5hdGlvbhgBIAEoBiJlChBIZWFydGJl", + "YXRSZXF1ZXN0EhMKC2luY2FybmF0aW9uGAMgASgGEjAKC3NvdXJjZV90YXNr", + "GAQgASgLMhsudGVuc29yZmxvdy5Db29yZGluYXRlZFRhc2tKBAgBEAJKBAgC", + "EAMiLwoRSGVhcnRiZWF0UmVzcG9uc2USGgoSbGVhZGVyX2luY2FybmF0aW9u", + "GAEgASgGIqIBChZXYWl0Rm9yQWxsVGFza3NSZXF1ZXN0EkQKEWxvY2FsX2Rl", + "dmljZV9pbmZvGAQgASgLMikudGVuc29yZmxvdy5Db29yZGluYXRpb25TZXJ2", + "aWNlRGV2aWNlSW5mbxIwCgtzb3VyY2VfdGFzaxgFIAEoCzIbLnRlbnNvcmZs", + "b3cuQ29vcmRpbmF0ZWRUYXNrSgQIARACSgQIAhADSgQIAxAEIoMBChdXYWl0", + "Rm9yQWxsVGFza3NSZXNwb25zZRIaChJsZWFkZXJfaW5jYXJuYXRpb24YASAB", + "KAYSRgoTY2x1c3Rlcl9kZXZpY2VfaW5mbxgDIAEoCzIpLnRlbnNvcmZsb3cu", + "Q29vcmRpbmF0aW9uU2VydmljZURldmljZUluZm9KBAgCEAMiRwoTU2h1dGRv", + "d25UYXNrUmVxdWVzdBIwCgtzb3VyY2VfdGFzaxgBIAEoCzIbLnRlbnNvcmZs", + "b3cuQ29vcmRpbmF0ZWRUYXNrIhYKFFNodXRkb3duVGFza1Jlc3BvbnNlIkQK", + "EFJlc2V0VGFza1JlcXVlc3QSMAoLc291cmNlX3Rhc2sYASABKAsyGy50ZW5z", + "b3JmbG93LkNvb3JkaW5hdGVkVGFzayITChFSZXNldFRhc2tSZXNwb25zZSKO", + "AQoYUmVwb3J0RXJyb3JUb1Rhc2tSZXF1ZXN0EhIKCmVycm9yX2NvZGUYASAB", + "KAUSFQoNZXJyb3JfbWVzc2FnZRgCIAEoCRI7Cg1lcnJvcl9wYXlsb2FkGAUg", + "ASgLMiQudGVuc29yZmxvdy5Db29yZGluYXRpb25TZXJ2aWNlRXJyb3JKBAgD", + "EARKBAgEEAUiGwoZUmVwb3J0RXJyb3JUb1Rhc2tSZXNwb25zZSKHAQobUmVw", + "b3J0RXJyb3JUb1NlcnZpY2VSZXF1ZXN0EhIKCmVycm9yX2NvZGUYASABKAUS", + "FQoNZXJyb3JfbWVzc2FnZRgCIAEoCRIxCgxlcnJvcl9vcmlnaW4YBSABKAsy", + "Gy50ZW5zb3JmbG93LkNvb3JkaW5hdGVkVGFza0oECAMQBEoECAQQBSIeChxS", + "ZXBvcnRFcnJvclRvU2VydmljZVJlc3BvbnNlIkcKE0dldFRhc2tTdGF0ZVJl", + "cXVlc3QSMAoLc291cmNlX3Rhc2sYASADKAsyGy50ZW5zb3JmbG93LkNvb3Jk", + "aW5hdGVkVGFzayJQChRHZXRUYXNrU3RhdGVSZXNwb25zZRI4Cgp0YXNrX3N0", + "YXRlGAEgAygLMiQudGVuc29yZmxvdy5Db29yZGluYXRlZFRhc2tTdGF0ZUlu", + "Zm8iKwoNS2V5VmFsdWVFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiAB", + "KAwiPgoVSW5zZXJ0S2V5VmFsdWVSZXF1ZXN0EiUKAmt2GAEgASgLMhkudGVu", + "c29yZmxvdy5LZXlWYWx1ZUVudHJ5IhgKFkluc2VydEtleVZhbHVlUmVzcG9u", + "c2UiIQoSR2V0S2V5VmFsdWVSZXF1ZXN0EgsKA2tleRgBIAEoCSI8ChNHZXRL", + "ZXlWYWx1ZVJlc3BvbnNlEiUKAmt2GAEgASgLMhkudGVuc29yZmxvdy5LZXlW", + "YWx1ZUVudHJ5IiQKFVRyeUdldEtleVZhbHVlUmVxdWVzdBILCgNrZXkYASAB", + "KAkiPwoWVHJ5R2V0S2V5VmFsdWVSZXNwb25zZRIlCgJrdhgBIAEoCzIZLnRl", + "bnNvcmZsb3cuS2V5VmFsdWVFbnRyeSIuChVHZXRLZXlWYWx1ZURpclJlcXVl", + "c3QSFQoNZGlyZWN0b3J5X2tleRgBIAEoCSJWChZHZXRLZXlWYWx1ZURpclJl", + "c3BvbnNlEhUKDWRpcmVjdG9yeV9rZXkYASABKAkSJQoCa3YYAiADKAsyGS50", + "ZW5zb3JmbG93LktleVZhbHVlRW50cnkiOgoVRGVsZXRlS2V5VmFsdWVSZXF1", + "ZXN0EgsKA2tleRgBIAEoCRIUCgxpc19kaXJlY3RvcnkYAiABKAgiGAoWRGVs", + "ZXRlS2V5VmFsdWVSZXNwb25zZSKhAQoOQmFycmllclJlcXVlc3QSEgoKYmFy", + "cmllcl9pZBgBIAEoCRIdChViYXJyaWVyX3RpbWVvdXRfaW5fbXMYAiABKAMS", + "KgoFdGFza3MYAyADKAsyGy50ZW5zb3JmbG93LkNvb3JkaW5hdGVkVGFzaxIw", + "Cgtzb3VyY2VfdGFzaxgEIAEoCzIbLnRlbnNvcmZsb3cuQ29vcmRpbmF0ZWRU", + "YXNrIhEKD0JhcnJpZXJSZXNwb25zZSJcChRDYW5jZWxCYXJyaWVyUmVxdWVz", + "dBISCgpiYXJyaWVyX2lkGAEgASgJEjAKC3NvdXJjZV90YXNrGAIgASgLMhsu", + "dGVuc29yZmxvdy5Db29yZGluYXRlZFRhc2siFwoVQ2FuY2VsQmFycmllclJl", + "c3BvbnNlKpgBChRDb29yZGluYXRlZFRhc2tTdGF0ZRIZChVUQVNLU1RBVEVf", + "VU5TUEVDSUZJRUQQABIbChdUQVNLU1RBVEVfVU5JTklUSUFMSVpFRBABEhoK", + "FlRBU0tTVEFURV9ESVNDT05ORUNURUQQAhIXChNUQVNLU1RBVEVfQ09OTkVD", + "VEVEEAMSEwoPVEFTS1NUQVRFX0VSUk9SEAQymQoKE0Nvb3JkaW5hdGlvblNl", + "cnZpY2USUQoMUmVnaXN0ZXJUYXNrEh8udGVuc29yZmxvdy5SZWdpc3RlclRh", + "c2tSZXF1ZXN0GiAudGVuc29yZmxvdy5SZWdpc3RlclRhc2tSZXNwb25zZRJI", + "CglIZWFydGJlYXQSHC50ZW5zb3JmbG93LkhlYXJ0YmVhdFJlcXVlc3QaHS50", + "ZW5zb3JmbG93LkhlYXJ0YmVhdFJlc3BvbnNlEloKD1dhaXRGb3JBbGxUYXNr", + "cxIiLnRlbnNvcmZsb3cuV2FpdEZvckFsbFRhc2tzUmVxdWVzdBojLnRlbnNv", + "cmZsb3cuV2FpdEZvckFsbFRhc2tzUmVzcG9uc2USUQoMU2h1dGRvd25UYXNr", + "Eh8udGVuc29yZmxvdy5TaHV0ZG93blRhc2tSZXF1ZXN0GiAudGVuc29yZmxv", + "dy5TaHV0ZG93blRhc2tSZXNwb25zZRJICglSZXNldFRhc2sSHC50ZW5zb3Jm", + "bG93LlJlc2V0VGFza1JlcXVlc3QaHS50ZW5zb3JmbG93LlJlc2V0VGFza1Jl", + "c3BvbnNlEmAKEVJlcG9ydEVycm9yVG9UYXNrEiQudGVuc29yZmxvdy5SZXBv", + "cnRFcnJvclRvVGFza1JlcXVlc3QaJS50ZW5zb3JmbG93LlJlcG9ydEVycm9y", + "VG9UYXNrUmVzcG9uc2USaQoUUmVwb3J0RXJyb3JUb1NlcnZpY2USJy50ZW5z", + "b3JmbG93LlJlcG9ydEVycm9yVG9TZXJ2aWNlUmVxdWVzdBooLnRlbnNvcmZs", + "b3cuUmVwb3J0RXJyb3JUb1NlcnZpY2VSZXNwb25zZRJRCgxHZXRUYXNrU3Rh", + "dGUSHy50ZW5zb3JmbG93LkdldFRhc2tTdGF0ZVJlcXVlc3QaIC50ZW5zb3Jm", + "bG93LkdldFRhc2tTdGF0ZVJlc3BvbnNlElcKDkluc2VydEtleVZhbHVlEiEu", + "dGVuc29yZmxvdy5JbnNlcnRLZXlWYWx1ZVJlcXVlc3QaIi50ZW5zb3JmbG93", + "Lkluc2VydEtleVZhbHVlUmVzcG9uc2USTgoLR2V0S2V5VmFsdWUSHi50ZW5z", + "b3JmbG93LkdldEtleVZhbHVlUmVxdWVzdBofLnRlbnNvcmZsb3cuR2V0S2V5", + "VmFsdWVSZXNwb25zZRJXCg5UcnlHZXRLZXlWYWx1ZRIhLnRlbnNvcmZsb3cu", + "VHJ5R2V0S2V5VmFsdWVSZXF1ZXN0GiIudGVuc29yZmxvdy5UcnlHZXRLZXlW", + "YWx1ZVJlc3BvbnNlElcKDkdldEtleVZhbHVlRGlyEiEudGVuc29yZmxvdy5H", + "ZXRLZXlWYWx1ZURpclJlcXVlc3QaIi50ZW5zb3JmbG93LkdldEtleVZhbHVl", + "RGlyUmVzcG9uc2USVwoORGVsZXRlS2V5VmFsdWUSIS50ZW5zb3JmbG93LkRl", + "bGV0ZUtleVZhbHVlUmVxdWVzdBoiLnRlbnNvcmZsb3cuRGVsZXRlS2V5VmFs", + "dWVSZXNwb25zZRJCCgdCYXJyaWVyEhoudGVuc29yZmxvdy5CYXJyaWVyUmVx", + "dWVzdBobLnRlbnNvcmZsb3cuQmFycmllclJlc3BvbnNlElQKDUNhbmNlbEJh", + "cnJpZXISIC50ZW5zb3JmbG93LkNhbmNlbEJhcnJpZXJSZXF1ZXN0GiEudGVu", + "c29yZmxvdy5DYW5jZWxCYXJyaWVyUmVzcG9uc2VCV1pVZ2l0aHViLmNvbS90", + "ZW5zb3JmbG93L3RlbnNvcmZsb3cvdGVuc29yZmxvdy9nby9jb3JlL3Byb3Rv", + "YnVmL2Zvcl9jb3JlX3Byb3Rvc19nb19wcm90b2IGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Xla.ProtocolReflection.Descriptor, global::Tensorflow.DeviceAttributesReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tensorflow.CoordinatedTaskState), }, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.CoordinatedTask), global::Tensorflow.CoordinatedTask.Parser, new[]{ "JobName", "TaskId" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.CoordinationServiceError), global::Tensorflow.CoordinationServiceError.Parser, new[]{ "IsReportedError", "SourceTask" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.CoordinatedTaskStateInfo), global::Tensorflow.CoordinatedTaskStateInfo.Parser, new[]{ "Task", "State", "ErrorCode", "ErrorMessage", "ErrorPayload" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.TfDeviceList), global::Tensorflow.TfDeviceList.Parser, new[]{ "Devices" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.XlaDeviceList), global::Tensorflow.XlaDeviceList.Parser, new[]{ "Devices" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.CoordinationServiceDeviceInfo), global::Tensorflow.CoordinationServiceDeviceInfo.Parser, new[]{ "Tf", "Xla" }, new[]{ "Type" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.RegisterTaskRequest), global::Tensorflow.RegisterTaskRequest.Parser, new[]{ "Incarnation", "SourceTask" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.RegisterTaskResponse), global::Tensorflow.RegisterTaskResponse.Parser, new[]{ "LeaderIncarnation" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.HeartbeatRequest), global::Tensorflow.HeartbeatRequest.Parser, new[]{ "Incarnation", "SourceTask" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.HeartbeatResponse), global::Tensorflow.HeartbeatResponse.Parser, new[]{ "LeaderIncarnation" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.WaitForAllTasksRequest), global::Tensorflow.WaitForAllTasksRequest.Parser, new[]{ "LocalDeviceInfo", "SourceTask" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.WaitForAllTasksResponse), global::Tensorflow.WaitForAllTasksResponse.Parser, new[]{ "LeaderIncarnation", "ClusterDeviceInfo" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.ShutdownTaskRequest), global::Tensorflow.ShutdownTaskRequest.Parser, new[]{ "SourceTask" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.ShutdownTaskResponse), global::Tensorflow.ShutdownTaskResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.ResetTaskRequest), global::Tensorflow.ResetTaskRequest.Parser, new[]{ "SourceTask" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.ResetTaskResponse), global::Tensorflow.ResetTaskResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.ReportErrorToTaskRequest), global::Tensorflow.ReportErrorToTaskRequest.Parser, new[]{ "ErrorCode", "ErrorMessage", "ErrorPayload" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.ReportErrorToTaskResponse), global::Tensorflow.ReportErrorToTaskResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.ReportErrorToServiceRequest), global::Tensorflow.ReportErrorToServiceRequest.Parser, new[]{ "ErrorCode", "ErrorMessage", "ErrorOrigin" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.ReportErrorToServiceResponse), global::Tensorflow.ReportErrorToServiceResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.GetTaskStateRequest), global::Tensorflow.GetTaskStateRequest.Parser, new[]{ "SourceTask" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.GetTaskStateResponse), global::Tensorflow.GetTaskStateResponse.Parser, new[]{ "TaskState" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.KeyValueEntry), global::Tensorflow.KeyValueEntry.Parser, new[]{ "Key", "Value" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.InsertKeyValueRequest), global::Tensorflow.InsertKeyValueRequest.Parser, new[]{ "Kv" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.InsertKeyValueResponse), global::Tensorflow.InsertKeyValueResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.GetKeyValueRequest), global::Tensorflow.GetKeyValueRequest.Parser, new[]{ "Key" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.GetKeyValueResponse), global::Tensorflow.GetKeyValueResponse.Parser, new[]{ "Kv" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.TryGetKeyValueRequest), global::Tensorflow.TryGetKeyValueRequest.Parser, new[]{ "Key" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.TryGetKeyValueResponse), global::Tensorflow.TryGetKeyValueResponse.Parser, new[]{ "Kv" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.GetKeyValueDirRequest), global::Tensorflow.GetKeyValueDirRequest.Parser, new[]{ "DirectoryKey" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.GetKeyValueDirResponse), global::Tensorflow.GetKeyValueDirResponse.Parser, new[]{ "DirectoryKey", "Kv" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.DeleteKeyValueRequest), global::Tensorflow.DeleteKeyValueRequest.Parser, new[]{ "Key", "IsDirectory" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.DeleteKeyValueResponse), global::Tensorflow.DeleteKeyValueResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.BarrierRequest), global::Tensorflow.BarrierRequest.Parser, new[]{ "BarrierId", "BarrierTimeoutInMs", "Tasks", "SourceTask" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.BarrierResponse), global::Tensorflow.BarrierResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.CancelBarrierRequest), global::Tensorflow.CancelBarrierRequest.Parser, new[]{ "BarrierId", "SourceTask" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.CancelBarrierResponse), global::Tensorflow.CancelBarrierResponse.Parser, null, null, null, null, null) + })); + } + #endregion + + } + #region Enums + /// + /// Represents the state of a remote worker + /// + public enum CoordinatedTaskState { + /// + /// TASKSTATE_UNSPECIFIED is an invalid state such that indicates a bug. + /// + [pbr::OriginalName("TASKSTATE_UNSPECIFIED")] TaskstateUnspecified = 0, + /// + /// TASKSTATE_UNINITIALIZED is an agent-only state. While the agent is + /// disconnected, the service has no way of knowing if the task is + /// initialized/uninitialized. + /// + [pbr::OriginalName("TASKSTATE_UNINITIALIZED")] TaskstateUninitialized = 1, + [pbr::OriginalName("TASKSTATE_DISCONNECTED")] TaskstateDisconnected = 2, + [pbr::OriginalName("TASKSTATE_CONNECTED")] TaskstateConnected = 3, + [pbr::OriginalName("TASKSTATE_ERROR")] TaskstateError = 4, + } + + #endregion + + #region Messages + /// + /// Represents a remote worker task, specified by job name and task id. + /// + public sealed partial class CoordinatedTask : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CoordinatedTask()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CoordinatedTask() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CoordinatedTask(CoordinatedTask other) : this() { + jobName_ = other.jobName_; + taskId_ = other.taskId_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CoordinatedTask Clone() { + return new CoordinatedTask(this); + } + + /// Field number for the "job_name" field. + public const int JobNameFieldNumber = 1; + private string jobName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string JobName { + get { return jobName_; } + set { + jobName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "task_id" field. + public const int TaskIdFieldNumber = 2; + private int taskId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int TaskId { + get { return taskId_; } + set { + taskId_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as CoordinatedTask); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(CoordinatedTask other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (JobName != other.JobName) return false; + if (TaskId != other.TaskId) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (JobName.Length != 0) hash ^= JobName.GetHashCode(); + if (TaskId != 0) hash ^= TaskId.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (JobName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(JobName); + } + if (TaskId != 0) { + output.WriteRawTag(16); + output.WriteInt32(TaskId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (JobName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(JobName); + } + if (TaskId != 0) { + output.WriteRawTag(16); + output.WriteInt32(TaskId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (JobName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(JobName); + } + if (TaskId != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(TaskId); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(CoordinatedTask other) { + if (other == null) { + return; + } + if (other.JobName.Length != 0) { + JobName = other.JobName; + } + if (other.TaskId != 0) { + TaskId = other.TaskId; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + JobName = input.ReadString(); + break; + } + case 16: { + TaskId = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + JobName = input.ReadString(); + break; + } + case 16: { + TaskId = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + /// + /// Status payload for all coordination service errors. + /// Note: an empty proto may be set if the error is triggered by the task's own + /// agent calls (i.e. not propagated by the service from another remote task). + /// + public sealed partial class CoordinationServiceError : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CoordinationServiceError()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CoordinationServiceError() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CoordinationServiceError(CoordinationServiceError other) : this() { + isReportedError_ = other.isReportedError_; + sourceTask_ = other.sourceTask_ != null ? other.sourceTask_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CoordinationServiceError Clone() { + return new CoordinationServiceError(this); + } + + /// Field number for the "is_reported_error" field. + public const int IsReportedErrorFieldNumber = 3; + private bool isReportedError_; + /// + /// If true, error is reported via the agent API by the user (and not an + /// internal service error). + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool IsReportedError { + get { return isReportedError_; } + set { + isReportedError_ = value; + } + } + + /// Field number for the "source_task" field. + public const int SourceTaskFieldNumber = 4; + private global::Tensorflow.CoordinatedTask sourceTask_; + /// + /// Denotes which task hit the error. If unset, the error originated from the + /// same task that is processing this error. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.CoordinatedTask SourceTask { + get { return sourceTask_; } + set { + sourceTask_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as CoordinationServiceError); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(CoordinationServiceError other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (IsReportedError != other.IsReportedError) return false; + if (!object.Equals(SourceTask, other.SourceTask)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (IsReportedError != false) hash ^= IsReportedError.GetHashCode(); + if (sourceTask_ != null) hash ^= SourceTask.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (IsReportedError != false) { + output.WriteRawTag(24); + output.WriteBool(IsReportedError); + } + if (sourceTask_ != null) { + output.WriteRawTag(34); + output.WriteMessage(SourceTask); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (IsReportedError != false) { + output.WriteRawTag(24); + output.WriteBool(IsReportedError); + } + if (sourceTask_ != null) { + output.WriteRawTag(34); + output.WriteMessage(SourceTask); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (IsReportedError != false) { + size += 1 + 1; + } + if (sourceTask_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceTask); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(CoordinationServiceError other) { + if (other == null) { + return; + } + if (other.IsReportedError != false) { + IsReportedError = other.IsReportedError; + } + if (other.sourceTask_ != null) { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + SourceTask.MergeFrom(other.SourceTask); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 24: { + IsReportedError = input.ReadBool(); + break; + } + case 34: { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + input.ReadMessage(SourceTask); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 24: { + IsReportedError = input.ReadBool(); + break; + } + case 34: { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + input.ReadMessage(SourceTask); + break; + } + } + } + } + #endif + + } + + public sealed partial class CoordinatedTaskStateInfo : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CoordinatedTaskStateInfo()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CoordinatedTaskStateInfo() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CoordinatedTaskStateInfo(CoordinatedTaskStateInfo other) : this() { + task_ = other.task_ != null ? other.task_.Clone() : null; + state_ = other.state_; + errorCode_ = other.errorCode_; + errorMessage_ = other.errorMessage_; + errorPayload_ = other.errorPayload_ != null ? other.errorPayload_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CoordinatedTaskStateInfo Clone() { + return new CoordinatedTaskStateInfo(this); + } + + /// Field number for the "task" field. + public const int TaskFieldNumber = 1; + private global::Tensorflow.CoordinatedTask task_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.CoordinatedTask Task { + get { return task_; } + set { + task_ = value; + } + } + + /// Field number for the "state" field. + public const int StateFieldNumber = 2; + private global::Tensorflow.CoordinatedTaskState state_ = global::Tensorflow.CoordinatedTaskState.TaskstateUnspecified; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.CoordinatedTaskState State { + get { return state_; } + set { + state_ = value; + } + } + + /// Field number for the "error_code" field. + public const int ErrorCodeFieldNumber = 3; + private int errorCode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int ErrorCode { + get { return errorCode_; } + set { + errorCode_ = value; + } + } + + /// Field number for the "error_message" field. + public const int ErrorMessageFieldNumber = 4; + private string errorMessage_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string ErrorMessage { + get { return errorMessage_; } + set { + errorMessage_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "error_payload" field. + public const int ErrorPayloadFieldNumber = 5; + private global::Tensorflow.CoordinationServiceError errorPayload_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.CoordinationServiceError ErrorPayload { + get { return errorPayload_; } + set { + errorPayload_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as CoordinatedTaskStateInfo); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(CoordinatedTaskStateInfo other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Task, other.Task)) return false; + if (State != other.State) return false; + if (ErrorCode != other.ErrorCode) return false; + if (ErrorMessage != other.ErrorMessage) return false; + if (!object.Equals(ErrorPayload, other.ErrorPayload)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (task_ != null) hash ^= Task.GetHashCode(); + if (State != global::Tensorflow.CoordinatedTaskState.TaskstateUnspecified) hash ^= State.GetHashCode(); + if (ErrorCode != 0) hash ^= ErrorCode.GetHashCode(); + if (ErrorMessage.Length != 0) hash ^= ErrorMessage.GetHashCode(); + if (errorPayload_ != null) hash ^= ErrorPayload.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (task_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Task); + } + if (State != global::Tensorflow.CoordinatedTaskState.TaskstateUnspecified) { + output.WriteRawTag(16); + output.WriteEnum((int) State); + } + if (ErrorCode != 0) { + output.WriteRawTag(24); + output.WriteInt32(ErrorCode); + } + if (ErrorMessage.Length != 0) { + output.WriteRawTag(34); + output.WriteString(ErrorMessage); + } + if (errorPayload_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ErrorPayload); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (task_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Task); + } + if (State != global::Tensorflow.CoordinatedTaskState.TaskstateUnspecified) { + output.WriteRawTag(16); + output.WriteEnum((int) State); + } + if (ErrorCode != 0) { + output.WriteRawTag(24); + output.WriteInt32(ErrorCode); + } + if (ErrorMessage.Length != 0) { + output.WriteRawTag(34); + output.WriteString(ErrorMessage); + } + if (errorPayload_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ErrorPayload); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (task_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Task); + } + if (State != global::Tensorflow.CoordinatedTaskState.TaskstateUnspecified) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) State); + } + if (ErrorCode != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(ErrorCode); + } + if (ErrorMessage.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ErrorMessage); + } + if (errorPayload_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ErrorPayload); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(CoordinatedTaskStateInfo other) { + if (other == null) { + return; + } + if (other.task_ != null) { + if (task_ == null) { + Task = new global::Tensorflow.CoordinatedTask(); + } + Task.MergeFrom(other.Task); + } + if (other.State != global::Tensorflow.CoordinatedTaskState.TaskstateUnspecified) { + State = other.State; + } + if (other.ErrorCode != 0) { + ErrorCode = other.ErrorCode; + } + if (other.ErrorMessage.Length != 0) { + ErrorMessage = other.ErrorMessage; + } + if (other.errorPayload_ != null) { + if (errorPayload_ == null) { + ErrorPayload = new global::Tensorflow.CoordinationServiceError(); + } + ErrorPayload.MergeFrom(other.ErrorPayload); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (task_ == null) { + Task = new global::Tensorflow.CoordinatedTask(); + } + input.ReadMessage(Task); + break; + } + case 16: { + State = (global::Tensorflow.CoordinatedTaskState) input.ReadEnum(); + break; + } + case 24: { + ErrorCode = input.ReadInt32(); + break; + } + case 34: { + ErrorMessage = input.ReadString(); + break; + } + case 42: { + if (errorPayload_ == null) { + ErrorPayload = new global::Tensorflow.CoordinationServiceError(); + } + input.ReadMessage(ErrorPayload); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (task_ == null) { + Task = new global::Tensorflow.CoordinatedTask(); + } + input.ReadMessage(Task); + break; + } + case 16: { + State = (global::Tensorflow.CoordinatedTaskState) input.ReadEnum(); + break; + } + case 24: { + ErrorCode = input.ReadInt32(); + break; + } + case 34: { + ErrorMessage = input.ReadString(); + break; + } + case 42: { + if (errorPayload_ == null) { + ErrorPayload = new global::Tensorflow.CoordinationServiceError(); + } + input.ReadMessage(ErrorPayload); + break; + } + } + } + } + #endif + + } + + /// + /// Represent device information from different runtimes. + /// + public sealed partial class TfDeviceList : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TfDeviceList()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TfDeviceList() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TfDeviceList(TfDeviceList other) : this() { + devices_ = other.devices_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TfDeviceList Clone() { + return new TfDeviceList(this); + } + + /// Field number for the "devices" field. + public const int DevicesFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_devices_codec + = pb::FieldCodec.ForMessage(10, global::Tensorflow.DeviceAttributes.Parser); + private readonly pbc::RepeatedField devices_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Devices { + get { return devices_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TfDeviceList); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TfDeviceList other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!devices_.Equals(other.devices_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= devices_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + devices_.WriteTo(output, _repeated_devices_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + devices_.WriteTo(ref output, _repeated_devices_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += devices_.CalculateSize(_repeated_devices_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TfDeviceList other) { + if (other == null) { + return; + } + devices_.Add(other.devices_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + devices_.AddEntriesFrom(input, _repeated_devices_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + devices_.AddEntriesFrom(ref input, _repeated_devices_codec); + break; + } + } + } + } + #endif + + } + + public sealed partial class XlaDeviceList : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new XlaDeviceList()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public XlaDeviceList() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public XlaDeviceList(XlaDeviceList other) : this() { + devices_ = other.devices_ != null ? other.devices_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public XlaDeviceList Clone() { + return new XlaDeviceList(this); + } + + /// Field number for the "devices" field. + public const int DevicesFieldNumber = 1; + private global::Xla.GlobalTopologyProto devices_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.GlobalTopologyProto Devices { + get { return devices_; } + set { + devices_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as XlaDeviceList); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(XlaDeviceList other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Devices, other.Devices)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (devices_ != null) hash ^= Devices.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (devices_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Devices); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (devices_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Devices); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (devices_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Devices); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(XlaDeviceList other) { + if (other == null) { + return; + } + if (other.devices_ != null) { + if (devices_ == null) { + Devices = new global::Xla.GlobalTopologyProto(); + } + Devices.MergeFrom(other.Devices); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (devices_ == null) { + Devices = new global::Xla.GlobalTopologyProto(); + } + input.ReadMessage(Devices); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (devices_ == null) { + Devices = new global::Xla.GlobalTopologyProto(); + } + input.ReadMessage(Devices); + break; + } + } + } + } + #endif + + } + + public sealed partial class CoordinationServiceDeviceInfo : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CoordinationServiceDeviceInfo()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[5]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CoordinationServiceDeviceInfo() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CoordinationServiceDeviceInfo(CoordinationServiceDeviceInfo other) : this() { + switch (other.TypeCase) { + case TypeOneofCase.Tf: + Tf = other.Tf.Clone(); + break; + case TypeOneofCase.Xla: + Xla = other.Xla.Clone(); + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CoordinationServiceDeviceInfo Clone() { + return new CoordinationServiceDeviceInfo(this); + } + + /// Field number for the "tf" field. + public const int TfFieldNumber = 1; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.TfDeviceList Tf { + get { return typeCase_ == TypeOneofCase.Tf ? (global::Tensorflow.TfDeviceList) type_ : null; } + set { + type_ = value; + typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Tf; + } + } + + /// Field number for the "xla" field. + public const int XlaFieldNumber = 2; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.XlaDeviceList Xla { + get { return typeCase_ == TypeOneofCase.Xla ? (global::Tensorflow.XlaDeviceList) type_ : null; } + set { + type_ = value; + typeCase_ = value == null ? TypeOneofCase.None : TypeOneofCase.Xla; + } + } + + private object type_; + /// Enum of possible cases for the "type" oneof. + public enum TypeOneofCase { + None = 0, + Tf = 1, + Xla = 2, + } + private TypeOneofCase typeCase_ = TypeOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TypeOneofCase TypeCase { + get { return typeCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void ClearType() { + typeCase_ = TypeOneofCase.None; + type_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as CoordinationServiceDeviceInfo); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(CoordinationServiceDeviceInfo other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Tf, other.Tf)) return false; + if (!object.Equals(Xla, other.Xla)) return false; + if (TypeCase != other.TypeCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (typeCase_ == TypeOneofCase.Tf) hash ^= Tf.GetHashCode(); + if (typeCase_ == TypeOneofCase.Xla) hash ^= Xla.GetHashCode(); + hash ^= (int) typeCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (typeCase_ == TypeOneofCase.Tf) { + output.WriteRawTag(10); + output.WriteMessage(Tf); + } + if (typeCase_ == TypeOneofCase.Xla) { + output.WriteRawTag(18); + output.WriteMessage(Xla); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (typeCase_ == TypeOneofCase.Tf) { + output.WriteRawTag(10); + output.WriteMessage(Tf); + } + if (typeCase_ == TypeOneofCase.Xla) { + output.WriteRawTag(18); + output.WriteMessage(Xla); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (typeCase_ == TypeOneofCase.Tf) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Tf); + } + if (typeCase_ == TypeOneofCase.Xla) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Xla); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(CoordinationServiceDeviceInfo other) { + if (other == null) { + return; + } + switch (other.TypeCase) { + case TypeOneofCase.Tf: + if (Tf == null) { + Tf = new global::Tensorflow.TfDeviceList(); + } + Tf.MergeFrom(other.Tf); + break; + case TypeOneofCase.Xla: + if (Xla == null) { + Xla = new global::Tensorflow.XlaDeviceList(); + } + Xla.MergeFrom(other.Xla); + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + global::Tensorflow.TfDeviceList subBuilder = new global::Tensorflow.TfDeviceList(); + if (typeCase_ == TypeOneofCase.Tf) { + subBuilder.MergeFrom(Tf); + } + input.ReadMessage(subBuilder); + Tf = subBuilder; + break; + } + case 18: { + global::Tensorflow.XlaDeviceList subBuilder = new global::Tensorflow.XlaDeviceList(); + if (typeCase_ == TypeOneofCase.Xla) { + subBuilder.MergeFrom(Xla); + } + input.ReadMessage(subBuilder); + Xla = subBuilder; + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + global::Tensorflow.TfDeviceList subBuilder = new global::Tensorflow.TfDeviceList(); + if (typeCase_ == TypeOneofCase.Tf) { + subBuilder.MergeFrom(Tf); + } + input.ReadMessage(subBuilder); + Tf = subBuilder; + break; + } + case 18: { + global::Tensorflow.XlaDeviceList subBuilder = new global::Tensorflow.XlaDeviceList(); + if (typeCase_ == TypeOneofCase.Xla) { + subBuilder.MergeFrom(Xla); + } + input.ReadMessage(subBuilder); + Xla = subBuilder; + break; + } + } + } + } + #endif + + } + + /// + /// Request and response messages for registering a task to the cluster leader. + /// A task is uniquely represented by its `job_name`, `task_id` and + /// `incarnation`. Leader responds with its `incarnation` to identify a leader + /// process. + /// + public sealed partial class RegisterTaskRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegisterTaskRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[6]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public RegisterTaskRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public RegisterTaskRequest(RegisterTaskRequest other) : this() { + incarnation_ = other.incarnation_; + sourceTask_ = other.sourceTask_ != null ? other.sourceTask_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public RegisterTaskRequest Clone() { + return new RegisterTaskRequest(this); + } + + /// Field number for the "incarnation" field. + public const int IncarnationFieldNumber = 3; + private ulong incarnation_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ulong Incarnation { + get { return incarnation_; } + set { + incarnation_ = value; + } + } + + /// Field number for the "source_task" field. + public const int SourceTaskFieldNumber = 5; + private global::Tensorflow.CoordinatedTask sourceTask_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.CoordinatedTask SourceTask { + get { return sourceTask_; } + set { + sourceTask_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as RegisterTaskRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(RegisterTaskRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Incarnation != other.Incarnation) return false; + if (!object.Equals(SourceTask, other.SourceTask)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Incarnation != 0UL) hash ^= Incarnation.GetHashCode(); + if (sourceTask_ != null) hash ^= SourceTask.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Incarnation != 0UL) { + output.WriteRawTag(25); + output.WriteFixed64(Incarnation); + } + if (sourceTask_ != null) { + output.WriteRawTag(42); + output.WriteMessage(SourceTask); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Incarnation != 0UL) { + output.WriteRawTag(25); + output.WriteFixed64(Incarnation); + } + if (sourceTask_ != null) { + output.WriteRawTag(42); + output.WriteMessage(SourceTask); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Incarnation != 0UL) { + size += 1 + 8; + } + if (sourceTask_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceTask); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(RegisterTaskRequest other) { + if (other == null) { + return; + } + if (other.Incarnation != 0UL) { + Incarnation = other.Incarnation; + } + if (other.sourceTask_ != null) { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + SourceTask.MergeFrom(other.SourceTask); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 25: { + Incarnation = input.ReadFixed64(); + break; + } + case 42: { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + input.ReadMessage(SourceTask); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 25: { + Incarnation = input.ReadFixed64(); + break; + } + case 42: { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + input.ReadMessage(SourceTask); + break; + } + } + } + } + #endif + + } + + public sealed partial class RegisterTaskResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegisterTaskResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[7]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public RegisterTaskResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public RegisterTaskResponse(RegisterTaskResponse other) : this() { + leaderIncarnation_ = other.leaderIncarnation_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public RegisterTaskResponse Clone() { + return new RegisterTaskResponse(this); + } + + /// Field number for the "leader_incarnation" field. + public const int LeaderIncarnationFieldNumber = 1; + private ulong leaderIncarnation_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ulong LeaderIncarnation { + get { return leaderIncarnation_; } + set { + leaderIncarnation_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as RegisterTaskResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(RegisterTaskResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (LeaderIncarnation != other.LeaderIncarnation) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (LeaderIncarnation != 0UL) hash ^= LeaderIncarnation.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (LeaderIncarnation != 0UL) { + output.WriteRawTag(9); + output.WriteFixed64(LeaderIncarnation); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (LeaderIncarnation != 0UL) { + output.WriteRawTag(9); + output.WriteFixed64(LeaderIncarnation); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (LeaderIncarnation != 0UL) { + size += 1 + 8; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(RegisterTaskResponse other) { + if (other == null) { + return; + } + if (other.LeaderIncarnation != 0UL) { + LeaderIncarnation = other.LeaderIncarnation; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 9: { + LeaderIncarnation = input.ReadFixed64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 9: { + LeaderIncarnation = input.ReadFixed64(); + break; + } + } + } + } + #endif + + } + + /// + /// Request and response messages for sending heartbeats. + /// + public sealed partial class HeartbeatRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HeartbeatRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[8]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HeartbeatRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HeartbeatRequest(HeartbeatRequest other) : this() { + incarnation_ = other.incarnation_; + sourceTask_ = other.sourceTask_ != null ? other.sourceTask_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HeartbeatRequest Clone() { + return new HeartbeatRequest(this); + } + + /// Field number for the "incarnation" field. + public const int IncarnationFieldNumber = 3; + private ulong incarnation_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ulong Incarnation { + get { return incarnation_; } + set { + incarnation_ = value; + } + } + + /// Field number for the "source_task" field. + public const int SourceTaskFieldNumber = 4; + private global::Tensorflow.CoordinatedTask sourceTask_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.CoordinatedTask SourceTask { + get { return sourceTask_; } + set { + sourceTask_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as HeartbeatRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(HeartbeatRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Incarnation != other.Incarnation) return false; + if (!object.Equals(SourceTask, other.SourceTask)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Incarnation != 0UL) hash ^= Incarnation.GetHashCode(); + if (sourceTask_ != null) hash ^= SourceTask.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Incarnation != 0UL) { + output.WriteRawTag(25); + output.WriteFixed64(Incarnation); + } + if (sourceTask_ != null) { + output.WriteRawTag(34); + output.WriteMessage(SourceTask); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Incarnation != 0UL) { + output.WriteRawTag(25); + output.WriteFixed64(Incarnation); + } + if (sourceTask_ != null) { + output.WriteRawTag(34); + output.WriteMessage(SourceTask); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Incarnation != 0UL) { + size += 1 + 8; + } + if (sourceTask_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceTask); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(HeartbeatRequest other) { + if (other == null) { + return; + } + if (other.Incarnation != 0UL) { + Incarnation = other.Incarnation; + } + if (other.sourceTask_ != null) { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + SourceTask.MergeFrom(other.SourceTask); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 25: { + Incarnation = input.ReadFixed64(); + break; + } + case 34: { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + input.ReadMessage(SourceTask); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 25: { + Incarnation = input.ReadFixed64(); + break; + } + case 34: { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + input.ReadMessage(SourceTask); + break; + } + } + } + } + #endif + + } + + public sealed partial class HeartbeatResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HeartbeatResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[9]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HeartbeatResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HeartbeatResponse(HeartbeatResponse other) : this() { + leaderIncarnation_ = other.leaderIncarnation_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HeartbeatResponse Clone() { + return new HeartbeatResponse(this); + } + + /// Field number for the "leader_incarnation" field. + public const int LeaderIncarnationFieldNumber = 1; + private ulong leaderIncarnation_; + /// + /// If there are failures in cluster, use additional metadata in response to + /// broadcast error code and message to other tasks. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ulong LeaderIncarnation { + get { return leaderIncarnation_; } + set { + leaderIncarnation_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as HeartbeatResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(HeartbeatResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (LeaderIncarnation != other.LeaderIncarnation) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (LeaderIncarnation != 0UL) hash ^= LeaderIncarnation.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (LeaderIncarnation != 0UL) { + output.WriteRawTag(9); + output.WriteFixed64(LeaderIncarnation); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (LeaderIncarnation != 0UL) { + output.WriteRawTag(9); + output.WriteFixed64(LeaderIncarnation); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (LeaderIncarnation != 0UL) { + size += 1 + 8; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(HeartbeatResponse other) { + if (other == null) { + return; + } + if (other.LeaderIncarnation != 0UL) { + LeaderIncarnation = other.LeaderIncarnation; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 9: { + LeaderIncarnation = input.ReadFixed64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 9: { + LeaderIncarnation = input.ReadFixed64(); + break; + } + } + } + } + #endif + + } + + /// + /// Request and response messages for waiting for all tasks. + /// + public sealed partial class WaitForAllTasksRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WaitForAllTasksRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[10]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WaitForAllTasksRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WaitForAllTasksRequest(WaitForAllTasksRequest other) : this() { + localDeviceInfo_ = other.localDeviceInfo_ != null ? other.localDeviceInfo_.Clone() : null; + sourceTask_ = other.sourceTask_ != null ? other.sourceTask_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WaitForAllTasksRequest Clone() { + return new WaitForAllTasksRequest(this); + } + + /// Field number for the "local_device_info" field. + public const int LocalDeviceInfoFieldNumber = 4; + private global::Tensorflow.CoordinationServiceDeviceInfo localDeviceInfo_; + /// + /// All local device attributes on the request sender. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.CoordinationServiceDeviceInfo LocalDeviceInfo { + get { return localDeviceInfo_; } + set { + localDeviceInfo_ = value; + } + } + + /// Field number for the "source_task" field. + public const int SourceTaskFieldNumber = 5; + private global::Tensorflow.CoordinatedTask sourceTask_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.CoordinatedTask SourceTask { + get { return sourceTask_; } + set { + sourceTask_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as WaitForAllTasksRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(WaitForAllTasksRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(LocalDeviceInfo, other.LocalDeviceInfo)) return false; + if (!object.Equals(SourceTask, other.SourceTask)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (localDeviceInfo_ != null) hash ^= LocalDeviceInfo.GetHashCode(); + if (sourceTask_ != null) hash ^= SourceTask.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (localDeviceInfo_ != null) { + output.WriteRawTag(34); + output.WriteMessage(LocalDeviceInfo); + } + if (sourceTask_ != null) { + output.WriteRawTag(42); + output.WriteMessage(SourceTask); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (localDeviceInfo_ != null) { + output.WriteRawTag(34); + output.WriteMessage(LocalDeviceInfo); + } + if (sourceTask_ != null) { + output.WriteRawTag(42); + output.WriteMessage(SourceTask); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (localDeviceInfo_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(LocalDeviceInfo); + } + if (sourceTask_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceTask); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(WaitForAllTasksRequest other) { + if (other == null) { + return; + } + if (other.localDeviceInfo_ != null) { + if (localDeviceInfo_ == null) { + LocalDeviceInfo = new global::Tensorflow.CoordinationServiceDeviceInfo(); + } + LocalDeviceInfo.MergeFrom(other.LocalDeviceInfo); + } + if (other.sourceTask_ != null) { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + SourceTask.MergeFrom(other.SourceTask); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 34: { + if (localDeviceInfo_ == null) { + LocalDeviceInfo = new global::Tensorflow.CoordinationServiceDeviceInfo(); + } + input.ReadMessage(LocalDeviceInfo); + break; + } + case 42: { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + input.ReadMessage(SourceTask); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 34: { + if (localDeviceInfo_ == null) { + LocalDeviceInfo = new global::Tensorflow.CoordinationServiceDeviceInfo(); + } + input.ReadMessage(LocalDeviceInfo); + break; + } + case 42: { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + input.ReadMessage(SourceTask); + break; + } + } + } + } + #endif + + } + + public sealed partial class WaitForAllTasksResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WaitForAllTasksResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[11]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WaitForAllTasksResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WaitForAllTasksResponse(WaitForAllTasksResponse other) : this() { + leaderIncarnation_ = other.leaderIncarnation_; + clusterDeviceInfo_ = other.clusterDeviceInfo_ != null ? other.clusterDeviceInfo_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WaitForAllTasksResponse Clone() { + return new WaitForAllTasksResponse(this); + } + + /// Field number for the "leader_incarnation" field. + public const int LeaderIncarnationFieldNumber = 1; + private ulong leaderIncarnation_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ulong LeaderIncarnation { + get { return leaderIncarnation_; } + set { + leaderIncarnation_ = value; + } + } + + /// Field number for the "cluster_device_info" field. + public const int ClusterDeviceInfoFieldNumber = 3; + private global::Tensorflow.CoordinationServiceDeviceInfo clusterDeviceInfo_; + /// + /// All devices in the cluster. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.CoordinationServiceDeviceInfo ClusterDeviceInfo { + get { return clusterDeviceInfo_; } + set { + clusterDeviceInfo_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as WaitForAllTasksResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(WaitForAllTasksResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (LeaderIncarnation != other.LeaderIncarnation) return false; + if (!object.Equals(ClusterDeviceInfo, other.ClusterDeviceInfo)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (LeaderIncarnation != 0UL) hash ^= LeaderIncarnation.GetHashCode(); + if (clusterDeviceInfo_ != null) hash ^= ClusterDeviceInfo.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (LeaderIncarnation != 0UL) { + output.WriteRawTag(9); + output.WriteFixed64(LeaderIncarnation); + } + if (clusterDeviceInfo_ != null) { + output.WriteRawTag(26); + output.WriteMessage(ClusterDeviceInfo); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (LeaderIncarnation != 0UL) { + output.WriteRawTag(9); + output.WriteFixed64(LeaderIncarnation); + } + if (clusterDeviceInfo_ != null) { + output.WriteRawTag(26); + output.WriteMessage(ClusterDeviceInfo); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (LeaderIncarnation != 0UL) { + size += 1 + 8; + } + if (clusterDeviceInfo_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ClusterDeviceInfo); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(WaitForAllTasksResponse other) { + if (other == null) { + return; + } + if (other.LeaderIncarnation != 0UL) { + LeaderIncarnation = other.LeaderIncarnation; + } + if (other.clusterDeviceInfo_ != null) { + if (clusterDeviceInfo_ == null) { + ClusterDeviceInfo = new global::Tensorflow.CoordinationServiceDeviceInfo(); + } + ClusterDeviceInfo.MergeFrom(other.ClusterDeviceInfo); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 9: { + LeaderIncarnation = input.ReadFixed64(); + break; + } + case 26: { + if (clusterDeviceInfo_ == null) { + ClusterDeviceInfo = new global::Tensorflow.CoordinationServiceDeviceInfo(); + } + input.ReadMessage(ClusterDeviceInfo); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 9: { + LeaderIncarnation = input.ReadFixed64(); + break; + } + case 26: { + if (clusterDeviceInfo_ == null) { + ClusterDeviceInfo = new global::Tensorflow.CoordinationServiceDeviceInfo(); + } + input.ReadMessage(ClusterDeviceInfo); + break; + } + } + } + } + #endif + + } + + /// + /// Request and response messages for disconnecting a task from the service. + /// + public sealed partial class ShutdownTaskRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ShutdownTaskRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[12]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ShutdownTaskRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ShutdownTaskRequest(ShutdownTaskRequest other) : this() { + sourceTask_ = other.sourceTask_ != null ? other.sourceTask_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ShutdownTaskRequest Clone() { + return new ShutdownTaskRequest(this); + } + + /// Field number for the "source_task" field. + public const int SourceTaskFieldNumber = 1; + private global::Tensorflow.CoordinatedTask sourceTask_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.CoordinatedTask SourceTask { + get { return sourceTask_; } + set { + sourceTask_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ShutdownTaskRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ShutdownTaskRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(SourceTask, other.SourceTask)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (sourceTask_ != null) hash ^= SourceTask.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (sourceTask_ != null) { + output.WriteRawTag(10); + output.WriteMessage(SourceTask); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (sourceTask_ != null) { + output.WriteRawTag(10); + output.WriteMessage(SourceTask); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (sourceTask_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceTask); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ShutdownTaskRequest other) { + if (other == null) { + return; + } + if (other.sourceTask_ != null) { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + SourceTask.MergeFrom(other.SourceTask); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + input.ReadMessage(SourceTask); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + input.ReadMessage(SourceTask); + break; + } + } + } + } + #endif + + } + + public sealed partial class ShutdownTaskResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ShutdownTaskResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[13]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ShutdownTaskResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ShutdownTaskResponse(ShutdownTaskResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ShutdownTaskResponse Clone() { + return new ShutdownTaskResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ShutdownTaskResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ShutdownTaskResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ShutdownTaskResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + /// + /// Request and response messages for resetting a task state in the service. + /// + public sealed partial class ResetTaskRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ResetTaskRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[14]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ResetTaskRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ResetTaskRequest(ResetTaskRequest other) : this() { + sourceTask_ = other.sourceTask_ != null ? other.sourceTask_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ResetTaskRequest Clone() { + return new ResetTaskRequest(this); + } + + /// Field number for the "source_task" field. + public const int SourceTaskFieldNumber = 1; + private global::Tensorflow.CoordinatedTask sourceTask_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.CoordinatedTask SourceTask { + get { return sourceTask_; } + set { + sourceTask_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ResetTaskRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ResetTaskRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(SourceTask, other.SourceTask)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (sourceTask_ != null) hash ^= SourceTask.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (sourceTask_ != null) { + output.WriteRawTag(10); + output.WriteMessage(SourceTask); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (sourceTask_ != null) { + output.WriteRawTag(10); + output.WriteMessage(SourceTask); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (sourceTask_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceTask); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ResetTaskRequest other) { + if (other == null) { + return; + } + if (other.sourceTask_ != null) { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + SourceTask.MergeFrom(other.SourceTask); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + input.ReadMessage(SourceTask); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + input.ReadMessage(SourceTask); + break; + } + } + } + } + #endif + + } + + public sealed partial class ResetTaskResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ResetTaskResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[15]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ResetTaskResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ResetTaskResponse(ResetTaskResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ResetTaskResponse Clone() { + return new ResetTaskResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ResetTaskResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ResetTaskResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ResetTaskResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + /// + /// Request and response messages for reporting errors to task. + /// + public sealed partial class ReportErrorToTaskRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReportErrorToTaskRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[16]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ReportErrorToTaskRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ReportErrorToTaskRequest(ReportErrorToTaskRequest other) : this() { + errorCode_ = other.errorCode_; + errorMessage_ = other.errorMessage_; + errorPayload_ = other.errorPayload_ != null ? other.errorPayload_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ReportErrorToTaskRequest Clone() { + return new ReportErrorToTaskRequest(this); + } + + /// Field number for the "error_code" field. + public const int ErrorCodeFieldNumber = 1; + private int errorCode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int ErrorCode { + get { return errorCode_; } + set { + errorCode_ = value; + } + } + + /// Field number for the "error_message" field. + public const int ErrorMessageFieldNumber = 2; + private string errorMessage_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string ErrorMessage { + get { return errorMessage_; } + set { + errorMessage_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "error_payload" field. + public const int ErrorPayloadFieldNumber = 5; + private global::Tensorflow.CoordinationServiceError errorPayload_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.CoordinationServiceError ErrorPayload { + get { return errorPayload_; } + set { + errorPayload_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ReportErrorToTaskRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ReportErrorToTaskRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ErrorCode != other.ErrorCode) return false; + if (ErrorMessage != other.ErrorMessage) return false; + if (!object.Equals(ErrorPayload, other.ErrorPayload)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (ErrorCode != 0) hash ^= ErrorCode.GetHashCode(); + if (ErrorMessage.Length != 0) hash ^= ErrorMessage.GetHashCode(); + if (errorPayload_ != null) hash ^= ErrorPayload.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ErrorCode != 0) { + output.WriteRawTag(8); + output.WriteInt32(ErrorCode); + } + if (ErrorMessage.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ErrorMessage); + } + if (errorPayload_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ErrorPayload); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ErrorCode != 0) { + output.WriteRawTag(8); + output.WriteInt32(ErrorCode); + } + if (ErrorMessage.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ErrorMessage); + } + if (errorPayload_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ErrorPayload); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (ErrorCode != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(ErrorCode); + } + if (ErrorMessage.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ErrorMessage); + } + if (errorPayload_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ErrorPayload); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ReportErrorToTaskRequest other) { + if (other == null) { + return; + } + if (other.ErrorCode != 0) { + ErrorCode = other.ErrorCode; + } + if (other.ErrorMessage.Length != 0) { + ErrorMessage = other.ErrorMessage; + } + if (other.errorPayload_ != null) { + if (errorPayload_ == null) { + ErrorPayload = new global::Tensorflow.CoordinationServiceError(); + } + ErrorPayload.MergeFrom(other.ErrorPayload); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + ErrorCode = input.ReadInt32(); + break; + } + case 18: { + ErrorMessage = input.ReadString(); + break; + } + case 42: { + if (errorPayload_ == null) { + ErrorPayload = new global::Tensorflow.CoordinationServiceError(); + } + input.ReadMessage(ErrorPayload); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + ErrorCode = input.ReadInt32(); + break; + } + case 18: { + ErrorMessage = input.ReadString(); + break; + } + case 42: { + if (errorPayload_ == null) { + ErrorPayload = new global::Tensorflow.CoordinationServiceError(); + } + input.ReadMessage(ErrorPayload); + break; + } + } + } + } + #endif + + } + + public sealed partial class ReportErrorToTaskResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReportErrorToTaskResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[17]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ReportErrorToTaskResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ReportErrorToTaskResponse(ReportErrorToTaskResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ReportErrorToTaskResponse Clone() { + return new ReportErrorToTaskResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ReportErrorToTaskResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ReportErrorToTaskResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ReportErrorToTaskResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + /// + /// Request and response messages for reporting errors to service instance. + /// + public sealed partial class ReportErrorToServiceRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReportErrorToServiceRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[18]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ReportErrorToServiceRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ReportErrorToServiceRequest(ReportErrorToServiceRequest other) : this() { + errorCode_ = other.errorCode_; + errorMessage_ = other.errorMessage_; + errorOrigin_ = other.errorOrigin_ != null ? other.errorOrigin_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ReportErrorToServiceRequest Clone() { + return new ReportErrorToServiceRequest(this); + } + + /// Field number for the "error_code" field. + public const int ErrorCodeFieldNumber = 1; + private int errorCode_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int ErrorCode { + get { return errorCode_; } + set { + errorCode_ = value; + } + } + + /// Field number for the "error_message" field. + public const int ErrorMessageFieldNumber = 2; + private string errorMessage_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string ErrorMessage { + get { return errorMessage_; } + set { + errorMessage_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "error_origin" field. + public const int ErrorOriginFieldNumber = 5; + private global::Tensorflow.CoordinatedTask errorOrigin_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.CoordinatedTask ErrorOrigin { + get { return errorOrigin_; } + set { + errorOrigin_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ReportErrorToServiceRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ReportErrorToServiceRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ErrorCode != other.ErrorCode) return false; + if (ErrorMessage != other.ErrorMessage) return false; + if (!object.Equals(ErrorOrigin, other.ErrorOrigin)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (ErrorCode != 0) hash ^= ErrorCode.GetHashCode(); + if (ErrorMessage.Length != 0) hash ^= ErrorMessage.GetHashCode(); + if (errorOrigin_ != null) hash ^= ErrorOrigin.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ErrorCode != 0) { + output.WriteRawTag(8); + output.WriteInt32(ErrorCode); + } + if (ErrorMessage.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ErrorMessage); + } + if (errorOrigin_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ErrorOrigin); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ErrorCode != 0) { + output.WriteRawTag(8); + output.WriteInt32(ErrorCode); + } + if (ErrorMessage.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ErrorMessage); + } + if (errorOrigin_ != null) { + output.WriteRawTag(42); + output.WriteMessage(ErrorOrigin); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (ErrorCode != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(ErrorCode); + } + if (ErrorMessage.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ErrorMessage); + } + if (errorOrigin_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ErrorOrigin); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ReportErrorToServiceRequest other) { + if (other == null) { + return; + } + if (other.ErrorCode != 0) { + ErrorCode = other.ErrorCode; + } + if (other.ErrorMessage.Length != 0) { + ErrorMessage = other.ErrorMessage; + } + if (other.errorOrigin_ != null) { + if (errorOrigin_ == null) { + ErrorOrigin = new global::Tensorflow.CoordinatedTask(); + } + ErrorOrigin.MergeFrom(other.ErrorOrigin); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + ErrorCode = input.ReadInt32(); + break; + } + case 18: { + ErrorMessage = input.ReadString(); + break; + } + case 42: { + if (errorOrigin_ == null) { + ErrorOrigin = new global::Tensorflow.CoordinatedTask(); + } + input.ReadMessage(ErrorOrigin); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + ErrorCode = input.ReadInt32(); + break; + } + case 18: { + ErrorMessage = input.ReadString(); + break; + } + case 42: { + if (errorOrigin_ == null) { + ErrorOrigin = new global::Tensorflow.CoordinatedTask(); + } + input.ReadMessage(ErrorOrigin); + break; + } + } + } + } + #endif + + } + + public sealed partial class ReportErrorToServiceResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReportErrorToServiceResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[19]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ReportErrorToServiceResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ReportErrorToServiceResponse(ReportErrorToServiceResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ReportErrorToServiceResponse Clone() { + return new ReportErrorToServiceResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ReportErrorToServiceResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ReportErrorToServiceResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ReportErrorToServiceResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + /// + /// Request and response messages for getting state of a remote task. + /// + public sealed partial class GetTaskStateRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetTaskStateRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[20]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetTaskStateRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetTaskStateRequest(GetTaskStateRequest other) : this() { + sourceTask_ = other.sourceTask_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetTaskStateRequest Clone() { + return new GetTaskStateRequest(this); + } + + /// Field number for the "source_task" field. + public const int SourceTaskFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_sourceTask_codec + = pb::FieldCodec.ForMessage(10, global::Tensorflow.CoordinatedTask.Parser); + private readonly pbc::RepeatedField sourceTask_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField SourceTask { + get { return sourceTask_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as GetTaskStateRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(GetTaskStateRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!sourceTask_.Equals(other.sourceTask_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= sourceTask_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + sourceTask_.WriteTo(output, _repeated_sourceTask_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + sourceTask_.WriteTo(ref output, _repeated_sourceTask_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += sourceTask_.CalculateSize(_repeated_sourceTask_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(GetTaskStateRequest other) { + if (other == null) { + return; + } + sourceTask_.Add(other.sourceTask_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + sourceTask_.AddEntriesFrom(input, _repeated_sourceTask_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + sourceTask_.AddEntriesFrom(ref input, _repeated_sourceTask_codec); + break; + } + } + } + } + #endif + + } + + public sealed partial class GetTaskStateResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetTaskStateResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[21]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetTaskStateResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetTaskStateResponse(GetTaskStateResponse other) : this() { + taskState_ = other.taskState_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetTaskStateResponse Clone() { + return new GetTaskStateResponse(this); + } + + /// Field number for the "task_state" field. + public const int TaskStateFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_taskState_codec + = pb::FieldCodec.ForMessage(10, global::Tensorflow.CoordinatedTaskStateInfo.Parser); + private readonly pbc::RepeatedField taskState_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField TaskState { + get { return taskState_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as GetTaskStateResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(GetTaskStateResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!taskState_.Equals(other.taskState_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= taskState_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + taskState_.WriteTo(output, _repeated_taskState_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + taskState_.WriteTo(ref output, _repeated_taskState_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += taskState_.CalculateSize(_repeated_taskState_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(GetTaskStateResponse other) { + if (other == null) { + return; + } + taskState_.Add(other.taskState_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + taskState_.AddEntriesFrom(input, _repeated_taskState_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + taskState_.AddEntriesFrom(ref input, _repeated_taskState_codec); + break; + } + } + } + } + #endif + + } + + /// + /// Message for configuration key value. + /// Key is structured like Unix file system, with multiple levels of directory + /// names separated by the slash ('/') characters. + /// + public sealed partial class KeyValueEntry : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KeyValueEntry()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[22]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public KeyValueEntry() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public KeyValueEntry(KeyValueEntry other) : this() { + key_ = other.key_; + value_ = other.value_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public KeyValueEntry Clone() { + return new KeyValueEntry(this); + } + + /// Field number for the "key" field. + public const int KeyFieldNumber = 1; + private string key_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "value" field. + public const int ValueFieldNumber = 2; + private pb::ByteString value_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pb::ByteString Value { + get { return value_; } + set { + value_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as KeyValueEntry); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(KeyValueEntry other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Key != other.Key) return false; + if (Value != other.Value) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Key.Length != 0) hash ^= Key.GetHashCode(); + if (Value.Length != 0) hash ^= Value.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Key.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Key); + } + if (Value.Length != 0) { + output.WriteRawTag(18); + output.WriteBytes(Value); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Key.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Key); + } + if (Value.Length != 0) { + output.WriteRawTag(18); + output.WriteBytes(Value); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + } + if (Value.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(Value); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(KeyValueEntry other) { + if (other == null) { + return; + } + if (other.Key.Length != 0) { + Key = other.Key; + } + if (other.Value.Length != 0) { + Value = other.Value; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Key = input.ReadString(); + break; + } + case 18: { + Value = input.ReadBytes(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Key = input.ReadString(); + break; + } + case 18: { + Value = input.ReadBytes(); + break; + } + } + } + } + #endif + + } + + /// + /// Request and response messages for inserting configuration key-value data. + /// + public sealed partial class InsertKeyValueRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new InsertKeyValueRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[23]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public InsertKeyValueRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public InsertKeyValueRequest(InsertKeyValueRequest other) : this() { + kv_ = other.kv_ != null ? other.kv_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public InsertKeyValueRequest Clone() { + return new InsertKeyValueRequest(this); + } + + /// Field number for the "kv" field. + public const int KvFieldNumber = 1; + private global::Tensorflow.KeyValueEntry kv_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.KeyValueEntry Kv { + get { return kv_; } + set { + kv_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as InsertKeyValueRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(InsertKeyValueRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Kv, other.Kv)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (kv_ != null) hash ^= Kv.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (kv_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Kv); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (kv_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Kv); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (kv_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Kv); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(InsertKeyValueRequest other) { + if (other == null) { + return; + } + if (other.kv_ != null) { + if (kv_ == null) { + Kv = new global::Tensorflow.KeyValueEntry(); + } + Kv.MergeFrom(other.Kv); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (kv_ == null) { + Kv = new global::Tensorflow.KeyValueEntry(); + } + input.ReadMessage(Kv); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (kv_ == null) { + Kv = new global::Tensorflow.KeyValueEntry(); + } + input.ReadMessage(Kv); + break; + } + } + } + } + #endif + + } + + public sealed partial class InsertKeyValueResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new InsertKeyValueResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[24]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public InsertKeyValueResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public InsertKeyValueResponse(InsertKeyValueResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public InsertKeyValueResponse Clone() { + return new InsertKeyValueResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as InsertKeyValueResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(InsertKeyValueResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(InsertKeyValueResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + /// + /// Request and response messages for getting configuration key-value data. + /// + public sealed partial class GetKeyValueRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetKeyValueRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[25]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetKeyValueRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetKeyValueRequest(GetKeyValueRequest other) : this() { + key_ = other.key_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetKeyValueRequest Clone() { + return new GetKeyValueRequest(this); + } + + /// Field number for the "key" field. + public const int KeyFieldNumber = 1; + private string key_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as GetKeyValueRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(GetKeyValueRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Key != other.Key) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Key.Length != 0) hash ^= Key.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Key.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Key); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Key.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Key); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(GetKeyValueRequest other) { + if (other == null) { + return; + } + if (other.Key.Length != 0) { + Key = other.Key; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Key = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Key = input.ReadString(); + break; + } + } + } + } + #endif + + } + + public sealed partial class GetKeyValueResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetKeyValueResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[26]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetKeyValueResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetKeyValueResponse(GetKeyValueResponse other) : this() { + kv_ = other.kv_ != null ? other.kv_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetKeyValueResponse Clone() { + return new GetKeyValueResponse(this); + } + + /// Field number for the "kv" field. + public const int KvFieldNumber = 1; + private global::Tensorflow.KeyValueEntry kv_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.KeyValueEntry Kv { + get { return kv_; } + set { + kv_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as GetKeyValueResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(GetKeyValueResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Kv, other.Kv)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (kv_ != null) hash ^= Kv.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (kv_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Kv); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (kv_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Kv); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (kv_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Kv); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(GetKeyValueResponse other) { + if (other == null) { + return; + } + if (other.kv_ != null) { + if (kv_ == null) { + Kv = new global::Tensorflow.KeyValueEntry(); + } + Kv.MergeFrom(other.Kv); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (kv_ == null) { + Kv = new global::Tensorflow.KeyValueEntry(); + } + input.ReadMessage(Kv); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (kv_ == null) { + Kv = new global::Tensorflow.KeyValueEntry(); + } + input.ReadMessage(Kv); + break; + } + } + } + } + #endif + + } + + public sealed partial class TryGetKeyValueRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TryGetKeyValueRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[27]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TryGetKeyValueRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TryGetKeyValueRequest(TryGetKeyValueRequest other) : this() { + key_ = other.key_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TryGetKeyValueRequest Clone() { + return new TryGetKeyValueRequest(this); + } + + /// Field number for the "key" field. + public const int KeyFieldNumber = 1; + private string key_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TryGetKeyValueRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TryGetKeyValueRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Key != other.Key) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Key.Length != 0) hash ^= Key.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Key.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Key); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Key.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Key); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TryGetKeyValueRequest other) { + if (other == null) { + return; + } + if (other.Key.Length != 0) { + Key = other.Key; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Key = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Key = input.ReadString(); + break; + } + } + } + } + #endif + + } + + public sealed partial class TryGetKeyValueResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TryGetKeyValueResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[28]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TryGetKeyValueResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TryGetKeyValueResponse(TryGetKeyValueResponse other) : this() { + kv_ = other.kv_ != null ? other.kv_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TryGetKeyValueResponse Clone() { + return new TryGetKeyValueResponse(this); + } + + /// Field number for the "kv" field. + public const int KvFieldNumber = 1; + private global::Tensorflow.KeyValueEntry kv_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.KeyValueEntry Kv { + get { return kv_; } + set { + kv_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TryGetKeyValueResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TryGetKeyValueResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Kv, other.Kv)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (kv_ != null) hash ^= Kv.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (kv_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Kv); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (kv_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Kv); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (kv_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Kv); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TryGetKeyValueResponse other) { + if (other == null) { + return; + } + if (other.kv_ != null) { + if (kv_ == null) { + Kv = new global::Tensorflow.KeyValueEntry(); + } + Kv.MergeFrom(other.Kv); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (kv_ == null) { + Kv = new global::Tensorflow.KeyValueEntry(); + } + input.ReadMessage(Kv); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (kv_ == null) { + Kv = new global::Tensorflow.KeyValueEntry(); + } + input.ReadMessage(Kv); + break; + } + } + } + } + #endif + + } + + public sealed partial class GetKeyValueDirRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetKeyValueDirRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[29]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetKeyValueDirRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetKeyValueDirRequest(GetKeyValueDirRequest other) : this() { + directoryKey_ = other.directoryKey_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetKeyValueDirRequest Clone() { + return new GetKeyValueDirRequest(this); + } + + /// Field number for the "directory_key" field. + public const int DirectoryKeyFieldNumber = 1; + private string directoryKey_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string DirectoryKey { + get { return directoryKey_; } + set { + directoryKey_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as GetKeyValueDirRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(GetKeyValueDirRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (DirectoryKey != other.DirectoryKey) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (DirectoryKey.Length != 0) hash ^= DirectoryKey.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (DirectoryKey.Length != 0) { + output.WriteRawTag(10); + output.WriteString(DirectoryKey); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (DirectoryKey.Length != 0) { + output.WriteRawTag(10); + output.WriteString(DirectoryKey); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (DirectoryKey.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(DirectoryKey); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(GetKeyValueDirRequest other) { + if (other == null) { + return; + } + if (other.DirectoryKey.Length != 0) { + DirectoryKey = other.DirectoryKey; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + DirectoryKey = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + DirectoryKey = input.ReadString(); + break; + } + } + } + } + #endif + + } + + public sealed partial class GetKeyValueDirResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetKeyValueDirResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[30]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetKeyValueDirResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetKeyValueDirResponse(GetKeyValueDirResponse other) : this() { + directoryKey_ = other.directoryKey_; + kv_ = other.kv_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetKeyValueDirResponse Clone() { + return new GetKeyValueDirResponse(this); + } + + /// Field number for the "directory_key" field. + public const int DirectoryKeyFieldNumber = 1; + private string directoryKey_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string DirectoryKey { + get { return directoryKey_; } + set { + directoryKey_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "kv" field. + public const int KvFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_kv_codec + = pb::FieldCodec.ForMessage(18, global::Tensorflow.KeyValueEntry.Parser); + private readonly pbc::RepeatedField kv_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Kv { + get { return kv_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as GetKeyValueDirResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(GetKeyValueDirResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (DirectoryKey != other.DirectoryKey) return false; + if(!kv_.Equals(other.kv_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (DirectoryKey.Length != 0) hash ^= DirectoryKey.GetHashCode(); + hash ^= kv_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (DirectoryKey.Length != 0) { + output.WriteRawTag(10); + output.WriteString(DirectoryKey); + } + kv_.WriteTo(output, _repeated_kv_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (DirectoryKey.Length != 0) { + output.WriteRawTag(10); + output.WriteString(DirectoryKey); + } + kv_.WriteTo(ref output, _repeated_kv_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (DirectoryKey.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(DirectoryKey); + } + size += kv_.CalculateSize(_repeated_kv_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(GetKeyValueDirResponse other) { + if (other == null) { + return; + } + if (other.DirectoryKey.Length != 0) { + DirectoryKey = other.DirectoryKey; + } + kv_.Add(other.kv_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + DirectoryKey = input.ReadString(); + break; + } + case 18: { + kv_.AddEntriesFrom(input, _repeated_kv_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + DirectoryKey = input.ReadString(); + break; + } + case 18: { + kv_.AddEntriesFrom(ref input, _repeated_kv_codec); + break; + } + } + } + } + #endif + + } + + /// + /// Request and response messages for deleting configuration key-value data. + /// When is_directory is true, delete key-values recursively under `key`. + /// + public sealed partial class DeleteKeyValueRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeleteKeyValueRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[31]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeleteKeyValueRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeleteKeyValueRequest(DeleteKeyValueRequest other) : this() { + key_ = other.key_; + isDirectory_ = other.isDirectory_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeleteKeyValueRequest Clone() { + return new DeleteKeyValueRequest(this); + } + + /// Field number for the "key" field. + public const int KeyFieldNumber = 1; + private string key_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "is_directory" field. + public const int IsDirectoryFieldNumber = 2; + private bool isDirectory_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool IsDirectory { + get { return isDirectory_; } + set { + isDirectory_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as DeleteKeyValueRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(DeleteKeyValueRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Key != other.Key) return false; + if (IsDirectory != other.IsDirectory) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Key.Length != 0) hash ^= Key.GetHashCode(); + if (IsDirectory != false) hash ^= IsDirectory.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Key.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Key); + } + if (IsDirectory != false) { + output.WriteRawTag(16); + output.WriteBool(IsDirectory); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Key.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Key); + } + if (IsDirectory != false) { + output.WriteRawTag(16); + output.WriteBool(IsDirectory); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + } + if (IsDirectory != false) { + size += 1 + 1; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(DeleteKeyValueRequest other) { + if (other == null) { + return; + } + if (other.Key.Length != 0) { + Key = other.Key; + } + if (other.IsDirectory != false) { + IsDirectory = other.IsDirectory; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Key = input.ReadString(); + break; + } + case 16: { + IsDirectory = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Key = input.ReadString(); + break; + } + case 16: { + IsDirectory = input.ReadBool(); + break; + } + } + } + } + #endif + + } + + public sealed partial class DeleteKeyValueResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeleteKeyValueResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[32]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeleteKeyValueResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeleteKeyValueResponse(DeleteKeyValueResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeleteKeyValueResponse Clone() { + return new DeleteKeyValueResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as DeleteKeyValueResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(DeleteKeyValueResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(DeleteKeyValueResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + /// + /// Request and response messages for generic sync barriers. + /// + public sealed partial class BarrierRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BarrierRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[33]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public BarrierRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public BarrierRequest(BarrierRequest other) : this() { + barrierId_ = other.barrierId_; + barrierTimeoutInMs_ = other.barrierTimeoutInMs_; + tasks_ = other.tasks_.Clone(); + sourceTask_ = other.sourceTask_ != null ? other.sourceTask_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public BarrierRequest Clone() { + return new BarrierRequest(this); + } + + /// Field number for the "barrier_id" field. + public const int BarrierIdFieldNumber = 1; + private string barrierId_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string BarrierId { + get { return barrierId_; } + set { + barrierId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "barrier_timeout_in_ms" field. + public const int BarrierTimeoutInMsFieldNumber = 2; + private long barrierTimeoutInMs_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long BarrierTimeoutInMs { + get { return barrierTimeoutInMs_; } + set { + barrierTimeoutInMs_ = value; + } + } + + /// Field number for the "tasks" field. + public const int TasksFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_tasks_codec + = pb::FieldCodec.ForMessage(26, global::Tensorflow.CoordinatedTask.Parser); + private readonly pbc::RepeatedField tasks_ = new pbc::RepeatedField(); + /// + /// Denotes list of tasks that will wait for the barrier. If unspecified, it + /// implies that the entire cluster is participating in the barrier. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Tasks { + get { return tasks_; } + } + + /// Field number for the "source_task" field. + public const int SourceTaskFieldNumber = 4; + private global::Tensorflow.CoordinatedTask sourceTask_; + /// + /// Task that is making the request. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.CoordinatedTask SourceTask { + get { return sourceTask_; } + set { + sourceTask_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as BarrierRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(BarrierRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (BarrierId != other.BarrierId) return false; + if (BarrierTimeoutInMs != other.BarrierTimeoutInMs) return false; + if(!tasks_.Equals(other.tasks_)) return false; + if (!object.Equals(SourceTask, other.SourceTask)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (BarrierId.Length != 0) hash ^= BarrierId.GetHashCode(); + if (BarrierTimeoutInMs != 0L) hash ^= BarrierTimeoutInMs.GetHashCode(); + hash ^= tasks_.GetHashCode(); + if (sourceTask_ != null) hash ^= SourceTask.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (BarrierId.Length != 0) { + output.WriteRawTag(10); + output.WriteString(BarrierId); + } + if (BarrierTimeoutInMs != 0L) { + output.WriteRawTag(16); + output.WriteInt64(BarrierTimeoutInMs); + } + tasks_.WriteTo(output, _repeated_tasks_codec); + if (sourceTask_ != null) { + output.WriteRawTag(34); + output.WriteMessage(SourceTask); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (BarrierId.Length != 0) { + output.WriteRawTag(10); + output.WriteString(BarrierId); + } + if (BarrierTimeoutInMs != 0L) { + output.WriteRawTag(16); + output.WriteInt64(BarrierTimeoutInMs); + } + tasks_.WriteTo(ref output, _repeated_tasks_codec); + if (sourceTask_ != null) { + output.WriteRawTag(34); + output.WriteMessage(SourceTask); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (BarrierId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(BarrierId); + } + if (BarrierTimeoutInMs != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(BarrierTimeoutInMs); + } + size += tasks_.CalculateSize(_repeated_tasks_codec); + if (sourceTask_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceTask); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(BarrierRequest other) { + if (other == null) { + return; + } + if (other.BarrierId.Length != 0) { + BarrierId = other.BarrierId; + } + if (other.BarrierTimeoutInMs != 0L) { + BarrierTimeoutInMs = other.BarrierTimeoutInMs; + } + tasks_.Add(other.tasks_); + if (other.sourceTask_ != null) { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + SourceTask.MergeFrom(other.SourceTask); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + BarrierId = input.ReadString(); + break; + } + case 16: { + BarrierTimeoutInMs = input.ReadInt64(); + break; + } + case 26: { + tasks_.AddEntriesFrom(input, _repeated_tasks_codec); + break; + } + case 34: { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + input.ReadMessage(SourceTask); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + BarrierId = input.ReadString(); + break; + } + case 16: { + BarrierTimeoutInMs = input.ReadInt64(); + break; + } + case 26: { + tasks_.AddEntriesFrom(ref input, _repeated_tasks_codec); + break; + } + case 34: { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + input.ReadMessage(SourceTask); + break; + } + } + } + } + #endif + + } + + public sealed partial class BarrierResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BarrierResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[34]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public BarrierResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public BarrierResponse(BarrierResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public BarrierResponse Clone() { + return new BarrierResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as BarrierResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(BarrierResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(BarrierResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + /// + /// Request and response messages for cancelling generic sync barriers. + /// + public sealed partial class CancelBarrierRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CancelBarrierRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[35]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CancelBarrierRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CancelBarrierRequest(CancelBarrierRequest other) : this() { + barrierId_ = other.barrierId_; + sourceTask_ = other.sourceTask_ != null ? other.sourceTask_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CancelBarrierRequest Clone() { + return new CancelBarrierRequest(this); + } + + /// Field number for the "barrier_id" field. + public const int BarrierIdFieldNumber = 1; + private string barrierId_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string BarrierId { + get { return barrierId_; } + set { + barrierId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "source_task" field. + public const int SourceTaskFieldNumber = 2; + private global::Tensorflow.CoordinatedTask sourceTask_; + /// + /// Task that is making the request. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.CoordinatedTask SourceTask { + get { return sourceTask_; } + set { + sourceTask_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as CancelBarrierRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(CancelBarrierRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (BarrierId != other.BarrierId) return false; + if (!object.Equals(SourceTask, other.SourceTask)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (BarrierId.Length != 0) hash ^= BarrierId.GetHashCode(); + if (sourceTask_ != null) hash ^= SourceTask.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (BarrierId.Length != 0) { + output.WriteRawTag(10); + output.WriteString(BarrierId); + } + if (sourceTask_ != null) { + output.WriteRawTag(18); + output.WriteMessage(SourceTask); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (BarrierId.Length != 0) { + output.WriteRawTag(10); + output.WriteString(BarrierId); + } + if (sourceTask_ != null) { + output.WriteRawTag(18); + output.WriteMessage(SourceTask); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (BarrierId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(BarrierId); + } + if (sourceTask_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(SourceTask); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(CancelBarrierRequest other) { + if (other == null) { + return; + } + if (other.BarrierId.Length != 0) { + BarrierId = other.BarrierId; + } + if (other.sourceTask_ != null) { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + SourceTask.MergeFrom(other.SourceTask); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + BarrierId = input.ReadString(); + break; + } + case 18: { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + input.ReadMessage(SourceTask); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + BarrierId = input.ReadString(); + break; + } + case 18: { + if (sourceTask_ == null) { + SourceTask = new global::Tensorflow.CoordinatedTask(); + } + input.ReadMessage(SourceTask); + break; + } + } + } + } + #endif + + } + + public sealed partial class CancelBarrierResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CancelBarrierResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.CoordinationServiceReflection.Descriptor.MessageTypes[36]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CancelBarrierResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CancelBarrierResponse(CancelBarrierResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CancelBarrierResponse Clone() { + return new CancelBarrierResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as CancelBarrierResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(CancelBarrierResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(CancelBarrierResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/TensorFlowNET.Core/Protobuf/CostGraph.cs b/src/TensorFlowNET.Core/Protobuf/CostGraph.cs index c3b91d8e3..fc655d400 100644 --- a/src/TensorFlowNET.Core/Protobuf/CostGraph.cs +++ b/src/TensorFlowNET.Core/Protobuf/CostGraph.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/cost_graph.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -62,23 +62,31 @@ static CostGraphReflection() { } #region Messages - public sealed partial class CostGraphDef : pb::IMessage { + public sealed partial class CostGraphDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CostGraphDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.CostGraphReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CostGraphDef() { OnConstruction(); } @@ -86,6 +94,7 @@ public CostGraphDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CostGraphDef(CostGraphDef other) : this() { node_ = other.node_.Clone(); cost_ = other.cost_.Clone(); @@ -93,6 +102,7 @@ public CostGraphDef(CostGraphDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CostGraphDef Clone() { return new CostGraphDef(this); } @@ -103,6 +113,7 @@ public CostGraphDef Clone() { = pb::FieldCodec.ForMessage(10, global::Tensorflow.CostGraphDef.Types.Node.Parser); private readonly pbc::RepeatedField node_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Node { get { return node_; } } @@ -113,16 +124,19 @@ public CostGraphDef Clone() { = pb::FieldCodec.ForMessage(18, global::Tensorflow.CostGraphDef.Types.AggregatedCost.Parser); private readonly pbc::RepeatedField cost_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Cost { get { return cost_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as CostGraphDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(CostGraphDef other) { if (ReferenceEquals(other, null)) { return false; @@ -136,6 +150,7 @@ public bool Equals(CostGraphDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= node_.GetHashCode(); @@ -147,20 +162,39 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else node_.WriteTo(output, _repeated_node_codec); cost_.WriteTo(output, _repeated_cost_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + node_.WriteTo(ref output, _repeated_node_codec); + cost_.WriteTo(ref output, _repeated_cost_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += node_.CalculateSize(_repeated_node_codec); @@ -172,6 +206,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(CostGraphDef other) { if (other == null) { return; @@ -182,7 +217,11 @@ public void MergeFrom(CostGraphDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -199,29 +238,62 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + node_.AddEntriesFrom(ref input, _repeated_node_codec); + break; + } + case 18: { + cost_.AddEntriesFrom(ref input, _repeated_cost_codec); + break; + } + } + } + } + #endif + #region Nested types /// Container for nested types declared in the CostGraphDef message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { - public sealed partial class Node : pb::IMessage { + public sealed partial class Node : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Node()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.CostGraphDef.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Node() { OnConstruction(); } @@ -229,6 +301,7 @@ public Node() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Node(Node other) : this() { name_ = other.name_; device_ = other.device_; @@ -250,6 +323,7 @@ public Node(Node other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Node Clone() { return new Node(this); } @@ -261,6 +335,7 @@ public Node Clone() { /// The name of the node. Names are globally unique. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -276,6 +351,7 @@ public string Name { /// default partition or partitioning hasn't been run yet. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Device { get { return device_; } set { @@ -290,6 +366,7 @@ public string Device { /// The id of the node. Node ids are only unique inside a partition. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int Id { get { return id_; } set { @@ -303,6 +380,7 @@ public int Id { = pb::FieldCodec.ForMessage(34, global::Tensorflow.CostGraphDef.Types.Node.Types.InputInfo.Parser); private readonly pbc::RepeatedField inputInfo_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField InputInfo { get { return inputInfo_; } } @@ -313,6 +391,7 @@ public int Id { = pb::FieldCodec.ForMessage(42, global::Tensorflow.CostGraphDef.Types.Node.Types.OutputInfo.Parser); private readonly pbc::RepeatedField outputInfo_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField OutputInfo { get { return outputInfo_; } } @@ -324,6 +403,7 @@ public int Id { /// Temporary memory used by this node. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long TemporaryMemorySize { get { return temporaryMemorySize_; } set { @@ -338,6 +418,7 @@ public long TemporaryMemorySize { /// Persistent memory used by this node. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long PersistentMemorySize { get { return persistentMemorySize_; } set { @@ -350,6 +431,7 @@ public long PersistentMemorySize { private long hostTempMemorySize_; [global::System.ObsoleteAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long HostTempMemorySize { get { return hostTempMemorySize_; } set { @@ -362,6 +444,7 @@ public long HostTempMemorySize { private long deviceTempMemorySize_; [global::System.ObsoleteAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long DeviceTempMemorySize { get { return deviceTempMemorySize_; } set { @@ -374,6 +457,7 @@ public long DeviceTempMemorySize { private long devicePersistentMemorySize_; [global::System.ObsoleteAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long DevicePersistentMemorySize { get { return devicePersistentMemorySize_; } set { @@ -388,6 +472,7 @@ public long DevicePersistentMemorySize { /// Estimate of the computational cost of this node, in microseconds. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long ComputeCost { get { return computeCost_; } set { @@ -403,6 +488,7 @@ public long ComputeCost { /// microseconds. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long ComputeTime { get { return computeTime_; } set { @@ -418,6 +504,7 @@ public long ComputeTime { /// microseconds. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long MemoryTime { get { return memoryTime_; } set { @@ -433,6 +520,7 @@ public long MemoryTime { /// node is part of the "final output". Nodes may depend on final nodes. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool IsFinal { get { return isFinal_; } set { @@ -449,6 +537,7 @@ public bool IsFinal { /// Ids of the control inputs for this node. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField ControlInput { get { return controlInput_; } } @@ -460,6 +549,7 @@ public bool IsFinal { /// Are the costs inaccurate? /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Inaccurate { get { return inaccurate_; } set { @@ -468,11 +558,13 @@ public bool Inaccurate { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as Node); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(Node other) { if (ReferenceEquals(other, null)) { return false; @@ -500,6 +592,7 @@ public bool Equals(Node other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -525,12 +618,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -589,9 +687,76 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (Device.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Device); + } + if (Id != 0) { + output.WriteRawTag(24); + output.WriteInt32(Id); + } + inputInfo_.WriteTo(ref output, _repeated_inputInfo_codec); + outputInfo_.WriteTo(ref output, _repeated_outputInfo_codec); + if (TemporaryMemorySize != 0L) { + output.WriteRawTag(48); + output.WriteInt64(TemporaryMemorySize); + } + if (IsFinal != false) { + output.WriteRawTag(56); + output.WriteBool(IsFinal); + } + controlInput_.WriteTo(ref output, _repeated_controlInput_codec); + if (ComputeCost != 0L) { + output.WriteRawTag(72); + output.WriteInt64(ComputeCost); + } + if (HostTempMemorySize != 0L) { + output.WriteRawTag(80); + output.WriteInt64(HostTempMemorySize); + } + if (DeviceTempMemorySize != 0L) { + output.WriteRawTag(88); + output.WriteInt64(DeviceTempMemorySize); + } + if (PersistentMemorySize != 0L) { + output.WriteRawTag(96); + output.WriteInt64(PersistentMemorySize); + } + if (ComputeTime != 0L) { + output.WriteRawTag(112); + output.WriteInt64(ComputeTime); + } + if (MemoryTime != 0L) { + output.WriteRawTag(120); + output.WriteInt64(MemoryTime); + } + if (DevicePersistentMemorySize != 0L) { + output.WriteRawTag(128, 1); + output.WriteInt64(DevicePersistentMemorySize); + } + if (Inaccurate != false) { + output.WriteRawTag(136, 1); + output.WriteBool(Inaccurate); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -643,6 +808,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(Node other) { if (other == null) { return; @@ -693,7 +859,11 @@ public void MergeFrom(Node other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -767,34 +937,124 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + Device = input.ReadString(); + break; + } + case 24: { + Id = input.ReadInt32(); + break; + } + case 34: { + inputInfo_.AddEntriesFrom(ref input, _repeated_inputInfo_codec); + break; + } + case 42: { + outputInfo_.AddEntriesFrom(ref input, _repeated_outputInfo_codec); + break; + } + case 48: { + TemporaryMemorySize = input.ReadInt64(); + break; + } + case 56: { + IsFinal = input.ReadBool(); + break; + } + case 66: + case 64: { + controlInput_.AddEntriesFrom(ref input, _repeated_controlInput_codec); + break; + } + case 72: { + ComputeCost = input.ReadInt64(); + break; + } + case 80: { + HostTempMemorySize = input.ReadInt64(); + break; + } + case 88: { + DeviceTempMemorySize = input.ReadInt64(); + break; + } + case 96: { + PersistentMemorySize = input.ReadInt64(); + break; + } + case 112: { + ComputeTime = input.ReadInt64(); + break; + } + case 120: { + MemoryTime = input.ReadInt64(); + break; + } + case 128: { + DevicePersistentMemorySize = input.ReadInt64(); + break; + } + case 136: { + Inaccurate = input.ReadBool(); + break; + } + } + } } + #endif #region Nested types /// Container for nested types declared in the Node message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { /// /// Inputs of this node. They must be executed before this node can be /// executed. An input is a particular output of another node, specified /// by the node id and the output index. /// - public sealed partial class InputInfo : pb::IMessage { + public sealed partial class InputInfo : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new InputInfo()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.CostGraphDef.Types.Node.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public InputInfo() { OnConstruction(); } @@ -802,6 +1062,7 @@ public InputInfo() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public InputInfo(InputInfo other) : this() { precedingNode_ = other.precedingNode_; precedingPort_ = other.precedingPort_; @@ -809,6 +1070,7 @@ public InputInfo(InputInfo other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public InputInfo Clone() { return new InputInfo(this); } @@ -817,6 +1079,7 @@ public InputInfo Clone() { public const int PrecedingNodeFieldNumber = 1; private int precedingNode_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int PrecedingNode { get { return precedingNode_; } set { @@ -828,6 +1091,7 @@ public int PrecedingNode { public const int PrecedingPortFieldNumber = 2; private int precedingPort_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int PrecedingPort { get { return precedingPort_; } set { @@ -836,11 +1100,13 @@ public int PrecedingPort { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as InputInfo); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(InputInfo other) { if (ReferenceEquals(other, null)) { return false; @@ -854,6 +1120,7 @@ public bool Equals(InputInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (PrecedingNode != 0) hash ^= PrecedingNode.GetHashCode(); @@ -865,12 +1132,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (PrecedingNode != 0) { output.WriteRawTag(8); output.WriteInt32(PrecedingNode); @@ -882,9 +1154,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (PrecedingNode != 0) { + output.WriteRawTag(8); + output.WriteInt32(PrecedingNode); + } + if (PrecedingPort != 0) { + output.WriteRawTag(16); + output.WriteInt32(PrecedingPort); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (PrecedingNode != 0) { @@ -900,6 +1192,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(InputInfo other) { if (other == null) { return; @@ -914,7 +1207,11 @@ public void MergeFrom(InputInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -931,30 +1228,62 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + PrecedingNode = input.ReadInt32(); + break; + } + case 16: { + PrecedingPort = input.ReadInt32(); + break; + } + } + } } + #endif } /// /// Outputs of this node. /// - public sealed partial class OutputInfo : pb::IMessage { + public sealed partial class OutputInfo : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OutputInfo()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.CostGraphDef.Types.Node.Descriptor.NestedTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public OutputInfo() { OnConstruction(); } @@ -962,6 +1291,7 @@ public OutputInfo() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public OutputInfo(OutputInfo other) : this() { size_ = other.size_; aliasInputPort_ = other.aliasInputPort_; @@ -971,6 +1301,7 @@ public OutputInfo(OutputInfo other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public OutputInfo Clone() { return new OutputInfo(this); } @@ -979,6 +1310,7 @@ public OutputInfo Clone() { public const int SizeFieldNumber = 1; private long size_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long Size { get { return size_; } set { @@ -995,6 +1327,7 @@ public long Size { /// those pointers. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long AliasInputPort { get { return aliasInputPort_; } set { @@ -1006,6 +1339,7 @@ public long AliasInputPort { public const int ShapeFieldNumber = 3; private global::Tensorflow.TensorShapeProto shape_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorShapeProto Shape { get { return shape_; } set { @@ -1017,6 +1351,7 @@ public long AliasInputPort { public const int DtypeFieldNumber = 4; private global::Tensorflow.DataType dtype_ = global::Tensorflow.DataType.DtInvalid; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.DataType Dtype { get { return dtype_; } set { @@ -1025,11 +1360,13 @@ public long AliasInputPort { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as OutputInfo); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(OutputInfo other) { if (ReferenceEquals(other, null)) { return false; @@ -1045,6 +1382,7 @@ public bool Equals(OutputInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Size != 0L) hash ^= Size.GetHashCode(); @@ -1058,12 +1396,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Size != 0L) { output.WriteRawTag(8); output.WriteInt64(Size); @@ -1083,9 +1426,37 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Size != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Size); + } + if (AliasInputPort != 0L) { + output.WriteRawTag(16); + output.WriteInt64(AliasInputPort); + } + if (shape_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Shape); + } + if (Dtype != global::Tensorflow.DataType.DtInvalid) { + output.WriteRawTag(32); + output.WriteEnum((int) Dtype); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Size != 0L) { @@ -1107,6 +1478,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(OutputInfo other) { if (other == null) { return; @@ -1130,7 +1502,11 @@ public void MergeFrom(OutputInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1158,8 +1534,43 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Size = input.ReadInt64(); + break; + } + case 16: { + AliasInputPort = input.ReadInt64(); + break; + } + case 26: { + if (shape_ == null) { + Shape = new global::Tensorflow.TensorShapeProto(); + } + input.ReadMessage(Shape); + break; + } + case 32: { + Dtype = (global::Tensorflow.DataType) input.ReadEnum(); + break; + } + } + } + } + #endif + } } @@ -1170,23 +1581,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// /// Total cost of this graph, typically used for balancing decisions. /// - public sealed partial class AggregatedCost : pb::IMessage { + public sealed partial class AggregatedCost : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AggregatedCost()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.CostGraphDef.Descriptor.NestedTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AggregatedCost() { OnConstruction(); } @@ -1194,6 +1613,7 @@ public AggregatedCost() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AggregatedCost(AggregatedCost other) : this() { cost_ = other.cost_; dimension_ = other.dimension_; @@ -1201,6 +1621,7 @@ public AggregatedCost(AggregatedCost other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AggregatedCost Clone() { return new AggregatedCost(this); } @@ -1212,6 +1633,7 @@ public AggregatedCost Clone() { /// Aggregated cost value. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public float Cost { get { return cost_; } set { @@ -1226,6 +1648,7 @@ public float Cost { /// Aggregated cost dimension (e.g. 'memory', 'compute', 'network'). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Dimension { get { return dimension_; } set { @@ -1234,11 +1657,13 @@ public string Dimension { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as AggregatedCost); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(AggregatedCost other) { if (ReferenceEquals(other, null)) { return false; @@ -1252,6 +1677,7 @@ public bool Equals(AggregatedCost other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Cost != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Cost); @@ -1263,12 +1689,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Cost != 0F) { output.WriteRawTag(13); output.WriteFloat(Cost); @@ -1280,9 +1711,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Cost != 0F) { + output.WriteRawTag(13); + output.WriteFloat(Cost); + } + if (Dimension.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Dimension); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Cost != 0F) { @@ -1298,6 +1749,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(AggregatedCost other) { if (other == null) { return; @@ -1312,7 +1764,11 @@ public void MergeFrom(AggregatedCost other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1329,7 +1785,31 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 13: { + Cost = input.ReadFloat(); + break; + } + case 18: { + Dimension = input.ReadString(); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/CppShapeInference.cs b/src/TensorFlowNET.Core/Protobuf/CppShapeInference.cs index f76bf2f02..c6de97c6b 100644 --- a/src/TensorFlowNET.Core/Protobuf/CppShapeInference.cs +++ b/src/TensorFlowNET.Core/Protobuf/CppShapeInference.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/python/framework/cpp_shape_inference.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -55,23 +55,31 @@ static CppShapeInferenceReflection() { } #region Messages - public sealed partial class CppShapeInferenceResult : pb::IMessage { + public sealed partial class CppShapeInferenceResult : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CppShapeInferenceResult()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.CppShapeInferenceReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CppShapeInferenceResult() { OnConstruction(); } @@ -79,6 +87,7 @@ public CppShapeInferenceResult() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CppShapeInferenceResult(CppShapeInferenceResult other) : this() { shape_ = other.shape_ != null ? other.shape_.Clone() : null; handleData_ = other.handleData_ != null ? other.handleData_.Clone() : null; @@ -86,6 +95,7 @@ public CppShapeInferenceResult(CppShapeInferenceResult other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CppShapeInferenceResult Clone() { return new CppShapeInferenceResult(this); } @@ -94,6 +104,7 @@ public CppShapeInferenceResult Clone() { public const int ShapeFieldNumber = 1; private global::Tensorflow.TensorShapeProto shape_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorShapeProto Shape { get { return shape_; } set { @@ -105,6 +116,7 @@ public CppShapeInferenceResult Clone() { public const int HandleDataFieldNumber = 4; private global::Tensorflow.CppShapeInferenceResult.Types.HandleData handleData_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.CppShapeInferenceResult.Types.HandleData HandleData { get { return handleData_; } set { @@ -113,11 +125,13 @@ public CppShapeInferenceResult Clone() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as CppShapeInferenceResult); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(CppShapeInferenceResult other) { if (ReferenceEquals(other, null)) { return false; @@ -131,6 +145,7 @@ public bool Equals(CppShapeInferenceResult other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (shape_ != null) hash ^= Shape.GetHashCode(); @@ -142,12 +157,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (shape_ != null) { output.WriteRawTag(10); output.WriteMessage(Shape); @@ -159,9 +179,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (shape_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Shape); + } + if (handleData_ != null) { + output.WriteRawTag(34); + output.WriteMessage(HandleData); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (shape_ != null) { @@ -177,6 +217,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(CppShapeInferenceResult other) { if (other == null) { return; @@ -197,7 +238,11 @@ public void MergeFrom(CppShapeInferenceResult other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -220,29 +265,68 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (shape_ == null) { + Shape = new global::Tensorflow.TensorShapeProto(); + } + input.ReadMessage(Shape); + break; + } + case 34: { + if (handleData_ == null) { + HandleData = new global::Tensorflow.CppShapeInferenceResult.Types.HandleData(); + } + input.ReadMessage(HandleData); + break; + } + } + } } + #endif #region Nested types /// Container for nested types declared in the CppShapeInferenceResult message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { - public sealed partial class HandleShapeAndType : pb::IMessage { + public sealed partial class HandleShapeAndType : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HandleShapeAndType()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.CppShapeInferenceResult.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public HandleShapeAndType() { OnConstruction(); } @@ -250,6 +334,7 @@ public HandleShapeAndType() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public HandleShapeAndType(HandleShapeAndType other) : this() { shape_ = other.shape_ != null ? other.shape_.Clone() : null; dtype_ = other.dtype_; @@ -258,6 +343,7 @@ public HandleShapeAndType(HandleShapeAndType other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public HandleShapeAndType Clone() { return new HandleShapeAndType(this); } @@ -266,6 +352,7 @@ public HandleShapeAndType Clone() { public const int ShapeFieldNumber = 1; private global::Tensorflow.TensorShapeProto shape_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorShapeProto Shape { get { return shape_; } set { @@ -277,6 +364,7 @@ public HandleShapeAndType Clone() { public const int DtypeFieldNumber = 2; private global::Tensorflow.DataType dtype_ = global::Tensorflow.DataType.DtInvalid; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.DataType Dtype { get { return dtype_; } set { @@ -288,6 +376,7 @@ public HandleShapeAndType Clone() { public const int TypeFieldNumber = 4; private global::Tensorflow.FullTypeDef type_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.FullTypeDef Type { get { return type_; } set { @@ -296,11 +385,13 @@ public HandleShapeAndType Clone() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as HandleShapeAndType); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(HandleShapeAndType other) { if (ReferenceEquals(other, null)) { return false; @@ -315,6 +406,7 @@ public bool Equals(HandleShapeAndType other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (shape_ != null) hash ^= Shape.GetHashCode(); @@ -327,12 +419,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (shape_ != null) { output.WriteRawTag(10); output.WriteMessage(Shape); @@ -348,9 +445,33 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (shape_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Shape); + } + if (Dtype != global::Tensorflow.DataType.DtInvalid) { + output.WriteRawTag(16); + output.WriteEnum((int) Dtype); + } + if (type_ != null) { + output.WriteRawTag(34); + output.WriteMessage(Type); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (shape_ != null) { @@ -369,6 +490,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(HandleShapeAndType other) { if (other == null) { return; @@ -392,7 +514,11 @@ public void MergeFrom(HandleShapeAndType other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -419,27 +545,69 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (shape_ == null) { + Shape = new global::Tensorflow.TensorShapeProto(); + } + input.ReadMessage(Shape); + break; + } + case 16: { + Dtype = (global::Tensorflow.DataType) input.ReadEnum(); + break; + } + case 34: { + if (type_ == null) { + Type = new global::Tensorflow.FullTypeDef(); + } + input.ReadMessage(Type); + break; + } + } + } + } + #endif + } - public sealed partial class HandleData : pb::IMessage { + public sealed partial class HandleData : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HandleData()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.CppShapeInferenceResult.Descriptor.NestedTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public HandleData() { OnConstruction(); } @@ -447,6 +615,7 @@ public HandleData() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public HandleData(HandleData other) : this() { isSet_ = other.isSet_; shapeAndType_ = other.shapeAndType_.Clone(); @@ -454,6 +623,7 @@ public HandleData(HandleData other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public HandleData Clone() { return new HandleData(this); } @@ -462,6 +632,7 @@ public HandleData Clone() { public const int IsSetFieldNumber = 1; private bool isSet_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool IsSet { get { return isSet_; } set { @@ -478,16 +649,19 @@ public bool IsSet { /// Only valid if <is_set>. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField ShapeAndType { get { return shapeAndType_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as HandleData); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(HandleData other) { if (ReferenceEquals(other, null)) { return false; @@ -501,6 +675,7 @@ public bool Equals(HandleData other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (IsSet != false) hash ^= IsSet.GetHashCode(); @@ -512,12 +687,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (IsSet != false) { output.WriteRawTag(8); output.WriteBool(IsSet); @@ -526,9 +706,26 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (IsSet != false) { + output.WriteRawTag(8); + output.WriteBool(IsSet); + } + shapeAndType_.WriteTo(ref output, _repeated_shapeAndType_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (IsSet != false) { @@ -542,6 +739,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(HandleData other) { if (other == null) { return; @@ -554,7 +752,11 @@ public void MergeFrom(HandleData other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -571,8 +773,32 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + IsSet = input.ReadBool(); + break; + } + case 18: { + shapeAndType_.AddEntriesFrom(ref input, _repeated_shapeAndType_codec); + break; + } + } + } + } + #endif + } } @@ -580,23 +806,31 @@ public void MergeFrom(pb::CodedInputStream input) { } - public sealed partial class CppShapeInferenceInputsNeeded : pb::IMessage { + public sealed partial class CppShapeInferenceInputsNeeded : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CppShapeInferenceInputsNeeded()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.CppShapeInferenceReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CppShapeInferenceInputsNeeded() { OnConstruction(); } @@ -604,6 +838,7 @@ public CppShapeInferenceInputsNeeded() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CppShapeInferenceInputsNeeded(CppShapeInferenceInputsNeeded other) : this() { inputTensorsNeeded_ = other.inputTensorsNeeded_.Clone(); inputTensorsAsShapesNeeded_ = other.inputTensorsAsShapesNeeded_.Clone(); @@ -611,6 +846,7 @@ public CppShapeInferenceInputsNeeded(CppShapeInferenceInputsNeeded other) : this } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CppShapeInferenceInputsNeeded Clone() { return new CppShapeInferenceInputsNeeded(this); } @@ -621,6 +857,7 @@ public CppShapeInferenceInputsNeeded Clone() { = pb::FieldCodec.ForInt32(10); private readonly pbc::RepeatedField inputTensorsNeeded_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField InputTensorsNeeded { get { return inputTensorsNeeded_; } } @@ -631,16 +868,19 @@ public CppShapeInferenceInputsNeeded Clone() { = pb::FieldCodec.ForInt32(18); private readonly pbc::RepeatedField inputTensorsAsShapesNeeded_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField InputTensorsAsShapesNeeded { get { return inputTensorsAsShapesNeeded_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as CppShapeInferenceInputsNeeded); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(CppShapeInferenceInputsNeeded other) { if (ReferenceEquals(other, null)) { return false; @@ -654,6 +894,7 @@ public bool Equals(CppShapeInferenceInputsNeeded other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= inputTensorsNeeded_.GetHashCode(); @@ -665,20 +906,39 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else inputTensorsNeeded_.WriteTo(output, _repeated_inputTensorsNeeded_codec); inputTensorsAsShapesNeeded_.WriteTo(output, _repeated_inputTensorsAsShapesNeeded_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + inputTensorsNeeded_.WriteTo(ref output, _repeated_inputTensorsNeeded_codec); + inputTensorsAsShapesNeeded_.WriteTo(ref output, _repeated_inputTensorsAsShapesNeeded_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += inputTensorsNeeded_.CalculateSize(_repeated_inputTensorsNeeded_codec); @@ -690,6 +950,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(CppShapeInferenceInputsNeeded other) { if (other == null) { return; @@ -700,7 +961,11 @@ public void MergeFrom(CppShapeInferenceInputsNeeded other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -719,7 +984,33 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: + case 8: { + inputTensorsNeeded_.AddEntriesFrom(ref input, _repeated_inputTensorsNeeded_codec); + break; + } + case 18: + case 16: { + inputTensorsAsShapesNeeded_.AddEntriesFrom(ref input, _repeated_inputTensorsAsShapesNeeded_codec); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/DataService.cs b/src/TensorFlowNET.Core/Protobuf/DataService.cs new file mode 100644 index 000000000..ca59a471d --- /dev/null +++ b/src/TensorFlowNET.Core/Protobuf/DataService.cs @@ -0,0 +1,1041 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tensorflow/core/protobuf/data_service.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tensorflow.Data { + + /// Holder for reflection information generated from tensorflow/core/protobuf/data_service.proto + public static partial class DataServiceReflection { + + #region Descriptor + /// File descriptor for tensorflow/core/protobuf/data_service.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static DataServiceReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Cit0ZW5zb3JmbG93L2NvcmUvcHJvdG9idWYvZGF0YV9zZXJ2aWNlLnByb3Rv", + "Eg90ZW5zb3JmbG93LmRhdGEitwEKEVByb2Nlc3NpbmdNb2RlRGVmEkoKD3No", + "YXJkaW5nX3BvbGljeRgBIAEoDjIxLnRlbnNvcmZsb3cuZGF0YS5Qcm9jZXNz", + "aW5nTW9kZURlZi5TaGFyZGluZ1BvbGljeSJWCg5TaGFyZGluZ1BvbGljeRIH", + "CgNPRkYQABILCgdEWU5BTUlDEAESCAoERklMRRACEggKBERBVEEQAxIQCgxG", + "SUxFX09SX0RBVEEQBBIICgRISU5UEAUi+wEKE0RhdGFTZXJ2aWNlTWV0YWRh", + "dGESFgoMZWxlbWVudF9zcGVjGAEgASgMSAASRQoLY29tcHJlc3Npb24YAiAB", + "KA4yMC50ZW5zb3JmbG93LmRhdGEuRGF0YVNlcnZpY2VNZXRhZGF0YS5Db21w", + "cmVzc2lvbhITCgtjYXJkaW5hbGl0eRgDIAEoAyJXCgtDb21wcmVzc2lvbhIb", + "ChdDT01QUkVTU0lPTl9VTlNQRUNJRklFRBAAEhMKD0NPTVBSRVNTSU9OX09G", + "RhABEhYKEkNPTVBSRVNTSU9OX1NOQVBQWRACQhcKFW9wdGlvbmFsX2VsZW1l", + "bnRfc3BlYyIuChhDcm9zc1RyYWluZXJDYWNoZU9wdGlvbnMSEgoKdHJhaW5l", + "cl9pZBgBIAEoCSJNChFEYXRhU2VydmljZUNvbmZpZxI4Cg9kZXBsb3ltZW50", + "X21vZGUYASABKA4yHy50ZW5zb3JmbG93LmRhdGEuRGVwbG95bWVudE1vZGUq", + "iAEKDkRlcGxveW1lbnRNb2RlEh8KG0RFUExPWU1FTlRfTU9ERV9VTlNQRUNJ", + "RklFRBAAEh0KGURFUExPWU1FTlRfTU9ERV9DT0xPQ0FURUQQARIaChZERVBM", + "T1lNRU5UX01PREVfUkVNT1RFEAISGgoWREVQTE9ZTUVOVF9NT0RFX0hZQlJJ", + "RBADQldaVWdpdGh1Yi5jb20vdGVuc29yZmxvdy90ZW5zb3JmbG93L3RlbnNv", + "cmZsb3cvZ28vY29yZS9wcm90b2J1Zi9mb3JfY29yZV9wcm90b3NfZ29fcHJv", + "dG9iBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tensorflow.Data.DeploymentMode), }, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.Data.ProcessingModeDef), global::Tensorflow.Data.ProcessingModeDef.Parser, new[]{ "ShardingPolicy" }, null, new[]{ typeof(global::Tensorflow.Data.ProcessingModeDef.Types.ShardingPolicy) }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.Data.DataServiceMetadata), global::Tensorflow.Data.DataServiceMetadata.Parser, new[]{ "ElementSpec", "Compression", "Cardinality" }, new[]{ "OptionalElementSpec" }, new[]{ typeof(global::Tensorflow.Data.DataServiceMetadata.Types.Compression) }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.Data.CrossTrainerCacheOptions), global::Tensorflow.Data.CrossTrainerCacheOptions.Parser, new[]{ "TrainerId" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.Data.DataServiceConfig), global::Tensorflow.Data.DataServiceConfig.Parser, new[]{ "DeploymentMode" }, null, null, null, null) + })); + } + #endregion + + } + #region Enums + /// + /// tf.data service deployment mode. + /// + public enum DeploymentMode { + [pbr::OriginalName("DEPLOYMENT_MODE_UNSPECIFIED")] Unspecified = 0, + /// + /// tf.data service workers colocate with TF workers. + /// + [pbr::OriginalName("DEPLOYMENT_MODE_COLOCATED")] Colocated = 1, + /// + /// tf.data service workers run in dedicated tf.data hosts. + /// + [pbr::OriginalName("DEPLOYMENT_MODE_REMOTE")] Remote = 2, + /// + /// tf.data service workers run in colocated TF hosts and dedicated tf.data + /// hosts. + /// + [pbr::OriginalName("DEPLOYMENT_MODE_HYBRID")] Hybrid = 3, + } + + #endregion + + #region Messages + /// + /// Next tag: 2 + /// + public sealed partial class ProcessingModeDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ProcessingModeDef()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.Data.DataServiceReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ProcessingModeDef() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ProcessingModeDef(ProcessingModeDef other) : this() { + shardingPolicy_ = other.shardingPolicy_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ProcessingModeDef Clone() { + return new ProcessingModeDef(this); + } + + /// Field number for the "sharding_policy" field. + public const int ShardingPolicyFieldNumber = 1; + private global::Tensorflow.Data.ProcessingModeDef.Types.ShardingPolicy shardingPolicy_ = global::Tensorflow.Data.ProcessingModeDef.Types.ShardingPolicy.Off; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.Data.ProcessingModeDef.Types.ShardingPolicy ShardingPolicy { + get { return shardingPolicy_; } + set { + shardingPolicy_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ProcessingModeDef); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ProcessingModeDef other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ShardingPolicy != other.ShardingPolicy) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (ShardingPolicy != global::Tensorflow.Data.ProcessingModeDef.Types.ShardingPolicy.Off) hash ^= ShardingPolicy.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ShardingPolicy != global::Tensorflow.Data.ProcessingModeDef.Types.ShardingPolicy.Off) { + output.WriteRawTag(8); + output.WriteEnum((int) ShardingPolicy); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ShardingPolicy != global::Tensorflow.Data.ProcessingModeDef.Types.ShardingPolicy.Off) { + output.WriteRawTag(8); + output.WriteEnum((int) ShardingPolicy); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (ShardingPolicy != global::Tensorflow.Data.ProcessingModeDef.Types.ShardingPolicy.Off) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) ShardingPolicy); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ProcessingModeDef other) { + if (other == null) { + return; + } + if (other.ShardingPolicy != global::Tensorflow.Data.ProcessingModeDef.Types.ShardingPolicy.Off) { + ShardingPolicy = other.ShardingPolicy; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + ShardingPolicy = (global::Tensorflow.Data.ProcessingModeDef.Types.ShardingPolicy) input.ReadEnum(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + ShardingPolicy = (global::Tensorflow.Data.ProcessingModeDef.Types.ShardingPolicy) input.ReadEnum(); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the ProcessingModeDef message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + /// + /// Specifies how data is sharded among tf.data service workers. + /// + public enum ShardingPolicy { + /// + /// No sharding will be performed. Each worker produces the entire dataset + /// without any sharding. With this mode, the best practice is to shuffle the + /// dataset nondeterministically so that workers process the dataset in + /// different orders. + /// + [pbr::OriginalName("OFF")] Off = 0, + /// + /// The input dataset is dynamically split among workers at runtime. Each + /// worker gets the next split when it reads data from the dispatcher. There + /// is no fixed sharding with this mode. + /// + [pbr::OriginalName("DYNAMIC")] Dynamic = 1, + /// + /// The following are static sharding policies. The semantics are similar to + /// `tf.data.experimental.AutoShardPolicy`. These policies require: + /// * The tf.data service cluster has a fixed size, and you need to specify + /// the workers in DispatcherConfig. + /// * Each client only reads from the local tf.data service worker. + /// + /// Shards by input files (each worker will get a set of files to process). + /// When this option is selected, make sure that there is at least as many + /// files as workers. If there are fewer input files than workers, a runtime + /// error will be raised. + /// + [pbr::OriginalName("FILE")] File = 2, + /// + /// Shards by elements produced by the dataset. Each worker will process the + /// whole dataset and discard the portion that is not for itself. Note that + /// for this mode to correctly partitions the dataset elements, the dataset + /// needs to produce elements in a deterministic order. + /// + [pbr::OriginalName("DATA")] Data = 3, + /// + /// Attempts FILE-based sharding, falling back to DATA-based sharding on + /// failures. + /// + [pbr::OriginalName("FILE_OR_DATA")] FileOrData = 4, + /// + /// Looks for the presence of `shard(SHARD_HINT, ...)` which is treated as a + /// placeholder to replace with `shard(num_workers, worker_index)`. + /// + [pbr::OriginalName("HINT")] Hint = 5, + } + + } + #endregion + + } + + /// + /// Metadata related to tf.data service datasets. + /// Next tag: 4 + /// + public sealed partial class DataServiceMetadata : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DataServiceMetadata()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.Data.DataServiceReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DataServiceMetadata() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DataServiceMetadata(DataServiceMetadata other) : this() { + compression_ = other.compression_; + cardinality_ = other.cardinality_; + switch (other.OptionalElementSpecCase) { + case OptionalElementSpecOneofCase.ElementSpec: + ElementSpec = other.ElementSpec; + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DataServiceMetadata Clone() { + return new DataServiceMetadata(this); + } + + /// Field number for the "element_spec" field. + public const int ElementSpecFieldNumber = 1; + /// + /// Serialized element spec. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pb::ByteString ElementSpec { + get { return optionalElementSpecCase_ == OptionalElementSpecOneofCase.ElementSpec ? (pb::ByteString) optionalElementSpec_ : pb::ByteString.Empty; } + set { + optionalElementSpec_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + optionalElementSpecCase_ = OptionalElementSpecOneofCase.ElementSpec; + } + } + + /// Field number for the "compression" field. + public const int CompressionFieldNumber = 2; + private global::Tensorflow.Data.DataServiceMetadata.Types.Compression compression_ = global::Tensorflow.Data.DataServiceMetadata.Types.Compression.Unspecified; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.Data.DataServiceMetadata.Types.Compression Compression { + get { return compression_; } + set { + compression_ = value; + } + } + + /// Field number for the "cardinality" field. + public const int CardinalityFieldNumber = 3; + private long cardinality_; + /// + /// Cardinality of the dataset. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Cardinality { + get { return cardinality_; } + set { + cardinality_ = value; + } + } + + private object optionalElementSpec_; + /// Enum of possible cases for the "optional_element_spec" oneof. + public enum OptionalElementSpecOneofCase { + None = 0, + ElementSpec = 1, + } + private OptionalElementSpecOneofCase optionalElementSpecCase_ = OptionalElementSpecOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public OptionalElementSpecOneofCase OptionalElementSpecCase { + get { return optionalElementSpecCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void ClearOptionalElementSpec() { + optionalElementSpecCase_ = OptionalElementSpecOneofCase.None; + optionalElementSpec_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as DataServiceMetadata); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(DataServiceMetadata other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ElementSpec != other.ElementSpec) return false; + if (Compression != other.Compression) return false; + if (Cardinality != other.Cardinality) return false; + if (OptionalElementSpecCase != other.OptionalElementSpecCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (optionalElementSpecCase_ == OptionalElementSpecOneofCase.ElementSpec) hash ^= ElementSpec.GetHashCode(); + if (Compression != global::Tensorflow.Data.DataServiceMetadata.Types.Compression.Unspecified) hash ^= Compression.GetHashCode(); + if (Cardinality != 0L) hash ^= Cardinality.GetHashCode(); + hash ^= (int) optionalElementSpecCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (optionalElementSpecCase_ == OptionalElementSpecOneofCase.ElementSpec) { + output.WriteRawTag(10); + output.WriteBytes(ElementSpec); + } + if (Compression != global::Tensorflow.Data.DataServiceMetadata.Types.Compression.Unspecified) { + output.WriteRawTag(16); + output.WriteEnum((int) Compression); + } + if (Cardinality != 0L) { + output.WriteRawTag(24); + output.WriteInt64(Cardinality); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (optionalElementSpecCase_ == OptionalElementSpecOneofCase.ElementSpec) { + output.WriteRawTag(10); + output.WriteBytes(ElementSpec); + } + if (Compression != global::Tensorflow.Data.DataServiceMetadata.Types.Compression.Unspecified) { + output.WriteRawTag(16); + output.WriteEnum((int) Compression); + } + if (Cardinality != 0L) { + output.WriteRawTag(24); + output.WriteInt64(Cardinality); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (optionalElementSpecCase_ == OptionalElementSpecOneofCase.ElementSpec) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(ElementSpec); + } + if (Compression != global::Tensorflow.Data.DataServiceMetadata.Types.Compression.Unspecified) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Compression); + } + if (Cardinality != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Cardinality); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(DataServiceMetadata other) { + if (other == null) { + return; + } + if (other.Compression != global::Tensorflow.Data.DataServiceMetadata.Types.Compression.Unspecified) { + Compression = other.Compression; + } + if (other.Cardinality != 0L) { + Cardinality = other.Cardinality; + } + switch (other.OptionalElementSpecCase) { + case OptionalElementSpecOneofCase.ElementSpec: + ElementSpec = other.ElementSpec; + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + ElementSpec = input.ReadBytes(); + break; + } + case 16: { + Compression = (global::Tensorflow.Data.DataServiceMetadata.Types.Compression) input.ReadEnum(); + break; + } + case 24: { + Cardinality = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + ElementSpec = input.ReadBytes(); + break; + } + case 16: { + Compression = (global::Tensorflow.Data.DataServiceMetadata.Types.Compression) input.ReadEnum(); + break; + } + case 24: { + Cardinality = input.ReadInt64(); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the DataServiceMetadata message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + public enum Compression { + [pbr::OriginalName("COMPRESSION_UNSPECIFIED")] Unspecified = 0, + /// + /// No compression. + /// + [pbr::OriginalName("COMPRESSION_OFF")] Off = 1, + /// + /// Snappy compression as defined in tensorflow/core/platform/snappy.h. + /// + [pbr::OriginalName("COMPRESSION_SNAPPY")] Snappy = 2, + } + + } + #endregion + + } + + public sealed partial class CrossTrainerCacheOptions : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CrossTrainerCacheOptions()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.Data.DataServiceReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CrossTrainerCacheOptions() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CrossTrainerCacheOptions(CrossTrainerCacheOptions other) : this() { + trainerId_ = other.trainerId_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CrossTrainerCacheOptions Clone() { + return new CrossTrainerCacheOptions(this); + } + + /// Field number for the "trainer_id" field. + public const int TrainerIdFieldNumber = 1; + private string trainerId_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string TrainerId { + get { return trainerId_; } + set { + trainerId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as CrossTrainerCacheOptions); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(CrossTrainerCacheOptions other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (TrainerId != other.TrainerId) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (TrainerId.Length != 0) hash ^= TrainerId.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (TrainerId.Length != 0) { + output.WriteRawTag(10); + output.WriteString(TrainerId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (TrainerId.Length != 0) { + output.WriteRawTag(10); + output.WriteString(TrainerId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (TrainerId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(TrainerId); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(CrossTrainerCacheOptions other) { + if (other == null) { + return; + } + if (other.TrainerId.Length != 0) { + TrainerId = other.TrainerId; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + TrainerId = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + TrainerId = input.ReadString(); + break; + } + } + } + } + #endif + + } + + /// + /// Data service config available to the client through GetDataServiceConfig RPC. + /// Next tag: 2 + /// + public sealed partial class DataServiceConfig : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DataServiceConfig()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.Data.DataServiceReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DataServiceConfig() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DataServiceConfig(DataServiceConfig other) : this() { + deploymentMode_ = other.deploymentMode_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DataServiceConfig Clone() { + return new DataServiceConfig(this); + } + + /// Field number for the "deployment_mode" field. + public const int DeploymentModeFieldNumber = 1; + private global::Tensorflow.Data.DeploymentMode deploymentMode_ = global::Tensorflow.Data.DeploymentMode.Unspecified; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.Data.DeploymentMode DeploymentMode { + get { return deploymentMode_; } + set { + deploymentMode_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as DataServiceConfig); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(DataServiceConfig other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (DeploymentMode != other.DeploymentMode) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (DeploymentMode != global::Tensorflow.Data.DeploymentMode.Unspecified) hash ^= DeploymentMode.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (DeploymentMode != global::Tensorflow.Data.DeploymentMode.Unspecified) { + output.WriteRawTag(8); + output.WriteEnum((int) DeploymentMode); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (DeploymentMode != global::Tensorflow.Data.DeploymentMode.Unspecified) { + output.WriteRawTag(8); + output.WriteEnum((int) DeploymentMode); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (DeploymentMode != global::Tensorflow.Data.DeploymentMode.Unspecified) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) DeploymentMode); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(DataServiceConfig other) { + if (other == null) { + return; + } + if (other.DeploymentMode != global::Tensorflow.Data.DeploymentMode.Unspecified) { + DeploymentMode = other.DeploymentMode; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + DeploymentMode = (global::Tensorflow.Data.DeploymentMode) input.ReadEnum(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + DeploymentMode = (global::Tensorflow.Data.DeploymentMode) input.ReadEnum(); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/TensorFlowNET.Core/Protobuf/Debug.cs b/src/TensorFlowNET.Core/Protobuf/Debug.cs index 5ef4662f2..85b3bc6cc 100644 --- a/src/TensorFlowNET.Core/Protobuf/Debug.cs +++ b/src/TensorFlowNET.Core/Protobuf/Debug.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/protobuf/debug.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -55,23 +55,31 @@ static DebugReflection() { /// /// Option for watching a node in TensorFlow Debugger (tfdbg). /// - public sealed partial class DebugTensorWatch : pb::IMessage { + public sealed partial class DebugTensorWatch : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DebugTensorWatch()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.DebugReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DebugTensorWatch() { OnConstruction(); } @@ -79,6 +87,7 @@ public DebugTensorWatch() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DebugTensorWatch(DebugTensorWatch other) : this() { nodeName_ = other.nodeName_; outputSlot_ = other.outputSlot_; @@ -89,6 +98,7 @@ public DebugTensorWatch(DebugTensorWatch other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DebugTensorWatch Clone() { return new DebugTensorWatch(this); } @@ -102,6 +112,7 @@ public DebugTensorWatch Clone() { /// general. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string NodeName { get { return nodeName_; } set { @@ -120,6 +131,7 @@ public string NodeName { /// errors currently. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int OutputSlot { get { return outputSlot_; } set { @@ -138,6 +150,7 @@ public int OutputSlot { /// e.g., {"DebugIdentity", "DebugNanCount"} /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField DebugOps { get { return debugOps_; } } @@ -170,6 +183,7 @@ public int OutputSlot { /// TODO(cais): More visible documentation of this in g3docs. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField DebugUrls { get { return debugUrls_; } } @@ -182,6 +196,7 @@ public int OutputSlot { /// incompatibility). Instead, just log the failure. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool TolerateDebugOpCreationFailures { get { return tolerateDebugOpCreationFailures_; } set { @@ -190,11 +205,13 @@ public bool TolerateDebugOpCreationFailures { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as DebugTensorWatch); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(DebugTensorWatch other) { if (ReferenceEquals(other, null)) { return false; @@ -211,6 +228,7 @@ public bool Equals(DebugTensorWatch other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (NodeName.Length != 0) hash ^= NodeName.GetHashCode(); @@ -225,12 +243,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (NodeName.Length != 0) { output.WriteRawTag(10); output.WriteString(NodeName); @@ -248,9 +271,35 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (NodeName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(NodeName); + } + if (OutputSlot != 0) { + output.WriteRawTag(16); + output.WriteInt32(OutputSlot); + } + debugOps_.WriteTo(ref output, _repeated_debugOps_codec); + debugUrls_.WriteTo(ref output, _repeated_debugUrls_codec); + if (TolerateDebugOpCreationFailures != false) { + output.WriteRawTag(40); + output.WriteBool(TolerateDebugOpCreationFailures); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (NodeName.Length != 0) { @@ -271,6 +320,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(DebugTensorWatch other) { if (other == null) { return; @@ -290,7 +340,11 @@ public void MergeFrom(DebugTensorWatch other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -319,30 +373,74 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + NodeName = input.ReadString(); + break; + } + case 16: { + OutputSlot = input.ReadInt32(); + break; + } + case 26: { + debugOps_.AddEntriesFrom(ref input, _repeated_debugOps_codec); + break; + } + case 34: { + debugUrls_.AddEntriesFrom(ref input, _repeated_debugUrls_codec); + break; + } + case 40: { + TolerateDebugOpCreationFailures = input.ReadBool(); + break; + } + } + } } + #endif } /// /// Options for initializing DebuggerState in TensorFlow Debugger (tfdbg). /// - public sealed partial class DebugOptions : pb::IMessage { + public sealed partial class DebugOptions : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DebugOptions()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.DebugReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DebugOptions() { OnConstruction(); } @@ -350,6 +448,7 @@ public DebugOptions() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DebugOptions(DebugOptions other) : this() { debugTensorWatchOpts_ = other.debugTensorWatchOpts_.Clone(); globalStep_ = other.globalStep_; @@ -358,6 +457,7 @@ public DebugOptions(DebugOptions other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DebugOptions Clone() { return new DebugOptions(this); } @@ -371,6 +471,7 @@ public DebugOptions Clone() { /// Debugging options /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField DebugTensorWatchOpts { get { return debugTensorWatchOpts_; } } @@ -384,6 +485,7 @@ public DebugOptions Clone() { /// step count. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long GlobalStep { get { return globalStep_; } set { @@ -401,6 +503,7 @@ public long GlobalStep { /// are cleaned up from the disk after each Session.run. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool ResetDiskByteUsage { get { return resetDiskByteUsage_; } set { @@ -409,11 +512,13 @@ public bool ResetDiskByteUsage { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as DebugOptions); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(DebugOptions other) { if (ReferenceEquals(other, null)) { return false; @@ -428,6 +533,7 @@ public bool Equals(DebugOptions other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= debugTensorWatchOpts_.GetHashCode(); @@ -440,12 +546,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else debugTensorWatchOpts_.WriteTo(output, _repeated_debugTensorWatchOpts_codec); if (GlobalStep != 0L) { output.WriteRawTag(80); @@ -458,9 +569,30 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + debugTensorWatchOpts_.WriteTo(ref output, _repeated_debugTensorWatchOpts_codec); + if (GlobalStep != 0L) { + output.WriteRawTag(80); + output.WriteInt64(GlobalStep); + } + if (ResetDiskByteUsage != false) { + output.WriteRawTag(88); + output.WriteBool(ResetDiskByteUsage); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += debugTensorWatchOpts_.CalculateSize(_repeated_debugTensorWatchOpts_codec); @@ -477,6 +609,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(DebugOptions other) { if (other == null) { return; @@ -492,7 +625,11 @@ public void MergeFrom(DebugOptions other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -513,27 +650,63 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 34: { + debugTensorWatchOpts_.AddEntriesFrom(ref input, _repeated_debugTensorWatchOpts_codec); + break; + } + case 80: { + GlobalStep = input.ReadInt64(); + break; + } + case 88: { + ResetDiskByteUsage = input.ReadBool(); + break; + } + } + } + } + #endif + } - public sealed partial class DebuggedSourceFile : pb::IMessage { + public sealed partial class DebuggedSourceFile : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DebuggedSourceFile()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.DebugReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DebuggedSourceFile() { OnConstruction(); } @@ -541,6 +714,7 @@ public DebuggedSourceFile() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DebuggedSourceFile(DebuggedSourceFile other) : this() { host_ = other.host_; filePath_ = other.filePath_; @@ -551,6 +725,7 @@ public DebuggedSourceFile(DebuggedSourceFile other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DebuggedSourceFile Clone() { return new DebuggedSourceFile(this); } @@ -562,6 +737,7 @@ public DebuggedSourceFile Clone() { /// The host name on which a source code file is located. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Host { get { return host_; } set { @@ -576,6 +752,7 @@ public string Host { /// Path to the source code file. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string FilePath { get { return filePath_; } set { @@ -590,6 +767,7 @@ public string FilePath { /// The timestamp at which the source code file is last modified. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long LastModified { get { return lastModified_; } set { @@ -604,6 +782,7 @@ public long LastModified { /// Byte size of the file. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long Bytes { get { return bytes_; } set { @@ -620,16 +799,19 @@ public long Bytes { /// Line-by-line content of the source code file. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Lines { get { return lines_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as DebuggedSourceFile); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(DebuggedSourceFile other) { if (ReferenceEquals(other, null)) { return false; @@ -646,6 +828,7 @@ public bool Equals(DebuggedSourceFile other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Host.Length != 0) hash ^= Host.GetHashCode(); @@ -660,12 +843,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Host.Length != 0) { output.WriteRawTag(10); output.WriteString(Host); @@ -686,9 +874,38 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Host.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Host); + } + if (FilePath.Length != 0) { + output.WriteRawTag(18); + output.WriteString(FilePath); + } + if (LastModified != 0L) { + output.WriteRawTag(24); + output.WriteInt64(LastModified); + } + if (Bytes != 0L) { + output.WriteRawTag(32); + output.WriteInt64(Bytes); + } + lines_.WriteTo(ref output, _repeated_lines_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Host.Length != 0) { @@ -711,6 +928,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(DebuggedSourceFile other) { if (other == null) { return; @@ -732,7 +950,11 @@ public void MergeFrom(DebuggedSourceFile other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -761,27 +983,71 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Host = input.ReadString(); + break; + } + case 18: { + FilePath = input.ReadString(); + break; + } + case 24: { + LastModified = input.ReadInt64(); + break; + } + case 32: { + Bytes = input.ReadInt64(); + break; + } + case 42: { + lines_.AddEntriesFrom(ref input, _repeated_lines_codec); + break; + } + } + } + } + #endif + } - public sealed partial class DebuggedSourceFiles : pb::IMessage { + public sealed partial class DebuggedSourceFiles : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DebuggedSourceFiles()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.DebugReflection.Descriptor.MessageTypes[3]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DebuggedSourceFiles() { OnConstruction(); } @@ -789,12 +1055,14 @@ public DebuggedSourceFiles() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DebuggedSourceFiles(DebuggedSourceFiles other) : this() { sourceFiles_ = other.sourceFiles_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DebuggedSourceFiles Clone() { return new DebuggedSourceFiles(this); } @@ -808,16 +1076,19 @@ public DebuggedSourceFiles Clone() { /// A collection of source code files. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField SourceFiles { get { return sourceFiles_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as DebuggedSourceFiles); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(DebuggedSourceFiles other) { if (ReferenceEquals(other, null)) { return false; @@ -830,6 +1101,7 @@ public bool Equals(DebuggedSourceFiles other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= sourceFiles_.GetHashCode(); @@ -840,19 +1112,37 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else sourceFiles_.WriteTo(output, _repeated_sourceFiles_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + sourceFiles_.WriteTo(ref output, _repeated_sourceFiles_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += sourceFiles_.CalculateSize(_repeated_sourceFiles_codec); @@ -863,6 +1153,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(DebuggedSourceFiles other) { if (other == null) { return; @@ -872,7 +1163,11 @@ public void MergeFrom(DebuggedSourceFiles other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -885,7 +1180,27 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + sourceFiles_.AddEntriesFrom(ref input, _repeated_sourceFiles_codec); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/DeviceAttributes.cs b/src/TensorFlowNET.Core/Protobuf/DeviceAttributes.cs index ec0d7c84c..81d17e932 100644 --- a/src/TensorFlowNET.Core/Protobuf/DeviceAttributes.cs +++ b/src/TensorFlowNET.Core/Protobuf/DeviceAttributes.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/device_attributes.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -30,44 +30,53 @@ static DeviceAttributesReflection() { "OAoKTG9jYWxMaW5rcxIqCgRsaW5rGAEgAygLMhwudGVuc29yZmxvdy5JbnRl", "cmNvbm5lY3RMaW5rIloKDkRldmljZUxvY2FsaXR5Eg4KBmJ1c19pZBgBIAEo", "BRIRCgludW1hX25vZGUYAiABKAUSJQoFbGlua3MYAyABKAsyFi50ZW5zb3Jm", - "bG93LkxvY2FsTGlua3MirAEKEERldmljZUF0dHJpYnV0ZXMSDAoEbmFtZRgB", + "bG93LkxvY2FsTGlua3MiwwEKEERldmljZUF0dHJpYnV0ZXMSDAoEbmFtZRgB", "IAEoCRITCgtkZXZpY2VfdHlwZRgCIAEoCRIUCgxtZW1vcnlfbGltaXQYBCAB", "KAMSLAoIbG9jYWxpdHkYBSABKAsyGi50ZW5zb3JmbG93LkRldmljZUxvY2Fs", "aXR5EhMKC2luY2FybmF0aW9uGAYgASgGEhwKFHBoeXNpY2FsX2RldmljZV9k", - "ZXNjGAcgASgJQpEBChhvcmcudGVuc29yZmxvdy5mcmFtZXdvcmtCFkRldmlj", - "ZUF0dHJpYnV0ZXNQcm90b3NQAVpYZ2l0aHViLmNvbS90ZW5zb3JmbG93L3Rl", - "bnNvcmZsb3cvdGVuc29yZmxvdy9nby9jb3JlL2ZyYW1ld29yay9kZXZpY2Vf", - "YXR0cmlidXRlc19nb19wcm90b/gBAWIGcHJvdG8z")); + "ZXNjGAcgASgJEhUKDXhsYV9nbG9iYWxfaWQYCCABKANCkQEKGG9yZy50ZW5z", + "b3JmbG93LmZyYW1ld29ya0IWRGV2aWNlQXR0cmlidXRlc1Byb3Rvc1ABWlhn", + "aXRodWIuY29tL3RlbnNvcmZsb3cvdGVuc29yZmxvdy90ZW5zb3JmbG93L2dv", + "L2NvcmUvZnJhbWV3b3JrL2RldmljZV9hdHRyaWJ1dGVzX2dvX3Byb3Rv+AEB", + "YgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.InterconnectLink), global::Tensorflow.InterconnectLink.Parser, new[]{ "DeviceId", "Type", "Strength" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.LocalLinks), global::Tensorflow.LocalLinks.Parser, new[]{ "Link" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.DeviceLocality), global::Tensorflow.DeviceLocality.Parser, new[]{ "BusId", "NumaNode", "Links" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.DeviceAttributes), global::Tensorflow.DeviceAttributes.Parser, new[]{ "Name", "DeviceType", "MemoryLimit", "Locality", "Incarnation", "PhysicalDeviceDesc" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.DeviceAttributes), global::Tensorflow.DeviceAttributes.Parser, new[]{ "Name", "DeviceType", "MemoryLimit", "Locality", "Incarnation", "PhysicalDeviceDesc", "XlaGlobalId" }, null, null, null, null) })); } #endregion } #region Messages - public sealed partial class InterconnectLink : pb::IMessage { + public sealed partial class InterconnectLink : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new InterconnectLink()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.DeviceAttributesReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public InterconnectLink() { OnConstruction(); } @@ -75,6 +84,7 @@ public InterconnectLink() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public InterconnectLink(InterconnectLink other) : this() { deviceId_ = other.deviceId_; type_ = other.type_; @@ -83,6 +93,7 @@ public InterconnectLink(InterconnectLink other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public InterconnectLink Clone() { return new InterconnectLink(this); } @@ -91,6 +102,7 @@ public InterconnectLink Clone() { public const int DeviceIdFieldNumber = 1; private int deviceId_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int DeviceId { get { return deviceId_; } set { @@ -102,6 +114,7 @@ public int DeviceId { public const int TypeFieldNumber = 2; private string type_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Type { get { return type_; } set { @@ -113,6 +126,7 @@ public string Type { public const int StrengthFieldNumber = 3; private int strength_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int Strength { get { return strength_; } set { @@ -121,11 +135,13 @@ public int Strength { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as InterconnectLink); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(InterconnectLink other) { if (ReferenceEquals(other, null)) { return false; @@ -140,6 +156,7 @@ public bool Equals(InterconnectLink other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (DeviceId != 0) hash ^= DeviceId.GetHashCode(); @@ -152,12 +169,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (DeviceId != 0) { output.WriteRawTag(8); output.WriteInt32(DeviceId); @@ -173,9 +195,33 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (DeviceId != 0) { + output.WriteRawTag(8); + output.WriteInt32(DeviceId); + } + if (Type.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Type); + } + if (Strength != 0) { + output.WriteRawTag(24); + output.WriteInt32(Strength); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (DeviceId != 0) { @@ -194,6 +240,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(InterconnectLink other) { if (other == null) { return; @@ -211,7 +258,11 @@ public void MergeFrom(InterconnectLink other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -232,27 +283,63 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + DeviceId = input.ReadInt32(); + break; + } + case 18: { + Type = input.ReadString(); + break; + } + case 24: { + Strength = input.ReadInt32(); + break; + } + } + } + } + #endif + } - public sealed partial class LocalLinks : pb::IMessage { + public sealed partial class LocalLinks : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new LocalLinks()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.DeviceAttributesReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public LocalLinks() { OnConstruction(); } @@ -260,12 +347,14 @@ public LocalLinks() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public LocalLinks(LocalLinks other) : this() { link_ = other.link_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public LocalLinks Clone() { return new LocalLinks(this); } @@ -276,16 +365,19 @@ public LocalLinks Clone() { = pb::FieldCodec.ForMessage(10, global::Tensorflow.InterconnectLink.Parser); private readonly pbc::RepeatedField link_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Link { get { return link_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as LocalLinks); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(LocalLinks other) { if (ReferenceEquals(other, null)) { return false; @@ -298,6 +390,7 @@ public bool Equals(LocalLinks other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= link_.GetHashCode(); @@ -308,19 +401,37 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else link_.WriteTo(output, _repeated_link_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + link_.WriteTo(ref output, _repeated_link_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += link_.CalculateSize(_repeated_link_codec); @@ -331,6 +442,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(LocalLinks other) { if (other == null) { return; @@ -340,7 +452,11 @@ public void MergeFrom(LocalLinks other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -353,27 +469,55 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + link_.AddEntriesFrom(ref input, _repeated_link_codec); + break; + } + } + } } + #endif } - public sealed partial class DeviceLocality : pb::IMessage { + public sealed partial class DeviceLocality : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeviceLocality()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.DeviceAttributesReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DeviceLocality() { OnConstruction(); } @@ -381,6 +525,7 @@ public DeviceLocality() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DeviceLocality(DeviceLocality other) : this() { busId_ = other.busId_; numaNode_ = other.numaNode_; @@ -389,6 +534,7 @@ public DeviceLocality(DeviceLocality other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DeviceLocality Clone() { return new DeviceLocality(this); } @@ -401,6 +547,7 @@ public DeviceLocality Clone() { /// no specific locality. Specific localities are indexed from 1. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int BusId { get { return busId_; } set { @@ -415,6 +562,7 @@ public int BusId { /// Optional NUMA locality of device. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int NumaNode { get { return numaNode_; } set { @@ -429,6 +577,7 @@ public int NumaNode { /// Optional local interconnect links to other devices. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.LocalLinks Links { get { return links_; } set { @@ -437,11 +586,13 @@ public int NumaNode { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as DeviceLocality); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(DeviceLocality other) { if (ReferenceEquals(other, null)) { return false; @@ -456,6 +607,7 @@ public bool Equals(DeviceLocality other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (BusId != 0) hash ^= BusId.GetHashCode(); @@ -468,12 +620,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (BusId != 0) { output.WriteRawTag(8); output.WriteInt32(BusId); @@ -489,9 +646,33 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (BusId != 0) { + output.WriteRawTag(8); + output.WriteInt32(BusId); + } + if (NumaNode != 0) { + output.WriteRawTag(16); + output.WriteInt32(NumaNode); + } + if (links_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Links); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (BusId != 0) { @@ -510,6 +691,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(DeviceLocality other) { if (other == null) { return; @@ -530,7 +712,11 @@ public void MergeFrom(DeviceLocality other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -554,27 +740,66 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + BusId = input.ReadInt32(); + break; + } + case 16: { + NumaNode = input.ReadInt32(); + break; + } + case 26: { + if (links_ == null) { + Links = new global::Tensorflow.LocalLinks(); + } + input.ReadMessage(Links); + break; + } + } + } } + #endif } - public sealed partial class DeviceAttributes : pb::IMessage { + public sealed partial class DeviceAttributes : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeviceAttributes()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.DeviceAttributesReflection.Descriptor.MessageTypes[3]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DeviceAttributes() { OnConstruction(); } @@ -582,6 +807,7 @@ public DeviceAttributes() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DeviceAttributes(DeviceAttributes other) : this() { name_ = other.name_; deviceType_ = other.deviceType_; @@ -589,10 +815,12 @@ public DeviceAttributes(DeviceAttributes other) : this() { locality_ = other.locality_ != null ? other.locality_.Clone() : null; incarnation_ = other.incarnation_; physicalDeviceDesc_ = other.physicalDeviceDesc_; + xlaGlobalId_ = other.xlaGlobalId_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DeviceAttributes Clone() { return new DeviceAttributes(this); } @@ -604,6 +832,7 @@ public DeviceAttributes Clone() { /// Fully specified name of the device within a cluster. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -618,6 +847,7 @@ public string Name { /// String representation of device_type. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string DeviceType { get { return deviceType_; } set { @@ -632,6 +862,7 @@ public string DeviceType { /// Memory capacity of device in bytes. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long MemoryLimit { get { return memoryLimit_; } set { @@ -647,6 +878,7 @@ public long MemoryLimit { /// for supporting efficient data transfers. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.DeviceLocality Locality { get { return locality_; } set { @@ -662,6 +894,7 @@ public long MemoryLimit { /// initialized. "incarnation" should never be 0. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ulong Incarnation { get { return incarnation_; } set { @@ -676,6 +909,7 @@ public ulong Incarnation { /// String representation of the physical device that this device maps to. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string PhysicalDeviceDesc { get { return physicalDeviceDesc_; } set { @@ -683,12 +917,31 @@ public string PhysicalDeviceDesc { } } + /// Field number for the "xla_global_id" field. + public const int XlaGlobalIdFieldNumber = 8; + private long xlaGlobalId_; + /// + /// A physical device ID for use in XLA DeviceAssignments, unique across + /// clients in a multi-client setup. Set to -1 if unavailable, non-negative + /// otherwise. + /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long XlaGlobalId { + get { return xlaGlobalId_; } + set { + xlaGlobalId_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as DeviceAttributes); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(DeviceAttributes other) { if (ReferenceEquals(other, null)) { return false; @@ -702,10 +955,12 @@ public bool Equals(DeviceAttributes other) { if (!object.Equals(Locality, other.Locality)) return false; if (Incarnation != other.Incarnation) return false; if (PhysicalDeviceDesc != other.PhysicalDeviceDesc) return false; + if (XlaGlobalId != other.XlaGlobalId) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -714,6 +969,7 @@ public override int GetHashCode() { if (locality_ != null) hash ^= Locality.GetHashCode(); if (Incarnation != 0UL) hash ^= Incarnation.GetHashCode(); if (PhysicalDeviceDesc.Length != 0) hash ^= PhysicalDeviceDesc.GetHashCode(); + if (XlaGlobalId != 0L) hash ^= XlaGlobalId.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -721,12 +977,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -751,12 +1012,56 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(58); output.WriteString(PhysicalDeviceDesc); } + if (XlaGlobalId != 0L) { + output.WriteRawTag(64); + output.WriteInt64(XlaGlobalId); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (DeviceType.Length != 0) { + output.WriteRawTag(18); + output.WriteString(DeviceType); + } + if (MemoryLimit != 0L) { + output.WriteRawTag(32); + output.WriteInt64(MemoryLimit); + } + if (locality_ != null) { + output.WriteRawTag(42); + output.WriteMessage(Locality); + } + if (Incarnation != 0UL) { + output.WriteRawTag(49); + output.WriteFixed64(Incarnation); + } + if (PhysicalDeviceDesc.Length != 0) { + output.WriteRawTag(58); + output.WriteString(PhysicalDeviceDesc); + } + if (XlaGlobalId != 0L) { + output.WriteRawTag(64); + output.WriteInt64(XlaGlobalId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -777,6 +1082,9 @@ public int CalculateSize() { if (PhysicalDeviceDesc.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(PhysicalDeviceDesc); } + if (XlaGlobalId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(XlaGlobalId); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -784,6 +1092,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(DeviceAttributes other) { if (other == null) { return; @@ -809,11 +1118,18 @@ public void MergeFrom(DeviceAttributes other) { if (other.PhysicalDeviceDesc.Length != 0) { PhysicalDeviceDesc = other.PhysicalDeviceDesc; } + if (other.XlaGlobalId != 0L) { + XlaGlobalId = other.XlaGlobalId; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -847,9 +1163,60 @@ public void MergeFrom(pb::CodedInputStream input) { PhysicalDeviceDesc = input.ReadString(); break; } + case 64: { + XlaGlobalId = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + DeviceType = input.ReadString(); + break; + } + case 32: { + MemoryLimit = input.ReadInt64(); + break; + } + case 42: { + if (locality_ == null) { + Locality = new global::Tensorflow.DeviceLocality(); + } + input.ReadMessage(Locality); + break; + } + case 49: { + Incarnation = input.ReadFixed64(); + break; + } + case 58: { + PhysicalDeviceDesc = input.ReadString(); + break; + } + case 64: { + XlaGlobalId = input.ReadInt64(); + break; + } } } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/Event.cs b/src/TensorFlowNET.Core/Protobuf/Event.cs index 131861687..cd80bf37d 100644 --- a/src/TensorFlowNET.Core/Protobuf/Event.cs +++ b/src/TensorFlowNET.Core/Protobuf/Event.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/util/event.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -110,23 +110,31 @@ public enum WorkerShutdownMode { /// Protocol buffer representing an event that happened during /// the execution of a Brain model. /// - public sealed partial class Event : pb::IMessage { + public sealed partial class Event : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Event()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.EventReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Event() { OnConstruction(); } @@ -134,6 +142,7 @@ public Event() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Event(Event other) : this() { wallTime_ = other.wallTime_; step_ = other.step_; @@ -165,6 +174,7 @@ public Event(Event other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Event Clone() { return new Event(this); } @@ -176,6 +186,7 @@ public Event Clone() { /// Timestamp of the event. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public double WallTime { get { return wallTime_; } set { @@ -190,6 +201,7 @@ public double WallTime { /// Global step of the event. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long Step { get { return step_; } set { @@ -206,6 +218,7 @@ public long Step { /// start with "brain.Event:". /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string FileVersion { get { return whatCase_ == WhatOneofCase.FileVersion ? (string) what_ : ""; } set { @@ -220,6 +233,7 @@ public string FileVersion { /// An encoded version of a GraphDef. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pb::ByteString GraphDef { get { return whatCase_ == WhatOneofCase.GraphDef ? (pb::ByteString) what_ : pb::ByteString.Empty; } set { @@ -234,6 +248,7 @@ public string FileVersion { /// A summary was generated. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.Summary Summary { get { return whatCase_ == WhatOneofCase.Summary ? (global::Tensorflow.Summary) what_ : null; } set { @@ -251,6 +266,7 @@ public string FileVersion { /// [global::System.ObsoleteAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.LogMessage LogMessage { get { return whatCase_ == WhatOneofCase.LogMessage ? (global::Tensorflow.LogMessage) what_ : null; } set { @@ -265,6 +281,7 @@ public string FileVersion { /// The state of the session which can be used for restarting after crashes. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.SessionLog SessionLog { get { return whatCase_ == WhatOneofCase.SessionLog ? (global::Tensorflow.SessionLog) what_ : null; } set { @@ -279,6 +296,7 @@ public string FileVersion { /// The metadata returned by running a session.run() call. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TaggedRunMetadata TaggedRunMetadata { get { return whatCase_ == WhatOneofCase.TaggedRunMetadata ? (global::Tensorflow.TaggedRunMetadata) what_ : null; } set { @@ -293,6 +311,7 @@ public string FileVersion { /// An encoded version of a MetaGraphDef. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pb::ByteString MetaGraphDef { get { return whatCase_ == WhatOneofCase.MetaGraphDef ? (pb::ByteString) what_ : pb::ByteString.Empty; } set { @@ -315,22 +334,26 @@ public enum WhatOneofCase { } private WhatOneofCase whatCase_ = WhatOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public WhatOneofCase WhatCase { get { return whatCase_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void ClearWhat() { whatCase_ = WhatOneofCase.None; what_ = null; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as Event); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(Event other) { if (ReferenceEquals(other, null)) { return false; @@ -352,6 +375,7 @@ public bool Equals(Event other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (WallTime != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(WallTime); @@ -371,12 +395,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (WallTime != 0D) { output.WriteRawTag(9); output.WriteDouble(WallTime); @@ -416,9 +445,57 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (WallTime != 0D) { + output.WriteRawTag(9); + output.WriteDouble(WallTime); + } + if (Step != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Step); + } + if (whatCase_ == WhatOneofCase.FileVersion) { + output.WriteRawTag(26); + output.WriteString(FileVersion); + } + if (whatCase_ == WhatOneofCase.GraphDef) { + output.WriteRawTag(34); + output.WriteBytes(GraphDef); + } + if (whatCase_ == WhatOneofCase.Summary) { + output.WriteRawTag(42); + output.WriteMessage(Summary); + } + if (whatCase_ == WhatOneofCase.LogMessage) { + output.WriteRawTag(50); + output.WriteMessage(LogMessage); + } + if (whatCase_ == WhatOneofCase.SessionLog) { + output.WriteRawTag(58); + output.WriteMessage(SessionLog); + } + if (whatCase_ == WhatOneofCase.TaggedRunMetadata) { + output.WriteRawTag(66); + output.WriteMessage(TaggedRunMetadata); + } + if (whatCase_ == WhatOneofCase.MetaGraphDef) { + output.WriteRawTag(74); + output.WriteBytes(MetaGraphDef); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (WallTime != 0D) { @@ -455,6 +532,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(Event other) { if (other == null) { return; @@ -505,7 +583,11 @@ public void MergeFrom(Event other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -570,8 +652,80 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 9: { + WallTime = input.ReadDouble(); + break; + } + case 16: { + Step = input.ReadInt64(); + break; + } + case 26: { + FileVersion = input.ReadString(); + break; + } + case 34: { + GraphDef = input.ReadBytes(); + break; + } + case 42: { + global::Tensorflow.Summary subBuilder = new global::Tensorflow.Summary(); + if (whatCase_ == WhatOneofCase.Summary) { + subBuilder.MergeFrom(Summary); + } + input.ReadMessage(subBuilder); + Summary = subBuilder; + break; + } + case 50: { + global::Tensorflow.LogMessage subBuilder = new global::Tensorflow.LogMessage(); + if (whatCase_ == WhatOneofCase.LogMessage) { + subBuilder.MergeFrom(LogMessage); + } + input.ReadMessage(subBuilder); + LogMessage = subBuilder; + break; + } + case 58: { + global::Tensorflow.SessionLog subBuilder = new global::Tensorflow.SessionLog(); + if (whatCase_ == WhatOneofCase.SessionLog) { + subBuilder.MergeFrom(SessionLog); + } + input.ReadMessage(subBuilder); + SessionLog = subBuilder; + break; + } + case 66: { + global::Tensorflow.TaggedRunMetadata subBuilder = new global::Tensorflow.TaggedRunMetadata(); + if (whatCase_ == WhatOneofCase.TaggedRunMetadata) { + subBuilder.MergeFrom(TaggedRunMetadata); + } + input.ReadMessage(subBuilder); + TaggedRunMetadata = subBuilder; + break; + } + case 74: { + MetaGraphDef = input.ReadBytes(); + break; + } + } + } + } + #endif + } /// @@ -581,23 +735,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// has been removed; this message is now deprecated and should not be used. /// [global::System.ObsoleteAttribute] - public sealed partial class LogMessage : pb::IMessage { + public sealed partial class LogMessage : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new LogMessage()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.EventReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public LogMessage() { OnConstruction(); } @@ -605,6 +767,7 @@ public LogMessage() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public LogMessage(LogMessage other) : this() { level_ = other.level_; message_ = other.message_; @@ -612,6 +775,7 @@ public LogMessage(LogMessage other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public LogMessage Clone() { return new LogMessage(this); } @@ -620,6 +784,7 @@ public LogMessage Clone() { public const int LevelFieldNumber = 1; private global::Tensorflow.LogMessage.Types.Level level_ = global::Tensorflow.LogMessage.Types.Level.Unknown; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.LogMessage.Types.Level Level { get { return level_; } set { @@ -631,6 +796,7 @@ public LogMessage Clone() { public const int MessageFieldNumber = 2; private string message_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Message { get { return message_; } set { @@ -639,11 +805,13 @@ public string Message { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as LogMessage); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(LogMessage other) { if (ReferenceEquals(other, null)) { return false; @@ -657,6 +825,7 @@ public bool Equals(LogMessage other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Level != global::Tensorflow.LogMessage.Types.Level.Unknown) hash ^= Level.GetHashCode(); @@ -668,12 +837,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Level != global::Tensorflow.LogMessage.Types.Level.Unknown) { output.WriteRawTag(8); output.WriteEnum((int) Level); @@ -685,9 +859,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Level != global::Tensorflow.LogMessage.Types.Level.Unknown) { + output.WriteRawTag(8); + output.WriteEnum((int) Level); + } + if (Message.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Message); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Level != global::Tensorflow.LogMessage.Types.Level.Unknown) { @@ -703,6 +897,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(LogMessage other) { if (other == null) { return; @@ -717,7 +912,11 @@ public void MergeFrom(LogMessage other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -734,11 +933,36 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Level = (global::Tensorflow.LogMessage.Types.Level) input.ReadEnum(); + break; + } + case 18: { + Message = input.ReadString(); + break; + } + } + } + } + #endif + #region Nested types /// Container for nested types declared in the LogMessage message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { public enum Level { [pbr::OriginalName("UNKNOWN")] Unknown = 0, @@ -763,23 +987,31 @@ public enum Level { /// /// Protocol buffer used for logging session state. /// - public sealed partial class SessionLog : pb::IMessage { + public sealed partial class SessionLog : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SessionLog()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.EventReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SessionLog() { OnConstruction(); } @@ -787,6 +1019,7 @@ public SessionLog() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SessionLog(SessionLog other) : this() { status_ = other.status_; checkpointPath_ = other.checkpointPath_; @@ -795,6 +1028,7 @@ public SessionLog(SessionLog other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SessionLog Clone() { return new SessionLog(this); } @@ -803,6 +1037,7 @@ public SessionLog Clone() { public const int StatusFieldNumber = 1; private global::Tensorflow.SessionLog.Types.SessionStatus status_ = global::Tensorflow.SessionLog.Types.SessionStatus.StatusUnspecified; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.SessionLog.Types.SessionStatus Status { get { return status_; } set { @@ -817,6 +1052,7 @@ public SessionLog Clone() { /// This checkpoint_path contains both the path and filename. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string CheckpointPath { get { return checkpointPath_; } set { @@ -828,6 +1064,7 @@ public string CheckpointPath { public const int MsgFieldNumber = 3; private string msg_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Msg { get { return msg_; } set { @@ -836,11 +1073,13 @@ public string Msg { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as SessionLog); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(SessionLog other) { if (ReferenceEquals(other, null)) { return false; @@ -855,6 +1094,7 @@ public bool Equals(SessionLog other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Status != global::Tensorflow.SessionLog.Types.SessionStatus.StatusUnspecified) hash ^= Status.GetHashCode(); @@ -867,12 +1107,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Status != global::Tensorflow.SessionLog.Types.SessionStatus.StatusUnspecified) { output.WriteRawTag(8); output.WriteEnum((int) Status); @@ -888,9 +1133,33 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Status != global::Tensorflow.SessionLog.Types.SessionStatus.StatusUnspecified) { + output.WriteRawTag(8); + output.WriteEnum((int) Status); + } + if (CheckpointPath.Length != 0) { + output.WriteRawTag(18); + output.WriteString(CheckpointPath); + } + if (Msg.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Msg); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Status != global::Tensorflow.SessionLog.Types.SessionStatus.StatusUnspecified) { @@ -909,6 +1178,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(SessionLog other) { if (other == null) { return; @@ -926,7 +1196,11 @@ public void MergeFrom(SessionLog other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -947,11 +1221,40 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Status = (global::Tensorflow.SessionLog.Types.SessionStatus) input.ReadEnum(); + break; + } + case 18: { + CheckpointPath = input.ReadString(); + break; + } + case 26: { + Msg = input.ReadString(); + break; + } + } + } + } + #endif + #region Nested types /// Container for nested types declared in the SessionLog message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { public enum SessionStatus { [pbr::OriginalName("STATUS_UNSPECIFIED")] StatusUnspecified = 0, @@ -968,23 +1271,31 @@ public enum SessionStatus { /// /// For logging the metadata output for a single session.run() call. /// - public sealed partial class TaggedRunMetadata : pb::IMessage { + public sealed partial class TaggedRunMetadata : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TaggedRunMetadata()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.EventReflection.Descriptor.MessageTypes[3]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TaggedRunMetadata() { OnConstruction(); } @@ -992,6 +1303,7 @@ public TaggedRunMetadata() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TaggedRunMetadata(TaggedRunMetadata other) : this() { tag_ = other.tag_; runMetadata_ = other.runMetadata_; @@ -999,6 +1311,7 @@ public TaggedRunMetadata(TaggedRunMetadata other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TaggedRunMetadata Clone() { return new TaggedRunMetadata(this); } @@ -1010,6 +1323,7 @@ public TaggedRunMetadata Clone() { /// Tag name associated with this metadata. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Tag { get { return tag_; } set { @@ -1025,6 +1339,7 @@ public string Tag { /// deserialization. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pb::ByteString RunMetadata { get { return runMetadata_; } set { @@ -1033,11 +1348,13 @@ public string Tag { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as TaggedRunMetadata); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(TaggedRunMetadata other) { if (ReferenceEquals(other, null)) { return false; @@ -1051,6 +1368,7 @@ public bool Equals(TaggedRunMetadata other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Tag.Length != 0) hash ^= Tag.GetHashCode(); @@ -1062,12 +1380,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Tag.Length != 0) { output.WriteRawTag(10); output.WriteString(Tag); @@ -1079,9 +1402,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Tag.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Tag); + } + if (RunMetadata.Length != 0) { + output.WriteRawTag(18); + output.WriteBytes(RunMetadata); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Tag.Length != 0) { @@ -1097,6 +1440,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(TaggedRunMetadata other) { if (other == null) { return; @@ -1111,7 +1455,11 @@ public void MergeFrom(TaggedRunMetadata other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1128,27 +1476,59 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Tag = input.ReadString(); + break; + } + case 18: { + RunMetadata = input.ReadBytes(); + break; + } + } + } + } + #endif + } - public sealed partial class WatchdogConfig : pb::IMessage { + public sealed partial class WatchdogConfig : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WatchdogConfig()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.EventReflection.Descriptor.MessageTypes[4]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public WatchdogConfig() { OnConstruction(); } @@ -1156,12 +1536,14 @@ public WatchdogConfig() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public WatchdogConfig(WatchdogConfig other) : this() { timeoutMs_ = other.timeoutMs_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public WatchdogConfig Clone() { return new WatchdogConfig(this); } @@ -1170,6 +1552,7 @@ public WatchdogConfig Clone() { public const int TimeoutMsFieldNumber = 1; private long timeoutMs_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long TimeoutMs { get { return timeoutMs_; } set { @@ -1178,11 +1561,13 @@ public long TimeoutMs { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as WatchdogConfig); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(WatchdogConfig other) { if (ReferenceEquals(other, null)) { return false; @@ -1195,6 +1580,7 @@ public bool Equals(WatchdogConfig other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (TimeoutMs != 0L) hash ^= TimeoutMs.GetHashCode(); @@ -1205,12 +1591,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (TimeoutMs != 0L) { output.WriteRawTag(8); output.WriteInt64(TimeoutMs); @@ -1218,9 +1609,25 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (TimeoutMs != 0L) { + output.WriteRawTag(8); + output.WriteInt64(TimeoutMs); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (TimeoutMs != 0L) { @@ -1233,6 +1640,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(WatchdogConfig other) { if (other == null) { return; @@ -1244,7 +1652,11 @@ public void MergeFrom(WatchdogConfig other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1257,27 +1669,55 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + TimeoutMs = input.ReadInt64(); + break; + } + } + } + } + #endif + } - public sealed partial class RequestedExitCode : pb::IMessage { + public sealed partial class RequestedExitCode : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RequestedExitCode()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.EventReflection.Descriptor.MessageTypes[5]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public RequestedExitCode() { OnConstruction(); } @@ -1285,12 +1725,14 @@ public RequestedExitCode() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public RequestedExitCode(RequestedExitCode other) : this() { exitCode_ = other.exitCode_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public RequestedExitCode Clone() { return new RequestedExitCode(this); } @@ -1299,6 +1741,7 @@ public RequestedExitCode Clone() { public const int ExitCodeFieldNumber = 1; private int exitCode_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int ExitCode { get { return exitCode_; } set { @@ -1307,11 +1750,13 @@ public int ExitCode { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as RequestedExitCode); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(RequestedExitCode other) { if (ReferenceEquals(other, null)) { return false; @@ -1324,6 +1769,7 @@ public bool Equals(RequestedExitCode other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (ExitCode != 0) hash ^= ExitCode.GetHashCode(); @@ -1334,12 +1780,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (ExitCode != 0) { output.WriteRawTag(8); output.WriteInt32(ExitCode); @@ -1347,9 +1798,25 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ExitCode != 0) { + output.WriteRawTag(8); + output.WriteInt32(ExitCode); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (ExitCode != 0) { @@ -1362,6 +1829,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(RequestedExitCode other) { if (other == null) { return; @@ -1373,7 +1841,11 @@ public void MergeFrom(RequestedExitCode other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1386,27 +1858,55 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + ExitCode = input.ReadInt32(); + break; + } + } + } } + #endif } - public sealed partial class WorkerHeartbeatRequest : pb::IMessage { + public sealed partial class WorkerHeartbeatRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WorkerHeartbeatRequest()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.EventReflection.Descriptor.MessageTypes[6]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public WorkerHeartbeatRequest() { OnConstruction(); } @@ -1414,6 +1914,7 @@ public WorkerHeartbeatRequest() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public WorkerHeartbeatRequest(WorkerHeartbeatRequest other) : this() { shutdownMode_ = other.shutdownMode_; watchdogConfig_ = other.watchdogConfig_ != null ? other.watchdogConfig_.Clone() : null; @@ -1422,6 +1923,7 @@ public WorkerHeartbeatRequest(WorkerHeartbeatRequest other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public WorkerHeartbeatRequest Clone() { return new WorkerHeartbeatRequest(this); } @@ -1430,6 +1932,7 @@ public WorkerHeartbeatRequest Clone() { public const int ShutdownModeFieldNumber = 1; private global::Tensorflow.WorkerShutdownMode shutdownMode_ = global::Tensorflow.WorkerShutdownMode.Default; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.WorkerShutdownMode ShutdownMode { get { return shutdownMode_; } set { @@ -1441,6 +1944,7 @@ public WorkerHeartbeatRequest Clone() { public const int WatchdogConfigFieldNumber = 2; private global::Tensorflow.WatchdogConfig watchdogConfig_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.WatchdogConfig WatchdogConfig { get { return watchdogConfig_; } set { @@ -1452,6 +1956,7 @@ public WorkerHeartbeatRequest Clone() { public const int ExitCodeFieldNumber = 3; private global::Tensorflow.RequestedExitCode exitCode_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RequestedExitCode ExitCode { get { return exitCode_; } set { @@ -1460,11 +1965,13 @@ public WorkerHeartbeatRequest Clone() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as WorkerHeartbeatRequest); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(WorkerHeartbeatRequest other) { if (ReferenceEquals(other, null)) { return false; @@ -1479,6 +1986,7 @@ public bool Equals(WorkerHeartbeatRequest other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (ShutdownMode != global::Tensorflow.WorkerShutdownMode.Default) hash ^= ShutdownMode.GetHashCode(); @@ -1491,12 +1999,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (ShutdownMode != global::Tensorflow.WorkerShutdownMode.Default) { output.WriteRawTag(8); output.WriteEnum((int) ShutdownMode); @@ -1512,9 +2025,33 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ShutdownMode != global::Tensorflow.WorkerShutdownMode.Default) { + output.WriteRawTag(8); + output.WriteEnum((int) ShutdownMode); + } + if (watchdogConfig_ != null) { + output.WriteRawTag(18); + output.WriteMessage(WatchdogConfig); + } + if (exitCode_ != null) { + output.WriteRawTag(26); + output.WriteMessage(ExitCode); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (ShutdownMode != global::Tensorflow.WorkerShutdownMode.Default) { @@ -1533,6 +2070,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(WorkerHeartbeatRequest other) { if (other == null) { return; @@ -1556,7 +2094,11 @@ public void MergeFrom(WorkerHeartbeatRequest other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1583,27 +2125,69 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + ShutdownMode = (global::Tensorflow.WorkerShutdownMode) input.ReadEnum(); + break; + } + case 18: { + if (watchdogConfig_ == null) { + WatchdogConfig = new global::Tensorflow.WatchdogConfig(); + } + input.ReadMessage(WatchdogConfig); + break; + } + case 26: { + if (exitCode_ == null) { + ExitCode = new global::Tensorflow.RequestedExitCode(); + } + input.ReadMessage(ExitCode); + break; + } + } + } + } + #endif + } - public sealed partial class WorkerHeartbeatResponse : pb::IMessage { + public sealed partial class WorkerHeartbeatResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WorkerHeartbeatResponse()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.EventReflection.Descriptor.MessageTypes[7]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public WorkerHeartbeatResponse() { OnConstruction(); } @@ -1611,6 +2195,7 @@ public WorkerHeartbeatResponse() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public WorkerHeartbeatResponse(WorkerHeartbeatResponse other) : this() { healthStatus_ = other.healthStatus_; workerLog_ = other.workerLog_.Clone(); @@ -1619,6 +2204,7 @@ public WorkerHeartbeatResponse(WorkerHeartbeatResponse other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public WorkerHeartbeatResponse Clone() { return new WorkerHeartbeatResponse(this); } @@ -1627,6 +2213,7 @@ public WorkerHeartbeatResponse Clone() { public const int HealthStatusFieldNumber = 1; private global::Tensorflow.WorkerHealth healthStatus_ = global::Tensorflow.WorkerHealth.Ok; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.WorkerHealth HealthStatus { get { return healthStatus_; } set { @@ -1640,6 +2227,7 @@ public WorkerHeartbeatResponse Clone() { = pb::FieldCodec.ForMessage(18, global::Tensorflow.Event.Parser); private readonly pbc::RepeatedField workerLog_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField WorkerLog { get { return workerLog_; } } @@ -1648,6 +2236,7 @@ public WorkerHeartbeatResponse Clone() { public const int HostnameFieldNumber = 3; private string hostname_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Hostname { get { return hostname_; } set { @@ -1656,11 +2245,13 @@ public string Hostname { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as WorkerHeartbeatResponse); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(WorkerHeartbeatResponse other) { if (ReferenceEquals(other, null)) { return false; @@ -1675,6 +2266,7 @@ public bool Equals(WorkerHeartbeatResponse other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (HealthStatus != global::Tensorflow.WorkerHealth.Ok) hash ^= HealthStatus.GetHashCode(); @@ -1687,12 +2279,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (HealthStatus != global::Tensorflow.WorkerHealth.Ok) { output.WriteRawTag(8); output.WriteEnum((int) HealthStatus); @@ -1705,9 +2302,30 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (HealthStatus != global::Tensorflow.WorkerHealth.Ok) { + output.WriteRawTag(8); + output.WriteEnum((int) HealthStatus); + } + workerLog_.WriteTo(ref output, _repeated_workerLog_codec); + if (Hostname.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Hostname); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (HealthStatus != global::Tensorflow.WorkerHealth.Ok) { @@ -1724,6 +2342,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(WorkerHeartbeatResponse other) { if (other == null) { return; @@ -1739,7 +2358,11 @@ public void MergeFrom(WorkerHeartbeatResponse other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1760,7 +2383,35 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + HealthStatus = (global::Tensorflow.WorkerHealth) input.ReadEnum(); + break; + } + case 18: { + workerLog_.AddEntriesFrom(ref input, _repeated_workerLog_codec); + break; + } + case 26: { + Hostname = input.ReadString(); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/Executable.cs b/src/TensorFlowNET.Core/Protobuf/Executable.cs new file mode 100644 index 000000000..245c87ffb --- /dev/null +++ b/src/TensorFlowNET.Core/Protobuf/Executable.cs @@ -0,0 +1,340 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tensorflow/compiler/xla/service/cpu/executable.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Xla.Cpu { + + /// Holder for reflection information generated from tensorflow/compiler/xla/service/cpu/executable.proto + public static partial class ExecutableReflection { + + #region Descriptor + /// File descriptor for tensorflow/compiler/xla/service/cpu/executable.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ExecutableReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CjR0ZW5zb3JmbG93L2NvbXBpbGVyL3hsYS9zZXJ2aWNlL2NwdS9leGVjdXRh", + "YmxlLnByb3RvEgd4bGEuY3B1Gjd0ZW5zb3JmbG93L2NvbXBpbGVyL3hsYS9z", + "ZXJ2aWNlL2NwdS94bGFfZnJhbWV3b3JrLnByb3RvGil0ZW5zb3JmbG93L2Nv", + "bXBpbGVyL3hsYS9zZXJ2aWNlL2hsby5wcm90byLXAQocWGxhUnVudGltZUNw", + "dUV4ZWN1dGFibGVQcm90bxI+ChZ4bGFfcnVudGltZV9leGVjdXRhYmxlGAEg", + "ASgLMh4ueGxhLlhsYVJ1bnRpbWVFeGVjdXRhYmxlUHJvdG8SQAoVeGxhX2Zy", + "YW1ld29ya19tYXBwaW5nGAIgASgLMiEueGxhLmNwdS5YbGFGcmFtZXdvcmtN", + "YXBwaW5nUHJvdG8SNQoRYnVmZmVyX2Fzc2lnbm1lbnQYAyABKAsyGi54bGEu", + "QnVmZmVyQXNzaWdubWVudFByb3Rv")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Xla.Cpu.XlaFrameworkReflection.Descriptor, global::Xla.HloReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.Cpu.XlaRuntimeCpuExecutableProto), global::Xla.Cpu.XlaRuntimeCpuExecutableProto.Parser, new[]{ "XlaRuntimeExecutable", "XlaFrameworkMapping", "BufferAssignment" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class XlaRuntimeCpuExecutableProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new XlaRuntimeCpuExecutableProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.Cpu.ExecutableReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public XlaRuntimeCpuExecutableProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public XlaRuntimeCpuExecutableProto(XlaRuntimeCpuExecutableProto other) : this() { + xlaRuntimeExecutable_ = other.xlaRuntimeExecutable_ != null ? other.xlaRuntimeExecutable_.Clone() : null; + xlaFrameworkMapping_ = other.xlaFrameworkMapping_ != null ? other.xlaFrameworkMapping_.Clone() : null; + bufferAssignment_ = other.bufferAssignment_ != null ? other.bufferAssignment_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public XlaRuntimeCpuExecutableProto Clone() { + return new XlaRuntimeCpuExecutableProto(this); + } + + /// Field number for the "xla_runtime_executable" field. + public const int XlaRuntimeExecutableFieldNumber = 1; + private global::Xla.XlaRuntimeExecutableProto xlaRuntimeExecutable_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.XlaRuntimeExecutableProto XlaRuntimeExecutable { + get { return xlaRuntimeExecutable_; } + set { + xlaRuntimeExecutable_ = value; + } + } + + /// Field number for the "xla_framework_mapping" field. + public const int XlaFrameworkMappingFieldNumber = 2; + private global::Xla.Cpu.XlaFrameworkMappingProto xlaFrameworkMapping_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.Cpu.XlaFrameworkMappingProto XlaFrameworkMapping { + get { return xlaFrameworkMapping_; } + set { + xlaFrameworkMapping_ = value; + } + } + + /// Field number for the "buffer_assignment" field. + public const int BufferAssignmentFieldNumber = 3; + private global::Xla.BufferAssignmentProto bufferAssignment_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.BufferAssignmentProto BufferAssignment { + get { return bufferAssignment_; } + set { + bufferAssignment_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as XlaRuntimeCpuExecutableProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(XlaRuntimeCpuExecutableProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(XlaRuntimeExecutable, other.XlaRuntimeExecutable)) return false; + if (!object.Equals(XlaFrameworkMapping, other.XlaFrameworkMapping)) return false; + if (!object.Equals(BufferAssignment, other.BufferAssignment)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (xlaRuntimeExecutable_ != null) hash ^= XlaRuntimeExecutable.GetHashCode(); + if (xlaFrameworkMapping_ != null) hash ^= XlaFrameworkMapping.GetHashCode(); + if (bufferAssignment_ != null) hash ^= BufferAssignment.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (xlaRuntimeExecutable_ != null) { + output.WriteRawTag(10); + output.WriteMessage(XlaRuntimeExecutable); + } + if (xlaFrameworkMapping_ != null) { + output.WriteRawTag(18); + output.WriteMessage(XlaFrameworkMapping); + } + if (bufferAssignment_ != null) { + output.WriteRawTag(26); + output.WriteMessage(BufferAssignment); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (xlaRuntimeExecutable_ != null) { + output.WriteRawTag(10); + output.WriteMessage(XlaRuntimeExecutable); + } + if (xlaFrameworkMapping_ != null) { + output.WriteRawTag(18); + output.WriteMessage(XlaFrameworkMapping); + } + if (bufferAssignment_ != null) { + output.WriteRawTag(26); + output.WriteMessage(BufferAssignment); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (xlaRuntimeExecutable_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(XlaRuntimeExecutable); + } + if (xlaFrameworkMapping_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(XlaFrameworkMapping); + } + if (bufferAssignment_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(BufferAssignment); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(XlaRuntimeCpuExecutableProto other) { + if (other == null) { + return; + } + if (other.xlaRuntimeExecutable_ != null) { + if (xlaRuntimeExecutable_ == null) { + XlaRuntimeExecutable = new global::Xla.XlaRuntimeExecutableProto(); + } + XlaRuntimeExecutable.MergeFrom(other.XlaRuntimeExecutable); + } + if (other.xlaFrameworkMapping_ != null) { + if (xlaFrameworkMapping_ == null) { + XlaFrameworkMapping = new global::Xla.Cpu.XlaFrameworkMappingProto(); + } + XlaFrameworkMapping.MergeFrom(other.XlaFrameworkMapping); + } + if (other.bufferAssignment_ != null) { + if (bufferAssignment_ == null) { + BufferAssignment = new global::Xla.BufferAssignmentProto(); + } + BufferAssignment.MergeFrom(other.BufferAssignment); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (xlaRuntimeExecutable_ == null) { + XlaRuntimeExecutable = new global::Xla.XlaRuntimeExecutableProto(); + } + input.ReadMessage(XlaRuntimeExecutable); + break; + } + case 18: { + if (xlaFrameworkMapping_ == null) { + XlaFrameworkMapping = new global::Xla.Cpu.XlaFrameworkMappingProto(); + } + input.ReadMessage(XlaFrameworkMapping); + break; + } + case 26: { + if (bufferAssignment_ == null) { + BufferAssignment = new global::Xla.BufferAssignmentProto(); + } + input.ReadMessage(BufferAssignment); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (xlaRuntimeExecutable_ == null) { + XlaRuntimeExecutable = new global::Xla.XlaRuntimeExecutableProto(); + } + input.ReadMessage(XlaRuntimeExecutable); + break; + } + case 18: { + if (xlaFrameworkMapping_ == null) { + XlaFrameworkMapping = new global::Xla.Cpu.XlaFrameworkMappingProto(); + } + input.ReadMessage(XlaFrameworkMapping); + break; + } + case 26: { + if (bufferAssignment_ == null) { + BufferAssignment = new global::Xla.BufferAssignmentProto(); + } + input.ReadMessage(BufferAssignment); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/TensorFlowNET.Core/Protobuf/FullType.cs b/src/TensorFlowNET.Core/Protobuf/FullType.cs index a8b54b2a6..dee5571e8 100644 --- a/src/TensorFlowNET.Core/Protobuf/FullType.cs +++ b/src/TensorFlowNET.Core/Protobuf/FullType.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/full_type.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -25,26 +25,30 @@ static FullTypeReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "Cil0ZW5zb3JmbG93L2NvcmUvZnJhbWV3b3JrL2Z1bGxfdHlwZS5wcm90bxIK", - "dGVuc29yZmxvdyJyCgtGdWxsVHlwZURlZhInCgd0eXBlX2lkGAEgASgOMhYu", + "dGVuc29yZmxvdyJ/CgtGdWxsVHlwZURlZhInCgd0eXBlX2lkGAEgASgOMhYu", "dGVuc29yZmxvdy5GdWxsVHlwZUlkEiUKBGFyZ3MYAiADKAsyFy50ZW5zb3Jm", - "bG93LkZ1bGxUeXBlRGVmEgsKAXMYAyABKAlIAEIGCgRhdHRyKqwDCgpGdWxs", - "VHlwZUlkEg0KCVRGVF9VTlNFVBAAEgsKB1RGVF9WQVIQARILCgdURlRfQU5Z", - "EAISDwoLVEZUX1BST0RVQ1QQAxIQCgxURlRfQ0FMTEFCTEUQZBIPCgpURlRf", - "VEVOU09SEOgHEg4KCVRGVF9BUlJBWRDpBxIRCgxURlRfT1BUSU9OQUwQ6gcS", - "EAoLVEZUX0RBVEFTRVQQ9k4SDQoIVEZUX0JPT0wQyAESDgoJVEZUX1VJTlQ4", - "EMkBEg8KClRGVF9VSU5UMTYQygESDwoKVEZUX1VJTlQzMhDLARIPCgpURlRf", - "VUlOVDY0EMwBEg0KCFRGVF9JTlQ4EM0BEg4KCVRGVF9JTlQxNhDOARIOCglU", - "RlRfSU5UMzIQzwESDgoJVEZUX0lOVDY0ENABEg0KCFRGVF9IQUxGENEBEg4K", - "CVRGVF9GTE9BVBDSARIPCgpURlRfRE9VQkxFENMBEhEKDFRGVF9CRkxPQVQx", - "NhDXARISCg1URlRfQ09NUExFWDY0ENQBEhMKDlRGVF9DT01QTEVYMTI4ENUB", - "Eg8KClRGVF9TVFJJTkcQ1gFCfQoYb3JnLnRlbnNvcmZsb3cuZnJhbWV3b3Jr", - "Qg5GdWxsVHlwZVByb3Rvc1ABWkxnaXRodWIuY29tL3RlbnNvcmZsb3cvdGVu", - "c29yZmxvdy90ZW5zb3JmbG93L2dvL2NvcmUvZnJhbWV3b3JrL3R5cGVzX2dv", - "X3Byb3Rv+AEBYgZwcm90bzM=")); + "bG93LkZ1bGxUeXBlRGVmEgsKAXMYAyABKAlIABILCgFpGAQgASgDSABCBgoE", + "YXR0cirDBAoKRnVsbFR5cGVJZBINCglURlRfVU5TRVQQABILCgdURlRfVkFS", + "EAESCwoHVEZUX0FOWRACEg8KC1RGVF9QUk9EVUNUEAMSDQoJVEZUX05BTUVE", + "EAQSEAoMVEZUX0ZPUl9FQUNIEBQSEAoMVEZUX0NBTExBQkxFEGQSDwoKVEZU", + "X1RFTlNPUhDoBxIOCglURlRfQVJSQVkQ6QcSEQoMVEZUX09QVElPTkFMEOoH", + "EhAKC1RGVF9MSVRFUkFMEOsHEhAKC1RGVF9FTkNPREVEEOwHEg0KCFRGVF9C", + "T09MEMgBEg4KCVRGVF9VSU5UOBDJARIPCgpURlRfVUlOVDE2EMoBEg8KClRG", + "VF9VSU5UMzIQywESDwoKVEZUX1VJTlQ2NBDMARINCghURlRfSU5UOBDNARIO", + "CglURlRfSU5UMTYQzgESDgoJVEZUX0lOVDMyEM8BEg4KCVRGVF9JTlQ2NBDQ", + "ARINCghURlRfSEFMRhDRARIOCglURlRfRkxPQVQQ0gESDwoKVEZUX0RPVUJM", + "RRDTARIRCgxURlRfQkZMT0FUMTYQ1wESEgoNVEZUX0NPTVBMRVg2NBDUARIT", + "Cg5URlRfQ09NUExFWDEyOBDVARIPCgpURlRfU1RSSU5HENYBEhAKC1RGVF9E", + "QVRBU0VUEPZOEg8KClRGVF9SQUdHRUQQ904SEQoMVEZUX0lURVJBVE9SEPhO", + "EhMKDlRGVF9NVVRFWF9MT0NLENpPEhcKElRGVF9MRUdBQ1lfVkFSSUFOVBDb", + "T0KBAQoYb3JnLnRlbnNvcmZsb3cuZnJhbWV3b3JrQg5GdWxsVHlwZVByb3Rv", + "c1ABWlBnaXRodWIuY29tL3RlbnNvcmZsb3cvdGVuc29yZmxvdy90ZW5zb3Jm", + "bG93L2dvL2NvcmUvZnJhbWV3b3JrL2Z1bGxfdHlwZV9nb19wcm90b/gBAWIG", + "cHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tensorflow.FullTypeId), }, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.FullTypeDef), global::Tensorflow.FullTypeDef.Parser, new[]{ "TypeId", "Args", "S" }, new[]{ "Attr" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.FullTypeDef), global::Tensorflow.FullTypeDef.Parser, new[]{ "TypeId", "Args", "S", "I" }, new[]{ "Attr" }, null, null, null) })); } #endregion @@ -52,6 +56,7 @@ static FullTypeReflection() { } #region Enums /// + /// LINT.IfChange /// Experimental. Represents the complete type information of a TensorFlow value. /// public enum FullTypeId { @@ -69,7 +74,7 @@ public enum FullTypeId { /// TFT_TENSOR[TFT_VAR["T"]], TFT_TENSOR[TFT_VAR["T"]] are two tensors of /// identical element types. /// TFT_TENSOR[TFT_VAR["P"]], TFT_TENSOR[TFT_VAR["Q"]] are two tensors of - /// potentially different element types. + /// independent element types. /// [pbr::OriginalName("TFT_VAR")] TftVar = 1, /// @@ -90,14 +95,55 @@ public enum FullTypeId { /// [pbr::OriginalName("TFT_PRODUCT")] TftProduct = 3, /// + /// Represents a named field, with the name stored in the attribute. + /// + /// Parametrization: + /// TFT_NAMED[<type>]{<name>} + /// * <type> is the type of the field + /// * <name> is the field name, as string (thpugh can theoretically be an int + /// as well) + /// + /// Example: + /// TFT_RECORD[ + /// TFT_NAMED[TFT_TENSOR[TFT_INT32]]{'foo'}, + /// TFT_NAMED[TFT_TENSOR[TFT_FLOAT32]]{'bar'}, + /// ] + /// is a structure with two fields, an int tensor "foo" and a float tensor + /// "bar". + /// + [pbr::OriginalName("TFT_NAMED")] TftNamed = 4, + /// + /// Template definition. Expands the variables by repeating a template as + /// arguments of container. + /// + /// Parametrization: + /// TFT_FOR_EACH[<container_type>, <template>, <expansions>] + /// * <container_type> is the type of the container that the template will be + /// expanded into + /// * <template> is any type definition that potentially contains type + /// variables + /// * <expansions> is a TFT_VAR and may include more types in the future + /// + /// Example: + /// TFT_FOR_EACH[ + /// TFT_PRODUCT, + /// TFT_TENSOR[TFT_VAR["t"]], + /// TFT_VAR["t"] + /// ] + /// will substitute a T = TFT_INT32 to TFT_PRODUCT[TFT_TENSOR[TFT_INT32]] + /// and a T = (TFT_INT32, TFT_INT64) to + /// TFT_PRODUCT[TFT_TENSOR[TFT_INT32], TFT_TENSOR[TFT_INT64]]. + /// + [pbr::OriginalName("TFT_FOR_EACH")] TftForEach = 20, + /// /// Callable types describe functions and ops. /// /// Parametrization: /// TFT_CALLABLE[<arg type>, <return type>] - /// * <arg_type> is the type of the arguments; TFT_PRODUCT represents + /// * <arg type> is the type of the arguments; TFT_PRODUCT represents /// multiple /// arguments. - /// * <return_type> is the return type; TFT_PRODUCT represents multiple + /// * <return type> is the return type; TFT_PRODUCT represents multiple /// return values (that means that callables returning multiple things /// don't necessarily return a single tuple). /// @@ -115,9 +161,9 @@ public enum FullTypeId { /// /// Parametrization: /// TFT_TENSOR[<element type>, <shape type>] - /// * <element_type> is currently limited to one of the element types + /// * <element type> is currently limited to one of the element types /// defined below. - /// * <shape_type> is not yet defined, and may only be TFT_UNKNOWN for now. + /// * <shape type> is not yet defined, and may only be TFT_UNKNOWN for now. /// /// A TFT_SHAPE type will be defined in the future. /// @@ -140,7 +186,7 @@ public enum FullTypeId { /// /// Parametrization: /// TFT_ARRAY[<element type>] - /// * <element_type> may be any concrete type. + /// * <element type> may be any concrete type. /// /// Examples: /// TFT_ARRAY[TFT_TENSOR[TFT_INT32]] is a TensorArray holding int32 Tensors @@ -159,7 +205,7 @@ public enum FullTypeId { /// /// Parametrization: /// TFT_OPTIONAL[<element type>] - /// * <element_type> may be any concrete type. + /// * <element type> may be any concrete type. /// /// Examples: /// TFT_OPTIONAL[TFT_TENSOR[TFT_INT32]] is an Optional holding an int32 @@ -167,28 +213,31 @@ public enum FullTypeId { /// [pbr::OriginalName("TFT_OPTIONAL")] TftOptional = 1002, /// - /// Datasets created by tf.data ops and APIs. Datasets have generator/iterable - /// semantics, that is, one can construct an iterator from them. Like - /// Array, they are considered to return elements that can be described - /// by a single type. Unlike Array, they do not support random access or - /// mutation, and can potentially produce an infinite number of elements. - /// A datasets can produce logical structures (e.g. multiple elements). This - /// is expressed using TFT_PRODUCT. + /// Literal types describe compile-time constant values. + /// Literal types may also participate in dependent types. /// - /// Parametrization: TFT_ARRAY[<element type>]. - /// <element_type> may be a concrete type or a type symbol. It represents the - /// data type of the elements produced by the dataset. + /// Parametrization: + /// TFT_LITERAL[<value type>]{<value>} + /// * <value type> may be any concrete type compatible that can hold <value> + /// * <value> is the type's attribute, and holds the actual literal value /// /// Examples: - /// TFT_DATSET[TFT_TENSOR[TFT_INT32]] is a Dataset producing single int32 - /// Tensors of unknown shape. - /// TFT_DATSET[TFT_PRODUCT[TFT_TENSOR[TFT_INT32], TFT_TENSOR[TFT_FLOAT32]] is - /// a - /// Dataset producing pairs of Tensors, one integer and one float. - /// Note: The high ID number is to prepare for the eventuality that Datasets - /// will be supported by user types in the future. + /// TFT_LITERAL[TFT_INT32]{1} is the compile-time constant 1. /// - [pbr::OriginalName("TFT_DATASET")] TftDataset = 10102, + [pbr::OriginalName("TFT_LITERAL")] TftLiteral = 1003, + /// + /// Encoding types describe a value of a certain type, encoded as a different + /// type. + /// + /// Parametrization: + /// TFT_ENCODED[<encoded type>, <encoding type>] + /// * <encoded type> may be any type + /// * <encoding type> may be any type + /// + /// Examples: + /// TFT_ENCODING[TFT_INT32, TFT_STRING] is an integer encoded as string. + /// + [pbr::OriginalName("TFT_ENCODED")] TftEncoded = 1004, /// /// The bool element type. /// TODO(mdan): Quantized types, legacy representations (e.g. ref) @@ -222,6 +271,62 @@ public enum FullTypeId { /// The string element type. /// [pbr::OriginalName("TFT_STRING")] TftString = 214, + /// + /// Datasets created by tf.data ops and APIs. Datasets have generator/iterable + /// semantics, that is, one can construct an iterator from them. Like + /// Array, they are considered to return elements that can be described + /// by a single type. Unlike Array, they do not support random access or + /// mutation, and can potentially produce an infinite number of elements. + /// A datasets can produce logical structures (e.g. multiple elements). This + /// is expressed using TFT_PRODUCT. + /// + /// Parametrization: TFT_DATASET[<element type>]. + /// * <element type> may be a concrete type or a type symbol. It represents + /// the data type of the elements produced by the dataset. + /// + /// Examples: + /// TFT_DATSET[TFT_TENSOR[TFT_INT32]] is a Dataset producing single int32 + /// Tensors of unknown shape. + /// TFT_DATSET[TFT_PRODUCT[TFT_TENSOR[TFT_INT32], TFT_TENSOR[TFT_FLOAT32]] is + /// a Dataset producing pairs of Tensors, one integer and one float. + /// Note: The high ID number is to prepare for the eventuality that Datasets + /// will be supported by user types in the future. + /// + [pbr::OriginalName("TFT_DATASET")] TftDataset = 10102, + /// + /// A ragged tensor created by tf.ragged ops and APIs. + /// + /// Parametrization: TFT_RAGGED[<element_type>]. + /// + [pbr::OriginalName("TFT_RAGGED")] TftRagged = 10103, + /// + /// Iterators created by tf.data ops and APIs. Very similar to Datasets, except + /// they are mutable. + /// + /// Parametrization: TFT_ITERATOR[<element type>]. + /// * <element type> may be a concrete type or a type symbol. It represents + /// the data type of the elements produced by the dataset. + /// + [pbr::OriginalName("TFT_ITERATOR")] TftIterator = 10104, + /// + /// A mutex lock tensor, produced by tf.raw_ops.MutexLock. + /// Unlike strict execution models, where ownership of a lock is denoted by + /// "running after the lock has been acquired", in non-strict mode, lock + /// ownership is in the true sense: "the op argument representing the lock is + /// available". + /// Mutex locks are the dynamic counterpart of control dependencies. + /// TODO(mdan): Properly document this thing. + /// + /// Parametrization: TFT_MUTEX_LOCK[]. + /// + [pbr::OriginalName("TFT_MUTEX_LOCK")] TftMutexLock = 10202, + /// + /// The equivalent of a Tensor with DT_VARIANT dtype, kept here to simplify + /// translation. This type should not normally appear after type inference. + /// Note that LEGACY_VARIANT != ANY: TENSOR[INT32] is a subtype of ANY, but is + /// not a subtype of LEGACY_VARIANT. + /// + [pbr::OriginalName("TFT_LEGACY_VARIANT")] TftLegacyVariant = 10203, } #endregion @@ -233,23 +338,31 @@ public enum FullTypeId { /// particular the encoding imposes no restrictions on what the parameters of any /// type should be, which in particular needs to be true for type symbols. /// - public sealed partial class FullTypeDef : pb::IMessage { + public sealed partial class FullTypeDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FullTypeDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.FullTypeReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public FullTypeDef() { OnConstruction(); } @@ -257,6 +370,7 @@ public FullTypeDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public FullTypeDef(FullTypeDef other) : this() { typeId_ = other.typeId_; args_ = other.args_.Clone(); @@ -264,12 +378,16 @@ public FullTypeDef(FullTypeDef other) : this() { case AttrOneofCase.S: S = other.S; break; + case AttrOneofCase.I: + I = other.I; + break; } _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public FullTypeDef Clone() { return new FullTypeDef(this); } @@ -283,6 +401,7 @@ public FullTypeDef Clone() { /// symbol (Any, Union). See FullTypeId for details. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.FullTypeId TypeId { get { return typeId_; } set { @@ -296,6 +415,7 @@ public FullTypeDef Clone() { = pb::FieldCodec.ForMessage(18, global::Tensorflow.FullTypeDef.Parser); private readonly pbc::RepeatedField args_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Args { get { return args_; } } @@ -303,6 +423,7 @@ public FullTypeDef Clone() { /// Field number for the "s" field. public const int SFieldNumber = 3; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string S { get { return attrCase_ == AttrOneofCase.S ? (string) attr_ : ""; } set { @@ -311,30 +432,50 @@ public string S { } } + /// Field number for the "i" field. + public const int IFieldNumber = 4; + /// + /// TODO(mdan): list/tensor, map? Need to reconcile with TFT_RECORD, etc. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long I { + get { return attrCase_ == AttrOneofCase.I ? (long) attr_ : 0L; } + set { + attr_ = value; + attrCase_ = AttrOneofCase.I; + } + } + private object attr_; /// Enum of possible cases for the "attr" oneof. public enum AttrOneofCase { None = 0, S = 3, + I = 4, } private AttrOneofCase attrCase_ = AttrOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AttrOneofCase AttrCase { get { return attrCase_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void ClearAttr() { attrCase_ = AttrOneofCase.None; attr_ = null; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as FullTypeDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(FullTypeDef other) { if (ReferenceEquals(other, null)) { return false; @@ -345,16 +486,19 @@ public bool Equals(FullTypeDef other) { if (TypeId != other.TypeId) return false; if(!args_.Equals(other.args_)) return false; if (S != other.S) return false; + if (I != other.I) return false; if (AttrCase != other.AttrCase) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (TypeId != global::Tensorflow.FullTypeId.TftUnset) hash ^= TypeId.GetHashCode(); hash ^= args_.GetHashCode(); if (attrCase_ == AttrOneofCase.S) hash ^= S.GetHashCode(); + if (attrCase_ == AttrOneofCase.I) hash ^= I.GetHashCode(); hash ^= (int) attrCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -363,12 +507,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (TypeId != global::Tensorflow.FullTypeId.TftUnset) { output.WriteRawTag(8); output.WriteEnum((int) TypeId); @@ -378,12 +527,41 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(26); output.WriteString(S); } + if (attrCase_ == AttrOneofCase.I) { + output.WriteRawTag(32); + output.WriteInt64(I); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (TypeId != global::Tensorflow.FullTypeId.TftUnset) { + output.WriteRawTag(8); + output.WriteEnum((int) TypeId); + } + args_.WriteTo(ref output, _repeated_args_codec); + if (attrCase_ == AttrOneofCase.S) { + output.WriteRawTag(26); + output.WriteString(S); + } + if (attrCase_ == AttrOneofCase.I) { + output.WriteRawTag(32); + output.WriteInt64(I); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (TypeId != global::Tensorflow.FullTypeId.TftUnset) { @@ -393,6 +571,9 @@ public int CalculateSize() { if (attrCase_ == AttrOneofCase.S) { size += 1 + pb::CodedOutputStream.ComputeStringSize(S); } + if (attrCase_ == AttrOneofCase.I) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(I); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -400,6 +581,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(FullTypeDef other) { if (other == null) { return; @@ -412,13 +594,20 @@ public void MergeFrom(FullTypeDef other) { case AttrOneofCase.S: S = other.S; break; + case AttrOneofCase.I: + I = other.I; + break; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -437,9 +626,45 @@ public void MergeFrom(pb::CodedInputStream input) { S = input.ReadString(); break; } + case 32: { + I = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + TypeId = (global::Tensorflow.FullTypeId) input.ReadEnum(); + break; + } + case 18: { + args_.AddEntriesFrom(ref input, _repeated_args_codec); + break; + } + case 26: { + S = input.ReadString(); + break; + } + case 32: { + I = input.ReadInt64(); + break; + } } } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/Function.cs b/src/TensorFlowNET.Core/Protobuf/Function.cs index 63cdc44f4..800e64442 100644 --- a/src/TensorFlowNET.Core/Protobuf/Function.cs +++ b/src/TensorFlowNET.Core/Protobuf/Function.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/function.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -74,23 +74,31 @@ static FunctionReflection() { /// /// A library is a set of named functions. /// - public sealed partial class FunctionDefLibrary : pb::IMessage { + public sealed partial class FunctionDefLibrary : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FunctionDefLibrary()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.FunctionReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public FunctionDefLibrary() { OnConstruction(); } @@ -98,6 +106,7 @@ public FunctionDefLibrary() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public FunctionDefLibrary(FunctionDefLibrary other) : this() { function_ = other.function_.Clone(); gradient_ = other.gradient_.Clone(); @@ -106,6 +115,7 @@ public FunctionDefLibrary(FunctionDefLibrary other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public FunctionDefLibrary Clone() { return new FunctionDefLibrary(this); } @@ -116,6 +126,7 @@ public FunctionDefLibrary Clone() { = pb::FieldCodec.ForMessage(10, global::Tensorflow.FunctionDef.Parser); private readonly pbc::RepeatedField function_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Function { get { return function_; } } @@ -126,6 +137,7 @@ public FunctionDefLibrary Clone() { = pb::FieldCodec.ForMessage(18, global::Tensorflow.GradientDef.Parser); private readonly pbc::RepeatedField gradient_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Gradient { get { return gradient_; } } @@ -136,16 +148,19 @@ public FunctionDefLibrary Clone() { = pb::FieldCodec.ForMessage(26, global::Tensorflow.RegisteredGradient.Parser); private readonly pbc::RepeatedField registeredGradients_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField RegisteredGradients { get { return registeredGradients_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as FunctionDefLibrary); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(FunctionDefLibrary other) { if (ReferenceEquals(other, null)) { return false; @@ -160,6 +175,7 @@ public bool Equals(FunctionDefLibrary other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= function_.GetHashCode(); @@ -172,21 +188,41 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else function_.WriteTo(output, _repeated_function_codec); gradient_.WriteTo(output, _repeated_gradient_codec); registeredGradients_.WriteTo(output, _repeated_registeredGradients_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + function_.WriteTo(ref output, _repeated_function_codec); + gradient_.WriteTo(ref output, _repeated_gradient_codec); + registeredGradients_.WriteTo(ref output, _repeated_registeredGradients_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += function_.CalculateSize(_repeated_function_codec); @@ -199,6 +235,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(FunctionDefLibrary other) { if (other == null) { return; @@ -210,7 +247,11 @@ public void MergeFrom(FunctionDefLibrary other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -231,8 +272,36 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + function_.AddEntriesFrom(ref input, _repeated_function_codec); + break; + } + case 18: { + gradient_.AddEntriesFrom(ref input, _repeated_gradient_codec); + break; + } + case 26: { + registeredGradients_.AddEntriesFrom(ref input, _repeated_registeredGradients_codec); + break; + } + } + } + } + #endif + } /// @@ -243,23 +312,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// TODO(zhifengc): /// * device spec, etc. /// - public sealed partial class FunctionDef : pb::IMessage { + public sealed partial class FunctionDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FunctionDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.FunctionReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public FunctionDef() { OnConstruction(); } @@ -267,6 +344,7 @@ public FunctionDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public FunctionDef(FunctionDef other) : this() { signature_ = other.signature_ != null ? other.signature_.Clone() : null; attr_ = other.attr_.Clone(); @@ -279,6 +357,7 @@ public FunctionDef(FunctionDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public FunctionDef Clone() { return new FunctionDef(this); } @@ -291,6 +370,7 @@ public FunctionDef Clone() { /// attrs etc. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.OpDef Signature { get { return signature_; } set { @@ -307,6 +387,7 @@ public FunctionDef Clone() { /// Attributes specific to this function definition. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField Attr { get { return attr_; } } @@ -317,6 +398,7 @@ public FunctionDef Clone() { = new pbc::MapField.Codec(pb::FieldCodec.ForUInt32(8, 0), pb::FieldCodec.ForMessage(18, global::Tensorflow.FunctionDef.Types.ArgAttrs.Parser), 58); private readonly pbc::MapField argAttr_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField ArgAttr { get { return argAttr_; } } @@ -338,6 +420,7 @@ public FunctionDef Clone() { /// "_resource_arg_unique_id" attribute. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField ResourceArgUniqueId { get { return resourceArgUniqueId_; } } @@ -353,6 +436,7 @@ public FunctionDef Clone() { /// be a builtin op. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField NodeDef { get { return nodeDef_; } } @@ -367,6 +451,7 @@ public FunctionDef Clone() { /// outputs from `node_def` that should be returned by the function. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField Ret { get { return ret_; } } @@ -381,16 +466,19 @@ public FunctionDef Clone() { /// `node_def` which should be control outputs of this function. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField ControlRet { get { return controlRet_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as FunctionDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(FunctionDef other) { if (ReferenceEquals(other, null)) { return false; @@ -409,6 +497,7 @@ public bool Equals(FunctionDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (signature_ != null) hash ^= Signature.GetHashCode(); @@ -425,12 +514,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (signature_ != null) { output.WriteRawTag(10); output.WriteMessage(Signature); @@ -444,9 +538,31 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (signature_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Signature); + } + nodeDef_.WriteTo(ref output, _repeated_nodeDef_codec); + ret_.WriteTo(ref output, _map_ret_codec); + attr_.WriteTo(ref output, _map_attr_codec); + controlRet_.WriteTo(ref output, _map_controlRet_codec); + argAttr_.WriteTo(ref output, _map_argAttr_codec); + resourceArgUniqueId_.WriteTo(ref output, _map_resourceArgUniqueId_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (signature_ != null) { @@ -465,6 +581,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(FunctionDef other) { if (other == null) { return; @@ -485,7 +602,11 @@ public void MergeFrom(FunctionDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -525,33 +646,89 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (signature_ == null) { + Signature = new global::Tensorflow.OpDef(); + } + input.ReadMessage(Signature); + break; + } + case 26: { + nodeDef_.AddEntriesFrom(ref input, _repeated_nodeDef_codec); + break; + } + case 34: { + ret_.AddEntriesFrom(ref input, _map_ret_codec); + break; + } + case 42: { + attr_.AddEntriesFrom(ref input, _map_attr_codec); + break; + } + case 50: { + controlRet_.AddEntriesFrom(ref input, _map_controlRet_codec); + break; + } + case 58: { + argAttr_.AddEntriesFrom(ref input, _map_argAttr_codec); + break; + } + case 66: { + resourceArgUniqueId_.AddEntriesFrom(ref input, _map_resourceArgUniqueId_codec); + break; + } + } + } } + #endif #region Nested types /// Container for nested types declared in the FunctionDef message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { /// /// Attributes for function arguments. These attributes are the same set of /// valid attributes as to _Arg nodes. /// - public sealed partial class ArgAttrs : pb::IMessage { + public sealed partial class ArgAttrs : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ArgAttrs()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.FunctionDef.Descriptor.NestedTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ArgAttrs() { OnConstruction(); } @@ -559,12 +736,14 @@ public ArgAttrs() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ArgAttrs(ArgAttrs other) : this() { attr_ = other.attr_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ArgAttrs Clone() { return new ArgAttrs(this); } @@ -575,16 +754,19 @@ public ArgAttrs Clone() { = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Tensorflow.AttrValue.Parser), 10); private readonly pbc::MapField attr_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField Attr { get { return attr_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as ArgAttrs); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(ArgAttrs other) { if (ReferenceEquals(other, null)) { return false; @@ -597,6 +779,7 @@ public bool Equals(ArgAttrs other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= Attr.GetHashCode(); @@ -607,19 +790,37 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else attr_.WriteTo(output, _map_attr_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + attr_.WriteTo(ref output, _map_attr_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += attr_.CalculateSize(_map_attr_codec); @@ -630,6 +831,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(ArgAttrs other) { if (other == null) { return; @@ -639,7 +841,11 @@ public void MergeFrom(ArgAttrs other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -652,7 +858,27 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + attr_.AddEntriesFrom(ref input, _map_attr_codec); + break; + } + } + } } + #endif } @@ -681,23 +907,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// loss function). dL/dx_i is the partial derivative of L with respect /// to x_i. /// - public sealed partial class GradientDef : pb::IMessage { + public sealed partial class GradientDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GradientDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.FunctionReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GradientDef() { OnConstruction(); } @@ -705,6 +939,7 @@ public GradientDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GradientDef(GradientDef other) : this() { functionName_ = other.functionName_; gradientFunc_ = other.gradientFunc_; @@ -712,6 +947,7 @@ public GradientDef(GradientDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GradientDef Clone() { return new GradientDef(this); } @@ -723,6 +959,7 @@ public GradientDef Clone() { /// The function name. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string FunctionName { get { return functionName_; } set { @@ -737,6 +974,7 @@ public string FunctionName { /// The gradient function's name. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string GradientFunc { get { return gradientFunc_; } set { @@ -745,11 +983,13 @@ public string GradientFunc { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as GradientDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(GradientDef other) { if (ReferenceEquals(other, null)) { return false; @@ -763,6 +1003,7 @@ public bool Equals(GradientDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (FunctionName.Length != 0) hash ^= FunctionName.GetHashCode(); @@ -774,12 +1015,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (FunctionName.Length != 0) { output.WriteRawTag(10); output.WriteString(FunctionName); @@ -791,9 +1037,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (FunctionName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FunctionName); + } + if (GradientFunc.Length != 0) { + output.WriteRawTag(18); + output.WriteString(GradientFunc); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (FunctionName.Length != 0) { @@ -809,6 +1075,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(GradientDef other) { if (other == null) { return; @@ -823,7 +1090,11 @@ public void MergeFrom(GradientDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -840,7 +1111,31 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + FunctionName = input.ReadString(); + break; + } + case 18: { + GradientFunc = input.ReadString(); + break; + } + } + } } + #endif } @@ -850,23 +1145,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// Unlike GradientDef, these gradients are identified by op type, and not /// directly linked to any function. /// - public sealed partial class RegisteredGradient : pb::IMessage { + public sealed partial class RegisteredGradient : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegisteredGradient()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.FunctionReflection.Descriptor.MessageTypes[3]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public RegisteredGradient() { OnConstruction(); } @@ -874,6 +1177,7 @@ public RegisteredGradient() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public RegisteredGradient(RegisteredGradient other) : this() { gradientFunc_ = other.gradientFunc_; registeredOpType_ = other.registeredOpType_; @@ -881,6 +1185,7 @@ public RegisteredGradient(RegisteredGradient other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public RegisteredGradient Clone() { return new RegisteredGradient(this); } @@ -892,6 +1197,7 @@ public RegisteredGradient Clone() { /// The gradient function's name. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string GradientFunc { get { return gradientFunc_; } set { @@ -906,6 +1212,7 @@ public string GradientFunc { /// The gradient function's registered op type. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string RegisteredOpType { get { return registeredOpType_; } set { @@ -914,11 +1221,13 @@ public string RegisteredOpType { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as RegisteredGradient); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(RegisteredGradient other) { if (ReferenceEquals(other, null)) { return false; @@ -932,6 +1241,7 @@ public bool Equals(RegisteredGradient other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (GradientFunc.Length != 0) hash ^= GradientFunc.GetHashCode(); @@ -943,12 +1253,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (GradientFunc.Length != 0) { output.WriteRawTag(10); output.WriteString(GradientFunc); @@ -960,9 +1275,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (GradientFunc.Length != 0) { + output.WriteRawTag(10); + output.WriteString(GradientFunc); + } + if (RegisteredOpType.Length != 0) { + output.WriteRawTag(18); + output.WriteString(RegisteredOpType); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (GradientFunc.Length != 0) { @@ -978,6 +1313,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(RegisteredGradient other) { if (other == null) { return; @@ -992,7 +1328,11 @@ public void MergeFrom(RegisteredGradient other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1009,7 +1349,31 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + GradientFunc = input.ReadString(); + break; + } + case 18: { + RegisteredOpType = input.ReadString(); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/Gen.bat b/src/TensorFlowNET.Core/Protobuf/Gen.bat index fdb962f80..6b898bcb8 100644 --- a/src/TensorFlowNET.Core/Protobuf/Gen.bat +++ b/src/TensorFlowNET.Core/Protobuf/Gen.bat @@ -1,7 +1,7 @@ @ECHO OFF -set SRC_DIR=D:/SciSharp/tensorflow-google -set DST_DIR=D:/SciSharp/TensorFlow.NET/src/TensorFlowNET.Core/Protobuf +set SRC_DIR=D:/development/tf.net/tensorflow-2.11.0 +set DST_DIR=D:/development/tf.net/gen_proto protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/core/framework/resource_handle.proto protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/core/framework/tensor_shape.proto @@ -30,6 +30,10 @@ protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/core/protobuf/saver.proto protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/core/protobuf/saved_object_graph.proto protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/core/protobuf/saved_model.proto ECHO Download `any.proto` from https://github.com/protocolbuffers/protobuf/tree/master/src/google/protobuf +protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/core/protobuf/coordination_service.proto +protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/core/protobuf/coordination_config.proto +protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/core/protobuf/service_config.proto +protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/core/protobuf/data_service.proto protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/core/protobuf/meta_graph.proto protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/core/protobuf/cluster.proto protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/core/protobuf/config.proto @@ -41,6 +45,14 @@ protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/core/protobuf/struct.proto protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/core/protobuf/verifier_config.proto protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/core/util/event.proto protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/core/util/memmapped_file_system.proto +protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/tsl/protobuf/histogram.proto +protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/compiler/xla/xla.proto +protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/compiler/xla/xla_data.proto +protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/compiler/xla/service/hlo.proto +protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/compiler/xla/pjrt/distributed/protocol.proto +protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/compiler/xla/service/gpu/executable.proto +protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/compiler/xla/service/cpu/executable.proto +protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/compiler/xla/service/cpu/xla_framework.proto protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/python/training/checkpoint_state.proto protoc -I=%SRC_DIR% --csharp_out=%DST_DIR% tensorflow/python/framework/cpp_shape_inference.proto diff --git a/src/TensorFlowNET.Core/Protobuf/Graph.cs b/src/TensorFlowNET.Core/Protobuf/Graph.cs index e5e782cca..0b7644eba 100644 --- a/src/TensorFlowNET.Core/Protobuf/Graph.cs +++ b/src/TensorFlowNET.Core/Protobuf/Graph.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/graph.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -48,23 +48,31 @@ static GraphReflection() { /// /// Represents the graph of operations /// - public sealed partial class GraphDef : pb::IMessage { + public sealed partial class GraphDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GraphDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.GraphReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphDef() { OnConstruction(); } @@ -72,6 +80,7 @@ public GraphDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphDef(GraphDef other) : this() { node_ = other.node_.Clone(); versions_ = other.versions_ != null ? other.versions_.Clone() : null; @@ -81,6 +90,7 @@ public GraphDef(GraphDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphDef Clone() { return new GraphDef(this); } @@ -91,6 +101,7 @@ public GraphDef Clone() { = pb::FieldCodec.ForMessage(10, global::Tensorflow.NodeDef.Parser); private readonly pbc::RepeatedField node_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Node { get { return node_; } } @@ -104,6 +115,7 @@ public GraphDef Clone() { /// each release of TensorFlow will support a range of GraphDef versions. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.VersionDef Versions { get { return versions_; } set { @@ -121,6 +133,7 @@ public GraphDef Clone() { /// [global::System.ObsoleteAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int Version { get { return version_; } set { @@ -159,6 +172,7 @@ public int Version { /// function are ready. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.FunctionDefLibrary Library { get { return library_; } set { @@ -167,11 +181,13 @@ public int Version { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as GraphDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(GraphDef other) { if (ReferenceEquals(other, null)) { return false; @@ -187,6 +203,7 @@ public bool Equals(GraphDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= node_.GetHashCode(); @@ -200,12 +217,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else node_.WriteTo(output, _repeated_node_codec); if (library_ != null) { output.WriteRawTag(18); @@ -222,9 +244,34 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + node_.WriteTo(ref output, _repeated_node_codec); + if (library_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Library); + } + if (Version != 0) { + output.WriteRawTag(24); + output.WriteInt32(Version); + } + if (versions_ != null) { + output.WriteRawTag(34); + output.WriteMessage(Versions); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += node_.CalculateSize(_repeated_node_codec); @@ -244,6 +291,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(GraphDef other) { if (other == null) { return; @@ -268,7 +316,11 @@ public void MergeFrom(GraphDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -299,7 +351,45 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + node_.AddEntriesFrom(ref input, _repeated_node_codec); + break; + } + case 18: { + if (library_ == null) { + Library = new global::Tensorflow.FunctionDefLibrary(); + } + input.ReadMessage(Library); + break; + } + case 24: { + Version = input.ReadInt32(); + break; + } + case 34: { + if (versions_ == null) { + Versions = new global::Tensorflow.VersionDef(); + } + input.ReadMessage(Versions); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/GraphTransferInfo.cs b/src/TensorFlowNET.Core/Protobuf/GraphTransferInfo.cs index 7094e6255..0292e8170 100644 --- a/src/TensorFlowNET.Core/Protobuf/GraphTransferInfo.cs +++ b/src/TensorFlowNET.Core/Protobuf/GraphTransferInfo.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/graph_transfer_info.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -75,23 +75,31 @@ static GraphTransferInfoReflection() { } #region Messages - public sealed partial class GraphTransferNodeInput : pb::IMessage { + public sealed partial class GraphTransferNodeInput : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GraphTransferNodeInput()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.GraphTransferInfoReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferNodeInput() { OnConstruction(); } @@ -99,6 +107,7 @@ public GraphTransferNodeInput() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferNodeInput(GraphTransferNodeInput other) : this() { nodeId_ = other.nodeId_; outputPort_ = other.outputPort_; @@ -106,6 +115,7 @@ public GraphTransferNodeInput(GraphTransferNodeInput other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferNodeInput Clone() { return new GraphTransferNodeInput(this); } @@ -114,6 +124,7 @@ public GraphTransferNodeInput Clone() { public const int NodeIdFieldNumber = 1; private int nodeId_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int NodeId { get { return nodeId_; } set { @@ -125,6 +136,7 @@ public int NodeId { public const int OutputPortFieldNumber = 2; private int outputPort_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int OutputPort { get { return outputPort_; } set { @@ -133,11 +145,13 @@ public int OutputPort { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as GraphTransferNodeInput); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(GraphTransferNodeInput other) { if (ReferenceEquals(other, null)) { return false; @@ -151,6 +165,7 @@ public bool Equals(GraphTransferNodeInput other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (NodeId != 0) hash ^= NodeId.GetHashCode(); @@ -162,12 +177,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (NodeId != 0) { output.WriteRawTag(8); output.WriteInt32(NodeId); @@ -179,9 +199,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (NodeId != 0) { + output.WriteRawTag(8); + output.WriteInt32(NodeId); + } + if (OutputPort != 0) { + output.WriteRawTag(16); + output.WriteInt32(OutputPort); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (NodeId != 0) { @@ -197,6 +237,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(GraphTransferNodeInput other) { if (other == null) { return; @@ -211,7 +252,11 @@ public void MergeFrom(GraphTransferNodeInput other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -228,27 +273,59 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + NodeId = input.ReadInt32(); + break; + } + case 16: { + OutputPort = input.ReadInt32(); + break; + } + } + } } + #endif } - public sealed partial class GraphTransferNodeInfo : pb::IMessage { + public sealed partial class GraphTransferNodeInfo : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GraphTransferNodeInfo()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.GraphTransferInfoReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferNodeInfo() { OnConstruction(); } @@ -256,6 +333,7 @@ public GraphTransferNodeInfo() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferNodeInfo(GraphTransferNodeInfo other) : this() { name_ = other.name_; nodeId_ = other.nodeId_; @@ -268,6 +346,7 @@ public GraphTransferNodeInfo(GraphTransferNodeInfo other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferNodeInfo Clone() { return new GraphTransferNodeInfo(this); } @@ -276,6 +355,7 @@ public GraphTransferNodeInfo Clone() { public const int NameFieldNumber = 1; private string name_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -287,6 +367,7 @@ public string Name { public const int NodeIdFieldNumber = 2; private int nodeId_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int NodeId { get { return nodeId_; } set { @@ -298,6 +379,7 @@ public int NodeId { public const int TypeNameFieldNumber = 3; private string typeName_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string TypeName { get { return typeName_; } set { @@ -309,6 +391,7 @@ public string TypeName { public const int SocOpIdFieldNumber = 4; private int socOpId_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int SocOpId { get { return socOpId_; } set { @@ -320,6 +403,7 @@ public int SocOpId { public const int PaddingIdFieldNumber = 5; private int paddingId_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int PaddingId { get { return paddingId_; } set { @@ -331,6 +415,7 @@ public int PaddingId { public const int InputCountFieldNumber = 6; private int inputCount_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int InputCount { get { return inputCount_; } set { @@ -342,6 +427,7 @@ public int InputCount { public const int OutputCountFieldNumber = 7; private int outputCount_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int OutputCount { get { return outputCount_; } set { @@ -350,11 +436,13 @@ public int OutputCount { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as GraphTransferNodeInfo); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(GraphTransferNodeInfo other) { if (ReferenceEquals(other, null)) { return false; @@ -373,6 +461,7 @@ public bool Equals(GraphTransferNodeInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -389,12 +478,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -426,9 +520,49 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (NodeId != 0) { + output.WriteRawTag(16); + output.WriteInt32(NodeId); + } + if (TypeName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(TypeName); + } + if (SocOpId != 0) { + output.WriteRawTag(32); + output.WriteInt32(SocOpId); + } + if (PaddingId != 0) { + output.WriteRawTag(40); + output.WriteInt32(PaddingId); + } + if (InputCount != 0) { + output.WriteRawTag(48); + output.WriteInt32(InputCount); + } + if (OutputCount != 0) { + output.WriteRawTag(56); + output.WriteInt32(OutputCount); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -459,6 +593,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(GraphTransferNodeInfo other) { if (other == null) { return; @@ -488,7 +623,11 @@ public void MergeFrom(GraphTransferNodeInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -525,27 +664,79 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 16: { + NodeId = input.ReadInt32(); + break; + } + case 26: { + TypeName = input.ReadString(); + break; + } + case 32: { + SocOpId = input.ReadInt32(); + break; + } + case 40: { + PaddingId = input.ReadInt32(); + break; + } + case 48: { + InputCount = input.ReadInt32(); + break; + } + case 56: { + OutputCount = input.ReadInt32(); + break; + } + } + } + } + #endif + } - public sealed partial class GraphTransferConstNodeInfo : pb::IMessage { + public sealed partial class GraphTransferConstNodeInfo : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GraphTransferConstNodeInfo()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.GraphTransferInfoReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferConstNodeInfo() { OnConstruction(); } @@ -553,6 +744,7 @@ public GraphTransferConstNodeInfo() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferConstNodeInfo(GraphTransferConstNodeInfo other) : this() { name_ = other.name_; nodeId_ = other.nodeId_; @@ -563,6 +755,7 @@ public GraphTransferConstNodeInfo(GraphTransferConstNodeInfo other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferConstNodeInfo Clone() { return new GraphTransferConstNodeInfo(this); } @@ -571,6 +764,7 @@ public GraphTransferConstNodeInfo Clone() { public const int NameFieldNumber = 1; private string name_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -582,6 +776,7 @@ public string Name { public const int NodeIdFieldNumber = 2; private int nodeId_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int NodeId { get { return nodeId_; } set { @@ -595,6 +790,7 @@ public int NodeId { = pb::FieldCodec.ForInt64(26); private readonly pbc::RepeatedField shape_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Shape { get { return shape_; } } @@ -603,6 +799,7 @@ public int NodeId { public const int DataFieldNumber = 4; private pb::ByteString data_ = pb::ByteString.Empty; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pb::ByteString Data { get { return data_; } set { @@ -614,6 +811,7 @@ public int NodeId { public const int DtypeFieldNumber = 5; private global::Tensorflow.DataType dtype_ = global::Tensorflow.DataType.DtInvalid; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.DataType Dtype { get { return dtype_; } set { @@ -622,11 +820,13 @@ public int NodeId { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as GraphTransferConstNodeInfo); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(GraphTransferConstNodeInfo other) { if (ReferenceEquals(other, null)) { return false; @@ -643,6 +843,7 @@ public bool Equals(GraphTransferConstNodeInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -657,12 +858,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -683,9 +889,38 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (NodeId != 0) { + output.WriteRawTag(16); + output.WriteInt32(NodeId); + } + shape_.WriteTo(ref output, _repeated_shape_codec); + if (Data.Length != 0) { + output.WriteRawTag(34); + output.WriteBytes(Data); + } + if (Dtype != global::Tensorflow.DataType.DtInvalid) { + output.WriteRawTag(40); + output.WriteEnum((int) Dtype); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -708,6 +943,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(GraphTransferConstNodeInfo other) { if (other == null) { return; @@ -729,7 +965,11 @@ public void MergeFrom(GraphTransferConstNodeInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -759,27 +999,72 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 16: { + NodeId = input.ReadInt32(); + break; + } + case 26: + case 24: { + shape_.AddEntriesFrom(ref input, _repeated_shape_codec); + break; + } + case 34: { + Data = input.ReadBytes(); + break; + } + case 40: { + Dtype = (global::Tensorflow.DataType) input.ReadEnum(); + break; + } + } + } + } + #endif + } - public sealed partial class GraphTransferNodeInputInfo : pb::IMessage { + public sealed partial class GraphTransferNodeInputInfo : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GraphTransferNodeInputInfo()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.GraphTransferInfoReflection.Descriptor.MessageTypes[3]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferNodeInputInfo() { OnConstruction(); } @@ -787,6 +1072,7 @@ public GraphTransferNodeInputInfo() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferNodeInputInfo(GraphTransferNodeInputInfo other) : this() { nodeId_ = other.nodeId_; nodeInput_ = other.nodeInput_.Clone(); @@ -794,6 +1080,7 @@ public GraphTransferNodeInputInfo(GraphTransferNodeInputInfo other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferNodeInputInfo Clone() { return new GraphTransferNodeInputInfo(this); } @@ -802,6 +1089,7 @@ public GraphTransferNodeInputInfo Clone() { public const int NodeIdFieldNumber = 1; private int nodeId_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int NodeId { get { return nodeId_; } set { @@ -815,16 +1103,19 @@ public int NodeId { = pb::FieldCodec.ForMessage(18, global::Tensorflow.GraphTransferNodeInput.Parser); private readonly pbc::RepeatedField nodeInput_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField NodeInput { get { return nodeInput_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as GraphTransferNodeInputInfo); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(GraphTransferNodeInputInfo other) { if (ReferenceEquals(other, null)) { return false; @@ -838,6 +1129,7 @@ public bool Equals(GraphTransferNodeInputInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (NodeId != 0) hash ^= NodeId.GetHashCode(); @@ -849,12 +1141,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (NodeId != 0) { output.WriteRawTag(8); output.WriteInt32(NodeId); @@ -863,9 +1160,26 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (NodeId != 0) { + output.WriteRawTag(8); + output.WriteInt32(NodeId); + } + nodeInput_.WriteTo(ref output, _repeated_nodeInput_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (NodeId != 0) { @@ -879,6 +1193,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(GraphTransferNodeInputInfo other) { if (other == null) { return; @@ -891,7 +1206,11 @@ public void MergeFrom(GraphTransferNodeInputInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -908,27 +1227,59 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + NodeId = input.ReadInt32(); + break; + } + case 18: { + nodeInput_.AddEntriesFrom(ref input, _repeated_nodeInput_codec); + break; + } + } + } } + #endif } - public sealed partial class GraphTransferNodeOutputInfo : pb::IMessage { + public sealed partial class GraphTransferNodeOutputInfo : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GraphTransferNodeOutputInfo()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.GraphTransferInfoReflection.Descriptor.MessageTypes[4]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferNodeOutputInfo() { OnConstruction(); } @@ -936,6 +1287,7 @@ public GraphTransferNodeOutputInfo() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferNodeOutputInfo(GraphTransferNodeOutputInfo other) : this() { nodeId_ = other.nodeId_; maxByteSize_ = other.maxByteSize_.Clone(); @@ -943,6 +1295,7 @@ public GraphTransferNodeOutputInfo(GraphTransferNodeOutputInfo other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferNodeOutputInfo Clone() { return new GraphTransferNodeOutputInfo(this); } @@ -951,6 +1304,7 @@ public GraphTransferNodeOutputInfo Clone() { public const int NodeIdFieldNumber = 1; private int nodeId_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int NodeId { get { return nodeId_; } set { @@ -964,16 +1318,19 @@ public int NodeId { = pb::FieldCodec.ForInt32(18); private readonly pbc::RepeatedField maxByteSize_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField MaxByteSize { get { return maxByteSize_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as GraphTransferNodeOutputInfo); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(GraphTransferNodeOutputInfo other) { if (ReferenceEquals(other, null)) { return false; @@ -987,6 +1344,7 @@ public bool Equals(GraphTransferNodeOutputInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (NodeId != 0) hash ^= NodeId.GetHashCode(); @@ -998,12 +1356,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (NodeId != 0) { output.WriteRawTag(8); output.WriteInt32(NodeId); @@ -1012,9 +1375,26 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (NodeId != 0) { + output.WriteRawTag(8); + output.WriteInt32(NodeId); + } + maxByteSize_.WriteTo(ref output, _repeated_maxByteSize_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (NodeId != 0) { @@ -1028,6 +1408,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(GraphTransferNodeOutputInfo other) { if (other == null) { return; @@ -1040,7 +1421,11 @@ public void MergeFrom(GraphTransferNodeOutputInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1058,27 +1443,60 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + NodeId = input.ReadInt32(); + break; + } + case 18: + case 16: { + maxByteSize_.AddEntriesFrom(ref input, _repeated_maxByteSize_codec); + break; + } + } + } + } + #endif + } - public sealed partial class GraphTransferGraphInputNodeInfo : pb::IMessage { + public sealed partial class GraphTransferGraphInputNodeInfo : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GraphTransferGraphInputNodeInfo()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.GraphTransferInfoReflection.Descriptor.MessageTypes[5]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferGraphInputNodeInfo() { OnConstruction(); } @@ -1086,6 +1504,7 @@ public GraphTransferGraphInputNodeInfo() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferGraphInputNodeInfo(GraphTransferGraphInputNodeInfo other) : this() { name_ = other.name_; shape_ = other.shape_.Clone(); @@ -1094,6 +1513,7 @@ public GraphTransferGraphInputNodeInfo(GraphTransferGraphInputNodeInfo other) : } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferGraphInputNodeInfo Clone() { return new GraphTransferGraphInputNodeInfo(this); } @@ -1102,6 +1522,7 @@ public GraphTransferGraphInputNodeInfo Clone() { public const int NameFieldNumber = 1; private string name_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -1115,6 +1536,7 @@ public string Name { = pb::FieldCodec.ForInt64(18); private readonly pbc::RepeatedField shape_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Shape { get { return shape_; } } @@ -1123,6 +1545,7 @@ public string Name { public const int DtypeFieldNumber = 3; private global::Tensorflow.DataType dtype_ = global::Tensorflow.DataType.DtInvalid; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.DataType Dtype { get { return dtype_; } set { @@ -1131,11 +1554,13 @@ public string Name { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as GraphTransferGraphInputNodeInfo); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(GraphTransferGraphInputNodeInfo other) { if (ReferenceEquals(other, null)) { return false; @@ -1150,6 +1575,7 @@ public bool Equals(GraphTransferGraphInputNodeInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -1162,12 +1588,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -1180,9 +1611,30 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + shape_.WriteTo(ref output, _repeated_shape_codec); + if (Dtype != global::Tensorflow.DataType.DtInvalid) { + output.WriteRawTag(24); + output.WriteEnum((int) Dtype); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -1199,6 +1651,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(GraphTransferGraphInputNodeInfo other) { if (other == null) { return; @@ -1214,7 +1667,11 @@ public void MergeFrom(GraphTransferGraphInputNodeInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1236,27 +1693,64 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: + case 16: { + shape_.AddEntriesFrom(ref input, _repeated_shape_codec); + break; + } + case 24: { + Dtype = (global::Tensorflow.DataType) input.ReadEnum(); + break; + } + } + } } + #endif } - public sealed partial class GraphTransferGraphOutputNodeInfo : pb::IMessage { + public sealed partial class GraphTransferGraphOutputNodeInfo : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GraphTransferGraphOutputNodeInfo()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.GraphTransferInfoReflection.Descriptor.MessageTypes[6]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferGraphOutputNodeInfo() { OnConstruction(); } @@ -1264,6 +1758,7 @@ public GraphTransferGraphOutputNodeInfo() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferGraphOutputNodeInfo(GraphTransferGraphOutputNodeInfo other) : this() { name_ = other.name_; shape_ = other.shape_.Clone(); @@ -1272,6 +1767,7 @@ public GraphTransferGraphOutputNodeInfo(GraphTransferGraphOutputNodeInfo other) } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferGraphOutputNodeInfo Clone() { return new GraphTransferGraphOutputNodeInfo(this); } @@ -1280,6 +1776,7 @@ public GraphTransferGraphOutputNodeInfo Clone() { public const int NameFieldNumber = 1; private string name_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -1293,6 +1790,7 @@ public string Name { = pb::FieldCodec.ForInt64(18); private readonly pbc::RepeatedField shape_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Shape { get { return shape_; } } @@ -1301,6 +1799,7 @@ public string Name { public const int DtypeFieldNumber = 3; private global::Tensorflow.DataType dtype_ = global::Tensorflow.DataType.DtInvalid; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.DataType Dtype { get { return dtype_; } set { @@ -1309,11 +1808,13 @@ public string Name { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as GraphTransferGraphOutputNodeInfo); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(GraphTransferGraphOutputNodeInfo other) { if (ReferenceEquals(other, null)) { return false; @@ -1328,6 +1829,7 @@ public bool Equals(GraphTransferGraphOutputNodeInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -1340,12 +1842,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -1358,9 +1865,30 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + shape_.WriteTo(ref output, _repeated_shape_codec); + if (Dtype != global::Tensorflow.DataType.DtInvalid) { + output.WriteRawTag(24); + output.WriteEnum((int) Dtype); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -1377,6 +1905,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(GraphTransferGraphOutputNodeInfo other) { if (other == null) { return; @@ -1392,7 +1921,11 @@ public void MergeFrom(GraphTransferGraphOutputNodeInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1414,7 +1947,36 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: + case 16: { + shape_.AddEntriesFrom(ref input, _repeated_shape_codec); + break; + } + case 24: { + Dtype = (global::Tensorflow.DataType) input.ReadEnum(); + break; + } + } + } } + #endif } @@ -1423,23 +1985,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// not valid across executions, but can be serialized back and forth from within /// a single run. /// - public sealed partial class GraphTransferInfo : pb::IMessage { + public sealed partial class GraphTransferInfo : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GraphTransferInfo()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.GraphTransferInfoReflection.Descriptor.MessageTypes[7]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferInfo() { OnConstruction(); } @@ -1447,6 +2017,7 @@ public GraphTransferInfo() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferInfo(GraphTransferInfo other) : this() { nodeInfo_ = other.nodeInfo_.Clone(); constNodeInfo_ = other.constNodeInfo_.Clone(); @@ -1459,6 +2030,7 @@ public GraphTransferInfo(GraphTransferInfo other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public GraphTransferInfo Clone() { return new GraphTransferInfo(this); } @@ -1469,6 +2041,7 @@ public GraphTransferInfo Clone() { = pb::FieldCodec.ForMessage(10, global::Tensorflow.GraphTransferNodeInfo.Parser); private readonly pbc::RepeatedField nodeInfo_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField NodeInfo { get { return nodeInfo_; } } @@ -1479,6 +2052,7 @@ public GraphTransferInfo Clone() { = pb::FieldCodec.ForMessage(18, global::Tensorflow.GraphTransferConstNodeInfo.Parser); private readonly pbc::RepeatedField constNodeInfo_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField ConstNodeInfo { get { return constNodeInfo_; } } @@ -1489,6 +2063,7 @@ public GraphTransferInfo Clone() { = pb::FieldCodec.ForMessage(26, global::Tensorflow.GraphTransferNodeInputInfo.Parser); private readonly pbc::RepeatedField nodeInputInfo_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField NodeInputInfo { get { return nodeInputInfo_; } } @@ -1499,6 +2074,7 @@ public GraphTransferInfo Clone() { = pb::FieldCodec.ForMessage(34, global::Tensorflow.GraphTransferNodeOutputInfo.Parser); private readonly pbc::RepeatedField nodeOutputInfo_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField NodeOutputInfo { get { return nodeOutputInfo_; } } @@ -1512,6 +2088,7 @@ public GraphTransferInfo Clone() { /// Input Node parameters of transferred graph /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField GraphInputNodeInfo { get { return graphInputNodeInfo_; } } @@ -1522,6 +2099,7 @@ public GraphTransferInfo Clone() { = pb::FieldCodec.ForMessage(50, global::Tensorflow.GraphTransferGraphOutputNodeInfo.Parser); private readonly pbc::RepeatedField graphOutputNodeInfo_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField GraphOutputNodeInfo { get { return graphOutputNodeInfo_; } } @@ -1533,6 +2111,7 @@ public GraphTransferInfo Clone() { /// Destination of graph transfer /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.GraphTransferInfo.Types.Destination Destination { get { return destination_; } set { @@ -1541,11 +2120,13 @@ public GraphTransferInfo Clone() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as GraphTransferInfo); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(GraphTransferInfo other) { if (ReferenceEquals(other, null)) { return false; @@ -1564,6 +2145,7 @@ public bool Equals(GraphTransferInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= nodeInfo_.GetHashCode(); @@ -1580,12 +2162,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else nodeInfo_.WriteTo(output, _repeated_nodeInfo_codec); constNodeInfo_.WriteTo(output, _repeated_constNodeInfo_codec); nodeInputInfo_.WriteTo(output, _repeated_nodeInputInfo_codec); @@ -1599,9 +2186,31 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + nodeInfo_.WriteTo(ref output, _repeated_nodeInfo_codec); + constNodeInfo_.WriteTo(ref output, _repeated_constNodeInfo_codec); + nodeInputInfo_.WriteTo(ref output, _repeated_nodeInputInfo_codec); + nodeOutputInfo_.WriteTo(ref output, _repeated_nodeOutputInfo_codec); + graphInputNodeInfo_.WriteTo(ref output, _repeated_graphInputNodeInfo_codec); + graphOutputNodeInfo_.WriteTo(ref output, _repeated_graphOutputNodeInfo_codec); + if (Destination != global::Tensorflow.GraphTransferInfo.Types.Destination.Nop) { + output.WriteRawTag(56); + output.WriteEnum((int) Destination); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += nodeInfo_.CalculateSize(_repeated_nodeInfo_codec); @@ -1620,6 +2229,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(GraphTransferInfo other) { if (other == null) { return; @@ -1637,7 +2247,11 @@ public void MergeFrom(GraphTransferInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1674,11 +2288,56 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + nodeInfo_.AddEntriesFrom(ref input, _repeated_nodeInfo_codec); + break; + } + case 18: { + constNodeInfo_.AddEntriesFrom(ref input, _repeated_constNodeInfo_codec); + break; + } + case 26: { + nodeInputInfo_.AddEntriesFrom(ref input, _repeated_nodeInputInfo_codec); + break; + } + case 34: { + nodeOutputInfo_.AddEntriesFrom(ref input, _repeated_nodeOutputInfo_codec); + break; + } + case 42: { + graphInputNodeInfo_.AddEntriesFrom(ref input, _repeated_graphInputNodeInfo_codec); + break; + } + case 50: { + graphOutputNodeInfo_.AddEntriesFrom(ref input, _repeated_graphOutputNodeInfo_codec); + break; + } + case 56: { + Destination = (global::Tensorflow.GraphTransferInfo.Types.Destination) input.ReadEnum(); + break; + } + } + } } + #endif #region Nested types /// Container for nested types declared in the GraphTransferInfo message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { public enum Destination { [pbr::OriginalName("NOP")] Nop = 0, diff --git a/src/TensorFlowNET.Core/Protobuf/Histogram.cs b/src/TensorFlowNET.Core/Protobuf/Histogram.cs new file mode 100644 index 000000000..7414d1e50 --- /dev/null +++ b/src/TensorFlowNET.Core/Protobuf/Histogram.cs @@ -0,0 +1,452 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tensorflow/tsl/protobuf/histogram.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tensorflow { + + /// Holder for reflection information generated from tensorflow/tsl/protobuf/histogram.proto + public static partial class HistogramReflection { + + #region Descriptor + /// File descriptor for tensorflow/tsl/protobuf/histogram.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static HistogramReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Cid0ZW5zb3JmbG93L3RzbC9wcm90b2J1Zi9oaXN0b2dyYW0ucHJvdG8SCnRl", + "bnNvcmZsb3cihwEKDkhpc3RvZ3JhbVByb3RvEgsKA21pbhgBIAEoARILCgNt", + "YXgYAiABKAESCwoDbnVtGAMgASgBEgsKA3N1bRgEIAEoARITCgtzdW1fc3F1", + "YXJlcxgFIAEoARIYCgxidWNrZXRfbGltaXQYBiADKAFCAhABEhIKBmJ1Y2tl", + "dBgHIAMoAUICEAFCXAoYb3JnLnRlbnNvcmZsb3cuZnJhbWV3b3JrUAFaO2dp", + "dGh1Yi5jb20vZ29vZ2xlL3RzbC90c2wvZ28vY29yZS9wcm90b2J1Zi9zdW1t", + "YXJ5X2dvX3Byb3Rv+AEBYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.HistogramProto), global::Tensorflow.HistogramProto.Parser, new[]{ "Min", "Max", "Num", "Sum", "SumSquares", "BucketLimit", "Bucket" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + /// + /// Serialization format for histogram module in + /// tsl/lib/histogram/histogram.h + /// + public sealed partial class HistogramProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HistogramProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.HistogramReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HistogramProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HistogramProto(HistogramProto other) : this() { + min_ = other.min_; + max_ = other.max_; + num_ = other.num_; + sum_ = other.sum_; + sumSquares_ = other.sumSquares_; + bucketLimit_ = other.bucketLimit_.Clone(); + bucket_ = other.bucket_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HistogramProto Clone() { + return new HistogramProto(this); + } + + /// Field number for the "min" field. + public const int MinFieldNumber = 1; + private double min_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Min { + get { return min_; } + set { + min_ = value; + } + } + + /// Field number for the "max" field. + public const int MaxFieldNumber = 2; + private double max_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Max { + get { return max_; } + set { + max_ = value; + } + } + + /// Field number for the "num" field. + public const int NumFieldNumber = 3; + private double num_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Num { + get { return num_; } + set { + num_ = value; + } + } + + /// Field number for the "sum" field. + public const int SumFieldNumber = 4; + private double sum_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double Sum { + get { return sum_; } + set { + sum_ = value; + } + } + + /// Field number for the "sum_squares" field. + public const int SumSquaresFieldNumber = 5; + private double sumSquares_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double SumSquares { + get { return sumSquares_; } + set { + sumSquares_ = value; + } + } + + /// Field number for the "bucket_limit" field. + public const int BucketLimitFieldNumber = 6; + private static readonly pb::FieldCodec _repeated_bucketLimit_codec + = pb::FieldCodec.ForDouble(50); + private readonly pbc::RepeatedField bucketLimit_ = new pbc::RepeatedField(); + /// + /// Parallel arrays encoding the bucket boundaries and the bucket values. + /// bucket(i) is the count for the bucket i. The range for + /// a bucket is: + /// i == 0: -DBL_MAX .. bucket_limit(0) + /// i != 0: bucket_limit(i-1) .. bucket_limit(i) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField BucketLimit { + get { return bucketLimit_; } + } + + /// Field number for the "bucket" field. + public const int BucketFieldNumber = 7; + private static readonly pb::FieldCodec _repeated_bucket_codec + = pb::FieldCodec.ForDouble(58); + private readonly pbc::RepeatedField bucket_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Bucket { + get { return bucket_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as HistogramProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(HistogramProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Min, other.Min)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Max, other.Max)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Num, other.Num)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Sum, other.Sum)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(SumSquares, other.SumSquares)) return false; + if(!bucketLimit_.Equals(other.bucketLimit_)) return false; + if(!bucket_.Equals(other.bucket_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Min != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Min); + if (Max != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Max); + if (Num != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Num); + if (Sum != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Sum); + if (SumSquares != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(SumSquares); + hash ^= bucketLimit_.GetHashCode(); + hash ^= bucket_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Min != 0D) { + output.WriteRawTag(9); + output.WriteDouble(Min); + } + if (Max != 0D) { + output.WriteRawTag(17); + output.WriteDouble(Max); + } + if (Num != 0D) { + output.WriteRawTag(25); + output.WriteDouble(Num); + } + if (Sum != 0D) { + output.WriteRawTag(33); + output.WriteDouble(Sum); + } + if (SumSquares != 0D) { + output.WriteRawTag(41); + output.WriteDouble(SumSquares); + } + bucketLimit_.WriteTo(output, _repeated_bucketLimit_codec); + bucket_.WriteTo(output, _repeated_bucket_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Min != 0D) { + output.WriteRawTag(9); + output.WriteDouble(Min); + } + if (Max != 0D) { + output.WriteRawTag(17); + output.WriteDouble(Max); + } + if (Num != 0D) { + output.WriteRawTag(25); + output.WriteDouble(Num); + } + if (Sum != 0D) { + output.WriteRawTag(33); + output.WriteDouble(Sum); + } + if (SumSquares != 0D) { + output.WriteRawTag(41); + output.WriteDouble(SumSquares); + } + bucketLimit_.WriteTo(ref output, _repeated_bucketLimit_codec); + bucket_.WriteTo(ref output, _repeated_bucket_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Min != 0D) { + size += 1 + 8; + } + if (Max != 0D) { + size += 1 + 8; + } + if (Num != 0D) { + size += 1 + 8; + } + if (Sum != 0D) { + size += 1 + 8; + } + if (SumSquares != 0D) { + size += 1 + 8; + } + size += bucketLimit_.CalculateSize(_repeated_bucketLimit_codec); + size += bucket_.CalculateSize(_repeated_bucket_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(HistogramProto other) { + if (other == null) { + return; + } + if (other.Min != 0D) { + Min = other.Min; + } + if (other.Max != 0D) { + Max = other.Max; + } + if (other.Num != 0D) { + Num = other.Num; + } + if (other.Sum != 0D) { + Sum = other.Sum; + } + if (other.SumSquares != 0D) { + SumSquares = other.SumSquares; + } + bucketLimit_.Add(other.bucketLimit_); + bucket_.Add(other.bucket_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 9: { + Min = input.ReadDouble(); + break; + } + case 17: { + Max = input.ReadDouble(); + break; + } + case 25: { + Num = input.ReadDouble(); + break; + } + case 33: { + Sum = input.ReadDouble(); + break; + } + case 41: { + SumSquares = input.ReadDouble(); + break; + } + case 50: + case 49: { + bucketLimit_.AddEntriesFrom(input, _repeated_bucketLimit_codec); + break; + } + case 58: + case 57: { + bucket_.AddEntriesFrom(input, _repeated_bucket_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 9: { + Min = input.ReadDouble(); + break; + } + case 17: { + Max = input.ReadDouble(); + break; + } + case 25: { + Num = input.ReadDouble(); + break; + } + case 33: { + Sum = input.ReadDouble(); + break; + } + case 41: { + SumSquares = input.ReadDouble(); + break; + } + case 50: + case 49: { + bucketLimit_.AddEntriesFrom(ref input, _repeated_bucketLimit_codec); + break; + } + case 58: + case 57: { + bucket_.AddEntriesFrom(ref input, _repeated_bucket_codec); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/TensorFlowNET.Core/Protobuf/Hlo.cs b/src/TensorFlowNET.Core/Protobuf/Hlo.cs new file mode 100644 index 000000000..27aa3faa3 --- /dev/null +++ b/src/TensorFlowNET.Core/Protobuf/Hlo.cs @@ -0,0 +1,11996 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tensorflow/compiler/xla/service/hlo.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Xla { + + /// Holder for reflection information generated from tensorflow/compiler/xla/service/hlo.proto + public static partial class HloReflection { + + #region Descriptor + /// File descriptor for tensorflow/compiler/xla/service/hlo.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static HloReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Cil0ZW5zb3JmbG93L2NvbXBpbGVyL3hsYS9zZXJ2aWNlL2hsby5wcm90bxID", + "eGxhGiZ0ZW5zb3JmbG93L2NvbXBpbGVyL3hsYS94bGFfZGF0YS5wcm90byKV", + "FQoTSGxvSW5zdHJ1Y3Rpb25Qcm90bxIMCgRuYW1lGAEgASgJEg4KBm9wY29k", + "ZRgCIAEoCRIeCgVzaGFwZRgDIAEoCzIPLnhsYS5TaGFwZVByb3RvEiEKCG1l", + "dGFkYXRhGAcgASgLMg8ueGxhLk9wTWV0YWRhdGESIgoHbGl0ZXJhbBgIIAEo", + "CzIRLnhsYS5MaXRlcmFsUHJvdG8SGAoQcGFyYW1ldGVyX251bWJlchgJIAEo", + "AxITCgtmdXNpb25fa2luZBgLIAEoCRITCgt0dXBsZV9pbmRleBgNIAEoAxIS", + "CgpkaW1lbnNpb25zGA4gAygDEhsKBndpbmRvdxgPIAEoCzILLnhsYS5XaW5k", + "b3cSRwodY29udm9sdXRpb25fZGltZW5zaW9uX251bWJlcnMYECABKAsyIC54", + "bGEuQ29udm9sdXRpb25EaW1lbnNpb25OdW1iZXJzEhsKE2ZlYXR1cmVfZ3Jv", + "dXBfY291bnQYMiABKAMSGQoRYmF0Y2hfZ3JvdXBfY291bnQYOiABKAMSQgoQ", + "c2xpY2VfZGltZW5zaW9ucxgRIAMoCzIoLnhsYS5IbG9JbnN0cnVjdGlvblBy", + "b3RvLlNsaWNlRGltZW5zaW9ucxIVCg1leHBvbmVudF9iaXRzGBIgASgFEhUK", + "DW1hbnRpc3NhX2JpdHMYEyABKAUSGwoTZHluYW1pY19zbGljZV9zaXplcxgU", + "IAMoAxIqCg5wYWRkaW5nX2NvbmZpZxgVIAEoCzISLnhsYS5QYWRkaW5nQ29u", + "ZmlnEhYKDm91dGZlZWRfY29uZmlnGBYgASgMEi0KDGRpc3RyaWJ1dGlvbhgX", + "IAEoDjIXLnhsYS5SYW5kb21EaXN0cmlidXRpb24SDwoHZXBzaWxvbhgYIAEo", + "AhIVCg1mZWF0dXJlX2luZGV4GBkgASgDEhIKCmNoYW5uZWxfaWQYGiABKAMS", + "FQoNaW5mZWVkX2NvbmZpZxgbIAEoDBIaChJjdXN0b21fY2FsbF90YXJnZXQY", + "HCABKAkSJgoNb3V0ZmVlZF9zaGFwZRgdIAEoCzIPLnhsYS5TaGFwZVByb3Rv", + "EjcKFWRvdF9kaW1lbnNpb25fbnVtYmVycxgeIAEoCzIYLnhsYS5Eb3REaW1l", + "bnNpb25OdW1iZXJzEh4KCGZmdF90eXBlGB8gASgOMgwueGxhLkZmdFR5cGUS", + "EgoKZmZ0X2xlbmd0aBggIAMoAxIcChRjb21wYXJpc29uX2RpcmVjdGlvbhg/", + "IAEoCRI9ChhnYXRoZXJfZGltZW5zaW9uX251bWJlcnMYISABKAsyGy54bGEu", + "R2F0aGVyRGltZW5zaW9uTnVtYmVycxIaChJnYXRoZXJfc2xpY2Vfc2l6ZXMY", + "IiADKAMSCgoCaWQYIyABKAMSEwoLb3BlcmFuZF9pZHMYJCADKAMSHwoXY29u", + "dHJvbF9wcmVkZWNlc3Nvcl9pZHMYJSADKAMSHgoWY2FsbGVkX2NvbXB1dGF0", + "aW9uX2lkcxgmIAMoAxIhCghzaGFyZGluZxgoIAEoCzIPLnhsYS5PcFNoYXJk", + "aW5nEhYKDmJhY2tlbmRfY29uZmlnGCsgASgMEikKDnJlcGxpY2FfZ3JvdXBz", + "GDEgAygLMhEueGxhLlJlcGxpY2FHcm91cBIZCg1hbGxfcmVkdWNlX2lkGC0g", + "ASgDQgIYARIdChV1c2VfZ2xvYmFsX2RldmljZV9pZHMYRyABKAgSGAoQaXNf", + "aG9zdF90cmFuc2ZlchgvIAEoCBIRCglpc19zdGFibGUYPCABKAgSPwoZc2Nh", + "dHRlcl9kaW1lbnNpb25fbnVtYmVycxgwIAEoCzIcLnhsYS5TY2F0dGVyRGlt", + "ZW5zaW9uTnVtYmVycxIuChBwcmVjaXNpb25fY29uZmlnGDMgASgLMhQueGxh", + "LlByZWNpc2lvbkNvbmZpZxIuChNzb3VyY2VfdGFyZ2V0X3BhaXJzGDQgAygL", + "MhEueGxhLlNvdXJjZVRhcmdldBIuChVkb21haW5fZW50cnlfc2hhcmRpbmcY", + "NiABKAsyDy54bGEuT3BTaGFyZGluZxItChRkb21haW5fZXhpdF9zaGFyZGlu", + "Zxg3IAEoCzIPLnhsYS5PcFNoYXJkaW5nEhgKEGNvbnN0cmFpbl9sYXlvdXQY", + "OCABKAgSMwoab3BlcmFuZF9zaGFwZXNfd2l0aF9sYXlvdXQYOSADKAsyDy54", + "bGEuU2hhcGVQcm90bxI9Chh0cmlhbmd1bGFyX3NvbHZlX29wdGlvbnMYOyAB", + "KAsyGy54bGEuVHJpYW5ndWxhclNvbHZlT3B0aW9ucxIuChBjaG9sZXNreV9v", + "cHRpb25zGD4gASgLMhQueGxhLkNob2xlc2t5T3B0aW9ucxI4ChVwYXJhbWV0", + "ZXJfcmVwbGljYXRpb24YPSABKAsyGS54bGEuUGFyYW1ldGVyUmVwbGljYXRp", + "b24SIwobY3VzdG9tX2NhbGxfaGFzX3NpZGVfZWZmZWN0GEEgASgIElEKI2N1", + "c3RvbV9jYWxsX291dHB1dF9vcGVyYW5kX2FsaWFzaW5nGEogAygLMiQueGxh", + "LkN1c3RvbUNhbGxPdXRwdXRPcGVyYW5kQWxpYXNpbmcSNQoUY3VzdG9tX2Nh", + "bGxfc2NoZWR1bGUYTCABKA4yFy54bGEuQ3VzdG9tQ2FsbFNjaGVkdWxlEg0K", + "BWRlbHRhGEIgASgDEhoKEmluZGljZXNfYXJlX3NvcnRlZBhDIAEoCBI0ChNm", + "cm9udGVuZF9hdHRyaWJ1dGVzGEQgASgLMhcueGxhLkZyb250ZW5kQXR0cmli", + "dXRlcxIWCg51bmlxdWVfaW5kaWNlcxhFIAEoCBIrCg1ybmdfYWxnb3JpdGht", + "GEYgASgOMhQueGxhLlJhbmRvbUFsZ29yaXRobRIXCg9jb21wYXJpc29uX3R5", + "cGUYSCABKAkSIQoZaXNfY3Jvc3NfcHJvZ3JhbV9wcmVmZXRjaBhJIAEoCBIm", + "CgxwYWRkaW5nX3R5cGUYSyABKA4yEC54bGEuUGFkZGluZ1R5cGUSOgoXY3Vz", + "dG9tX2NhbGxfYXBpX3ZlcnNpb24YTSABKA4yGS54bGEuQ3VzdG9tQ2FsbEFw", + "aVZlcnNpb24SFgoOYXN5bmNfZ3JvdXBfaWQYTiABKAMSHgoWYXN5bmNfZXhl", + "Y3V0aW9uX3RocmVhZBhPIAEoCRo/Cg9TbGljZURpbWVuc2lvbnMSDQoFc3Rh", + "cnQYASABKAMSDQoFbGltaXQYAiABKAMSDgoGc3RyaWRlGAMgASgDSgQIChAL", + "SgQIDBANSgQIBBAFSgQIBRAGSgQIBhAHSgQILBAtSgQINRA2SgQILhAvSgQI", + "KRAqSgQIKhArSgQIQBBBUg5wYXJhbWV0ZXJfbmFtZVIeZnVzZWRfaW5zdHJ1", + "Y3Rpb25zX2NvbXB1dGF0aW9uUg1vcGVyYW5kX25hbWVzUhljb250cm9sX3By", + "ZWRlY2Vzc29yX25hbWVzUhhjYWxsZWRfY29tcHV0YXRpb25fbmFtZXNSEXJl", + "cGxpY2FfZ3JvdXBfaWRzUhJjdXN0b21fY2FsbF9vcGFxdWVSEmFsbF9yZWR1", + "Y2VfYmFycmllciLpAQoTSGxvQ29tcHV0YXRpb25Qcm90bxIMCgRuYW1lGAEg", + "ASgJEi4KDGluc3RydWN0aW9ucxgCIAMoCzIYLnhsYS5IbG9JbnN0cnVjdGlv", + "blByb3RvEi0KDXByb2dyYW1fc2hhcGUYBCABKAsyFi54bGEuUHJvZ3JhbVNo", + "YXBlUHJvdG8SCgoCaWQYBSABKAMSDwoHcm9vdF9pZBgGIAEoAxIdChVpc19m", + "dXNpb25fY29tcHV0YXRpb24YByABKAgSGAoQZXhlY3V0aW9uX3RocmVhZBgI", + "IAEoCUoECAMQBFIJcm9vdF9uYW1lItgBChBIbG9TY2hlZHVsZVByb3RvEjcK", + "CXNlcXVlbmNlcxgBIAMoCzIkLnhsYS5IbG9TY2hlZHVsZVByb3RvLlNlcXVl", + "bmNlc0VudHJ5Gi4KE0luc3RydWN0aW9uU2VxdWVuY2USFwoPaW5zdHJ1Y3Rp", + "b25faWRzGAEgAygDGlsKDlNlcXVlbmNlc0VudHJ5EgsKA2tleRgBIAEoAxI4", + "CgV2YWx1ZRgCIAEoCzIpLnhsYS5IbG9TY2hlZHVsZVByb3RvLkluc3RydWN0", + "aW9uU2VxdWVuY2U6AjgBItsBChhIbG9JbnB1dE91dHB1dEFsaWFzUHJvdG8S", + "PgoHZW50cmllcxgBIAMoCzItLnhsYS5IbG9JbnB1dE91dHB1dEFsaWFzUHJv", + "dG8uQWxpYXNFbnRyeVByb3RvGn8KD0FsaWFzRW50cnlQcm90bxIaChJvdXRw", + "dXRfc2hhcGVfaW5kZXgYASADKAMSGAoQcGFyYW1ldGVyX251bWJlchgCIAEo", + "AxIdChVwYXJhbWV0ZXJfc2hhcGVfaW5kZXgYAyADKAMSFwoEa2luZBgEIAEo", + "DjIJLnhsYS5LaW5kIvIBChxEeW5hbWljUGFyYW1ldGVyQmluZGluZ1Byb3Rv", + "EjoKB2VudHJpZXMYASADKAsyKS54bGEuRHluYW1pY1BhcmFtZXRlckJpbmRp", + "bmdQcm90by5CaW5kaW5nGpUBCgdCaW5kaW5nEhkKEWR5bmFtaWNfcGFyYW1f", + "bnVtGAEgASgDEhsKE2R5bmFtaWNfcGFyYW1faW5kZXgYAiADKAMSGAoQdGFy", + "Z2V0X3BhcmFtX251bRgDIAEoAxIaChJ0YXJnZXRfcGFyYW1faW5kZXgYBCAD", + "KAMSHAoUdGFyZ2V0X3BhcmFtX2RpbV9udW0YBSABKAMiOAoUQ3Jvc3NQcm9n", + "cmFtUHJlZmV0Y2gSEQoJcGFyYW1ldGVyGAEgASgDEg0KBWluZGV4GAIgAygD", + "IsIHCg5IbG9Nb2R1bGVQcm90bxIMCgRuYW1lGAEgASgJEh4KFmVudHJ5X2Nv", + "bXB1dGF0aW9uX25hbWUYAiABKAkSHAoUZW50cnlfY29tcHV0YXRpb25faWQY", + "BiABKAMSLgoMY29tcHV0YXRpb25zGAMgAygLMhgueGxhLkhsb0NvbXB1dGF0", + "aW9uUHJvdG8SMgoSaG9zdF9wcm9ncmFtX3NoYXBlGAQgASgLMhYueGxhLlBy", + "b2dyYW1TaGFwZVByb3RvEgoKAmlkGAUgASgDEicKCHNjaGVkdWxlGAcgASgL", + "MhUueGxhLkhsb1NjaGVkdWxlUHJvdG8SOQoSaW5wdXRfb3V0cHV0X2FsaWFz", + "GAggASgLMh0ueGxhLkhsb0lucHV0T3V0cHV0QWxpYXNQcm90bxJEChlkeW5h", + "bWljX3BhcmFtZXRlcl9iaW5kaW5nGAkgASgLMiEueGxhLkR5bmFtaWNQYXJh", + "bWV0ZXJCaW5kaW5nUHJvdG8SOwoYY3Jvc3NfcHJvZ3JhbV9wcmVmZXRjaGVz", + "GAogAygLMhkueGxhLkNyb3NzUHJvZ3JhbVByZWZldGNoEhIKCmlzX2R5bmFt", + "aWMYCyABKAgSLQoUc3BtZF9vdXRwdXRfc2hhcmRpbmcYDCABKAsyDy54bGEu", + "T3BTaGFyZGluZxIyChlzcG1kX3BhcmFtZXRlcnNfc2hhcmRpbmdzGA4gAygL", + "Mg8ueGxhLk9wU2hhcmRpbmcSIgoadXNlX2F1dG9fc3BtZF9wYXJ0aXRpb25p", + "bmcYECABKAgSNQoMcHJvZmlsZV9pbmZvGA0gAygLMh8ueGxhLkhsb01vZHVs", + "ZVByb3RvLlByb2ZpbGVJbmZvEjUKEWRldmljZV9hc3NpZ25tZW50GA8gASgL", + "MhoueGxhLkRldmljZUFzc2lnbm1lbnRQcm90bxq8AQoLUHJvZmlsZUluZm8S", + "NQoMcHJvZmlsZV90eXBlGAEgASgOMh8ueGxhLkhsb01vZHVsZVByb3RvLlBy", + "b2ZpbGVUeXBlEhgKEHJlbGF0aXZlX3NwZWVkdXAYAiABKAESKgoOcHJvZmls", + "ZV9zb3VyY2UYAyABKA4yEi54bGEuUHJvZmlsZVNvdXJjZRIwChFjb21waWxh", + "dGlvbl9ldmVudBgEIAEoDjIVLnhsYS5Db21waWxhdGlvbkV2ZW50IkUKC1By", + "b2ZpbGVUeXBlEgsKB0lOVkFMSUQQABIICgRGTEFHEAESCgoGRlVTSU9OEAIS", + "CgoGTEFZT1VUEAMSBwoDRE9UEAQi6AEKEkxvZ2ljYWxCdWZmZXJQcm90bxIK", + "CgJpZBgBIAEoAxIMCgRzaXplGAIgASgDEjQKCmRlZmluZWRfYXQYAyABKAsy", + "IC54bGEuTG9naWNhbEJ1ZmZlclByb3RvLkxvY2F0aW9uEg0KBWNvbG9yGAQg", + "ASgDGnMKCExvY2F0aW9uEhwKEGNvbXB1dGF0aW9uX25hbWUYASABKAlCAhgB", + "EhwKEGluc3RydWN0aW9uX25hbWUYAiABKAlCAhgBEhYKDmluc3RydWN0aW9u", + "X2lkGAQgASgDEhMKC3NoYXBlX2luZGV4GAMgAygDIvgCChVCdWZmZXJBbGxv", + "Y2F0aW9uUHJvdG8SDQoFaW5kZXgYASABKAMSDAoEc2l6ZRgCIAEoAxIXCg9p", + "c190aHJlYWRfbG9jYWwYAyABKAgSEAoIaXNfdHVwbGUYCyABKAgSJgoeaXNf", + "ZW50cnlfY29tcHV0YXRpb25fcGFyYW1ldGVyGAUgASgIEhMKC2lzX2NvbnN0", + "YW50GAwgASgIEhgKEHBhcmFtZXRlcl9udW1iZXIYBiABKAMSHQoVcGFyYW1l", + "dGVyX3NoYXBlX2luZGV4GAogAygDEhYKDm1heWJlX2xpdmVfb3V0GAcgASgI", + "Eg0KBWNvbG9yGAggASgDEjUKCGFzc2lnbmVkGAkgAygLMiMueGxhLkJ1ZmZl", + "ckFsbG9jYXRpb25Qcm90by5Bc3NpZ25lZBpDCghBc3NpZ25lZBIZChFsb2dp", + "Y2FsX2J1ZmZlcl9pZBgBIAEoAxIOCgZvZmZzZXQYAiABKAMSDAoEc2l6ZRgD", + "IAEoAyLWAgoSSGVhcFNpbXVsYXRvclRyYWNlEi0KBmV2ZW50cxgBIAMoCzId", + "LnhsYS5IZWFwU2ltdWxhdG9yVHJhY2UuRXZlbnQSHwoXd2hvbGVfbW9kdWxl", + "X3NpbXVsYXRpb24YAiABKAgSHwoXYnVmZmVyX2FsbG9jYXRpb25faW5kZXgY", + "AyABKAMazgEKBUV2ZW50EjAKBGtpbmQYASABKA4yIi54bGEuSGVhcFNpbXVs", + "YXRvclRyYWNlLkV2ZW50LktpbmQSEQoJYnVmZmVyX2lkGAIgASgDEhgKEGNv", + "bXB1dGF0aW9uX25hbWUYAyABKAkSGAoQaW5zdHJ1Y3Rpb25fbmFtZRgEIAEo", + "CRIfChdzaGFyZV93aXRoX2Nhbm9uaWNhbF9pZBgFIAEoAyIrCgRLaW5kEgkK", + "BUFMTE9DEAASCAoERlJFRRABEg4KClNIQVJFX1dJVEgQAiJNChNIbG9Nb2R1", + "bGVHcm91cFByb3RvEgwKBG5hbWUYASABKAkSKAoLaGxvX21vZHVsZXMYAiAD", + "KAsyEy54bGEuSGxvTW9kdWxlUHJvdG8i1gIKFUJ1ZmZlckFzc2lnbm1lbnRQ", + "cm90bxIwCg9sb2dpY2FsX2J1ZmZlcnMYASADKAsyFy54bGEuTG9naWNhbEJ1", + "ZmZlclByb3RvEj4KDmJ1ZmZlcl9hbGlhc2VzGAIgAygLMiYueGxhLkJ1ZmZl", + "ckFzc2lnbm1lbnRQcm90by5CdWZmZXJBbGlhcxI2ChJidWZmZXJfYWxsb2Nh", + "dGlvbnMYAyADKAsyGi54bGEuQnVmZmVyQWxsb2NhdGlvblByb3RvEjYKFWhl", + "YXBfc2ltdWxhdG9yX3RyYWNlcxgEIAMoCzIXLnhsYS5IZWFwU2ltdWxhdG9y", + "VHJhY2UaWwoLQnVmZmVyQWxpYXMSGAoQc291cmNlX2J1ZmZlcl9pZBgBIAEo", + "AxIyCghsb2NhdGlvbhgCIAEoCzIgLnhsYS5Mb2dpY2FsQnVmZmVyUHJvdG8u", + "TG9jYXRpb24ifgoISGxvUHJvdG8SJwoKaGxvX21vZHVsZRgBIAEoCzITLnhs", + "YS5IbG9Nb2R1bGVQcm90bxI1ChFidWZmZXJfYXNzaWdubWVudBgDIAEoCzIa", + "LnhsYS5CdWZmZXJBc3NpZ25tZW50UHJvdG9KBAgCEANSDGhsb19vcmRlcmlu", + "ZyKOAQoLSGxvU25hcHNob3QSGgoDaGxvGAEgASgLMg0ueGxhLkhsb1Byb3Rv", + "EiQKCWFyZ3VtZW50cxgCIAMoCzIRLnhsYS5MaXRlcmFsUHJvdG8SIQoGcmVz", + "dWx0GAMgASgLMhEueGxhLkxpdGVyYWxQcm90bxIaChJleGVjdXRpb25fcGxh", + "dGZvcm0YBCABKAkiuQEKFkhsb01vZHVsZU1ldGFkYXRhUHJvdG8SGwoTY2Fu", + "b25pY2FsX21vZHVsZV9pZBgBIAEoAxIZChFtb2R1bGVfZ3JvdXBfbmFtZRgC", + "IAEoCRIaChJvcmlnaW5hbF9tb2R1bGVfaWQYAyABKAMSHgoWcGFydGl0aW9u", + "ZWRfbW9kdWxlX2lkcxgEIAMoAxIrCg1wYXNzX21ldGFkYXRhGAUgAygLMhQu", + "eGxhLkhsb1Bhc3NNZXRhZGF0YSLqAQoPSGxvUGFzc01ldGFkYXRhEg8KB3Bh", + "c3NfaWQYASABKAMSEQoJcGFzc19uYW1lGAIgASgJEhUKDXBpcGVsaW5lX25h", + "bWUYAyABKAkSFgoOZHVtcF9maWxlbmFtZXMYBCADKAkSFgoObW9kdWxlX2No", + "YW5nZWQYBSABKAgSEQoJbW9kdWxlX2lkGAYgASgDEh8KF21vZHVsZV9ncm91", + "cF9tb2R1bGVfaWRzGAcgAygDEhwKFHN0YXJ0X3RpbWVzdGFtcF91c2VjGAgg", + "ASgDEhoKEmVuZF90aW1lc3RhbXBfdXNlYxgJIAEoAyKzAwoXRW50cnlGdW5j", + "dGlvbkF0dHJpYnV0ZXMSRwoHYnVmZmVycxgBIAMoCzI2LnhsYS5FbnRyeUZ1", + "bmN0aW9uQXR0cmlidXRlcy5CdWZmZXJQYXJhbWV0ZXJBdHRyaWJ1dGVzEhgK", + "EHJlc3VsdF94bGFfc2hhcGUYAiABKAkaHQoKU2hhcGVJbmRleBIPCgdpbmRp", + "Y2VzGAEgAygDGpUCChlCdWZmZXJQYXJhbWV0ZXJBdHRyaWJ1dGVzEhQKDGxt", + "aGxvX3BhcmFtcxgBIAEoAxIcChRsbWhsb19wYXJhbXNfcHJlc2VudBgGIAEo", + "CBJIChdsbWhsb19wYXJhbV9zaGFwZV9pbmRleBgCIAEoCzInLnhsYS5FbnRy", + "eUZ1bmN0aW9uQXR0cmlidXRlcy5TaGFwZUluZGV4EhsKE2xtaGxvX2NvbnN0", + "YW50X25hbWUYAyABKAkSGAoQbG1obG9fbXVzdF9hbGlhcxgEIAEoCBJDChJs", + "bWhsb19vdXRwdXRfaW5kZXgYBSABKAsyJy54bGEuRW50cnlGdW5jdGlvbkF0", + "dHJpYnV0ZXMuU2hhcGVJbmRleCKpAQoZWGxhUnVudGltZUV4ZWN1dGFibGVQ", + "cm90bxItChBobG9fbW9kdWxlX3Byb3RvGAEgASgLMhMueGxhLkhsb01vZHVs", + "ZVByb3RvEjYKEGVudHJ5X2Z1bmNfYXR0cnMYAiABKAsyHC54bGEuRW50cnlG", + "dW5jdGlvbkF0dHJpYnV0ZXMSEAoIb2JqX2ZpbGUYAyABKAwSEwoLbWxpcl9t", + "b2R1bGUYBCABKAkqUwoSQ3VzdG9tQ2FsbFNjaGVkdWxlEhEKDVNDSEVEVUxF", + "X05PTkUQABITCg9TQ0hFRFVMRV9MQVRFU1QQARIVChFTQ0hFRFVMRV9FQVJM", + "SUVTVBACKpkBChRDdXN0b21DYWxsQXBpVmVyc2lvbhIbChdBUElfVkVSU0lP", + "Tl9VTlNQRUNJRklFRBAAEhgKFEFQSV9WRVJTSU9OX09SSUdJTkFMEAESIAoc", + "QVBJX1ZFUlNJT05fU1RBVFVTX1JFVFVSTklORxACEigKJEFQSV9WRVJTSU9O", + "X1NUQVRVU19SRVRVUk5JTkdfVU5JRklFRBADKjoKBEtpbmQSEwoPVU5ERUZJ", + "TkVEX0FMSUFTEAASDQoJTUFZX0FMSUFTEAESDgoKTVVTVF9BTElBUxACQgP4", + "AQFiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Xla.XlaDataReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Xla.CustomCallSchedule), typeof(global::Xla.CustomCallApiVersion), typeof(global::Xla.Kind), }, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.HloInstructionProto), global::Xla.HloInstructionProto.Parser, new[]{ "Name", "Opcode", "Shape", "Metadata", "Literal", "ParameterNumber", "FusionKind", "TupleIndex", "Dimensions", "Window", "ConvolutionDimensionNumbers", "FeatureGroupCount", "BatchGroupCount", "SliceDimensions", "ExponentBits", "MantissaBits", "DynamicSliceSizes", "PaddingConfig", "OutfeedConfig", "Distribution", "Epsilon", "FeatureIndex", "ChannelId", "InfeedConfig", "CustomCallTarget", "OutfeedShape", "DotDimensionNumbers", "FftType", "FftLength", "ComparisonDirection", "GatherDimensionNumbers", "GatherSliceSizes", "Id", "OperandIds", "ControlPredecessorIds", "CalledComputationIds", "Sharding", "BackendConfig", "ReplicaGroups", "AllReduceId", "UseGlobalDeviceIds", "IsHostTransfer", "IsStable", "ScatterDimensionNumbers", "PrecisionConfig", "SourceTargetPairs", "DomainEntrySharding", "DomainExitSharding", "ConstrainLayout", "OperandShapesWithLayout", "TriangularSolveOptions", "CholeskyOptions", "ParameterReplication", "CustomCallHasSideEffect", "CustomCallOutputOperandAliasing", "CustomCallSchedule", "Delta", "IndicesAreSorted", "FrontendAttributes", "UniqueIndices", "RngAlgorithm", "ComparisonType", "IsCrossProgramPrefetch", "PaddingType", "CustomCallApiVersion", "AsyncGroupId", "AsyncExecutionThread" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Xla.HloInstructionProto.Types.SliceDimensions), global::Xla.HloInstructionProto.Types.SliceDimensions.Parser, new[]{ "Start", "Limit", "Stride" }, null, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.HloComputationProto), global::Xla.HloComputationProto.Parser, new[]{ "Name", "Instructions", "ProgramShape", "Id", "RootId", "IsFusionComputation", "ExecutionThread" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.HloScheduleProto), global::Xla.HloScheduleProto.Parser, new[]{ "Sequences" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Xla.HloScheduleProto.Types.InstructionSequence), global::Xla.HloScheduleProto.Types.InstructionSequence.Parser, new[]{ "InstructionIds" }, null, null, null, null), + null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.HloInputOutputAliasProto), global::Xla.HloInputOutputAliasProto.Parser, new[]{ "Entries" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Xla.HloInputOutputAliasProto.Types.AliasEntryProto), global::Xla.HloInputOutputAliasProto.Types.AliasEntryProto.Parser, new[]{ "OutputShapeIndex", "ParameterNumber", "ParameterShapeIndex", "Kind" }, null, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.DynamicParameterBindingProto), global::Xla.DynamicParameterBindingProto.Parser, new[]{ "Entries" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Xla.DynamicParameterBindingProto.Types.Binding), global::Xla.DynamicParameterBindingProto.Types.Binding.Parser, new[]{ "DynamicParamNum", "DynamicParamIndex", "TargetParamNum", "TargetParamIndex", "TargetParamDimNum" }, null, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.CrossProgramPrefetch), global::Xla.CrossProgramPrefetch.Parser, new[]{ "Parameter", "Index" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.HloModuleProto), global::Xla.HloModuleProto.Parser, new[]{ "Name", "EntryComputationName", "EntryComputationId", "Computations", "HostProgramShape", "Id", "Schedule", "InputOutputAlias", "DynamicParameterBinding", "CrossProgramPrefetches", "IsDynamic", "SpmdOutputSharding", "SpmdParametersShardings", "UseAutoSpmdPartitioning", "ProfileInfo", "DeviceAssignment" }, null, new[]{ typeof(global::Xla.HloModuleProto.Types.ProfileType) }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Xla.HloModuleProto.Types.ProfileInfo), global::Xla.HloModuleProto.Types.ProfileInfo.Parser, new[]{ "ProfileType", "RelativeSpeedup", "ProfileSource", "CompilationEvent" }, null, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.LogicalBufferProto), global::Xla.LogicalBufferProto.Parser, new[]{ "Id", "Size", "DefinedAt", "Color" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Xla.LogicalBufferProto.Types.Location), global::Xla.LogicalBufferProto.Types.Location.Parser, new[]{ "ComputationName", "InstructionName", "InstructionId", "ShapeIndex" }, null, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.BufferAllocationProto), global::Xla.BufferAllocationProto.Parser, new[]{ "Index", "Size", "IsThreadLocal", "IsTuple", "IsEntryComputationParameter", "IsConstant", "ParameterNumber", "ParameterShapeIndex", "MaybeLiveOut", "Color", "Assigned" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Xla.BufferAllocationProto.Types.Assigned), global::Xla.BufferAllocationProto.Types.Assigned.Parser, new[]{ "LogicalBufferId", "Offset", "Size" }, null, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.HeapSimulatorTrace), global::Xla.HeapSimulatorTrace.Parser, new[]{ "Events", "WholeModuleSimulation", "BufferAllocationIndex" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Xla.HeapSimulatorTrace.Types.Event), global::Xla.HeapSimulatorTrace.Types.Event.Parser, new[]{ "Kind", "BufferId", "ComputationName", "InstructionName", "ShareWithCanonicalId" }, null, new[]{ typeof(global::Xla.HeapSimulatorTrace.Types.Event.Types.Kind) }, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.HloModuleGroupProto), global::Xla.HloModuleGroupProto.Parser, new[]{ "Name", "HloModules" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.BufferAssignmentProto), global::Xla.BufferAssignmentProto.Parser, new[]{ "LogicalBuffers", "BufferAliases", "BufferAllocations", "HeapSimulatorTraces" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Xla.BufferAssignmentProto.Types.BufferAlias), global::Xla.BufferAssignmentProto.Types.BufferAlias.Parser, new[]{ "SourceBufferId", "Location" }, null, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.HloProto), global::Xla.HloProto.Parser, new[]{ "HloModule", "BufferAssignment" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.HloSnapshot), global::Xla.HloSnapshot.Parser, new[]{ "Hlo", "Arguments", "Result", "ExecutionPlatform" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.HloModuleMetadataProto), global::Xla.HloModuleMetadataProto.Parser, new[]{ "CanonicalModuleId", "ModuleGroupName", "OriginalModuleId", "PartitionedModuleIds", "PassMetadata" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.HloPassMetadata), global::Xla.HloPassMetadata.Parser, new[]{ "PassId", "PassName", "PipelineName", "DumpFilenames", "ModuleChanged", "ModuleId", "ModuleGroupModuleIds", "StartTimestampUsec", "EndTimestampUsec" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.EntryFunctionAttributes), global::Xla.EntryFunctionAttributes.Parser, new[]{ "Buffers", "ResultXlaShape" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Xla.EntryFunctionAttributes.Types.ShapeIndex), global::Xla.EntryFunctionAttributes.Types.ShapeIndex.Parser, new[]{ "Indices" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.EntryFunctionAttributes.Types.BufferParameterAttributes), global::Xla.EntryFunctionAttributes.Types.BufferParameterAttributes.Parser, new[]{ "LmhloParams", "LmhloParamsPresent", "LmhloParamShapeIndex", "LmhloConstantName", "LmhloMustAlias", "LmhloOutputIndex" }, null, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.XlaRuntimeExecutableProto), global::Xla.XlaRuntimeExecutableProto.Parser, new[]{ "HloModuleProto", "EntryFuncAttrs", "ObjFile", "MlirModule" }, null, null, null, null) + })); + } + #endregion + + } + #region Enums + public enum CustomCallSchedule { + [pbr::OriginalName("SCHEDULE_NONE")] ScheduleNone = 0, + [pbr::OriginalName("SCHEDULE_LATEST")] ScheduleLatest = 1, + [pbr::OriginalName("SCHEDULE_EARLIEST")] ScheduleEarliest = 2, + } + + /// + /// The version of the API used by the custom call function. The signatures for + /// each version are given below. + /// TODO(b/189822916): Remove this enum when all clients are migrated to the + /// status-returning API. + /// + public enum CustomCallApiVersion { + [pbr::OriginalName("API_VERSION_UNSPECIFIED")] ApiVersionUnspecified = 0, + /// + /// The first version of the API, with the following signatures: + /// + /// CPU: + /// void do_custom_call(void* out, const void** in); + /// + /// GPU: + /// void do_custom_call(CUstream stream, void** buffers, + /// const char* opaque, size_t opaque_len); + /// + [pbr::OriginalName("API_VERSION_ORIGINAL")] ApiVersionOriginal = 1, + /// + /// When the ability to return success/failure status was added: + /// + /// CPU: + /// void do_custom_call(void* out, const void** in, + /// XlaCustomCallStatus* status); + /// + /// GPU: + /// void do_custom_call(CUstream stream, void** buffers, + /// const char* opaque, size_t opaque_len, + /// XlaCustomCallStatus* status); + /// + [pbr::OriginalName("API_VERSION_STATUS_RETURNING")] ApiVersionStatusReturning = 2, + /// + /// Fixes the API signatures on the CPU side of the version STATUS_RETURNING by + /// adding the opaque string so that the custom call API is consistent across + /// CPUs and GPUs. For GPUs, the behaviors invoked by + /// API_VERSION_STATUS_RETURNING and API_VERSION_STATUS_RETURNING_UNIFIED are + /// the same. + /// + /// CPU: + /// void do_custom_call(void* out, const void** in, + /// const char* opaque, size_t opaque_len, + /// XlaCustomCallStatus* status); + /// + /// GPU: + /// void do_custom_call(CUstream stream, void** buffers, + /// const char* opaque, size_t opaque_len, + /// XlaCustomCallStatus* status); + /// + [pbr::OriginalName("API_VERSION_STATUS_RETURNING_UNIFIED")] ApiVersionStatusReturningUnified = 3, + } + + public enum Kind { + /// + /// Define a UNDEFINED_ALIAS equal to zero to get around the default-0 proto3 + /// behavior and missing has_*() APIs. + /// + [pbr::OriginalName("UNDEFINED_ALIAS")] UndefinedAlias = 0, + /// + /// The buffers may or may not alias at runtime. + /// + [pbr::OriginalName("MAY_ALIAS")] MayAlias = 1, + /// + /// The buffers must alias at runtime. + /// + [pbr::OriginalName("MUST_ALIAS")] MustAlias = 2, + } + + #endregion + + #region Messages + /// + /// Serialization of HloInstruction. + /// Next ID: 80 + /// + public sealed partial class HloInstructionProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HloInstructionProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloInstructionProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloInstructionProto(HloInstructionProto other) : this() { + name_ = other.name_; + opcode_ = other.opcode_; + shape_ = other.shape_ != null ? other.shape_.Clone() : null; + metadata_ = other.metadata_ != null ? other.metadata_.Clone() : null; + literal_ = other.literal_ != null ? other.literal_.Clone() : null; + parameterNumber_ = other.parameterNumber_; + fusionKind_ = other.fusionKind_; + tupleIndex_ = other.tupleIndex_; + dimensions_ = other.dimensions_.Clone(); + window_ = other.window_ != null ? other.window_.Clone() : null; + convolutionDimensionNumbers_ = other.convolutionDimensionNumbers_ != null ? other.convolutionDimensionNumbers_.Clone() : null; + featureGroupCount_ = other.featureGroupCount_; + batchGroupCount_ = other.batchGroupCount_; + sliceDimensions_ = other.sliceDimensions_.Clone(); + exponentBits_ = other.exponentBits_; + mantissaBits_ = other.mantissaBits_; + dynamicSliceSizes_ = other.dynamicSliceSizes_.Clone(); + paddingConfig_ = other.paddingConfig_ != null ? other.paddingConfig_.Clone() : null; + outfeedConfig_ = other.outfeedConfig_; + distribution_ = other.distribution_; + epsilon_ = other.epsilon_; + featureIndex_ = other.featureIndex_; + channelId_ = other.channelId_; + infeedConfig_ = other.infeedConfig_; + customCallTarget_ = other.customCallTarget_; + outfeedShape_ = other.outfeedShape_ != null ? other.outfeedShape_.Clone() : null; + dotDimensionNumbers_ = other.dotDimensionNumbers_ != null ? other.dotDimensionNumbers_.Clone() : null; + fftType_ = other.fftType_; + fftLength_ = other.fftLength_.Clone(); + comparisonDirection_ = other.comparisonDirection_; + gatherDimensionNumbers_ = other.gatherDimensionNumbers_ != null ? other.gatherDimensionNumbers_.Clone() : null; + gatherSliceSizes_ = other.gatherSliceSizes_.Clone(); + id_ = other.id_; + operandIds_ = other.operandIds_.Clone(); + controlPredecessorIds_ = other.controlPredecessorIds_.Clone(); + calledComputationIds_ = other.calledComputationIds_.Clone(); + sharding_ = other.sharding_ != null ? other.sharding_.Clone() : null; + backendConfig_ = other.backendConfig_; + replicaGroups_ = other.replicaGroups_.Clone(); + allReduceId_ = other.allReduceId_; + useGlobalDeviceIds_ = other.useGlobalDeviceIds_; + isHostTransfer_ = other.isHostTransfer_; + isStable_ = other.isStable_; + scatterDimensionNumbers_ = other.scatterDimensionNumbers_ != null ? other.scatterDimensionNumbers_.Clone() : null; + precisionConfig_ = other.precisionConfig_ != null ? other.precisionConfig_.Clone() : null; + sourceTargetPairs_ = other.sourceTargetPairs_.Clone(); + domainEntrySharding_ = other.domainEntrySharding_ != null ? other.domainEntrySharding_.Clone() : null; + domainExitSharding_ = other.domainExitSharding_ != null ? other.domainExitSharding_.Clone() : null; + constrainLayout_ = other.constrainLayout_; + operandShapesWithLayout_ = other.operandShapesWithLayout_.Clone(); + triangularSolveOptions_ = other.triangularSolveOptions_ != null ? other.triangularSolveOptions_.Clone() : null; + choleskyOptions_ = other.choleskyOptions_ != null ? other.choleskyOptions_.Clone() : null; + parameterReplication_ = other.parameterReplication_ != null ? other.parameterReplication_.Clone() : null; + customCallHasSideEffect_ = other.customCallHasSideEffect_; + customCallOutputOperandAliasing_ = other.customCallOutputOperandAliasing_.Clone(); + customCallSchedule_ = other.customCallSchedule_; + delta_ = other.delta_; + indicesAreSorted_ = other.indicesAreSorted_; + frontendAttributes_ = other.frontendAttributes_ != null ? other.frontendAttributes_.Clone() : null; + uniqueIndices_ = other.uniqueIndices_; + rngAlgorithm_ = other.rngAlgorithm_; + comparisonType_ = other.comparisonType_; + isCrossProgramPrefetch_ = other.isCrossProgramPrefetch_; + paddingType_ = other.paddingType_; + customCallApiVersion_ = other.customCallApiVersion_; + asyncGroupId_ = other.asyncGroupId_; + asyncExecutionThread_ = other.asyncExecutionThread_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloInstructionProto Clone() { + return new HloInstructionProto(this); + } + + /// Field number for the "name" field. + public const int NameFieldNumber = 1; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "opcode" field. + public const int OpcodeFieldNumber = 2; + private string opcode_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Opcode { + get { return opcode_; } + set { + opcode_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "shape" field. + public const int ShapeFieldNumber = 3; + private global::Xla.ShapeProto shape_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ShapeProto Shape { + get { return shape_; } + set { + shape_ = value; + } + } + + /// Field number for the "metadata" field. + public const int MetadataFieldNumber = 7; + private global::Xla.OpMetadata metadata_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.OpMetadata Metadata { + get { return metadata_; } + set { + metadata_ = value; + } + } + + /// Field number for the "literal" field. + public const int LiteralFieldNumber = 8; + private global::Xla.LiteralProto literal_; + /// + /// Literal, only present for kConstant. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.LiteralProto Literal { + get { return literal_; } + set { + literal_ = value; + } + } + + /// Field number for the "parameter_number" field. + public const int ParameterNumberFieldNumber = 9; + private long parameterNumber_; + /// + /// Parameter number is only present for kParameter. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long ParameterNumber { + get { return parameterNumber_; } + set { + parameterNumber_ = value; + } + } + + /// Field number for the "fusion_kind" field. + public const int FusionKindFieldNumber = 11; + private string fusionKind_ = ""; + /// + /// Fusion state, only present for kFusion. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string FusionKind { + get { return fusionKind_; } + set { + fusionKind_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "tuple_index" field. + public const int TupleIndexFieldNumber = 13; + private long tupleIndex_; + /// + /// Index for kGetTupleElement. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long TupleIndex { + get { return tupleIndex_; } + set { + tupleIndex_ = value; + } + } + + /// Field number for the "dimensions" field. + public const int DimensionsFieldNumber = 14; + private static readonly pb::FieldCodec _repeated_dimensions_codec + = pb::FieldCodec.ForInt64(114); + private readonly pbc::RepeatedField dimensions_ = new pbc::RepeatedField(); + /// + /// Dimensions present for some operations that require reshaping or + /// broadcasting, including Reshape, Reduce, ReduceWindow, and Reverse. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Dimensions { + get { return dimensions_; } + } + + /// Field number for the "window" field. + public const int WindowFieldNumber = 15; + private global::Xla.Window window_; + /// + /// Describes the window in a windowed operation such as convolution. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.Window Window { + get { return window_; } + set { + window_ = value; + } + } + + /// Field number for the "convolution_dimension_numbers" field. + public const int ConvolutionDimensionNumbersFieldNumber = 16; + private global::Xla.ConvolutionDimensionNumbers convolutionDimensionNumbers_; + /// + /// Describes the dimension numbers used for a convolution. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ConvolutionDimensionNumbers ConvolutionDimensionNumbers { + get { return convolutionDimensionNumbers_; } + set { + convolutionDimensionNumbers_ = value; + } + } + + /// Field number for the "feature_group_count" field. + public const int FeatureGroupCountFieldNumber = 50; + private long featureGroupCount_; + /// + /// The number of feature groups. Used for a convolution. Must be a divisor of + /// the input feature dimension and output feature dimension. If not specified, + /// it will use a default value of 1. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long FeatureGroupCount { + get { return featureGroupCount_; } + set { + featureGroupCount_ = value; + } + } + + /// Field number for the "batch_group_count" field. + public const int BatchGroupCountFieldNumber = 58; + private long batchGroupCount_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long BatchGroupCount { + get { return batchGroupCount_; } + set { + batchGroupCount_ = value; + } + } + + /// Field number for the "slice_dimensions" field. + public const int SliceDimensionsFieldNumber = 17; + private static readonly pb::FieldCodec _repeated_sliceDimensions_codec + = pb::FieldCodec.ForMessage(138, global::Xla.HloInstructionProto.Types.SliceDimensions.Parser); + private readonly pbc::RepeatedField sliceDimensions_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField SliceDimensions { + get { return sliceDimensions_; } + } + + /// Field number for the "exponent_bits" field. + public const int ExponentBitsFieldNumber = 18; + private int exponentBits_; + /// + /// The bit sizes for a reduce-precision operation. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int ExponentBits { + get { return exponentBits_; } + set { + exponentBits_ = value; + } + } + + /// Field number for the "mantissa_bits" field. + public const int MantissaBitsFieldNumber = 19; + private int mantissaBits_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int MantissaBits { + get { return mantissaBits_; } + set { + mantissaBits_ = value; + } + } + + /// Field number for the "dynamic_slice_sizes" field. + public const int DynamicSliceSizesFieldNumber = 20; + private static readonly pb::FieldCodec _repeated_dynamicSliceSizes_codec + = pb::FieldCodec.ForInt64(162); + private readonly pbc::RepeatedField dynamicSliceSizes_ = new pbc::RepeatedField(); + /// + /// Describes the [start, start + size) range size for a dynamic slice + /// ('start' is specified dynamically in the second operand of the operation). + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField DynamicSliceSizes { + get { return dynamicSliceSizes_; } + } + + /// Field number for the "padding_config" field. + public const int PaddingConfigFieldNumber = 21; + private global::Xla.PaddingConfig paddingConfig_; + /// + /// The padding configuration that describes the edge padding and interior + /// padding of this pad instruction. Only set for pad instructions. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.PaddingConfig PaddingConfig { + get { return paddingConfig_; } + set { + paddingConfig_ = value; + } + } + + /// Field number for the "outfeed_config" field. + public const int OutfeedConfigFieldNumber = 22; + private pb::ByteString outfeedConfig_ = pb::ByteString.Empty; + /// + /// Outfeed configuration information, only present for kOutfeed. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pb::ByteString OutfeedConfig { + get { return outfeedConfig_; } + set { + outfeedConfig_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "distribution" field. + public const int DistributionFieldNumber = 23; + private global::Xla.RandomDistribution distribution_ = global::Xla.RandomDistribution.RngInvalid; + /// + /// The distribution requested for random number generation. + /// Only present for kRng. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.RandomDistribution Distribution { + get { return distribution_; } + set { + distribution_ = value; + } + } + + /// Field number for the "epsilon" field. + public const int EpsilonFieldNumber = 24; + private float epsilon_; + /// + /// A small float number added to the variance to avoid divide-by-zero error. + /// Only present for kBatchNormTraining, kBatchNormInference, and + /// kBatchNormGrad. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public float Epsilon { + get { return epsilon_; } + set { + epsilon_ = value; + } + } + + /// Field number for the "feature_index" field. + public const int FeatureIndexFieldNumber = 25; + private long featureIndex_; + /// + /// An integer value representing the index of the feature dimension. + /// Only present for kBatchNormTraining, kBatchNormInference, and + /// kBatchNormGrad. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long FeatureIndex { + get { return featureIndex_; } + set { + featureIndex_ = value; + } + } + + /// Field number for the "channel_id" field. + public const int ChannelIdFieldNumber = 26; + private long channelId_; + /// + /// Represents a unique identifier for each Send/Recv instruction pair or + /// optionally for collective instructions (AllReduce, CollectivePermute, + /// AllToAll). Non-positive channel_id is equivalent to no channel id. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long ChannelId { + get { return channelId_; } + set { + channelId_ = value; + } + } + + /// Field number for the "infeed_config" field. + public const int InfeedConfigFieldNumber = 27; + private pb::ByteString infeedConfig_ = pb::ByteString.Empty; + /// + /// The string representation of the infeed configuration. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pb::ByteString InfeedConfig { + get { return infeedConfig_; } + set { + infeedConfig_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "custom_call_target" field. + public const int CustomCallTargetFieldNumber = 28; + private string customCallTarget_ = ""; + /// + /// Name of a external target (eg, global symbol) to call, only present for + /// kCustomCall. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string CustomCallTarget { + get { return customCallTarget_; } + set { + customCallTarget_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "outfeed_shape" field. + public const int OutfeedShapeFieldNumber = 29; + private global::Xla.ShapeProto outfeedShape_; + /// + /// Shape of outfeed request. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ShapeProto OutfeedShape { + get { return outfeedShape_; } + set { + outfeedShape_ = value; + } + } + + /// Field number for the "dot_dimension_numbers" field. + public const int DotDimensionNumbersFieldNumber = 30; + private global::Xla.DotDimensionNumbers dotDimensionNumbers_; + /// + /// Describes the dimension numbers used for a dot operation + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.DotDimensionNumbers DotDimensionNumbers { + get { return dotDimensionNumbers_; } + set { + dotDimensionNumbers_ = value; + } + } + + /// Field number for the "fft_type" field. + public const int FftTypeFieldNumber = 31; + private global::Xla.FftType fftType_ = global::Xla.FftType.Fft; + /// + /// FFT type (FFT, IFFT, etc). + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.FftType FftType { + get { return fftType_; } + set { + fftType_ = value; + } + } + + /// Field number for the "fft_length" field. + public const int FftLengthFieldNumber = 32; + private static readonly pb::FieldCodec _repeated_fftLength_codec + = pb::FieldCodec.ForInt64(258); + private readonly pbc::RepeatedField fftLength_ = new pbc::RepeatedField(); + /// + /// FFT length. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField FftLength { + get { return fftLength_; } + } + + /// Field number for the "comparison_direction" field. + public const int ComparisonDirectionFieldNumber = 63; + private string comparisonDirection_ = ""; + /// + /// Comparison direction only used for kCompare. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string ComparisonDirection { + get { return comparisonDirection_; } + set { + comparisonDirection_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "gather_dimension_numbers" field. + public const int GatherDimensionNumbersFieldNumber = 33; + private global::Xla.GatherDimensionNumbers gatherDimensionNumbers_; + /// + /// Gather dimension numbers. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.GatherDimensionNumbers GatherDimensionNumbers { + get { return gatherDimensionNumbers_; } + set { + gatherDimensionNumbers_ = value; + } + } + + /// Field number for the "gather_slice_sizes" field. + public const int GatherSliceSizesFieldNumber = 34; + private static readonly pb::FieldCodec _repeated_gatherSliceSizes_codec + = pb::FieldCodec.ForInt64(274); + private readonly pbc::RepeatedField gatherSliceSizes_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField GatherSliceSizes { + get { return gatherSliceSizes_; } + } + + /// Field number for the "id" field. + public const int IdFieldNumber = 35; + private long id_; + /// + /// The id of this instruction. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "operand_ids" field. + public const int OperandIdsFieldNumber = 36; + private static readonly pb::FieldCodec _repeated_operandIds_codec + = pb::FieldCodec.ForInt64(290); + private readonly pbc::RepeatedField operandIds_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField OperandIds { + get { return operandIds_; } + } + + /// Field number for the "control_predecessor_ids" field. + public const int ControlPredecessorIdsFieldNumber = 37; + private static readonly pb::FieldCodec _repeated_controlPredecessorIds_codec + = pb::FieldCodec.ForInt64(298); + private readonly pbc::RepeatedField controlPredecessorIds_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField ControlPredecessorIds { + get { return controlPredecessorIds_; } + } + + /// Field number for the "called_computation_ids" field. + public const int CalledComputationIdsFieldNumber = 38; + private static readonly pb::FieldCodec _repeated_calledComputationIds_codec + = pb::FieldCodec.ForInt64(306); + private readonly pbc::RepeatedField calledComputationIds_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField CalledComputationIds { + get { return calledComputationIds_; } + } + + /// Field number for the "sharding" field. + public const int ShardingFieldNumber = 40; + private global::Xla.OpSharding sharding_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.OpSharding Sharding { + get { return sharding_; } + set { + sharding_ = value; + } + } + + /// Field number for the "backend_config" field. + public const int BackendConfigFieldNumber = 43; + private pb::ByteString backendConfig_ = pb::ByteString.Empty; + /// + /// Backend configuration for the instruction. Has backend-specific meaning. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pb::ByteString BackendConfig { + get { return backendConfig_; } + set { + backendConfig_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "replica_groups" field. + public const int ReplicaGroupsFieldNumber = 49; + private static readonly pb::FieldCodec _repeated_replicaGroups_codec + = pb::FieldCodec.ForMessage(394, global::Xla.ReplicaGroup.Parser); + private readonly pbc::RepeatedField replicaGroups_ = new pbc::RepeatedField(); + /// + /// Cross replica op fields. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField ReplicaGroups { + get { return replicaGroups_; } + } + + /// Field number for the "all_reduce_id" field. + public const int AllReduceIdFieldNumber = 45; + private long allReduceId_; + /// + /// Deprecated, but keeping it for backward compatibility. Use channel_id. + /// Non-positive all_reduce_id is equivalent to no all_reduce_id. + /// + [global::System.ObsoleteAttribute] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long AllReduceId { + get { return allReduceId_; } + set { + allReduceId_ = value; + } + } + + /// Field number for the "use_global_device_ids" field. + public const int UseGlobalDeviceIdsFieldNumber = 71; + private bool useGlobalDeviceIds_; + /// + /// If true, interprets ids in ReplicaGroup as global device ids, which is + /// a linearized id of `replica_id * partition_count + partition_id`. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool UseGlobalDeviceIds { + get { return useGlobalDeviceIds_; } + set { + useGlobalDeviceIds_ = value; + } + } + + /// Field number for the "is_host_transfer" field. + public const int IsHostTransferFieldNumber = 47; + private bool isHostTransfer_; + /// + /// Whether this Send/Recv instruction transfers data to/from the host. Only + /// present for Send and Recv instructions and their SendDone and RecvDone + /// partners. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool IsHostTransfer { + get { return isHostTransfer_; } + set { + isHostTransfer_ = value; + } + } + + /// Field number for the "is_stable" field. + public const int IsStableFieldNumber = 60; + private bool isStable_; + /// + /// Whether this Sort instruction should be stable. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool IsStable { + get { return isStable_; } + set { + isStable_ = value; + } + } + + /// Field number for the "scatter_dimension_numbers" field. + public const int ScatterDimensionNumbersFieldNumber = 48; + private global::Xla.ScatterDimensionNumbers scatterDimensionNumbers_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ScatterDimensionNumbers ScatterDimensionNumbers { + get { return scatterDimensionNumbers_; } + set { + scatterDimensionNumbers_ = value; + } + } + + /// Field number for the "precision_config" field. + public const int PrecisionConfigFieldNumber = 51; + private global::Xla.PrecisionConfig precisionConfig_; + /// + /// Precision configuration for the instruction. Has backend-specific meaning. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.PrecisionConfig PrecisionConfig { + get { return precisionConfig_; } + set { + precisionConfig_ = value; + } + } + + /// Field number for the "source_target_pairs" field. + public const int SourceTargetPairsFieldNumber = 52; + private static readonly pb::FieldCodec _repeated_sourceTargetPairs_codec + = pb::FieldCodec.ForMessage(418, global::Xla.SourceTarget.Parser); + private readonly pbc::RepeatedField sourceTargetPairs_ = new pbc::RepeatedField(); + /// + /// Collective permute field. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField SourceTargetPairs { + get { return sourceTargetPairs_; } + } + + /// Field number for the "domain_entry_sharding" field. + public const int DomainEntryShardingFieldNumber = 54; + private global::Xla.OpSharding domainEntrySharding_; + /// + /// Sharding for kDomain instructions. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.OpSharding DomainEntrySharding { + get { return domainEntrySharding_; } + set { + domainEntrySharding_ = value; + } + } + + /// Field number for the "domain_exit_sharding" field. + public const int DomainExitShardingFieldNumber = 55; + private global::Xla.OpSharding domainExitSharding_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.OpSharding DomainExitSharding { + get { return domainExitSharding_; } + set { + domainExitSharding_ = value; + } + } + + /// Field number for the "constrain_layout" field. + public const int ConstrainLayoutFieldNumber = 56; + private bool constrainLayout_; + /// + /// For custom call this indicates that the layouts are constrained. If + /// constrain_layout is true then the 'shape' field must contain a layout, and + /// 'operand_shapes_with_layout' must contain a shape with layout for each + /// operand. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool ConstrainLayout { + get { return constrainLayout_; } + set { + constrainLayout_ = value; + } + } + + /// Field number for the "operand_shapes_with_layout" field. + public const int OperandShapesWithLayoutFieldNumber = 57; + private static readonly pb::FieldCodec _repeated_operandShapesWithLayout_codec + = pb::FieldCodec.ForMessage(458, global::Xla.ShapeProto.Parser); + private readonly pbc::RepeatedField operandShapesWithLayout_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField OperandShapesWithLayout { + get { return operandShapesWithLayout_; } + } + + /// Field number for the "triangular_solve_options" field. + public const int TriangularSolveOptionsFieldNumber = 59; + private global::Xla.TriangularSolveOptions triangularSolveOptions_; + /// + /// Options for TriangularSolve + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.TriangularSolveOptions TriangularSolveOptions { + get { return triangularSolveOptions_; } + set { + triangularSolveOptions_ = value; + } + } + + /// Field number for the "cholesky_options" field. + public const int CholeskyOptionsFieldNumber = 62; + private global::Xla.CholeskyOptions choleskyOptions_; + /// + /// Options for Cholesky + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.CholeskyOptions CholeskyOptions { + get { return choleskyOptions_; } + set { + choleskyOptions_ = value; + } + } + + /// Field number for the "parameter_replication" field. + public const int ParameterReplicationFieldNumber = 61; + private global::Xla.ParameterReplication parameterReplication_; + /// + /// Describes how parameters behave with regards to replicas. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ParameterReplication ParameterReplication { + get { return parameterReplication_; } + set { + parameterReplication_ = value; + } + } + + /// Field number for the "custom_call_has_side_effect" field. + public const int CustomCallHasSideEffectFieldNumber = 65; + private bool customCallHasSideEffect_; + /// + /// Whether the kCustomCall instruction has side-effects, only present for + /// kCustomCall. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool CustomCallHasSideEffect { + get { return customCallHasSideEffect_; } + set { + customCallHasSideEffect_ = value; + } + } + + /// Field number for the "custom_call_output_operand_aliasing" field. + public const int CustomCallOutputOperandAliasingFieldNumber = 74; + private static readonly pb::FieldCodec _repeated_customCallOutputOperandAliasing_codec + = pb::FieldCodec.ForMessage(594, global::Xla.CustomCallOutputOperandAliasing.Parser); + private readonly pbc::RepeatedField customCallOutputOperandAliasing_ = new pbc::RepeatedField(); + /// + /// A list of CustomCallOutputOperandAliasing pairs that specifies aliasing + /// buffers between output and operands for kCustomCall. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField CustomCallOutputOperandAliasing { + get { return customCallOutputOperandAliasing_; } + } + + /// Field number for the "custom_call_schedule" field. + public const int CustomCallScheduleFieldNumber = 76; + private global::Xla.CustomCallSchedule customCallSchedule_ = global::Xla.CustomCallSchedule.ScheduleNone; + /// + /// Specifies the desired schedule for the custom-call. The field is only + /// present for custom-call. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.CustomCallSchedule CustomCallSchedule { + get { return customCallSchedule_; } + set { + customCallSchedule_ = value; + } + } + + /// Field number for the "delta" field. + public const int DeltaFieldNumber = 66; + private long delta_; + /// + /// The delta value for kRngGetAndUpdateState. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Delta { + get { return delta_; } + set { + delta_ = value; + } + } + + /// Field number for the "indices_are_sorted" field. + public const int IndicesAreSortedFieldNumber = 67; + private bool indicesAreSorted_; + /// + /// Specifies if the gather/scatter indices are guaranteed to be sorted by the + /// caller. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool IndicesAreSorted { + get { return indicesAreSorted_; } + set { + indicesAreSorted_ = value; + } + } + + /// Field number for the "frontend_attributes" field. + public const int FrontendAttributesFieldNumber = 68; + private global::Xla.FrontendAttributes frontendAttributes_; + /// + /// Frontend attributes to pass to the XLA backend. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.FrontendAttributes FrontendAttributes { + get { return frontendAttributes_; } + set { + frontendAttributes_ = value; + } + } + + /// Field number for the "unique_indices" field. + public const int UniqueIndicesFieldNumber = 69; + private bool uniqueIndices_; + /// + /// Specifies if all elements updated are guaranteed to be unique by + /// the caller. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool UniqueIndices { + get { return uniqueIndices_; } + set { + uniqueIndices_ = value; + } + } + + /// Field number for the "rng_algorithm" field. + public const int RngAlgorithmFieldNumber = 70; + private global::Xla.RandomAlgorithm rngAlgorithm_ = global::Xla.RandomAlgorithm.RngDefault; + /// + /// RNG algorithm used by kRngBitGenerator. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.RandomAlgorithm RngAlgorithm { + get { return rngAlgorithm_; } + set { + rngAlgorithm_ = value; + } + } + + /// Field number for the "comparison_type" field. + public const int ComparisonTypeFieldNumber = 72; + private string comparisonType_ = ""; + /// + /// The comparison type used for kCompare. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string ComparisonType { + get { return comparisonType_; } + set { + comparisonType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "is_cross_program_prefetch" field. + public const int IsCrossProgramPrefetchFieldNumber = 73; + private bool isCrossProgramPrefetch_; + /// + /// Specifies if this is a cross-program-prefetch, used by kCopyStart. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool IsCrossProgramPrefetch { + get { return isCrossProgramPrefetch_; } + set { + isCrossProgramPrefetch_ = value; + } + } + + /// Field number for the "padding_type" field. + public const int PaddingTypeFieldNumber = 75; + private global::Xla.PaddingType paddingType_ = global::Xla.PaddingType.PaddingInvalid; + /// + /// If a convolution is dynamic, a dynamic padding type will be specified. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.PaddingType PaddingType { + get { return paddingType_; } + set { + paddingType_ = value; + } + } + + /// Field number for the "custom_call_api_version" field. + public const int CustomCallApiVersionFieldNumber = 77; + private global::Xla.CustomCallApiVersion customCallApiVersion_ = global::Xla.CustomCallApiVersion.ApiVersionUnspecified; + /// + /// The API version used by the custom call function. This field is only + /// present for custom-call. + /// TODO(b/189822916): Remove this field when all clients are migrated to the + /// status-returning API. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.CustomCallApiVersion CustomCallApiVersion { + get { return customCallApiVersion_; } + set { + customCallApiVersion_ = value; + } + } + + /// Field number for the "async_group_id" field. + public const int AsyncGroupIdFieldNumber = 78; + private long asyncGroupId_; + /// + /// Represents a unique identifier for an async group which consists of an + /// async start, async done, and zero or more async update operations. + /// Negative async_group_id is equivalent to no async group id. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long AsyncGroupId { + get { return asyncGroupId_; } + set { + asyncGroupId_ = value; + } + } + + /// Field number for the "async_execution_thread" field. + public const int AsyncExecutionThreadFieldNumber = 79; + private string asyncExecutionThread_ = ""; + /// + /// Represents a unique execution thread name for one or more async groups. + /// Each HLO module may contain a main thread and one or more parallel threads. + /// Empty async_execution_thread is equivalent to main thread. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string AsyncExecutionThread { + get { return asyncExecutionThread_; } + set { + asyncExecutionThread_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as HloInstructionProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(HloInstructionProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + if (Opcode != other.Opcode) return false; + if (!object.Equals(Shape, other.Shape)) return false; + if (!object.Equals(Metadata, other.Metadata)) return false; + if (!object.Equals(Literal, other.Literal)) return false; + if (ParameterNumber != other.ParameterNumber) return false; + if (FusionKind != other.FusionKind) return false; + if (TupleIndex != other.TupleIndex) return false; + if(!dimensions_.Equals(other.dimensions_)) return false; + if (!object.Equals(Window, other.Window)) return false; + if (!object.Equals(ConvolutionDimensionNumbers, other.ConvolutionDimensionNumbers)) return false; + if (FeatureGroupCount != other.FeatureGroupCount) return false; + if (BatchGroupCount != other.BatchGroupCount) return false; + if(!sliceDimensions_.Equals(other.sliceDimensions_)) return false; + if (ExponentBits != other.ExponentBits) return false; + if (MantissaBits != other.MantissaBits) return false; + if(!dynamicSliceSizes_.Equals(other.dynamicSliceSizes_)) return false; + if (!object.Equals(PaddingConfig, other.PaddingConfig)) return false; + if (OutfeedConfig != other.OutfeedConfig) return false; + if (Distribution != other.Distribution) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Epsilon, other.Epsilon)) return false; + if (FeatureIndex != other.FeatureIndex) return false; + if (ChannelId != other.ChannelId) return false; + if (InfeedConfig != other.InfeedConfig) return false; + if (CustomCallTarget != other.CustomCallTarget) return false; + if (!object.Equals(OutfeedShape, other.OutfeedShape)) return false; + if (!object.Equals(DotDimensionNumbers, other.DotDimensionNumbers)) return false; + if (FftType != other.FftType) return false; + if(!fftLength_.Equals(other.fftLength_)) return false; + if (ComparisonDirection != other.ComparisonDirection) return false; + if (!object.Equals(GatherDimensionNumbers, other.GatherDimensionNumbers)) return false; + if(!gatherSliceSizes_.Equals(other.gatherSliceSizes_)) return false; + if (Id != other.Id) return false; + if(!operandIds_.Equals(other.operandIds_)) return false; + if(!controlPredecessorIds_.Equals(other.controlPredecessorIds_)) return false; + if(!calledComputationIds_.Equals(other.calledComputationIds_)) return false; + if (!object.Equals(Sharding, other.Sharding)) return false; + if (BackendConfig != other.BackendConfig) return false; + if(!replicaGroups_.Equals(other.replicaGroups_)) return false; + if (AllReduceId != other.AllReduceId) return false; + if (UseGlobalDeviceIds != other.UseGlobalDeviceIds) return false; + if (IsHostTransfer != other.IsHostTransfer) return false; + if (IsStable != other.IsStable) return false; + if (!object.Equals(ScatterDimensionNumbers, other.ScatterDimensionNumbers)) return false; + if (!object.Equals(PrecisionConfig, other.PrecisionConfig)) return false; + if(!sourceTargetPairs_.Equals(other.sourceTargetPairs_)) return false; + if (!object.Equals(DomainEntrySharding, other.DomainEntrySharding)) return false; + if (!object.Equals(DomainExitSharding, other.DomainExitSharding)) return false; + if (ConstrainLayout != other.ConstrainLayout) return false; + if(!operandShapesWithLayout_.Equals(other.operandShapesWithLayout_)) return false; + if (!object.Equals(TriangularSolveOptions, other.TriangularSolveOptions)) return false; + if (!object.Equals(CholeskyOptions, other.CholeskyOptions)) return false; + if (!object.Equals(ParameterReplication, other.ParameterReplication)) return false; + if (CustomCallHasSideEffect != other.CustomCallHasSideEffect) return false; + if(!customCallOutputOperandAliasing_.Equals(other.customCallOutputOperandAliasing_)) return false; + if (CustomCallSchedule != other.CustomCallSchedule) return false; + if (Delta != other.Delta) return false; + if (IndicesAreSorted != other.IndicesAreSorted) return false; + if (!object.Equals(FrontendAttributes, other.FrontendAttributes)) return false; + if (UniqueIndices != other.UniqueIndices) return false; + if (RngAlgorithm != other.RngAlgorithm) return false; + if (ComparisonType != other.ComparisonType) return false; + if (IsCrossProgramPrefetch != other.IsCrossProgramPrefetch) return false; + if (PaddingType != other.PaddingType) return false; + if (CustomCallApiVersion != other.CustomCallApiVersion) return false; + if (AsyncGroupId != other.AsyncGroupId) return false; + if (AsyncExecutionThread != other.AsyncExecutionThread) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (Opcode.Length != 0) hash ^= Opcode.GetHashCode(); + if (shape_ != null) hash ^= Shape.GetHashCode(); + if (metadata_ != null) hash ^= Metadata.GetHashCode(); + if (literal_ != null) hash ^= Literal.GetHashCode(); + if (ParameterNumber != 0L) hash ^= ParameterNumber.GetHashCode(); + if (FusionKind.Length != 0) hash ^= FusionKind.GetHashCode(); + if (TupleIndex != 0L) hash ^= TupleIndex.GetHashCode(); + hash ^= dimensions_.GetHashCode(); + if (window_ != null) hash ^= Window.GetHashCode(); + if (convolutionDimensionNumbers_ != null) hash ^= ConvolutionDimensionNumbers.GetHashCode(); + if (FeatureGroupCount != 0L) hash ^= FeatureGroupCount.GetHashCode(); + if (BatchGroupCount != 0L) hash ^= BatchGroupCount.GetHashCode(); + hash ^= sliceDimensions_.GetHashCode(); + if (ExponentBits != 0) hash ^= ExponentBits.GetHashCode(); + if (MantissaBits != 0) hash ^= MantissaBits.GetHashCode(); + hash ^= dynamicSliceSizes_.GetHashCode(); + if (paddingConfig_ != null) hash ^= PaddingConfig.GetHashCode(); + if (OutfeedConfig.Length != 0) hash ^= OutfeedConfig.GetHashCode(); + if (Distribution != global::Xla.RandomDistribution.RngInvalid) hash ^= Distribution.GetHashCode(); + if (Epsilon != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Epsilon); + if (FeatureIndex != 0L) hash ^= FeatureIndex.GetHashCode(); + if (ChannelId != 0L) hash ^= ChannelId.GetHashCode(); + if (InfeedConfig.Length != 0) hash ^= InfeedConfig.GetHashCode(); + if (CustomCallTarget.Length != 0) hash ^= CustomCallTarget.GetHashCode(); + if (outfeedShape_ != null) hash ^= OutfeedShape.GetHashCode(); + if (dotDimensionNumbers_ != null) hash ^= DotDimensionNumbers.GetHashCode(); + if (FftType != global::Xla.FftType.Fft) hash ^= FftType.GetHashCode(); + hash ^= fftLength_.GetHashCode(); + if (ComparisonDirection.Length != 0) hash ^= ComparisonDirection.GetHashCode(); + if (gatherDimensionNumbers_ != null) hash ^= GatherDimensionNumbers.GetHashCode(); + hash ^= gatherSliceSizes_.GetHashCode(); + if (Id != 0L) hash ^= Id.GetHashCode(); + hash ^= operandIds_.GetHashCode(); + hash ^= controlPredecessorIds_.GetHashCode(); + hash ^= calledComputationIds_.GetHashCode(); + if (sharding_ != null) hash ^= Sharding.GetHashCode(); + if (BackendConfig.Length != 0) hash ^= BackendConfig.GetHashCode(); + hash ^= replicaGroups_.GetHashCode(); + if (AllReduceId != 0L) hash ^= AllReduceId.GetHashCode(); + if (UseGlobalDeviceIds != false) hash ^= UseGlobalDeviceIds.GetHashCode(); + if (IsHostTransfer != false) hash ^= IsHostTransfer.GetHashCode(); + if (IsStable != false) hash ^= IsStable.GetHashCode(); + if (scatterDimensionNumbers_ != null) hash ^= ScatterDimensionNumbers.GetHashCode(); + if (precisionConfig_ != null) hash ^= PrecisionConfig.GetHashCode(); + hash ^= sourceTargetPairs_.GetHashCode(); + if (domainEntrySharding_ != null) hash ^= DomainEntrySharding.GetHashCode(); + if (domainExitSharding_ != null) hash ^= DomainExitSharding.GetHashCode(); + if (ConstrainLayout != false) hash ^= ConstrainLayout.GetHashCode(); + hash ^= operandShapesWithLayout_.GetHashCode(); + if (triangularSolveOptions_ != null) hash ^= TriangularSolveOptions.GetHashCode(); + if (choleskyOptions_ != null) hash ^= CholeskyOptions.GetHashCode(); + if (parameterReplication_ != null) hash ^= ParameterReplication.GetHashCode(); + if (CustomCallHasSideEffect != false) hash ^= CustomCallHasSideEffect.GetHashCode(); + hash ^= customCallOutputOperandAliasing_.GetHashCode(); + if (CustomCallSchedule != global::Xla.CustomCallSchedule.ScheduleNone) hash ^= CustomCallSchedule.GetHashCode(); + if (Delta != 0L) hash ^= Delta.GetHashCode(); + if (IndicesAreSorted != false) hash ^= IndicesAreSorted.GetHashCode(); + if (frontendAttributes_ != null) hash ^= FrontendAttributes.GetHashCode(); + if (UniqueIndices != false) hash ^= UniqueIndices.GetHashCode(); + if (RngAlgorithm != global::Xla.RandomAlgorithm.RngDefault) hash ^= RngAlgorithm.GetHashCode(); + if (ComparisonType.Length != 0) hash ^= ComparisonType.GetHashCode(); + if (IsCrossProgramPrefetch != false) hash ^= IsCrossProgramPrefetch.GetHashCode(); + if (PaddingType != global::Xla.PaddingType.PaddingInvalid) hash ^= PaddingType.GetHashCode(); + if (CustomCallApiVersion != global::Xla.CustomCallApiVersion.ApiVersionUnspecified) hash ^= CustomCallApiVersion.GetHashCode(); + if (AsyncGroupId != 0L) hash ^= AsyncGroupId.GetHashCode(); + if (AsyncExecutionThread.Length != 0) hash ^= AsyncExecutionThread.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (Opcode.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Opcode); + } + if (shape_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Shape); + } + if (metadata_ != null) { + output.WriteRawTag(58); + output.WriteMessage(Metadata); + } + if (literal_ != null) { + output.WriteRawTag(66); + output.WriteMessage(Literal); + } + if (ParameterNumber != 0L) { + output.WriteRawTag(72); + output.WriteInt64(ParameterNumber); + } + if (FusionKind.Length != 0) { + output.WriteRawTag(90); + output.WriteString(FusionKind); + } + if (TupleIndex != 0L) { + output.WriteRawTag(104); + output.WriteInt64(TupleIndex); + } + dimensions_.WriteTo(output, _repeated_dimensions_codec); + if (window_ != null) { + output.WriteRawTag(122); + output.WriteMessage(Window); + } + if (convolutionDimensionNumbers_ != null) { + output.WriteRawTag(130, 1); + output.WriteMessage(ConvolutionDimensionNumbers); + } + sliceDimensions_.WriteTo(output, _repeated_sliceDimensions_codec); + if (ExponentBits != 0) { + output.WriteRawTag(144, 1); + output.WriteInt32(ExponentBits); + } + if (MantissaBits != 0) { + output.WriteRawTag(152, 1); + output.WriteInt32(MantissaBits); + } + dynamicSliceSizes_.WriteTo(output, _repeated_dynamicSliceSizes_codec); + if (paddingConfig_ != null) { + output.WriteRawTag(170, 1); + output.WriteMessage(PaddingConfig); + } + if (OutfeedConfig.Length != 0) { + output.WriteRawTag(178, 1); + output.WriteBytes(OutfeedConfig); + } + if (Distribution != global::Xla.RandomDistribution.RngInvalid) { + output.WriteRawTag(184, 1); + output.WriteEnum((int) Distribution); + } + if (Epsilon != 0F) { + output.WriteRawTag(197, 1); + output.WriteFloat(Epsilon); + } + if (FeatureIndex != 0L) { + output.WriteRawTag(200, 1); + output.WriteInt64(FeatureIndex); + } + if (ChannelId != 0L) { + output.WriteRawTag(208, 1); + output.WriteInt64(ChannelId); + } + if (InfeedConfig.Length != 0) { + output.WriteRawTag(218, 1); + output.WriteBytes(InfeedConfig); + } + if (CustomCallTarget.Length != 0) { + output.WriteRawTag(226, 1); + output.WriteString(CustomCallTarget); + } + if (outfeedShape_ != null) { + output.WriteRawTag(234, 1); + output.WriteMessage(OutfeedShape); + } + if (dotDimensionNumbers_ != null) { + output.WriteRawTag(242, 1); + output.WriteMessage(DotDimensionNumbers); + } + if (FftType != global::Xla.FftType.Fft) { + output.WriteRawTag(248, 1); + output.WriteEnum((int) FftType); + } + fftLength_.WriteTo(output, _repeated_fftLength_codec); + if (gatherDimensionNumbers_ != null) { + output.WriteRawTag(138, 2); + output.WriteMessage(GatherDimensionNumbers); + } + gatherSliceSizes_.WriteTo(output, _repeated_gatherSliceSizes_codec); + if (Id != 0L) { + output.WriteRawTag(152, 2); + output.WriteInt64(Id); + } + operandIds_.WriteTo(output, _repeated_operandIds_codec); + controlPredecessorIds_.WriteTo(output, _repeated_controlPredecessorIds_codec); + calledComputationIds_.WriteTo(output, _repeated_calledComputationIds_codec); + if (sharding_ != null) { + output.WriteRawTag(194, 2); + output.WriteMessage(Sharding); + } + if (BackendConfig.Length != 0) { + output.WriteRawTag(218, 2); + output.WriteBytes(BackendConfig); + } + if (AllReduceId != 0L) { + output.WriteRawTag(232, 2); + output.WriteInt64(AllReduceId); + } + if (IsHostTransfer != false) { + output.WriteRawTag(248, 2); + output.WriteBool(IsHostTransfer); + } + if (scatterDimensionNumbers_ != null) { + output.WriteRawTag(130, 3); + output.WriteMessage(ScatterDimensionNumbers); + } + replicaGroups_.WriteTo(output, _repeated_replicaGroups_codec); + if (FeatureGroupCount != 0L) { + output.WriteRawTag(144, 3); + output.WriteInt64(FeatureGroupCount); + } + if (precisionConfig_ != null) { + output.WriteRawTag(154, 3); + output.WriteMessage(PrecisionConfig); + } + sourceTargetPairs_.WriteTo(output, _repeated_sourceTargetPairs_codec); + if (domainEntrySharding_ != null) { + output.WriteRawTag(178, 3); + output.WriteMessage(DomainEntrySharding); + } + if (domainExitSharding_ != null) { + output.WriteRawTag(186, 3); + output.WriteMessage(DomainExitSharding); + } + if (ConstrainLayout != false) { + output.WriteRawTag(192, 3); + output.WriteBool(ConstrainLayout); + } + operandShapesWithLayout_.WriteTo(output, _repeated_operandShapesWithLayout_codec); + if (BatchGroupCount != 0L) { + output.WriteRawTag(208, 3); + output.WriteInt64(BatchGroupCount); + } + if (triangularSolveOptions_ != null) { + output.WriteRawTag(218, 3); + output.WriteMessage(TriangularSolveOptions); + } + if (IsStable != false) { + output.WriteRawTag(224, 3); + output.WriteBool(IsStable); + } + if (parameterReplication_ != null) { + output.WriteRawTag(234, 3); + output.WriteMessage(ParameterReplication); + } + if (choleskyOptions_ != null) { + output.WriteRawTag(242, 3); + output.WriteMessage(CholeskyOptions); + } + if (ComparisonDirection.Length != 0) { + output.WriteRawTag(250, 3); + output.WriteString(ComparisonDirection); + } + if (CustomCallHasSideEffect != false) { + output.WriteRawTag(136, 4); + output.WriteBool(CustomCallHasSideEffect); + } + if (Delta != 0L) { + output.WriteRawTag(144, 4); + output.WriteInt64(Delta); + } + if (IndicesAreSorted != false) { + output.WriteRawTag(152, 4); + output.WriteBool(IndicesAreSorted); + } + if (frontendAttributes_ != null) { + output.WriteRawTag(162, 4); + output.WriteMessage(FrontendAttributes); + } + if (UniqueIndices != false) { + output.WriteRawTag(168, 4); + output.WriteBool(UniqueIndices); + } + if (RngAlgorithm != global::Xla.RandomAlgorithm.RngDefault) { + output.WriteRawTag(176, 4); + output.WriteEnum((int) RngAlgorithm); + } + if (UseGlobalDeviceIds != false) { + output.WriteRawTag(184, 4); + output.WriteBool(UseGlobalDeviceIds); + } + if (ComparisonType.Length != 0) { + output.WriteRawTag(194, 4); + output.WriteString(ComparisonType); + } + if (IsCrossProgramPrefetch != false) { + output.WriteRawTag(200, 4); + output.WriteBool(IsCrossProgramPrefetch); + } + customCallOutputOperandAliasing_.WriteTo(output, _repeated_customCallOutputOperandAliasing_codec); + if (PaddingType != global::Xla.PaddingType.PaddingInvalid) { + output.WriteRawTag(216, 4); + output.WriteEnum((int) PaddingType); + } + if (CustomCallSchedule != global::Xla.CustomCallSchedule.ScheduleNone) { + output.WriteRawTag(224, 4); + output.WriteEnum((int) CustomCallSchedule); + } + if (CustomCallApiVersion != global::Xla.CustomCallApiVersion.ApiVersionUnspecified) { + output.WriteRawTag(232, 4); + output.WriteEnum((int) CustomCallApiVersion); + } + if (AsyncGroupId != 0L) { + output.WriteRawTag(240, 4); + output.WriteInt64(AsyncGroupId); + } + if (AsyncExecutionThread.Length != 0) { + output.WriteRawTag(250, 4); + output.WriteString(AsyncExecutionThread); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (Opcode.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Opcode); + } + if (shape_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Shape); + } + if (metadata_ != null) { + output.WriteRawTag(58); + output.WriteMessage(Metadata); + } + if (literal_ != null) { + output.WriteRawTag(66); + output.WriteMessage(Literal); + } + if (ParameterNumber != 0L) { + output.WriteRawTag(72); + output.WriteInt64(ParameterNumber); + } + if (FusionKind.Length != 0) { + output.WriteRawTag(90); + output.WriteString(FusionKind); + } + if (TupleIndex != 0L) { + output.WriteRawTag(104); + output.WriteInt64(TupleIndex); + } + dimensions_.WriteTo(ref output, _repeated_dimensions_codec); + if (window_ != null) { + output.WriteRawTag(122); + output.WriteMessage(Window); + } + if (convolutionDimensionNumbers_ != null) { + output.WriteRawTag(130, 1); + output.WriteMessage(ConvolutionDimensionNumbers); + } + sliceDimensions_.WriteTo(ref output, _repeated_sliceDimensions_codec); + if (ExponentBits != 0) { + output.WriteRawTag(144, 1); + output.WriteInt32(ExponentBits); + } + if (MantissaBits != 0) { + output.WriteRawTag(152, 1); + output.WriteInt32(MantissaBits); + } + dynamicSliceSizes_.WriteTo(ref output, _repeated_dynamicSliceSizes_codec); + if (paddingConfig_ != null) { + output.WriteRawTag(170, 1); + output.WriteMessage(PaddingConfig); + } + if (OutfeedConfig.Length != 0) { + output.WriteRawTag(178, 1); + output.WriteBytes(OutfeedConfig); + } + if (Distribution != global::Xla.RandomDistribution.RngInvalid) { + output.WriteRawTag(184, 1); + output.WriteEnum((int) Distribution); + } + if (Epsilon != 0F) { + output.WriteRawTag(197, 1); + output.WriteFloat(Epsilon); + } + if (FeatureIndex != 0L) { + output.WriteRawTag(200, 1); + output.WriteInt64(FeatureIndex); + } + if (ChannelId != 0L) { + output.WriteRawTag(208, 1); + output.WriteInt64(ChannelId); + } + if (InfeedConfig.Length != 0) { + output.WriteRawTag(218, 1); + output.WriteBytes(InfeedConfig); + } + if (CustomCallTarget.Length != 0) { + output.WriteRawTag(226, 1); + output.WriteString(CustomCallTarget); + } + if (outfeedShape_ != null) { + output.WriteRawTag(234, 1); + output.WriteMessage(OutfeedShape); + } + if (dotDimensionNumbers_ != null) { + output.WriteRawTag(242, 1); + output.WriteMessage(DotDimensionNumbers); + } + if (FftType != global::Xla.FftType.Fft) { + output.WriteRawTag(248, 1); + output.WriteEnum((int) FftType); + } + fftLength_.WriteTo(ref output, _repeated_fftLength_codec); + if (gatherDimensionNumbers_ != null) { + output.WriteRawTag(138, 2); + output.WriteMessage(GatherDimensionNumbers); + } + gatherSliceSizes_.WriteTo(ref output, _repeated_gatherSliceSizes_codec); + if (Id != 0L) { + output.WriteRawTag(152, 2); + output.WriteInt64(Id); + } + operandIds_.WriteTo(ref output, _repeated_operandIds_codec); + controlPredecessorIds_.WriteTo(ref output, _repeated_controlPredecessorIds_codec); + calledComputationIds_.WriteTo(ref output, _repeated_calledComputationIds_codec); + if (sharding_ != null) { + output.WriteRawTag(194, 2); + output.WriteMessage(Sharding); + } + if (BackendConfig.Length != 0) { + output.WriteRawTag(218, 2); + output.WriteBytes(BackendConfig); + } + if (AllReduceId != 0L) { + output.WriteRawTag(232, 2); + output.WriteInt64(AllReduceId); + } + if (IsHostTransfer != false) { + output.WriteRawTag(248, 2); + output.WriteBool(IsHostTransfer); + } + if (scatterDimensionNumbers_ != null) { + output.WriteRawTag(130, 3); + output.WriteMessage(ScatterDimensionNumbers); + } + replicaGroups_.WriteTo(ref output, _repeated_replicaGroups_codec); + if (FeatureGroupCount != 0L) { + output.WriteRawTag(144, 3); + output.WriteInt64(FeatureGroupCount); + } + if (precisionConfig_ != null) { + output.WriteRawTag(154, 3); + output.WriteMessage(PrecisionConfig); + } + sourceTargetPairs_.WriteTo(ref output, _repeated_sourceTargetPairs_codec); + if (domainEntrySharding_ != null) { + output.WriteRawTag(178, 3); + output.WriteMessage(DomainEntrySharding); + } + if (domainExitSharding_ != null) { + output.WriteRawTag(186, 3); + output.WriteMessage(DomainExitSharding); + } + if (ConstrainLayout != false) { + output.WriteRawTag(192, 3); + output.WriteBool(ConstrainLayout); + } + operandShapesWithLayout_.WriteTo(ref output, _repeated_operandShapesWithLayout_codec); + if (BatchGroupCount != 0L) { + output.WriteRawTag(208, 3); + output.WriteInt64(BatchGroupCount); + } + if (triangularSolveOptions_ != null) { + output.WriteRawTag(218, 3); + output.WriteMessage(TriangularSolveOptions); + } + if (IsStable != false) { + output.WriteRawTag(224, 3); + output.WriteBool(IsStable); + } + if (parameterReplication_ != null) { + output.WriteRawTag(234, 3); + output.WriteMessage(ParameterReplication); + } + if (choleskyOptions_ != null) { + output.WriteRawTag(242, 3); + output.WriteMessage(CholeskyOptions); + } + if (ComparisonDirection.Length != 0) { + output.WriteRawTag(250, 3); + output.WriteString(ComparisonDirection); + } + if (CustomCallHasSideEffect != false) { + output.WriteRawTag(136, 4); + output.WriteBool(CustomCallHasSideEffect); + } + if (Delta != 0L) { + output.WriteRawTag(144, 4); + output.WriteInt64(Delta); + } + if (IndicesAreSorted != false) { + output.WriteRawTag(152, 4); + output.WriteBool(IndicesAreSorted); + } + if (frontendAttributes_ != null) { + output.WriteRawTag(162, 4); + output.WriteMessage(FrontendAttributes); + } + if (UniqueIndices != false) { + output.WriteRawTag(168, 4); + output.WriteBool(UniqueIndices); + } + if (RngAlgorithm != global::Xla.RandomAlgorithm.RngDefault) { + output.WriteRawTag(176, 4); + output.WriteEnum((int) RngAlgorithm); + } + if (UseGlobalDeviceIds != false) { + output.WriteRawTag(184, 4); + output.WriteBool(UseGlobalDeviceIds); + } + if (ComparisonType.Length != 0) { + output.WriteRawTag(194, 4); + output.WriteString(ComparisonType); + } + if (IsCrossProgramPrefetch != false) { + output.WriteRawTag(200, 4); + output.WriteBool(IsCrossProgramPrefetch); + } + customCallOutputOperandAliasing_.WriteTo(ref output, _repeated_customCallOutputOperandAliasing_codec); + if (PaddingType != global::Xla.PaddingType.PaddingInvalid) { + output.WriteRawTag(216, 4); + output.WriteEnum((int) PaddingType); + } + if (CustomCallSchedule != global::Xla.CustomCallSchedule.ScheduleNone) { + output.WriteRawTag(224, 4); + output.WriteEnum((int) CustomCallSchedule); + } + if (CustomCallApiVersion != global::Xla.CustomCallApiVersion.ApiVersionUnspecified) { + output.WriteRawTag(232, 4); + output.WriteEnum((int) CustomCallApiVersion); + } + if (AsyncGroupId != 0L) { + output.WriteRawTag(240, 4); + output.WriteInt64(AsyncGroupId); + } + if (AsyncExecutionThread.Length != 0) { + output.WriteRawTag(250, 4); + output.WriteString(AsyncExecutionThread); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (Opcode.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Opcode); + } + if (shape_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Shape); + } + if (metadata_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Metadata); + } + if (literal_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Literal); + } + if (ParameterNumber != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(ParameterNumber); + } + if (FusionKind.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(FusionKind); + } + if (TupleIndex != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(TupleIndex); + } + size += dimensions_.CalculateSize(_repeated_dimensions_codec); + if (window_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Window); + } + if (convolutionDimensionNumbers_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(ConvolutionDimensionNumbers); + } + if (FeatureGroupCount != 0L) { + size += 2 + pb::CodedOutputStream.ComputeInt64Size(FeatureGroupCount); + } + if (BatchGroupCount != 0L) { + size += 2 + pb::CodedOutputStream.ComputeInt64Size(BatchGroupCount); + } + size += sliceDimensions_.CalculateSize(_repeated_sliceDimensions_codec); + if (ExponentBits != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(ExponentBits); + } + if (MantissaBits != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(MantissaBits); + } + size += dynamicSliceSizes_.CalculateSize(_repeated_dynamicSliceSizes_codec); + if (paddingConfig_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(PaddingConfig); + } + if (OutfeedConfig.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeBytesSize(OutfeedConfig); + } + if (Distribution != global::Xla.RandomDistribution.RngInvalid) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) Distribution); + } + if (Epsilon != 0F) { + size += 2 + 4; + } + if (FeatureIndex != 0L) { + size += 2 + pb::CodedOutputStream.ComputeInt64Size(FeatureIndex); + } + if (ChannelId != 0L) { + size += 2 + pb::CodedOutputStream.ComputeInt64Size(ChannelId); + } + if (InfeedConfig.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeBytesSize(InfeedConfig); + } + if (CustomCallTarget.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(CustomCallTarget); + } + if (outfeedShape_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(OutfeedShape); + } + if (dotDimensionNumbers_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(DotDimensionNumbers); + } + if (FftType != global::Xla.FftType.Fft) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) FftType); + } + size += fftLength_.CalculateSize(_repeated_fftLength_codec); + if (ComparisonDirection.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(ComparisonDirection); + } + if (gatherDimensionNumbers_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(GatherDimensionNumbers); + } + size += gatherSliceSizes_.CalculateSize(_repeated_gatherSliceSizes_codec); + if (Id != 0L) { + size += 2 + pb::CodedOutputStream.ComputeInt64Size(Id); + } + size += operandIds_.CalculateSize(_repeated_operandIds_codec); + size += controlPredecessorIds_.CalculateSize(_repeated_controlPredecessorIds_codec); + size += calledComputationIds_.CalculateSize(_repeated_calledComputationIds_codec); + if (sharding_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(Sharding); + } + if (BackendConfig.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeBytesSize(BackendConfig); + } + size += replicaGroups_.CalculateSize(_repeated_replicaGroups_codec); + if (AllReduceId != 0L) { + size += 2 + pb::CodedOutputStream.ComputeInt64Size(AllReduceId); + } + if (UseGlobalDeviceIds != false) { + size += 2 + 1; + } + if (IsHostTransfer != false) { + size += 2 + 1; + } + if (IsStable != false) { + size += 2 + 1; + } + if (scatterDimensionNumbers_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(ScatterDimensionNumbers); + } + if (precisionConfig_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(PrecisionConfig); + } + size += sourceTargetPairs_.CalculateSize(_repeated_sourceTargetPairs_codec); + if (domainEntrySharding_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(DomainEntrySharding); + } + if (domainExitSharding_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(DomainExitSharding); + } + if (ConstrainLayout != false) { + size += 2 + 1; + } + size += operandShapesWithLayout_.CalculateSize(_repeated_operandShapesWithLayout_codec); + if (triangularSolveOptions_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(TriangularSolveOptions); + } + if (choleskyOptions_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(CholeskyOptions); + } + if (parameterReplication_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(ParameterReplication); + } + if (CustomCallHasSideEffect != false) { + size += 2 + 1; + } + size += customCallOutputOperandAliasing_.CalculateSize(_repeated_customCallOutputOperandAliasing_codec); + if (CustomCallSchedule != global::Xla.CustomCallSchedule.ScheduleNone) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) CustomCallSchedule); + } + if (Delta != 0L) { + size += 2 + pb::CodedOutputStream.ComputeInt64Size(Delta); + } + if (IndicesAreSorted != false) { + size += 2 + 1; + } + if (frontendAttributes_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(FrontendAttributes); + } + if (UniqueIndices != false) { + size += 2 + 1; + } + if (RngAlgorithm != global::Xla.RandomAlgorithm.RngDefault) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) RngAlgorithm); + } + if (ComparisonType.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(ComparisonType); + } + if (IsCrossProgramPrefetch != false) { + size += 2 + 1; + } + if (PaddingType != global::Xla.PaddingType.PaddingInvalid) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) PaddingType); + } + if (CustomCallApiVersion != global::Xla.CustomCallApiVersion.ApiVersionUnspecified) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) CustomCallApiVersion); + } + if (AsyncGroupId != 0L) { + size += 2 + pb::CodedOutputStream.ComputeInt64Size(AsyncGroupId); + } + if (AsyncExecutionThread.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(AsyncExecutionThread); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(HloInstructionProto other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + if (other.Opcode.Length != 0) { + Opcode = other.Opcode; + } + if (other.shape_ != null) { + if (shape_ == null) { + Shape = new global::Xla.ShapeProto(); + } + Shape.MergeFrom(other.Shape); + } + if (other.metadata_ != null) { + if (metadata_ == null) { + Metadata = new global::Xla.OpMetadata(); + } + Metadata.MergeFrom(other.Metadata); + } + if (other.literal_ != null) { + if (literal_ == null) { + Literal = new global::Xla.LiteralProto(); + } + Literal.MergeFrom(other.Literal); + } + if (other.ParameterNumber != 0L) { + ParameterNumber = other.ParameterNumber; + } + if (other.FusionKind.Length != 0) { + FusionKind = other.FusionKind; + } + if (other.TupleIndex != 0L) { + TupleIndex = other.TupleIndex; + } + dimensions_.Add(other.dimensions_); + if (other.window_ != null) { + if (window_ == null) { + Window = new global::Xla.Window(); + } + Window.MergeFrom(other.Window); + } + if (other.convolutionDimensionNumbers_ != null) { + if (convolutionDimensionNumbers_ == null) { + ConvolutionDimensionNumbers = new global::Xla.ConvolutionDimensionNumbers(); + } + ConvolutionDimensionNumbers.MergeFrom(other.ConvolutionDimensionNumbers); + } + if (other.FeatureGroupCount != 0L) { + FeatureGroupCount = other.FeatureGroupCount; + } + if (other.BatchGroupCount != 0L) { + BatchGroupCount = other.BatchGroupCount; + } + sliceDimensions_.Add(other.sliceDimensions_); + if (other.ExponentBits != 0) { + ExponentBits = other.ExponentBits; + } + if (other.MantissaBits != 0) { + MantissaBits = other.MantissaBits; + } + dynamicSliceSizes_.Add(other.dynamicSliceSizes_); + if (other.paddingConfig_ != null) { + if (paddingConfig_ == null) { + PaddingConfig = new global::Xla.PaddingConfig(); + } + PaddingConfig.MergeFrom(other.PaddingConfig); + } + if (other.OutfeedConfig.Length != 0) { + OutfeedConfig = other.OutfeedConfig; + } + if (other.Distribution != global::Xla.RandomDistribution.RngInvalid) { + Distribution = other.Distribution; + } + if (other.Epsilon != 0F) { + Epsilon = other.Epsilon; + } + if (other.FeatureIndex != 0L) { + FeatureIndex = other.FeatureIndex; + } + if (other.ChannelId != 0L) { + ChannelId = other.ChannelId; + } + if (other.InfeedConfig.Length != 0) { + InfeedConfig = other.InfeedConfig; + } + if (other.CustomCallTarget.Length != 0) { + CustomCallTarget = other.CustomCallTarget; + } + if (other.outfeedShape_ != null) { + if (outfeedShape_ == null) { + OutfeedShape = new global::Xla.ShapeProto(); + } + OutfeedShape.MergeFrom(other.OutfeedShape); + } + if (other.dotDimensionNumbers_ != null) { + if (dotDimensionNumbers_ == null) { + DotDimensionNumbers = new global::Xla.DotDimensionNumbers(); + } + DotDimensionNumbers.MergeFrom(other.DotDimensionNumbers); + } + if (other.FftType != global::Xla.FftType.Fft) { + FftType = other.FftType; + } + fftLength_.Add(other.fftLength_); + if (other.ComparisonDirection.Length != 0) { + ComparisonDirection = other.ComparisonDirection; + } + if (other.gatherDimensionNumbers_ != null) { + if (gatherDimensionNumbers_ == null) { + GatherDimensionNumbers = new global::Xla.GatherDimensionNumbers(); + } + GatherDimensionNumbers.MergeFrom(other.GatherDimensionNumbers); + } + gatherSliceSizes_.Add(other.gatherSliceSizes_); + if (other.Id != 0L) { + Id = other.Id; + } + operandIds_.Add(other.operandIds_); + controlPredecessorIds_.Add(other.controlPredecessorIds_); + calledComputationIds_.Add(other.calledComputationIds_); + if (other.sharding_ != null) { + if (sharding_ == null) { + Sharding = new global::Xla.OpSharding(); + } + Sharding.MergeFrom(other.Sharding); + } + if (other.BackendConfig.Length != 0) { + BackendConfig = other.BackendConfig; + } + replicaGroups_.Add(other.replicaGroups_); + if (other.AllReduceId != 0L) { + AllReduceId = other.AllReduceId; + } + if (other.UseGlobalDeviceIds != false) { + UseGlobalDeviceIds = other.UseGlobalDeviceIds; + } + if (other.IsHostTransfer != false) { + IsHostTransfer = other.IsHostTransfer; + } + if (other.IsStable != false) { + IsStable = other.IsStable; + } + if (other.scatterDimensionNumbers_ != null) { + if (scatterDimensionNumbers_ == null) { + ScatterDimensionNumbers = new global::Xla.ScatterDimensionNumbers(); + } + ScatterDimensionNumbers.MergeFrom(other.ScatterDimensionNumbers); + } + if (other.precisionConfig_ != null) { + if (precisionConfig_ == null) { + PrecisionConfig = new global::Xla.PrecisionConfig(); + } + PrecisionConfig.MergeFrom(other.PrecisionConfig); + } + sourceTargetPairs_.Add(other.sourceTargetPairs_); + if (other.domainEntrySharding_ != null) { + if (domainEntrySharding_ == null) { + DomainEntrySharding = new global::Xla.OpSharding(); + } + DomainEntrySharding.MergeFrom(other.DomainEntrySharding); + } + if (other.domainExitSharding_ != null) { + if (domainExitSharding_ == null) { + DomainExitSharding = new global::Xla.OpSharding(); + } + DomainExitSharding.MergeFrom(other.DomainExitSharding); + } + if (other.ConstrainLayout != false) { + ConstrainLayout = other.ConstrainLayout; + } + operandShapesWithLayout_.Add(other.operandShapesWithLayout_); + if (other.triangularSolveOptions_ != null) { + if (triangularSolveOptions_ == null) { + TriangularSolveOptions = new global::Xla.TriangularSolveOptions(); + } + TriangularSolveOptions.MergeFrom(other.TriangularSolveOptions); + } + if (other.choleskyOptions_ != null) { + if (choleskyOptions_ == null) { + CholeskyOptions = new global::Xla.CholeskyOptions(); + } + CholeskyOptions.MergeFrom(other.CholeskyOptions); + } + if (other.parameterReplication_ != null) { + if (parameterReplication_ == null) { + ParameterReplication = new global::Xla.ParameterReplication(); + } + ParameterReplication.MergeFrom(other.ParameterReplication); + } + if (other.CustomCallHasSideEffect != false) { + CustomCallHasSideEffect = other.CustomCallHasSideEffect; + } + customCallOutputOperandAliasing_.Add(other.customCallOutputOperandAliasing_); + if (other.CustomCallSchedule != global::Xla.CustomCallSchedule.ScheduleNone) { + CustomCallSchedule = other.CustomCallSchedule; + } + if (other.Delta != 0L) { + Delta = other.Delta; + } + if (other.IndicesAreSorted != false) { + IndicesAreSorted = other.IndicesAreSorted; + } + if (other.frontendAttributes_ != null) { + if (frontendAttributes_ == null) { + FrontendAttributes = new global::Xla.FrontendAttributes(); + } + FrontendAttributes.MergeFrom(other.FrontendAttributes); + } + if (other.UniqueIndices != false) { + UniqueIndices = other.UniqueIndices; + } + if (other.RngAlgorithm != global::Xla.RandomAlgorithm.RngDefault) { + RngAlgorithm = other.RngAlgorithm; + } + if (other.ComparisonType.Length != 0) { + ComparisonType = other.ComparisonType; + } + if (other.IsCrossProgramPrefetch != false) { + IsCrossProgramPrefetch = other.IsCrossProgramPrefetch; + } + if (other.PaddingType != global::Xla.PaddingType.PaddingInvalid) { + PaddingType = other.PaddingType; + } + if (other.CustomCallApiVersion != global::Xla.CustomCallApiVersion.ApiVersionUnspecified) { + CustomCallApiVersion = other.CustomCallApiVersion; + } + if (other.AsyncGroupId != 0L) { + AsyncGroupId = other.AsyncGroupId; + } + if (other.AsyncExecutionThread.Length != 0) { + AsyncExecutionThread = other.AsyncExecutionThread; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + Opcode = input.ReadString(); + break; + } + case 26: { + if (shape_ == null) { + Shape = new global::Xla.ShapeProto(); + } + input.ReadMessage(Shape); + break; + } + case 58: { + if (metadata_ == null) { + Metadata = new global::Xla.OpMetadata(); + } + input.ReadMessage(Metadata); + break; + } + case 66: { + if (literal_ == null) { + Literal = new global::Xla.LiteralProto(); + } + input.ReadMessage(Literal); + break; + } + case 72: { + ParameterNumber = input.ReadInt64(); + break; + } + case 90: { + FusionKind = input.ReadString(); + break; + } + case 104: { + TupleIndex = input.ReadInt64(); + break; + } + case 114: + case 112: { + dimensions_.AddEntriesFrom(input, _repeated_dimensions_codec); + break; + } + case 122: { + if (window_ == null) { + Window = new global::Xla.Window(); + } + input.ReadMessage(Window); + break; + } + case 130: { + if (convolutionDimensionNumbers_ == null) { + ConvolutionDimensionNumbers = new global::Xla.ConvolutionDimensionNumbers(); + } + input.ReadMessage(ConvolutionDimensionNumbers); + break; + } + case 138: { + sliceDimensions_.AddEntriesFrom(input, _repeated_sliceDimensions_codec); + break; + } + case 144: { + ExponentBits = input.ReadInt32(); + break; + } + case 152: { + MantissaBits = input.ReadInt32(); + break; + } + case 162: + case 160: { + dynamicSliceSizes_.AddEntriesFrom(input, _repeated_dynamicSliceSizes_codec); + break; + } + case 170: { + if (paddingConfig_ == null) { + PaddingConfig = new global::Xla.PaddingConfig(); + } + input.ReadMessage(PaddingConfig); + break; + } + case 178: { + OutfeedConfig = input.ReadBytes(); + break; + } + case 184: { + Distribution = (global::Xla.RandomDistribution) input.ReadEnum(); + break; + } + case 197: { + Epsilon = input.ReadFloat(); + break; + } + case 200: { + FeatureIndex = input.ReadInt64(); + break; + } + case 208: { + ChannelId = input.ReadInt64(); + break; + } + case 218: { + InfeedConfig = input.ReadBytes(); + break; + } + case 226: { + CustomCallTarget = input.ReadString(); + break; + } + case 234: { + if (outfeedShape_ == null) { + OutfeedShape = new global::Xla.ShapeProto(); + } + input.ReadMessage(OutfeedShape); + break; + } + case 242: { + if (dotDimensionNumbers_ == null) { + DotDimensionNumbers = new global::Xla.DotDimensionNumbers(); + } + input.ReadMessage(DotDimensionNumbers); + break; + } + case 248: { + FftType = (global::Xla.FftType) input.ReadEnum(); + break; + } + case 258: + case 256: { + fftLength_.AddEntriesFrom(input, _repeated_fftLength_codec); + break; + } + case 266: { + if (gatherDimensionNumbers_ == null) { + GatherDimensionNumbers = new global::Xla.GatherDimensionNumbers(); + } + input.ReadMessage(GatherDimensionNumbers); + break; + } + case 274: + case 272: { + gatherSliceSizes_.AddEntriesFrom(input, _repeated_gatherSliceSizes_codec); + break; + } + case 280: { + Id = input.ReadInt64(); + break; + } + case 290: + case 288: { + operandIds_.AddEntriesFrom(input, _repeated_operandIds_codec); + break; + } + case 298: + case 296: { + controlPredecessorIds_.AddEntriesFrom(input, _repeated_controlPredecessorIds_codec); + break; + } + case 306: + case 304: { + calledComputationIds_.AddEntriesFrom(input, _repeated_calledComputationIds_codec); + break; + } + case 322: { + if (sharding_ == null) { + Sharding = new global::Xla.OpSharding(); + } + input.ReadMessage(Sharding); + break; + } + case 346: { + BackendConfig = input.ReadBytes(); + break; + } + case 360: { + AllReduceId = input.ReadInt64(); + break; + } + case 376: { + IsHostTransfer = input.ReadBool(); + break; + } + case 386: { + if (scatterDimensionNumbers_ == null) { + ScatterDimensionNumbers = new global::Xla.ScatterDimensionNumbers(); + } + input.ReadMessage(ScatterDimensionNumbers); + break; + } + case 394: { + replicaGroups_.AddEntriesFrom(input, _repeated_replicaGroups_codec); + break; + } + case 400: { + FeatureGroupCount = input.ReadInt64(); + break; + } + case 410: { + if (precisionConfig_ == null) { + PrecisionConfig = new global::Xla.PrecisionConfig(); + } + input.ReadMessage(PrecisionConfig); + break; + } + case 418: { + sourceTargetPairs_.AddEntriesFrom(input, _repeated_sourceTargetPairs_codec); + break; + } + case 434: { + if (domainEntrySharding_ == null) { + DomainEntrySharding = new global::Xla.OpSharding(); + } + input.ReadMessage(DomainEntrySharding); + break; + } + case 442: { + if (domainExitSharding_ == null) { + DomainExitSharding = new global::Xla.OpSharding(); + } + input.ReadMessage(DomainExitSharding); + break; + } + case 448: { + ConstrainLayout = input.ReadBool(); + break; + } + case 458: { + operandShapesWithLayout_.AddEntriesFrom(input, _repeated_operandShapesWithLayout_codec); + break; + } + case 464: { + BatchGroupCount = input.ReadInt64(); + break; + } + case 474: { + if (triangularSolveOptions_ == null) { + TriangularSolveOptions = new global::Xla.TriangularSolveOptions(); + } + input.ReadMessage(TriangularSolveOptions); + break; + } + case 480: { + IsStable = input.ReadBool(); + break; + } + case 490: { + if (parameterReplication_ == null) { + ParameterReplication = new global::Xla.ParameterReplication(); + } + input.ReadMessage(ParameterReplication); + break; + } + case 498: { + if (choleskyOptions_ == null) { + CholeskyOptions = new global::Xla.CholeskyOptions(); + } + input.ReadMessage(CholeskyOptions); + break; + } + case 506: { + ComparisonDirection = input.ReadString(); + break; + } + case 520: { + CustomCallHasSideEffect = input.ReadBool(); + break; + } + case 528: { + Delta = input.ReadInt64(); + break; + } + case 536: { + IndicesAreSorted = input.ReadBool(); + break; + } + case 546: { + if (frontendAttributes_ == null) { + FrontendAttributes = new global::Xla.FrontendAttributes(); + } + input.ReadMessage(FrontendAttributes); + break; + } + case 552: { + UniqueIndices = input.ReadBool(); + break; + } + case 560: { + RngAlgorithm = (global::Xla.RandomAlgorithm) input.ReadEnum(); + break; + } + case 568: { + UseGlobalDeviceIds = input.ReadBool(); + break; + } + case 578: { + ComparisonType = input.ReadString(); + break; + } + case 584: { + IsCrossProgramPrefetch = input.ReadBool(); + break; + } + case 594: { + customCallOutputOperandAliasing_.AddEntriesFrom(input, _repeated_customCallOutputOperandAliasing_codec); + break; + } + case 600: { + PaddingType = (global::Xla.PaddingType) input.ReadEnum(); + break; + } + case 608: { + CustomCallSchedule = (global::Xla.CustomCallSchedule) input.ReadEnum(); + break; + } + case 616: { + CustomCallApiVersion = (global::Xla.CustomCallApiVersion) input.ReadEnum(); + break; + } + case 624: { + AsyncGroupId = input.ReadInt64(); + break; + } + case 634: { + AsyncExecutionThread = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + Opcode = input.ReadString(); + break; + } + case 26: { + if (shape_ == null) { + Shape = new global::Xla.ShapeProto(); + } + input.ReadMessage(Shape); + break; + } + case 58: { + if (metadata_ == null) { + Metadata = new global::Xla.OpMetadata(); + } + input.ReadMessage(Metadata); + break; + } + case 66: { + if (literal_ == null) { + Literal = new global::Xla.LiteralProto(); + } + input.ReadMessage(Literal); + break; + } + case 72: { + ParameterNumber = input.ReadInt64(); + break; + } + case 90: { + FusionKind = input.ReadString(); + break; + } + case 104: { + TupleIndex = input.ReadInt64(); + break; + } + case 114: + case 112: { + dimensions_.AddEntriesFrom(ref input, _repeated_dimensions_codec); + break; + } + case 122: { + if (window_ == null) { + Window = new global::Xla.Window(); + } + input.ReadMessage(Window); + break; + } + case 130: { + if (convolutionDimensionNumbers_ == null) { + ConvolutionDimensionNumbers = new global::Xla.ConvolutionDimensionNumbers(); + } + input.ReadMessage(ConvolutionDimensionNumbers); + break; + } + case 138: { + sliceDimensions_.AddEntriesFrom(ref input, _repeated_sliceDimensions_codec); + break; + } + case 144: { + ExponentBits = input.ReadInt32(); + break; + } + case 152: { + MantissaBits = input.ReadInt32(); + break; + } + case 162: + case 160: { + dynamicSliceSizes_.AddEntriesFrom(ref input, _repeated_dynamicSliceSizes_codec); + break; + } + case 170: { + if (paddingConfig_ == null) { + PaddingConfig = new global::Xla.PaddingConfig(); + } + input.ReadMessage(PaddingConfig); + break; + } + case 178: { + OutfeedConfig = input.ReadBytes(); + break; + } + case 184: { + Distribution = (global::Xla.RandomDistribution) input.ReadEnum(); + break; + } + case 197: { + Epsilon = input.ReadFloat(); + break; + } + case 200: { + FeatureIndex = input.ReadInt64(); + break; + } + case 208: { + ChannelId = input.ReadInt64(); + break; + } + case 218: { + InfeedConfig = input.ReadBytes(); + break; + } + case 226: { + CustomCallTarget = input.ReadString(); + break; + } + case 234: { + if (outfeedShape_ == null) { + OutfeedShape = new global::Xla.ShapeProto(); + } + input.ReadMessage(OutfeedShape); + break; + } + case 242: { + if (dotDimensionNumbers_ == null) { + DotDimensionNumbers = new global::Xla.DotDimensionNumbers(); + } + input.ReadMessage(DotDimensionNumbers); + break; + } + case 248: { + FftType = (global::Xla.FftType) input.ReadEnum(); + break; + } + case 258: + case 256: { + fftLength_.AddEntriesFrom(ref input, _repeated_fftLength_codec); + break; + } + case 266: { + if (gatherDimensionNumbers_ == null) { + GatherDimensionNumbers = new global::Xla.GatherDimensionNumbers(); + } + input.ReadMessage(GatherDimensionNumbers); + break; + } + case 274: + case 272: { + gatherSliceSizes_.AddEntriesFrom(ref input, _repeated_gatherSliceSizes_codec); + break; + } + case 280: { + Id = input.ReadInt64(); + break; + } + case 290: + case 288: { + operandIds_.AddEntriesFrom(ref input, _repeated_operandIds_codec); + break; + } + case 298: + case 296: { + controlPredecessorIds_.AddEntriesFrom(ref input, _repeated_controlPredecessorIds_codec); + break; + } + case 306: + case 304: { + calledComputationIds_.AddEntriesFrom(ref input, _repeated_calledComputationIds_codec); + break; + } + case 322: { + if (sharding_ == null) { + Sharding = new global::Xla.OpSharding(); + } + input.ReadMessage(Sharding); + break; + } + case 346: { + BackendConfig = input.ReadBytes(); + break; + } + case 360: { + AllReduceId = input.ReadInt64(); + break; + } + case 376: { + IsHostTransfer = input.ReadBool(); + break; + } + case 386: { + if (scatterDimensionNumbers_ == null) { + ScatterDimensionNumbers = new global::Xla.ScatterDimensionNumbers(); + } + input.ReadMessage(ScatterDimensionNumbers); + break; + } + case 394: { + replicaGroups_.AddEntriesFrom(ref input, _repeated_replicaGroups_codec); + break; + } + case 400: { + FeatureGroupCount = input.ReadInt64(); + break; + } + case 410: { + if (precisionConfig_ == null) { + PrecisionConfig = new global::Xla.PrecisionConfig(); + } + input.ReadMessage(PrecisionConfig); + break; + } + case 418: { + sourceTargetPairs_.AddEntriesFrom(ref input, _repeated_sourceTargetPairs_codec); + break; + } + case 434: { + if (domainEntrySharding_ == null) { + DomainEntrySharding = new global::Xla.OpSharding(); + } + input.ReadMessage(DomainEntrySharding); + break; + } + case 442: { + if (domainExitSharding_ == null) { + DomainExitSharding = new global::Xla.OpSharding(); + } + input.ReadMessage(DomainExitSharding); + break; + } + case 448: { + ConstrainLayout = input.ReadBool(); + break; + } + case 458: { + operandShapesWithLayout_.AddEntriesFrom(ref input, _repeated_operandShapesWithLayout_codec); + break; + } + case 464: { + BatchGroupCount = input.ReadInt64(); + break; + } + case 474: { + if (triangularSolveOptions_ == null) { + TriangularSolveOptions = new global::Xla.TriangularSolveOptions(); + } + input.ReadMessage(TriangularSolveOptions); + break; + } + case 480: { + IsStable = input.ReadBool(); + break; + } + case 490: { + if (parameterReplication_ == null) { + ParameterReplication = new global::Xla.ParameterReplication(); + } + input.ReadMessage(ParameterReplication); + break; + } + case 498: { + if (choleskyOptions_ == null) { + CholeskyOptions = new global::Xla.CholeskyOptions(); + } + input.ReadMessage(CholeskyOptions); + break; + } + case 506: { + ComparisonDirection = input.ReadString(); + break; + } + case 520: { + CustomCallHasSideEffect = input.ReadBool(); + break; + } + case 528: { + Delta = input.ReadInt64(); + break; + } + case 536: { + IndicesAreSorted = input.ReadBool(); + break; + } + case 546: { + if (frontendAttributes_ == null) { + FrontendAttributes = new global::Xla.FrontendAttributes(); + } + input.ReadMessage(FrontendAttributes); + break; + } + case 552: { + UniqueIndices = input.ReadBool(); + break; + } + case 560: { + RngAlgorithm = (global::Xla.RandomAlgorithm) input.ReadEnum(); + break; + } + case 568: { + UseGlobalDeviceIds = input.ReadBool(); + break; + } + case 578: { + ComparisonType = input.ReadString(); + break; + } + case 584: { + IsCrossProgramPrefetch = input.ReadBool(); + break; + } + case 594: { + customCallOutputOperandAliasing_.AddEntriesFrom(ref input, _repeated_customCallOutputOperandAliasing_codec); + break; + } + case 600: { + PaddingType = (global::Xla.PaddingType) input.ReadEnum(); + break; + } + case 608: { + CustomCallSchedule = (global::Xla.CustomCallSchedule) input.ReadEnum(); + break; + } + case 616: { + CustomCallApiVersion = (global::Xla.CustomCallApiVersion) input.ReadEnum(); + break; + } + case 624: { + AsyncGroupId = input.ReadInt64(); + break; + } + case 634: { + AsyncExecutionThread = input.ReadString(); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the HloInstructionProto message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + /// + /// Describes the [begin, end) index range and stride for slices. + /// + public sealed partial class SliceDimensions : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SliceDimensions()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloInstructionProto.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public SliceDimensions() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public SliceDimensions(SliceDimensions other) : this() { + start_ = other.start_; + limit_ = other.limit_; + stride_ = other.stride_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public SliceDimensions Clone() { + return new SliceDimensions(this); + } + + /// Field number for the "start" field. + public const int StartFieldNumber = 1; + private long start_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Start { + get { return start_; } + set { + start_ = value; + } + } + + /// Field number for the "limit" field. + public const int LimitFieldNumber = 2; + private long limit_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Limit { + get { return limit_; } + set { + limit_ = value; + } + } + + /// Field number for the "stride" field. + public const int StrideFieldNumber = 3; + private long stride_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Stride { + get { return stride_; } + set { + stride_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as SliceDimensions); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(SliceDimensions other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Start != other.Start) return false; + if (Limit != other.Limit) return false; + if (Stride != other.Stride) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Start != 0L) hash ^= Start.GetHashCode(); + if (Limit != 0L) hash ^= Limit.GetHashCode(); + if (Stride != 0L) hash ^= Stride.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Start != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Start); + } + if (Limit != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Limit); + } + if (Stride != 0L) { + output.WriteRawTag(24); + output.WriteInt64(Stride); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Start != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Start); + } + if (Limit != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Limit); + } + if (Stride != 0L) { + output.WriteRawTag(24); + output.WriteInt64(Stride); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Start != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Start); + } + if (Limit != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Limit); + } + if (Stride != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Stride); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(SliceDimensions other) { + if (other == null) { + return; + } + if (other.Start != 0L) { + Start = other.Start; + } + if (other.Limit != 0L) { + Limit = other.Limit; + } + if (other.Stride != 0L) { + Stride = other.Stride; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Start = input.ReadInt64(); + break; + } + case 16: { + Limit = input.ReadInt64(); + break; + } + case 24: { + Stride = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Start = input.ReadInt64(); + break; + } + case 16: { + Limit = input.ReadInt64(); + break; + } + case 24: { + Stride = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + } + #endregion + + } + + /// + /// Serialization of HloComputation. + /// + public sealed partial class HloComputationProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HloComputationProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloComputationProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloComputationProto(HloComputationProto other) : this() { + name_ = other.name_; + instructions_ = other.instructions_.Clone(); + programShape_ = other.programShape_ != null ? other.programShape_.Clone() : null; + id_ = other.id_; + rootId_ = other.rootId_; + isFusionComputation_ = other.isFusionComputation_; + executionThread_ = other.executionThread_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloComputationProto Clone() { + return new HloComputationProto(this); + } + + /// Field number for the "name" field. + public const int NameFieldNumber = 1; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "instructions" field. + public const int InstructionsFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_instructions_codec + = pb::FieldCodec.ForMessage(18, global::Xla.HloInstructionProto.Parser); + private readonly pbc::RepeatedField instructions_ = new pbc::RepeatedField(); + /// + /// The array of instructions is always in a valid dependency order, where + /// operands appear before their users. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Instructions { + get { return instructions_; } + } + + /// Field number for the "program_shape" field. + public const int ProgramShapeFieldNumber = 4; + private global::Xla.ProgramShapeProto programShape_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ProgramShapeProto ProgramShape { + get { return programShape_; } + set { + programShape_ = value; + } + } + + /// Field number for the "id" field. + public const int IdFieldNumber = 5; + private long id_; + /// + /// The id of this computation. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "root_id" field. + public const int RootIdFieldNumber = 6; + private long rootId_; + /// + /// The id of the root of the computation. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long RootId { + get { return rootId_; } + set { + rootId_ = value; + } + } + + /// Field number for the "is_fusion_computation" field. + public const int IsFusionComputationFieldNumber = 7; + private bool isFusionComputation_; + /// + /// Whether this is a fusion computation. Fusion computations should use this + /// to determine whether they are a fusion in CreateFromProto since the + /// parent fusion_instruction_ may get removed and be nullptr. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool IsFusionComputation { + get { return isFusionComputation_; } + set { + isFusionComputation_ = value; + } + } + + /// Field number for the "execution_thread" field. + public const int ExecutionThreadFieldNumber = 8; + private string executionThread_ = ""; + /// + /// The name of execution thread this computation belongs to. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string ExecutionThread { + get { return executionThread_; } + set { + executionThread_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as HloComputationProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(HloComputationProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + if(!instructions_.Equals(other.instructions_)) return false; + if (!object.Equals(ProgramShape, other.ProgramShape)) return false; + if (Id != other.Id) return false; + if (RootId != other.RootId) return false; + if (IsFusionComputation != other.IsFusionComputation) return false; + if (ExecutionThread != other.ExecutionThread) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + hash ^= instructions_.GetHashCode(); + if (programShape_ != null) hash ^= ProgramShape.GetHashCode(); + if (Id != 0L) hash ^= Id.GetHashCode(); + if (RootId != 0L) hash ^= RootId.GetHashCode(); + if (IsFusionComputation != false) hash ^= IsFusionComputation.GetHashCode(); + if (ExecutionThread.Length != 0) hash ^= ExecutionThread.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + instructions_.WriteTo(output, _repeated_instructions_codec); + if (programShape_ != null) { + output.WriteRawTag(34); + output.WriteMessage(ProgramShape); + } + if (Id != 0L) { + output.WriteRawTag(40); + output.WriteInt64(Id); + } + if (RootId != 0L) { + output.WriteRawTag(48); + output.WriteInt64(RootId); + } + if (IsFusionComputation != false) { + output.WriteRawTag(56); + output.WriteBool(IsFusionComputation); + } + if (ExecutionThread.Length != 0) { + output.WriteRawTag(66); + output.WriteString(ExecutionThread); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + instructions_.WriteTo(ref output, _repeated_instructions_codec); + if (programShape_ != null) { + output.WriteRawTag(34); + output.WriteMessage(ProgramShape); + } + if (Id != 0L) { + output.WriteRawTag(40); + output.WriteInt64(Id); + } + if (RootId != 0L) { + output.WriteRawTag(48); + output.WriteInt64(RootId); + } + if (IsFusionComputation != false) { + output.WriteRawTag(56); + output.WriteBool(IsFusionComputation); + } + if (ExecutionThread.Length != 0) { + output.WriteRawTag(66); + output.WriteString(ExecutionThread); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + size += instructions_.CalculateSize(_repeated_instructions_codec); + if (programShape_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ProgramShape); + } + if (Id != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Id); + } + if (RootId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(RootId); + } + if (IsFusionComputation != false) { + size += 1 + 1; + } + if (ExecutionThread.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ExecutionThread); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(HloComputationProto other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + instructions_.Add(other.instructions_); + if (other.programShape_ != null) { + if (programShape_ == null) { + ProgramShape = new global::Xla.ProgramShapeProto(); + } + ProgramShape.MergeFrom(other.ProgramShape); + } + if (other.Id != 0L) { + Id = other.Id; + } + if (other.RootId != 0L) { + RootId = other.RootId; + } + if (other.IsFusionComputation != false) { + IsFusionComputation = other.IsFusionComputation; + } + if (other.ExecutionThread.Length != 0) { + ExecutionThread = other.ExecutionThread; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + instructions_.AddEntriesFrom(input, _repeated_instructions_codec); + break; + } + case 34: { + if (programShape_ == null) { + ProgramShape = new global::Xla.ProgramShapeProto(); + } + input.ReadMessage(ProgramShape); + break; + } + case 40: { + Id = input.ReadInt64(); + break; + } + case 48: { + RootId = input.ReadInt64(); + break; + } + case 56: { + IsFusionComputation = input.ReadBool(); + break; + } + case 66: { + ExecutionThread = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + instructions_.AddEntriesFrom(ref input, _repeated_instructions_codec); + break; + } + case 34: { + if (programShape_ == null) { + ProgramShape = new global::Xla.ProgramShapeProto(); + } + input.ReadMessage(ProgramShape); + break; + } + case 40: { + Id = input.ReadInt64(); + break; + } + case 48: { + RootId = input.ReadInt64(); + break; + } + case 56: { + IsFusionComputation = input.ReadBool(); + break; + } + case 66: { + ExecutionThread = input.ReadString(); + break; + } + } + } + } + #endif + + } + + /// + /// Serialization of an HLO schedule. An HLO schedule contains a total order of + /// instructions for each non-fusion computation in the module. + /// + public sealed partial class HloScheduleProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HloScheduleProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloScheduleProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloScheduleProto(HloScheduleProto other) : this() { + sequences_ = other.sequences_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloScheduleProto Clone() { + return new HloScheduleProto(this); + } + + /// Field number for the "sequences" field. + public const int SequencesFieldNumber = 1; + private static readonly pbc::MapField.Codec _map_sequences_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForInt64(8, 0L), pb::FieldCodec.ForMessage(18, global::Xla.HloScheduleProto.Types.InstructionSequence.Parser), 10); + private readonly pbc::MapField sequences_ = new pbc::MapField(); + /// + /// Map from computation id to sequence. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::MapField Sequences { + get { return sequences_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as HloScheduleProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(HloScheduleProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!Sequences.Equals(other.Sequences)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= Sequences.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + sequences_.WriteTo(output, _map_sequences_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + sequences_.WriteTo(ref output, _map_sequences_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += sequences_.CalculateSize(_map_sequences_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(HloScheduleProto other) { + if (other == null) { + return; + } + sequences_.Add(other.sequences_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + sequences_.AddEntriesFrom(input, _map_sequences_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + sequences_.AddEntriesFrom(ref input, _map_sequences_codec); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the HloScheduleProto message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + public sealed partial class InstructionSequence : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new InstructionSequence()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloScheduleProto.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public InstructionSequence() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public InstructionSequence(InstructionSequence other) : this() { + instructionIds_ = other.instructionIds_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public InstructionSequence Clone() { + return new InstructionSequence(this); + } + + /// Field number for the "instruction_ids" field. + public const int InstructionIdsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_instructionIds_codec + = pb::FieldCodec.ForInt64(10); + private readonly pbc::RepeatedField instructionIds_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField InstructionIds { + get { return instructionIds_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as InstructionSequence); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(InstructionSequence other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!instructionIds_.Equals(other.instructionIds_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= instructionIds_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + instructionIds_.WriteTo(output, _repeated_instructionIds_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + instructionIds_.WriteTo(ref output, _repeated_instructionIds_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += instructionIds_.CalculateSize(_repeated_instructionIds_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(InstructionSequence other) { + if (other == null) { + return; + } + instructionIds_.Add(other.instructionIds_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: + case 8: { + instructionIds_.AddEntriesFrom(input, _repeated_instructionIds_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: + case 8: { + instructionIds_.AddEntriesFrom(ref input, _repeated_instructionIds_codec); + break; + } + } + } + } + #endif + + } + + } + #endregion + + } + + public sealed partial class HloInputOutputAliasProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HloInputOutputAliasProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloInputOutputAliasProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloInputOutputAliasProto(HloInputOutputAliasProto other) : this() { + entries_ = other.entries_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloInputOutputAliasProto Clone() { + return new HloInputOutputAliasProto(this); + } + + /// Field number for the "entries" field. + public const int EntriesFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_entries_codec + = pb::FieldCodec.ForMessage(10, global::Xla.HloInputOutputAliasProto.Types.AliasEntryProto.Parser); + private readonly pbc::RepeatedField entries_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Entries { + get { return entries_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as HloInputOutputAliasProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(HloInputOutputAliasProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!entries_.Equals(other.entries_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= entries_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + entries_.WriteTo(output, _repeated_entries_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + entries_.WriteTo(ref output, _repeated_entries_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += entries_.CalculateSize(_repeated_entries_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(HloInputOutputAliasProto other) { + if (other == null) { + return; + } + entries_.Add(other.entries_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + entries_.AddEntriesFrom(input, _repeated_entries_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + entries_.AddEntriesFrom(ref input, _repeated_entries_codec); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the HloInputOutputAliasProto message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + /// + /// The following proto describes a pair of aliased an input + /// (described by parameter number and a ShapeIndex of the parameter) + /// and an output (described by a ShapeIndex of the root + /// instruction). For example: + /// + /// entry = { + /// output_shape_index={1}, + /// parameter_number=0, + /// parameter_shape_index={1, 2}, + /// } + /// + /// This entry indicates that the first paremter's {1, 2} element is + /// aliased with the {1} element of the root instruction. + /// + public sealed partial class AliasEntryProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AliasEntryProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloInputOutputAliasProto.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public AliasEntryProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public AliasEntryProto(AliasEntryProto other) : this() { + outputShapeIndex_ = other.outputShapeIndex_.Clone(); + parameterNumber_ = other.parameterNumber_; + parameterShapeIndex_ = other.parameterShapeIndex_.Clone(); + kind_ = other.kind_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public AliasEntryProto Clone() { + return new AliasEntryProto(this); + } + + /// Field number for the "output_shape_index" field. + public const int OutputShapeIndexFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_outputShapeIndex_codec + = pb::FieldCodec.ForInt64(10); + private readonly pbc::RepeatedField outputShapeIndex_ = new pbc::RepeatedField(); + /// + /// ShapeIndex of the root hlo. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField OutputShapeIndex { + get { return outputShapeIndex_; } + } + + /// Field number for the "parameter_number" field. + public const int ParameterNumberFieldNumber = 2; + private long parameterNumber_; + /// + /// Number of the parameter in entry computation. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long ParameterNumber { + get { return parameterNumber_; } + set { + parameterNumber_ = value; + } + } + + /// Field number for the "parameter_shape_index" field. + public const int ParameterShapeIndexFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_parameterShapeIndex_codec + = pb::FieldCodec.ForInt64(26); + private readonly pbc::RepeatedField parameterShapeIndex_ = new pbc::RepeatedField(); + /// + /// ShapeIndex of the parameter instruction. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField ParameterShapeIndex { + get { return parameterShapeIndex_; } + } + + /// Field number for the "kind" field. + public const int KindFieldNumber = 4; + private global::Xla.Kind kind_ = global::Xla.Kind.UndefinedAlias; + /// + /// The kind of alias to be setup. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.Kind Kind { + get { return kind_; } + set { + kind_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as AliasEntryProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(AliasEntryProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!outputShapeIndex_.Equals(other.outputShapeIndex_)) return false; + if (ParameterNumber != other.ParameterNumber) return false; + if(!parameterShapeIndex_.Equals(other.parameterShapeIndex_)) return false; + if (Kind != other.Kind) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= outputShapeIndex_.GetHashCode(); + if (ParameterNumber != 0L) hash ^= ParameterNumber.GetHashCode(); + hash ^= parameterShapeIndex_.GetHashCode(); + if (Kind != global::Xla.Kind.UndefinedAlias) hash ^= Kind.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + outputShapeIndex_.WriteTo(output, _repeated_outputShapeIndex_codec); + if (ParameterNumber != 0L) { + output.WriteRawTag(16); + output.WriteInt64(ParameterNumber); + } + parameterShapeIndex_.WriteTo(output, _repeated_parameterShapeIndex_codec); + if (Kind != global::Xla.Kind.UndefinedAlias) { + output.WriteRawTag(32); + output.WriteEnum((int) Kind); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + outputShapeIndex_.WriteTo(ref output, _repeated_outputShapeIndex_codec); + if (ParameterNumber != 0L) { + output.WriteRawTag(16); + output.WriteInt64(ParameterNumber); + } + parameterShapeIndex_.WriteTo(ref output, _repeated_parameterShapeIndex_codec); + if (Kind != global::Xla.Kind.UndefinedAlias) { + output.WriteRawTag(32); + output.WriteEnum((int) Kind); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += outputShapeIndex_.CalculateSize(_repeated_outputShapeIndex_codec); + if (ParameterNumber != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(ParameterNumber); + } + size += parameterShapeIndex_.CalculateSize(_repeated_parameterShapeIndex_codec); + if (Kind != global::Xla.Kind.UndefinedAlias) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Kind); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(AliasEntryProto other) { + if (other == null) { + return; + } + outputShapeIndex_.Add(other.outputShapeIndex_); + if (other.ParameterNumber != 0L) { + ParameterNumber = other.ParameterNumber; + } + parameterShapeIndex_.Add(other.parameterShapeIndex_); + if (other.Kind != global::Xla.Kind.UndefinedAlias) { + Kind = other.Kind; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: + case 8: { + outputShapeIndex_.AddEntriesFrom(input, _repeated_outputShapeIndex_codec); + break; + } + case 16: { + ParameterNumber = input.ReadInt64(); + break; + } + case 26: + case 24: { + parameterShapeIndex_.AddEntriesFrom(input, _repeated_parameterShapeIndex_codec); + break; + } + case 32: { + Kind = (global::Xla.Kind) input.ReadEnum(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: + case 8: { + outputShapeIndex_.AddEntriesFrom(ref input, _repeated_outputShapeIndex_codec); + break; + } + case 16: { + ParameterNumber = input.ReadInt64(); + break; + } + case 26: + case 24: { + parameterShapeIndex_.AddEntriesFrom(ref input, _repeated_parameterShapeIndex_codec); + break; + } + case 32: { + Kind = (global::Xla.Kind) input.ReadEnum(); + break; + } + } + } + } + #endif + + } + + } + #endregion + + } + + public sealed partial class DynamicParameterBindingProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DynamicParameterBindingProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DynamicParameterBindingProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DynamicParameterBindingProto(DynamicParameterBindingProto other) : this() { + entries_ = other.entries_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DynamicParameterBindingProto Clone() { + return new DynamicParameterBindingProto(this); + } + + /// Field number for the "entries" field. + public const int EntriesFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_entries_codec + = pb::FieldCodec.ForMessage(10, global::Xla.DynamicParameterBindingProto.Types.Binding.Parser); + private readonly pbc::RepeatedField entries_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Entries { + get { return entries_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as DynamicParameterBindingProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(DynamicParameterBindingProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!entries_.Equals(other.entries_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= entries_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + entries_.WriteTo(output, _repeated_entries_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + entries_.WriteTo(ref output, _repeated_entries_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += entries_.CalculateSize(_repeated_entries_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(DynamicParameterBindingProto other) { + if (other == null) { + return; + } + entries_.Add(other.entries_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + entries_.AddEntriesFrom(input, _repeated_entries_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + entries_.AddEntriesFrom(ref input, _repeated_entries_codec); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the DynamicParameterBindingProto message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + /// + /// A list of bindings which indicates that the `target_dim_num` in + /// the subshape `target_param_index` of parameter `target_param_num` + /// is a dynamic dimension and its real dynamic size is represented + /// by `dynamic_param_index` in parameter `dynamic_param_num`. + /// + /// As an example, imagine we have a program: + /// + /// ENTRY main { + /// a = f32[] parameter(0) + /// b = f32[10] parameter(1) + /// ROOT root = (f32[], f32[10]) tuple(%a, %b) + /// } + /// + /// Let's say 'b' (param index 1) is a dynamic shape whose input has + /// an upperbound of 10 and real size is determined at runtime.'a' + /// represents the real size of b's first dimension. + /// + /// In this case, the fields are set in the following way: + /// dynamic_param_num = 1 + /// dynamic_param_index = {} + /// target_param_num = 0 + /// target_param_index = {} + /// target_param_dim = 0 + /// + public sealed partial class Binding : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Binding()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.DynamicParameterBindingProto.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Binding() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Binding(Binding other) : this() { + dynamicParamNum_ = other.dynamicParamNum_; + dynamicParamIndex_ = other.dynamicParamIndex_.Clone(); + targetParamNum_ = other.targetParamNum_; + targetParamIndex_ = other.targetParamIndex_.Clone(); + targetParamDimNum_ = other.targetParamDimNum_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Binding Clone() { + return new Binding(this); + } + + /// Field number for the "dynamic_param_num" field. + public const int DynamicParamNumFieldNumber = 1; + private long dynamicParamNum_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long DynamicParamNum { + get { return dynamicParamNum_; } + set { + dynamicParamNum_ = value; + } + } + + /// Field number for the "dynamic_param_index" field. + public const int DynamicParamIndexFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_dynamicParamIndex_codec + = pb::FieldCodec.ForInt64(18); + private readonly pbc::RepeatedField dynamicParamIndex_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField DynamicParamIndex { + get { return dynamicParamIndex_; } + } + + /// Field number for the "target_param_num" field. + public const int TargetParamNumFieldNumber = 3; + private long targetParamNum_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long TargetParamNum { + get { return targetParamNum_; } + set { + targetParamNum_ = value; + } + } + + /// Field number for the "target_param_index" field. + public const int TargetParamIndexFieldNumber = 4; + private static readonly pb::FieldCodec _repeated_targetParamIndex_codec + = pb::FieldCodec.ForInt64(34); + private readonly pbc::RepeatedField targetParamIndex_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField TargetParamIndex { + get { return targetParamIndex_; } + } + + /// Field number for the "target_param_dim_num" field. + public const int TargetParamDimNumFieldNumber = 5; + private long targetParamDimNum_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long TargetParamDimNum { + get { return targetParamDimNum_; } + set { + targetParamDimNum_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as Binding); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(Binding other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (DynamicParamNum != other.DynamicParamNum) return false; + if(!dynamicParamIndex_.Equals(other.dynamicParamIndex_)) return false; + if (TargetParamNum != other.TargetParamNum) return false; + if(!targetParamIndex_.Equals(other.targetParamIndex_)) return false; + if (TargetParamDimNum != other.TargetParamDimNum) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (DynamicParamNum != 0L) hash ^= DynamicParamNum.GetHashCode(); + hash ^= dynamicParamIndex_.GetHashCode(); + if (TargetParamNum != 0L) hash ^= TargetParamNum.GetHashCode(); + hash ^= targetParamIndex_.GetHashCode(); + if (TargetParamDimNum != 0L) hash ^= TargetParamDimNum.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (DynamicParamNum != 0L) { + output.WriteRawTag(8); + output.WriteInt64(DynamicParamNum); + } + dynamicParamIndex_.WriteTo(output, _repeated_dynamicParamIndex_codec); + if (TargetParamNum != 0L) { + output.WriteRawTag(24); + output.WriteInt64(TargetParamNum); + } + targetParamIndex_.WriteTo(output, _repeated_targetParamIndex_codec); + if (TargetParamDimNum != 0L) { + output.WriteRawTag(40); + output.WriteInt64(TargetParamDimNum); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (DynamicParamNum != 0L) { + output.WriteRawTag(8); + output.WriteInt64(DynamicParamNum); + } + dynamicParamIndex_.WriteTo(ref output, _repeated_dynamicParamIndex_codec); + if (TargetParamNum != 0L) { + output.WriteRawTag(24); + output.WriteInt64(TargetParamNum); + } + targetParamIndex_.WriteTo(ref output, _repeated_targetParamIndex_codec); + if (TargetParamDimNum != 0L) { + output.WriteRawTag(40); + output.WriteInt64(TargetParamDimNum); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (DynamicParamNum != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(DynamicParamNum); + } + size += dynamicParamIndex_.CalculateSize(_repeated_dynamicParamIndex_codec); + if (TargetParamNum != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(TargetParamNum); + } + size += targetParamIndex_.CalculateSize(_repeated_targetParamIndex_codec); + if (TargetParamDimNum != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(TargetParamDimNum); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(Binding other) { + if (other == null) { + return; + } + if (other.DynamicParamNum != 0L) { + DynamicParamNum = other.DynamicParamNum; + } + dynamicParamIndex_.Add(other.dynamicParamIndex_); + if (other.TargetParamNum != 0L) { + TargetParamNum = other.TargetParamNum; + } + targetParamIndex_.Add(other.targetParamIndex_); + if (other.TargetParamDimNum != 0L) { + TargetParamDimNum = other.TargetParamDimNum; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + DynamicParamNum = input.ReadInt64(); + break; + } + case 18: + case 16: { + dynamicParamIndex_.AddEntriesFrom(input, _repeated_dynamicParamIndex_codec); + break; + } + case 24: { + TargetParamNum = input.ReadInt64(); + break; + } + case 34: + case 32: { + targetParamIndex_.AddEntriesFrom(input, _repeated_targetParamIndex_codec); + break; + } + case 40: { + TargetParamDimNum = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + DynamicParamNum = input.ReadInt64(); + break; + } + case 18: + case 16: { + dynamicParamIndex_.AddEntriesFrom(ref input, _repeated_dynamicParamIndex_codec); + break; + } + case 24: { + TargetParamNum = input.ReadInt64(); + break; + } + case 34: + case 32: { + targetParamIndex_.AddEntriesFrom(ref input, _repeated_targetParamIndex_codec); + break; + } + case 40: { + TargetParamDimNum = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + } + #endregion + + } + + public sealed partial class CrossProgramPrefetch : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CrossProgramPrefetch()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloReflection.Descriptor.MessageTypes[5]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CrossProgramPrefetch() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CrossProgramPrefetch(CrossProgramPrefetch other) : this() { + parameter_ = other.parameter_; + index_ = other.index_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CrossProgramPrefetch Clone() { + return new CrossProgramPrefetch(this); + } + + /// Field number for the "parameter" field. + public const int ParameterFieldNumber = 1; + private long parameter_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Parameter { + get { return parameter_; } + set { + parameter_ = value; + } + } + + /// Field number for the "index" field. + public const int IndexFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_index_codec + = pb::FieldCodec.ForInt64(18); + private readonly pbc::RepeatedField index_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Index { + get { return index_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as CrossProgramPrefetch); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(CrossProgramPrefetch other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Parameter != other.Parameter) return false; + if(!index_.Equals(other.index_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Parameter != 0L) hash ^= Parameter.GetHashCode(); + hash ^= index_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Parameter != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Parameter); + } + index_.WriteTo(output, _repeated_index_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Parameter != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Parameter); + } + index_.WriteTo(ref output, _repeated_index_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Parameter != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Parameter); + } + size += index_.CalculateSize(_repeated_index_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(CrossProgramPrefetch other) { + if (other == null) { + return; + } + if (other.Parameter != 0L) { + Parameter = other.Parameter; + } + index_.Add(other.index_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Parameter = input.ReadInt64(); + break; + } + case 18: + case 16: { + index_.AddEntriesFrom(input, _repeated_index_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Parameter = input.ReadInt64(); + break; + } + case 18: + case 16: { + index_.AddEntriesFrom(ref input, _repeated_index_codec); + break; + } + } + } + } + #endif + + } + + /// + /// Serialization of HloModule. + /// + public sealed partial class HloModuleProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HloModuleProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloReflection.Descriptor.MessageTypes[6]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloModuleProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloModuleProto(HloModuleProto other) : this() { + name_ = other.name_; + entryComputationName_ = other.entryComputationName_; + entryComputationId_ = other.entryComputationId_; + computations_ = other.computations_.Clone(); + hostProgramShape_ = other.hostProgramShape_ != null ? other.hostProgramShape_.Clone() : null; + id_ = other.id_; + schedule_ = other.schedule_ != null ? other.schedule_.Clone() : null; + inputOutputAlias_ = other.inputOutputAlias_ != null ? other.inputOutputAlias_.Clone() : null; + dynamicParameterBinding_ = other.dynamicParameterBinding_ != null ? other.dynamicParameterBinding_.Clone() : null; + crossProgramPrefetches_ = other.crossProgramPrefetches_.Clone(); + isDynamic_ = other.isDynamic_; + spmdOutputSharding_ = other.spmdOutputSharding_ != null ? other.spmdOutputSharding_.Clone() : null; + spmdParametersShardings_ = other.spmdParametersShardings_.Clone(); + useAutoSpmdPartitioning_ = other.useAutoSpmdPartitioning_; + profileInfo_ = other.profileInfo_.Clone(); + deviceAssignment_ = other.deviceAssignment_ != null ? other.deviceAssignment_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloModuleProto Clone() { + return new HloModuleProto(this); + } + + /// Field number for the "name" field. + public const int NameFieldNumber = 1; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "entry_computation_name" field. + public const int EntryComputationNameFieldNumber = 2; + private string entryComputationName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string EntryComputationName { + get { return entryComputationName_; } + set { + entryComputationName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "entry_computation_id" field. + public const int EntryComputationIdFieldNumber = 6; + private long entryComputationId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long EntryComputationId { + get { return entryComputationId_; } + set { + entryComputationId_ = value; + } + } + + /// Field number for the "computations" field. + public const int ComputationsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_computations_codec + = pb::FieldCodec.ForMessage(26, global::Xla.HloComputationProto.Parser); + private readonly pbc::RepeatedField computations_ = new pbc::RepeatedField(); + /// + /// The array of computations is always in a valid dependency order, where + /// callees appear before their callers. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Computations { + get { return computations_; } + } + + /// Field number for the "host_program_shape" field. + public const int HostProgramShapeFieldNumber = 4; + private global::Xla.ProgramShapeProto hostProgramShape_; + /// + /// The host program shape (with layout) of the entry computation. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ProgramShapeProto HostProgramShape { + get { return hostProgramShape_; } + set { + hostProgramShape_ = value; + } + } + + /// Field number for the "id" field. + public const int IdFieldNumber = 5; + private long id_; + /// + /// The id of this module. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "schedule" field. + public const int ScheduleFieldNumber = 7; + private global::Xla.HloScheduleProto schedule_; + /// + /// The schedule for this module. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.HloScheduleProto Schedule { + get { return schedule_; } + set { + schedule_ = value; + } + } + + /// Field number for the "input_output_alias" field. + public const int InputOutputAliasFieldNumber = 8; + private global::Xla.HloInputOutputAliasProto inputOutputAlias_; + /// + /// Describes alias information between inputs and outputs. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.HloInputOutputAliasProto InputOutputAlias { + get { return inputOutputAlias_; } + set { + inputOutputAlias_ = value; + } + } + + /// Field number for the "dynamic_parameter_binding" field. + public const int DynamicParameterBindingFieldNumber = 9; + private global::Xla.DynamicParameterBindingProto dynamicParameterBinding_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.DynamicParameterBindingProto DynamicParameterBinding { + get { return dynamicParameterBinding_; } + set { + dynamicParameterBinding_ = value; + } + } + + /// Field number for the "cross_program_prefetches" field. + public const int CrossProgramPrefetchesFieldNumber = 10; + private static readonly pb::FieldCodec _repeated_crossProgramPrefetches_codec + = pb::FieldCodec.ForMessage(82, global::Xla.CrossProgramPrefetch.Parser); + private readonly pbc::RepeatedField crossProgramPrefetches_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField CrossProgramPrefetches { + get { return crossProgramPrefetches_; } + } + + /// Field number for the "is_dynamic" field. + public const int IsDynamicFieldNumber = 11; + private bool isDynamic_; + /// + /// True if the module contains dynamic computation. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool IsDynamic { + get { return isDynamic_; } + set { + isDynamic_ = value; + } + } + + /// Field number for the "spmd_output_sharding" field. + public const int SpmdOutputShardingFieldNumber = 12; + private global::Xla.OpSharding spmdOutputSharding_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.OpSharding SpmdOutputSharding { + get { return spmdOutputSharding_; } + set { + spmdOutputSharding_ = value; + } + } + + /// Field number for the "spmd_parameters_shardings" field. + public const int SpmdParametersShardingsFieldNumber = 14; + private static readonly pb::FieldCodec _repeated_spmdParametersShardings_codec + = pb::FieldCodec.ForMessage(114, global::Xla.OpSharding.Parser); + private readonly pbc::RepeatedField spmdParametersShardings_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField SpmdParametersShardings { + get { return spmdParametersShardings_; } + } + + /// Field number for the "use_auto_spmd_partitioning" field. + public const int UseAutoSpmdPartitioningFieldNumber = 16; + private bool useAutoSpmdPartitioning_; + /// + /// Uses AutoSharding pass or not. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool UseAutoSpmdPartitioning { + get { return useAutoSpmdPartitioning_; } + set { + useAutoSpmdPartitioning_ = value; + } + } + + /// Field number for the "profile_info" field. + public const int ProfileInfoFieldNumber = 13; + private static readonly pb::FieldCodec _repeated_profileInfo_codec + = pb::FieldCodec.ForMessage(106, global::Xla.HloModuleProto.Types.ProfileInfo.Parser); + private readonly pbc::RepeatedField profileInfo_ = new pbc::RepeatedField(); + /// + /// Profile information for the HLO module. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField ProfileInfo { + get { return profileInfo_; } + } + + /// Field number for the "device_assignment" field. + public const int DeviceAssignmentFieldNumber = 15; + private global::Xla.DeviceAssignmentProto deviceAssignment_; + /// + /// DeviceAssignment object information. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.DeviceAssignmentProto DeviceAssignment { + get { return deviceAssignment_; } + set { + deviceAssignment_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as HloModuleProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(HloModuleProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + if (EntryComputationName != other.EntryComputationName) return false; + if (EntryComputationId != other.EntryComputationId) return false; + if(!computations_.Equals(other.computations_)) return false; + if (!object.Equals(HostProgramShape, other.HostProgramShape)) return false; + if (Id != other.Id) return false; + if (!object.Equals(Schedule, other.Schedule)) return false; + if (!object.Equals(InputOutputAlias, other.InputOutputAlias)) return false; + if (!object.Equals(DynamicParameterBinding, other.DynamicParameterBinding)) return false; + if(!crossProgramPrefetches_.Equals(other.crossProgramPrefetches_)) return false; + if (IsDynamic != other.IsDynamic) return false; + if (!object.Equals(SpmdOutputSharding, other.SpmdOutputSharding)) return false; + if(!spmdParametersShardings_.Equals(other.spmdParametersShardings_)) return false; + if (UseAutoSpmdPartitioning != other.UseAutoSpmdPartitioning) return false; + if(!profileInfo_.Equals(other.profileInfo_)) return false; + if (!object.Equals(DeviceAssignment, other.DeviceAssignment)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (EntryComputationName.Length != 0) hash ^= EntryComputationName.GetHashCode(); + if (EntryComputationId != 0L) hash ^= EntryComputationId.GetHashCode(); + hash ^= computations_.GetHashCode(); + if (hostProgramShape_ != null) hash ^= HostProgramShape.GetHashCode(); + if (Id != 0L) hash ^= Id.GetHashCode(); + if (schedule_ != null) hash ^= Schedule.GetHashCode(); + if (inputOutputAlias_ != null) hash ^= InputOutputAlias.GetHashCode(); + if (dynamicParameterBinding_ != null) hash ^= DynamicParameterBinding.GetHashCode(); + hash ^= crossProgramPrefetches_.GetHashCode(); + if (IsDynamic != false) hash ^= IsDynamic.GetHashCode(); + if (spmdOutputSharding_ != null) hash ^= SpmdOutputSharding.GetHashCode(); + hash ^= spmdParametersShardings_.GetHashCode(); + if (UseAutoSpmdPartitioning != false) hash ^= UseAutoSpmdPartitioning.GetHashCode(); + hash ^= profileInfo_.GetHashCode(); + if (deviceAssignment_ != null) hash ^= DeviceAssignment.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (EntryComputationName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(EntryComputationName); + } + computations_.WriteTo(output, _repeated_computations_codec); + if (hostProgramShape_ != null) { + output.WriteRawTag(34); + output.WriteMessage(HostProgramShape); + } + if (Id != 0L) { + output.WriteRawTag(40); + output.WriteInt64(Id); + } + if (EntryComputationId != 0L) { + output.WriteRawTag(48); + output.WriteInt64(EntryComputationId); + } + if (schedule_ != null) { + output.WriteRawTag(58); + output.WriteMessage(Schedule); + } + if (inputOutputAlias_ != null) { + output.WriteRawTag(66); + output.WriteMessage(InputOutputAlias); + } + if (dynamicParameterBinding_ != null) { + output.WriteRawTag(74); + output.WriteMessage(DynamicParameterBinding); + } + crossProgramPrefetches_.WriteTo(output, _repeated_crossProgramPrefetches_codec); + if (IsDynamic != false) { + output.WriteRawTag(88); + output.WriteBool(IsDynamic); + } + if (spmdOutputSharding_ != null) { + output.WriteRawTag(98); + output.WriteMessage(SpmdOutputSharding); + } + profileInfo_.WriteTo(output, _repeated_profileInfo_codec); + spmdParametersShardings_.WriteTo(output, _repeated_spmdParametersShardings_codec); + if (deviceAssignment_ != null) { + output.WriteRawTag(122); + output.WriteMessage(DeviceAssignment); + } + if (UseAutoSpmdPartitioning != false) { + output.WriteRawTag(128, 1); + output.WriteBool(UseAutoSpmdPartitioning); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (EntryComputationName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(EntryComputationName); + } + computations_.WriteTo(ref output, _repeated_computations_codec); + if (hostProgramShape_ != null) { + output.WriteRawTag(34); + output.WriteMessage(HostProgramShape); + } + if (Id != 0L) { + output.WriteRawTag(40); + output.WriteInt64(Id); + } + if (EntryComputationId != 0L) { + output.WriteRawTag(48); + output.WriteInt64(EntryComputationId); + } + if (schedule_ != null) { + output.WriteRawTag(58); + output.WriteMessage(Schedule); + } + if (inputOutputAlias_ != null) { + output.WriteRawTag(66); + output.WriteMessage(InputOutputAlias); + } + if (dynamicParameterBinding_ != null) { + output.WriteRawTag(74); + output.WriteMessage(DynamicParameterBinding); + } + crossProgramPrefetches_.WriteTo(ref output, _repeated_crossProgramPrefetches_codec); + if (IsDynamic != false) { + output.WriteRawTag(88); + output.WriteBool(IsDynamic); + } + if (spmdOutputSharding_ != null) { + output.WriteRawTag(98); + output.WriteMessage(SpmdOutputSharding); + } + profileInfo_.WriteTo(ref output, _repeated_profileInfo_codec); + spmdParametersShardings_.WriteTo(ref output, _repeated_spmdParametersShardings_codec); + if (deviceAssignment_ != null) { + output.WriteRawTag(122); + output.WriteMessage(DeviceAssignment); + } + if (UseAutoSpmdPartitioning != false) { + output.WriteRawTag(128, 1); + output.WriteBool(UseAutoSpmdPartitioning); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (EntryComputationName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(EntryComputationName); + } + if (EntryComputationId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(EntryComputationId); + } + size += computations_.CalculateSize(_repeated_computations_codec); + if (hostProgramShape_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(HostProgramShape); + } + if (Id != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Id); + } + if (schedule_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Schedule); + } + if (inputOutputAlias_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(InputOutputAlias); + } + if (dynamicParameterBinding_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DynamicParameterBinding); + } + size += crossProgramPrefetches_.CalculateSize(_repeated_crossProgramPrefetches_codec); + if (IsDynamic != false) { + size += 1 + 1; + } + if (spmdOutputSharding_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(SpmdOutputSharding); + } + size += spmdParametersShardings_.CalculateSize(_repeated_spmdParametersShardings_codec); + if (UseAutoSpmdPartitioning != false) { + size += 2 + 1; + } + size += profileInfo_.CalculateSize(_repeated_profileInfo_codec); + if (deviceAssignment_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DeviceAssignment); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(HloModuleProto other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + if (other.EntryComputationName.Length != 0) { + EntryComputationName = other.EntryComputationName; + } + if (other.EntryComputationId != 0L) { + EntryComputationId = other.EntryComputationId; + } + computations_.Add(other.computations_); + if (other.hostProgramShape_ != null) { + if (hostProgramShape_ == null) { + HostProgramShape = new global::Xla.ProgramShapeProto(); + } + HostProgramShape.MergeFrom(other.HostProgramShape); + } + if (other.Id != 0L) { + Id = other.Id; + } + if (other.schedule_ != null) { + if (schedule_ == null) { + Schedule = new global::Xla.HloScheduleProto(); + } + Schedule.MergeFrom(other.Schedule); + } + if (other.inputOutputAlias_ != null) { + if (inputOutputAlias_ == null) { + InputOutputAlias = new global::Xla.HloInputOutputAliasProto(); + } + InputOutputAlias.MergeFrom(other.InputOutputAlias); + } + if (other.dynamicParameterBinding_ != null) { + if (dynamicParameterBinding_ == null) { + DynamicParameterBinding = new global::Xla.DynamicParameterBindingProto(); + } + DynamicParameterBinding.MergeFrom(other.DynamicParameterBinding); + } + crossProgramPrefetches_.Add(other.crossProgramPrefetches_); + if (other.IsDynamic != false) { + IsDynamic = other.IsDynamic; + } + if (other.spmdOutputSharding_ != null) { + if (spmdOutputSharding_ == null) { + SpmdOutputSharding = new global::Xla.OpSharding(); + } + SpmdOutputSharding.MergeFrom(other.SpmdOutputSharding); + } + spmdParametersShardings_.Add(other.spmdParametersShardings_); + if (other.UseAutoSpmdPartitioning != false) { + UseAutoSpmdPartitioning = other.UseAutoSpmdPartitioning; + } + profileInfo_.Add(other.profileInfo_); + if (other.deviceAssignment_ != null) { + if (deviceAssignment_ == null) { + DeviceAssignment = new global::Xla.DeviceAssignmentProto(); + } + DeviceAssignment.MergeFrom(other.DeviceAssignment); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + EntryComputationName = input.ReadString(); + break; + } + case 26: { + computations_.AddEntriesFrom(input, _repeated_computations_codec); + break; + } + case 34: { + if (hostProgramShape_ == null) { + HostProgramShape = new global::Xla.ProgramShapeProto(); + } + input.ReadMessage(HostProgramShape); + break; + } + case 40: { + Id = input.ReadInt64(); + break; + } + case 48: { + EntryComputationId = input.ReadInt64(); + break; + } + case 58: { + if (schedule_ == null) { + Schedule = new global::Xla.HloScheduleProto(); + } + input.ReadMessage(Schedule); + break; + } + case 66: { + if (inputOutputAlias_ == null) { + InputOutputAlias = new global::Xla.HloInputOutputAliasProto(); + } + input.ReadMessage(InputOutputAlias); + break; + } + case 74: { + if (dynamicParameterBinding_ == null) { + DynamicParameterBinding = new global::Xla.DynamicParameterBindingProto(); + } + input.ReadMessage(DynamicParameterBinding); + break; + } + case 82: { + crossProgramPrefetches_.AddEntriesFrom(input, _repeated_crossProgramPrefetches_codec); + break; + } + case 88: { + IsDynamic = input.ReadBool(); + break; + } + case 98: { + if (spmdOutputSharding_ == null) { + SpmdOutputSharding = new global::Xla.OpSharding(); + } + input.ReadMessage(SpmdOutputSharding); + break; + } + case 106: { + profileInfo_.AddEntriesFrom(input, _repeated_profileInfo_codec); + break; + } + case 114: { + spmdParametersShardings_.AddEntriesFrom(input, _repeated_spmdParametersShardings_codec); + break; + } + case 122: { + if (deviceAssignment_ == null) { + DeviceAssignment = new global::Xla.DeviceAssignmentProto(); + } + input.ReadMessage(DeviceAssignment); + break; + } + case 128: { + UseAutoSpmdPartitioning = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + EntryComputationName = input.ReadString(); + break; + } + case 26: { + computations_.AddEntriesFrom(ref input, _repeated_computations_codec); + break; + } + case 34: { + if (hostProgramShape_ == null) { + HostProgramShape = new global::Xla.ProgramShapeProto(); + } + input.ReadMessage(HostProgramShape); + break; + } + case 40: { + Id = input.ReadInt64(); + break; + } + case 48: { + EntryComputationId = input.ReadInt64(); + break; + } + case 58: { + if (schedule_ == null) { + Schedule = new global::Xla.HloScheduleProto(); + } + input.ReadMessage(Schedule); + break; + } + case 66: { + if (inputOutputAlias_ == null) { + InputOutputAlias = new global::Xla.HloInputOutputAliasProto(); + } + input.ReadMessage(InputOutputAlias); + break; + } + case 74: { + if (dynamicParameterBinding_ == null) { + DynamicParameterBinding = new global::Xla.DynamicParameterBindingProto(); + } + input.ReadMessage(DynamicParameterBinding); + break; + } + case 82: { + crossProgramPrefetches_.AddEntriesFrom(ref input, _repeated_crossProgramPrefetches_codec); + break; + } + case 88: { + IsDynamic = input.ReadBool(); + break; + } + case 98: { + if (spmdOutputSharding_ == null) { + SpmdOutputSharding = new global::Xla.OpSharding(); + } + input.ReadMessage(SpmdOutputSharding); + break; + } + case 106: { + profileInfo_.AddEntriesFrom(ref input, _repeated_profileInfo_codec); + break; + } + case 114: { + spmdParametersShardings_.AddEntriesFrom(ref input, _repeated_spmdParametersShardings_codec); + break; + } + case 122: { + if (deviceAssignment_ == null) { + DeviceAssignment = new global::Xla.DeviceAssignmentProto(); + } + input.ReadMessage(DeviceAssignment); + break; + } + case 128: { + UseAutoSpmdPartitioning = input.ReadBool(); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the HloModuleProto message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + /// + /// The type of optimization profile in use for module-level optimizations. + /// + public enum ProfileType { + [pbr::OriginalName("INVALID")] Invalid = 0, + [pbr::OriginalName("FLAG")] Flag = 1, + [pbr::OriginalName("FUSION")] Fusion = 2, + [pbr::OriginalName("LAYOUT")] Layout = 3, + [pbr::OriginalName("DOT")] Dot = 4, + } + + /// + /// Information about the optimization profile that this module contains. + /// + public sealed partial class ProfileInfo : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ProfileInfo()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloModuleProto.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ProfileInfo() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ProfileInfo(ProfileInfo other) : this() { + profileType_ = other.profileType_; + relativeSpeedup_ = other.relativeSpeedup_; + profileSource_ = other.profileSource_; + compilationEvent_ = other.compilationEvent_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ProfileInfo Clone() { + return new ProfileInfo(this); + } + + /// Field number for the "profile_type" field. + public const int ProfileTypeFieldNumber = 1; + private global::Xla.HloModuleProto.Types.ProfileType profileType_ = global::Xla.HloModuleProto.Types.ProfileType.Invalid; + /// + /// The optimization profiles that this module contains. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.HloModuleProto.Types.ProfileType ProfileType { + get { return profileType_; } + set { + profileType_ = value; + } + } + + /// Field number for the "relative_speedup" field. + public const int RelativeSpeedupFieldNumber = 2; + private double relativeSpeedup_; + /// + /// Speedup of tuned config compared to default config. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double RelativeSpeedup { + get { return relativeSpeedup_; } + set { + relativeSpeedup_ = value; + } + } + + /// Field number for the "profile_source" field. + public const int ProfileSourceFieldNumber = 3; + private global::Xla.ProfileSource profileSource_ = global::Xla.ProfileSource.UnknownSource; + /// + /// The source of the optimization profile that this module contains. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ProfileSource ProfileSource { + get { return profileSource_; } + set { + profileSource_ = value; + } + } + + /// Field number for the "compilation_event" field. + public const int CompilationEventFieldNumber = 4; + private global::Xla.CompilationEvent compilationEvent_ = global::Xla.CompilationEvent.UnknownEvent; + /// + /// The compilation event that triggered the use of the profile. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.CompilationEvent CompilationEvent { + get { return compilationEvent_; } + set { + compilationEvent_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ProfileInfo); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ProfileInfo other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ProfileType != other.ProfileType) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(RelativeSpeedup, other.RelativeSpeedup)) return false; + if (ProfileSource != other.ProfileSource) return false; + if (CompilationEvent != other.CompilationEvent) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (ProfileType != global::Xla.HloModuleProto.Types.ProfileType.Invalid) hash ^= ProfileType.GetHashCode(); + if (RelativeSpeedup != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(RelativeSpeedup); + if (ProfileSource != global::Xla.ProfileSource.UnknownSource) hash ^= ProfileSource.GetHashCode(); + if (CompilationEvent != global::Xla.CompilationEvent.UnknownEvent) hash ^= CompilationEvent.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ProfileType != global::Xla.HloModuleProto.Types.ProfileType.Invalid) { + output.WriteRawTag(8); + output.WriteEnum((int) ProfileType); + } + if (RelativeSpeedup != 0D) { + output.WriteRawTag(17); + output.WriteDouble(RelativeSpeedup); + } + if (ProfileSource != global::Xla.ProfileSource.UnknownSource) { + output.WriteRawTag(24); + output.WriteEnum((int) ProfileSource); + } + if (CompilationEvent != global::Xla.CompilationEvent.UnknownEvent) { + output.WriteRawTag(32); + output.WriteEnum((int) CompilationEvent); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ProfileType != global::Xla.HloModuleProto.Types.ProfileType.Invalid) { + output.WriteRawTag(8); + output.WriteEnum((int) ProfileType); + } + if (RelativeSpeedup != 0D) { + output.WriteRawTag(17); + output.WriteDouble(RelativeSpeedup); + } + if (ProfileSource != global::Xla.ProfileSource.UnknownSource) { + output.WriteRawTag(24); + output.WriteEnum((int) ProfileSource); + } + if (CompilationEvent != global::Xla.CompilationEvent.UnknownEvent) { + output.WriteRawTag(32); + output.WriteEnum((int) CompilationEvent); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (ProfileType != global::Xla.HloModuleProto.Types.ProfileType.Invalid) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) ProfileType); + } + if (RelativeSpeedup != 0D) { + size += 1 + 8; + } + if (ProfileSource != global::Xla.ProfileSource.UnknownSource) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) ProfileSource); + } + if (CompilationEvent != global::Xla.CompilationEvent.UnknownEvent) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) CompilationEvent); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ProfileInfo other) { + if (other == null) { + return; + } + if (other.ProfileType != global::Xla.HloModuleProto.Types.ProfileType.Invalid) { + ProfileType = other.ProfileType; + } + if (other.RelativeSpeedup != 0D) { + RelativeSpeedup = other.RelativeSpeedup; + } + if (other.ProfileSource != global::Xla.ProfileSource.UnknownSource) { + ProfileSource = other.ProfileSource; + } + if (other.CompilationEvent != global::Xla.CompilationEvent.UnknownEvent) { + CompilationEvent = other.CompilationEvent; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + ProfileType = (global::Xla.HloModuleProto.Types.ProfileType) input.ReadEnum(); + break; + } + case 17: { + RelativeSpeedup = input.ReadDouble(); + break; + } + case 24: { + ProfileSource = (global::Xla.ProfileSource) input.ReadEnum(); + break; + } + case 32: { + CompilationEvent = (global::Xla.CompilationEvent) input.ReadEnum(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + ProfileType = (global::Xla.HloModuleProto.Types.ProfileType) input.ReadEnum(); + break; + } + case 17: { + RelativeSpeedup = input.ReadDouble(); + break; + } + case 24: { + ProfileSource = (global::Xla.ProfileSource) input.ReadEnum(); + break; + } + case 32: { + CompilationEvent = (global::Xla.CompilationEvent) input.ReadEnum(); + break; + } + } + } + } + #endif + + } + + } + #endregion + + } + + /// + /// Serialization of LogicalBuffer. + /// + public sealed partial class LogicalBufferProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new LogicalBufferProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloReflection.Descriptor.MessageTypes[7]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LogicalBufferProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LogicalBufferProto(LogicalBufferProto other) : this() { + id_ = other.id_; + size_ = other.size_; + definedAt_ = other.definedAt_ != null ? other.definedAt_.Clone() : null; + color_ = other.color_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LogicalBufferProto Clone() { + return new LogicalBufferProto(this); + } + + /// Field number for the "id" field. + public const int IdFieldNumber = 1; + private long id_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Id { + get { return id_; } + set { + id_ = value; + } + } + + /// Field number for the "size" field. + public const int SizeFieldNumber = 2; + private long size_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Size { + get { return size_; } + set { + size_ = value; + } + } + + /// Field number for the "defined_at" field. + public const int DefinedAtFieldNumber = 3; + private global::Xla.LogicalBufferProto.Types.Location definedAt_; + /// + /// The location where the buffer is defined. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.LogicalBufferProto.Types.Location DefinedAt { + get { return definedAt_; } + set { + definedAt_ = value; + } + } + + /// Field number for the "color" field. + public const int ColorFieldNumber = 4; + private long color_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Color { + get { return color_; } + set { + color_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as LogicalBufferProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(LogicalBufferProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (Size != other.Size) return false; + if (!object.Equals(DefinedAt, other.DefinedAt)) return false; + if (Color != other.Color) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Id != 0L) hash ^= Id.GetHashCode(); + if (Size != 0L) hash ^= Size.GetHashCode(); + if (definedAt_ != null) hash ^= DefinedAt.GetHashCode(); + if (Color != 0L) hash ^= Color.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Id != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Id); + } + if (Size != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Size); + } + if (definedAt_ != null) { + output.WriteRawTag(26); + output.WriteMessage(DefinedAt); + } + if (Color != 0L) { + output.WriteRawTag(32); + output.WriteInt64(Color); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Id != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Id); + } + if (Size != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Size); + } + if (definedAt_ != null) { + output.WriteRawTag(26); + output.WriteMessage(DefinedAt); + } + if (Color != 0L) { + output.WriteRawTag(32); + output.WriteInt64(Color); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Id != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Id); + } + if (Size != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Size); + } + if (definedAt_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DefinedAt); + } + if (Color != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Color); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(LogicalBufferProto other) { + if (other == null) { + return; + } + if (other.Id != 0L) { + Id = other.Id; + } + if (other.Size != 0L) { + Size = other.Size; + } + if (other.definedAt_ != null) { + if (definedAt_ == null) { + DefinedAt = new global::Xla.LogicalBufferProto.Types.Location(); + } + DefinedAt.MergeFrom(other.DefinedAt); + } + if (other.Color != 0L) { + Color = other.Color; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Id = input.ReadInt64(); + break; + } + case 16: { + Size = input.ReadInt64(); + break; + } + case 26: { + if (definedAt_ == null) { + DefinedAt = new global::Xla.LogicalBufferProto.Types.Location(); + } + input.ReadMessage(DefinedAt); + break; + } + case 32: { + Color = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Id = input.ReadInt64(); + break; + } + case 16: { + Size = input.ReadInt64(); + break; + } + case 26: { + if (definedAt_ == null) { + DefinedAt = new global::Xla.LogicalBufferProto.Types.Location(); + } + input.ReadMessage(DefinedAt); + break; + } + case 32: { + Color = input.ReadInt64(); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the LogicalBufferProto message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + /// + /// Location represents an instruction and its shape index, which uniquely + /// identifies a point where a buffer is needed. + /// + public sealed partial class Location : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Location()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.LogicalBufferProto.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Location() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Location(Location other) : this() { + computationName_ = other.computationName_; + instructionName_ = other.instructionName_; + instructionId_ = other.instructionId_; + shapeIndex_ = other.shapeIndex_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Location Clone() { + return new Location(this); + } + + /// Field number for the "computation_name" field. + public const int ComputationNameFieldNumber = 1; + private string computationName_ = ""; + /// + /// NOTE: module_name isn't necessary, since all LogicalBuffers are + /// associated with a single HloModule. + /// TODO(b/239098765): Remove instruction_name and computation_name. + /// + [global::System.ObsoleteAttribute] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string ComputationName { + get { return computationName_; } + set { + computationName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "instruction_name" field. + public const int InstructionNameFieldNumber = 2; + private string instructionName_ = ""; + [global::System.ObsoleteAttribute] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string InstructionName { + get { return instructionName_; } + set { + instructionName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "instruction_id" field. + public const int InstructionIdFieldNumber = 4; + private long instructionId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long InstructionId { + get { return instructionId_; } + set { + instructionId_ = value; + } + } + + /// Field number for the "shape_index" field. + public const int ShapeIndexFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_shapeIndex_codec + = pb::FieldCodec.ForInt64(26); + private readonly pbc::RepeatedField shapeIndex_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField ShapeIndex { + get { return shapeIndex_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as Location); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(Location other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ComputationName != other.ComputationName) return false; + if (InstructionName != other.InstructionName) return false; + if (InstructionId != other.InstructionId) return false; + if(!shapeIndex_.Equals(other.shapeIndex_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (ComputationName.Length != 0) hash ^= ComputationName.GetHashCode(); + if (InstructionName.Length != 0) hash ^= InstructionName.GetHashCode(); + if (InstructionId != 0L) hash ^= InstructionId.GetHashCode(); + hash ^= shapeIndex_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ComputationName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ComputationName); + } + if (InstructionName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(InstructionName); + } + shapeIndex_.WriteTo(output, _repeated_shapeIndex_codec); + if (InstructionId != 0L) { + output.WriteRawTag(32); + output.WriteInt64(InstructionId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ComputationName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ComputationName); + } + if (InstructionName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(InstructionName); + } + shapeIndex_.WriteTo(ref output, _repeated_shapeIndex_codec); + if (InstructionId != 0L) { + output.WriteRawTag(32); + output.WriteInt64(InstructionId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (ComputationName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ComputationName); + } + if (InstructionName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(InstructionName); + } + if (InstructionId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(InstructionId); + } + size += shapeIndex_.CalculateSize(_repeated_shapeIndex_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(Location other) { + if (other == null) { + return; + } + if (other.ComputationName.Length != 0) { + ComputationName = other.ComputationName; + } + if (other.InstructionName.Length != 0) { + InstructionName = other.InstructionName; + } + if (other.InstructionId != 0L) { + InstructionId = other.InstructionId; + } + shapeIndex_.Add(other.shapeIndex_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + ComputationName = input.ReadString(); + break; + } + case 18: { + InstructionName = input.ReadString(); + break; + } + case 26: + case 24: { + shapeIndex_.AddEntriesFrom(input, _repeated_shapeIndex_codec); + break; + } + case 32: { + InstructionId = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + ComputationName = input.ReadString(); + break; + } + case 18: { + InstructionName = input.ReadString(); + break; + } + case 26: + case 24: { + shapeIndex_.AddEntriesFrom(ref input, _repeated_shapeIndex_codec); + break; + } + case 32: { + InstructionId = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + } + #endregion + + } + + /// + /// Serialization of BufferAllocation. + /// + public sealed partial class BufferAllocationProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BufferAllocationProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloReflection.Descriptor.MessageTypes[8]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public BufferAllocationProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public BufferAllocationProto(BufferAllocationProto other) : this() { + index_ = other.index_; + size_ = other.size_; + isThreadLocal_ = other.isThreadLocal_; + isTuple_ = other.isTuple_; + isEntryComputationParameter_ = other.isEntryComputationParameter_; + isConstant_ = other.isConstant_; + parameterNumber_ = other.parameterNumber_; + parameterShapeIndex_ = other.parameterShapeIndex_.Clone(); + maybeLiveOut_ = other.maybeLiveOut_; + color_ = other.color_; + assigned_ = other.assigned_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public BufferAllocationProto Clone() { + return new BufferAllocationProto(this); + } + + /// Field number for the "index" field. + public const int IndexFieldNumber = 1; + private long index_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Index { + get { return index_; } + set { + index_ = value; + } + } + + /// Field number for the "size" field. + public const int SizeFieldNumber = 2; + private long size_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Size { + get { return size_; } + set { + size_ = value; + } + } + + /// Field number for the "is_thread_local" field. + public const int IsThreadLocalFieldNumber = 3; + private bool isThreadLocal_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool IsThreadLocal { + get { return isThreadLocal_; } + set { + isThreadLocal_ = value; + } + } + + /// Field number for the "is_tuple" field. + public const int IsTupleFieldNumber = 11; + private bool isTuple_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool IsTuple { + get { return isTuple_; } + set { + isTuple_ = value; + } + } + + /// Field number for the "is_entry_computation_parameter" field. + public const int IsEntryComputationParameterFieldNumber = 5; + private bool isEntryComputationParameter_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool IsEntryComputationParameter { + get { return isEntryComputationParameter_; } + set { + isEntryComputationParameter_ = value; + } + } + + /// Field number for the "is_constant" field. + public const int IsConstantFieldNumber = 12; + private bool isConstant_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool IsConstant { + get { return isConstant_; } + set { + isConstant_ = value; + } + } + + /// Field number for the "parameter_number" field. + public const int ParameterNumberFieldNumber = 6; + private long parameterNumber_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long ParameterNumber { + get { return parameterNumber_; } + set { + parameterNumber_ = value; + } + } + + /// Field number for the "parameter_shape_index" field. + public const int ParameterShapeIndexFieldNumber = 10; + private static readonly pb::FieldCodec _repeated_parameterShapeIndex_codec + = pb::FieldCodec.ForInt64(82); + private readonly pbc::RepeatedField parameterShapeIndex_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField ParameterShapeIndex { + get { return parameterShapeIndex_; } + } + + /// Field number for the "maybe_live_out" field. + public const int MaybeLiveOutFieldNumber = 7; + private bool maybeLiveOut_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool MaybeLiveOut { + get { return maybeLiveOut_; } + set { + maybeLiveOut_ = value; + } + } + + /// Field number for the "color" field. + public const int ColorFieldNumber = 8; + private long color_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Color { + get { return color_; } + set { + color_ = value; + } + } + + /// Field number for the "assigned" field. + public const int AssignedFieldNumber = 9; + private static readonly pb::FieldCodec _repeated_assigned_codec + = pb::FieldCodec.ForMessage(74, global::Xla.BufferAllocationProto.Types.Assigned.Parser); + private readonly pbc::RepeatedField assigned_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Assigned { + get { return assigned_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as BufferAllocationProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(BufferAllocationProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Index != other.Index) return false; + if (Size != other.Size) return false; + if (IsThreadLocal != other.IsThreadLocal) return false; + if (IsTuple != other.IsTuple) return false; + if (IsEntryComputationParameter != other.IsEntryComputationParameter) return false; + if (IsConstant != other.IsConstant) return false; + if (ParameterNumber != other.ParameterNumber) return false; + if(!parameterShapeIndex_.Equals(other.parameterShapeIndex_)) return false; + if (MaybeLiveOut != other.MaybeLiveOut) return false; + if (Color != other.Color) return false; + if(!assigned_.Equals(other.assigned_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Index != 0L) hash ^= Index.GetHashCode(); + if (Size != 0L) hash ^= Size.GetHashCode(); + if (IsThreadLocal != false) hash ^= IsThreadLocal.GetHashCode(); + if (IsTuple != false) hash ^= IsTuple.GetHashCode(); + if (IsEntryComputationParameter != false) hash ^= IsEntryComputationParameter.GetHashCode(); + if (IsConstant != false) hash ^= IsConstant.GetHashCode(); + if (ParameterNumber != 0L) hash ^= ParameterNumber.GetHashCode(); + hash ^= parameterShapeIndex_.GetHashCode(); + if (MaybeLiveOut != false) hash ^= MaybeLiveOut.GetHashCode(); + if (Color != 0L) hash ^= Color.GetHashCode(); + hash ^= assigned_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Index != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Index); + } + if (Size != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Size); + } + if (IsThreadLocal != false) { + output.WriteRawTag(24); + output.WriteBool(IsThreadLocal); + } + if (IsEntryComputationParameter != false) { + output.WriteRawTag(40); + output.WriteBool(IsEntryComputationParameter); + } + if (ParameterNumber != 0L) { + output.WriteRawTag(48); + output.WriteInt64(ParameterNumber); + } + if (MaybeLiveOut != false) { + output.WriteRawTag(56); + output.WriteBool(MaybeLiveOut); + } + if (Color != 0L) { + output.WriteRawTag(64); + output.WriteInt64(Color); + } + assigned_.WriteTo(output, _repeated_assigned_codec); + parameterShapeIndex_.WriteTo(output, _repeated_parameterShapeIndex_codec); + if (IsTuple != false) { + output.WriteRawTag(88); + output.WriteBool(IsTuple); + } + if (IsConstant != false) { + output.WriteRawTag(96); + output.WriteBool(IsConstant); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Index != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Index); + } + if (Size != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Size); + } + if (IsThreadLocal != false) { + output.WriteRawTag(24); + output.WriteBool(IsThreadLocal); + } + if (IsEntryComputationParameter != false) { + output.WriteRawTag(40); + output.WriteBool(IsEntryComputationParameter); + } + if (ParameterNumber != 0L) { + output.WriteRawTag(48); + output.WriteInt64(ParameterNumber); + } + if (MaybeLiveOut != false) { + output.WriteRawTag(56); + output.WriteBool(MaybeLiveOut); + } + if (Color != 0L) { + output.WriteRawTag(64); + output.WriteInt64(Color); + } + assigned_.WriteTo(ref output, _repeated_assigned_codec); + parameterShapeIndex_.WriteTo(ref output, _repeated_parameterShapeIndex_codec); + if (IsTuple != false) { + output.WriteRawTag(88); + output.WriteBool(IsTuple); + } + if (IsConstant != false) { + output.WriteRawTag(96); + output.WriteBool(IsConstant); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Index != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Index); + } + if (Size != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Size); + } + if (IsThreadLocal != false) { + size += 1 + 1; + } + if (IsTuple != false) { + size += 1 + 1; + } + if (IsEntryComputationParameter != false) { + size += 1 + 1; + } + if (IsConstant != false) { + size += 1 + 1; + } + if (ParameterNumber != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(ParameterNumber); + } + size += parameterShapeIndex_.CalculateSize(_repeated_parameterShapeIndex_codec); + if (MaybeLiveOut != false) { + size += 1 + 1; + } + if (Color != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Color); + } + size += assigned_.CalculateSize(_repeated_assigned_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(BufferAllocationProto other) { + if (other == null) { + return; + } + if (other.Index != 0L) { + Index = other.Index; + } + if (other.Size != 0L) { + Size = other.Size; + } + if (other.IsThreadLocal != false) { + IsThreadLocal = other.IsThreadLocal; + } + if (other.IsTuple != false) { + IsTuple = other.IsTuple; + } + if (other.IsEntryComputationParameter != false) { + IsEntryComputationParameter = other.IsEntryComputationParameter; + } + if (other.IsConstant != false) { + IsConstant = other.IsConstant; + } + if (other.ParameterNumber != 0L) { + ParameterNumber = other.ParameterNumber; + } + parameterShapeIndex_.Add(other.parameterShapeIndex_); + if (other.MaybeLiveOut != false) { + MaybeLiveOut = other.MaybeLiveOut; + } + if (other.Color != 0L) { + Color = other.Color; + } + assigned_.Add(other.assigned_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Index = input.ReadInt64(); + break; + } + case 16: { + Size = input.ReadInt64(); + break; + } + case 24: { + IsThreadLocal = input.ReadBool(); + break; + } + case 40: { + IsEntryComputationParameter = input.ReadBool(); + break; + } + case 48: { + ParameterNumber = input.ReadInt64(); + break; + } + case 56: { + MaybeLiveOut = input.ReadBool(); + break; + } + case 64: { + Color = input.ReadInt64(); + break; + } + case 74: { + assigned_.AddEntriesFrom(input, _repeated_assigned_codec); + break; + } + case 82: + case 80: { + parameterShapeIndex_.AddEntriesFrom(input, _repeated_parameterShapeIndex_codec); + break; + } + case 88: { + IsTuple = input.ReadBool(); + break; + } + case 96: { + IsConstant = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Index = input.ReadInt64(); + break; + } + case 16: { + Size = input.ReadInt64(); + break; + } + case 24: { + IsThreadLocal = input.ReadBool(); + break; + } + case 40: { + IsEntryComputationParameter = input.ReadBool(); + break; + } + case 48: { + ParameterNumber = input.ReadInt64(); + break; + } + case 56: { + MaybeLiveOut = input.ReadBool(); + break; + } + case 64: { + Color = input.ReadInt64(); + break; + } + case 74: { + assigned_.AddEntriesFrom(ref input, _repeated_assigned_codec); + break; + } + case 82: + case 80: { + parameterShapeIndex_.AddEntriesFrom(ref input, _repeated_parameterShapeIndex_codec); + break; + } + case 88: { + IsTuple = input.ReadBool(); + break; + } + case 96: { + IsConstant = input.ReadBool(); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the BufferAllocationProto message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + /// + /// Assigned represents a single LogicalBuffer that is assigned to this + /// BufferAllocation. + /// + public sealed partial class Assigned : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Assigned()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.BufferAllocationProto.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Assigned() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Assigned(Assigned other) : this() { + logicalBufferId_ = other.logicalBufferId_; + offset_ = other.offset_; + size_ = other.size_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Assigned Clone() { + return new Assigned(this); + } + + /// Field number for the "logical_buffer_id" field. + public const int LogicalBufferIdFieldNumber = 1; + private long logicalBufferId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long LogicalBufferId { + get { return logicalBufferId_; } + set { + logicalBufferId_ = value; + } + } + + /// Field number for the "offset" field. + public const int OffsetFieldNumber = 2; + private long offset_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Offset { + get { return offset_; } + set { + offset_ = value; + } + } + + /// Field number for the "size" field. + public const int SizeFieldNumber = 3; + private long size_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Size { + get { return size_; } + set { + size_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as Assigned); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(Assigned other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (LogicalBufferId != other.LogicalBufferId) return false; + if (Offset != other.Offset) return false; + if (Size != other.Size) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (LogicalBufferId != 0L) hash ^= LogicalBufferId.GetHashCode(); + if (Offset != 0L) hash ^= Offset.GetHashCode(); + if (Size != 0L) hash ^= Size.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (LogicalBufferId != 0L) { + output.WriteRawTag(8); + output.WriteInt64(LogicalBufferId); + } + if (Offset != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Offset); + } + if (Size != 0L) { + output.WriteRawTag(24); + output.WriteInt64(Size); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (LogicalBufferId != 0L) { + output.WriteRawTag(8); + output.WriteInt64(LogicalBufferId); + } + if (Offset != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Offset); + } + if (Size != 0L) { + output.WriteRawTag(24); + output.WriteInt64(Size); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (LogicalBufferId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(LogicalBufferId); + } + if (Offset != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Offset); + } + if (Size != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Size); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(Assigned other) { + if (other == null) { + return; + } + if (other.LogicalBufferId != 0L) { + LogicalBufferId = other.LogicalBufferId; + } + if (other.Offset != 0L) { + Offset = other.Offset; + } + if (other.Size != 0L) { + Size = other.Size; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + LogicalBufferId = input.ReadInt64(); + break; + } + case 16: { + Offset = input.ReadInt64(); + break; + } + case 24: { + Size = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + LogicalBufferId = input.ReadInt64(); + break; + } + case 16: { + Offset = input.ReadInt64(); + break; + } + case 24: { + Size = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + } + #endregion + + } + + /// + /// A trace of a HeapSimulator run. + /// + public sealed partial class HeapSimulatorTrace : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HeapSimulatorTrace()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloReflection.Descriptor.MessageTypes[9]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HeapSimulatorTrace() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HeapSimulatorTrace(HeapSimulatorTrace other) : this() { + events_ = other.events_.Clone(); + wholeModuleSimulation_ = other.wholeModuleSimulation_; + bufferAllocationIndex_ = other.bufferAllocationIndex_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HeapSimulatorTrace Clone() { + return new HeapSimulatorTrace(this); + } + + /// Field number for the "events" field. + public const int EventsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_events_codec + = pb::FieldCodec.ForMessage(10, global::Xla.HeapSimulatorTrace.Types.Event.Parser); + private readonly pbc::RepeatedField events_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Events { + get { return events_; } + } + + /// Field number for the "whole_module_simulation" field. + public const int WholeModuleSimulationFieldNumber = 2; + private bool wholeModuleSimulation_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool WholeModuleSimulation { + get { return wholeModuleSimulation_; } + set { + wholeModuleSimulation_ = value; + } + } + + /// Field number for the "buffer_allocation_index" field. + public const int BufferAllocationIndexFieldNumber = 3; + private long bufferAllocationIndex_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long BufferAllocationIndex { + get { return bufferAllocationIndex_; } + set { + bufferAllocationIndex_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as HeapSimulatorTrace); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(HeapSimulatorTrace other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!events_.Equals(other.events_)) return false; + if (WholeModuleSimulation != other.WholeModuleSimulation) return false; + if (BufferAllocationIndex != other.BufferAllocationIndex) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= events_.GetHashCode(); + if (WholeModuleSimulation != false) hash ^= WholeModuleSimulation.GetHashCode(); + if (BufferAllocationIndex != 0L) hash ^= BufferAllocationIndex.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + events_.WriteTo(output, _repeated_events_codec); + if (WholeModuleSimulation != false) { + output.WriteRawTag(16); + output.WriteBool(WholeModuleSimulation); + } + if (BufferAllocationIndex != 0L) { + output.WriteRawTag(24); + output.WriteInt64(BufferAllocationIndex); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + events_.WriteTo(ref output, _repeated_events_codec); + if (WholeModuleSimulation != false) { + output.WriteRawTag(16); + output.WriteBool(WholeModuleSimulation); + } + if (BufferAllocationIndex != 0L) { + output.WriteRawTag(24); + output.WriteInt64(BufferAllocationIndex); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += events_.CalculateSize(_repeated_events_codec); + if (WholeModuleSimulation != false) { + size += 1 + 1; + } + if (BufferAllocationIndex != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(BufferAllocationIndex); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(HeapSimulatorTrace other) { + if (other == null) { + return; + } + events_.Add(other.events_); + if (other.WholeModuleSimulation != false) { + WholeModuleSimulation = other.WholeModuleSimulation; + } + if (other.BufferAllocationIndex != 0L) { + BufferAllocationIndex = other.BufferAllocationIndex; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + events_.AddEntriesFrom(input, _repeated_events_codec); + break; + } + case 16: { + WholeModuleSimulation = input.ReadBool(); + break; + } + case 24: { + BufferAllocationIndex = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + events_.AddEntriesFrom(ref input, _repeated_events_codec); + break; + } + case 16: { + WholeModuleSimulation = input.ReadBool(); + break; + } + case 24: { + BufferAllocationIndex = input.ReadInt64(); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the HeapSimulatorTrace message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + /// + /// The trace includes a list of events, where each event describes one action + /// performed by the heap simulator. + /// + public sealed partial class Event : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Event()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HeapSimulatorTrace.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Event() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Event(Event other) : this() { + kind_ = other.kind_; + bufferId_ = other.bufferId_; + computationName_ = other.computationName_; + instructionName_ = other.instructionName_; + shareWithCanonicalId_ = other.shareWithCanonicalId_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Event Clone() { + return new Event(this); + } + + /// Field number for the "kind" field. + public const int KindFieldNumber = 1; + private global::Xla.HeapSimulatorTrace.Types.Event.Types.Kind kind_ = global::Xla.HeapSimulatorTrace.Types.Event.Types.Kind.Alloc; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.HeapSimulatorTrace.Types.Event.Types.Kind Kind { + get { return kind_; } + set { + kind_ = value; + } + } + + /// Field number for the "buffer_id" field. + public const int BufferIdFieldNumber = 2; + private long bufferId_; + /// + /// The id of the LogicalBuffer that the event applies to. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long BufferId { + get { return bufferId_; } + set { + bufferId_ = value; + } + } + + /// Field number for the "computation_name" field. + public const int ComputationNameFieldNumber = 3; + private string computationName_ = ""; + /// + /// The HloInstruction that the simulation was processing that caused this + /// event to occur, identified by its computation and instruction name. E.g. + /// buffers defined by instruction A are allocated when processing A. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string ComputationName { + get { return computationName_; } + set { + computationName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "instruction_name" field. + public const int InstructionNameFieldNumber = 4; + private string instructionName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string InstructionName { + get { return instructionName_; } + set { + instructionName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "share_with_canonical_id" field. + public const int ShareWithCanonicalIdFieldNumber = 5; + private long shareWithCanonicalId_; + /// + /// The id of the canonical LogicalBuffer that the buffer shares with. Only + /// set for SHARE_WITH events. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long ShareWithCanonicalId { + get { return shareWithCanonicalId_; } + set { + shareWithCanonicalId_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as Event); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(Event other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Kind != other.Kind) return false; + if (BufferId != other.BufferId) return false; + if (ComputationName != other.ComputationName) return false; + if (InstructionName != other.InstructionName) return false; + if (ShareWithCanonicalId != other.ShareWithCanonicalId) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Kind != global::Xla.HeapSimulatorTrace.Types.Event.Types.Kind.Alloc) hash ^= Kind.GetHashCode(); + if (BufferId != 0L) hash ^= BufferId.GetHashCode(); + if (ComputationName.Length != 0) hash ^= ComputationName.GetHashCode(); + if (InstructionName.Length != 0) hash ^= InstructionName.GetHashCode(); + if (ShareWithCanonicalId != 0L) hash ^= ShareWithCanonicalId.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Kind != global::Xla.HeapSimulatorTrace.Types.Event.Types.Kind.Alloc) { + output.WriteRawTag(8); + output.WriteEnum((int) Kind); + } + if (BufferId != 0L) { + output.WriteRawTag(16); + output.WriteInt64(BufferId); + } + if (ComputationName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(ComputationName); + } + if (InstructionName.Length != 0) { + output.WriteRawTag(34); + output.WriteString(InstructionName); + } + if (ShareWithCanonicalId != 0L) { + output.WriteRawTag(40); + output.WriteInt64(ShareWithCanonicalId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Kind != global::Xla.HeapSimulatorTrace.Types.Event.Types.Kind.Alloc) { + output.WriteRawTag(8); + output.WriteEnum((int) Kind); + } + if (BufferId != 0L) { + output.WriteRawTag(16); + output.WriteInt64(BufferId); + } + if (ComputationName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(ComputationName); + } + if (InstructionName.Length != 0) { + output.WriteRawTag(34); + output.WriteString(InstructionName); + } + if (ShareWithCanonicalId != 0L) { + output.WriteRawTag(40); + output.WriteInt64(ShareWithCanonicalId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Kind != global::Xla.HeapSimulatorTrace.Types.Event.Types.Kind.Alloc) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Kind); + } + if (BufferId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(BufferId); + } + if (ComputationName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ComputationName); + } + if (InstructionName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(InstructionName); + } + if (ShareWithCanonicalId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(ShareWithCanonicalId); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(Event other) { + if (other == null) { + return; + } + if (other.Kind != global::Xla.HeapSimulatorTrace.Types.Event.Types.Kind.Alloc) { + Kind = other.Kind; + } + if (other.BufferId != 0L) { + BufferId = other.BufferId; + } + if (other.ComputationName.Length != 0) { + ComputationName = other.ComputationName; + } + if (other.InstructionName.Length != 0) { + InstructionName = other.InstructionName; + } + if (other.ShareWithCanonicalId != 0L) { + ShareWithCanonicalId = other.ShareWithCanonicalId; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Kind = (global::Xla.HeapSimulatorTrace.Types.Event.Types.Kind) input.ReadEnum(); + break; + } + case 16: { + BufferId = input.ReadInt64(); + break; + } + case 26: { + ComputationName = input.ReadString(); + break; + } + case 34: { + InstructionName = input.ReadString(); + break; + } + case 40: { + ShareWithCanonicalId = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Kind = (global::Xla.HeapSimulatorTrace.Types.Event.Types.Kind) input.ReadEnum(); + break; + } + case 16: { + BufferId = input.ReadInt64(); + break; + } + case 26: { + ComputationName = input.ReadString(); + break; + } + case 34: { + InstructionName = input.ReadString(); + break; + } + case 40: { + ShareWithCanonicalId = input.ReadInt64(); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the Event message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + public enum Kind { + /// + /// A memory region was allocated for the buffer. + /// + [pbr::OriginalName("ALLOC")] Alloc = 0, + /// + /// A memory region was freed for the buffer. + /// + [pbr::OriginalName("FREE")] Free = 1, + /// + /// A buffer was shared with another (canonical) buffer. This is similar to + /// ALLOC, except that instead of allocating a new region of memory, the + /// memory region of the canonical buffer is directly re-used. Multiple + /// buffers may share with the same canonical buffer. The lifetime of the + /// canonical buffer is extended to the union of all lifetimes. + /// + [pbr::OriginalName("SHARE_WITH")] ShareWith = 2, + } + + } + #endregion + + } + + } + #endregion + + } + + /// + /// An abstraction representing a set of HLO module built to run concurrently + /// across different devices. + /// + public sealed partial class HloModuleGroupProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HloModuleGroupProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloReflection.Descriptor.MessageTypes[10]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloModuleGroupProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloModuleGroupProto(HloModuleGroupProto other) : this() { + name_ = other.name_; + hloModules_ = other.hloModules_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloModuleGroupProto Clone() { + return new HloModuleGroupProto(this); + } + + /// Field number for the "name" field. + public const int NameFieldNumber = 1; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "hlo_modules" field. + public const int HloModulesFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_hloModules_codec + = pb::FieldCodec.ForMessage(18, global::Xla.HloModuleProto.Parser); + private readonly pbc::RepeatedField hloModules_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField HloModules { + get { return hloModules_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as HloModuleGroupProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(HloModuleGroupProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + if(!hloModules_.Equals(other.hloModules_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + hash ^= hloModules_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + hloModules_.WriteTo(output, _repeated_hloModules_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + hloModules_.WriteTo(ref output, _repeated_hloModules_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + size += hloModules_.CalculateSize(_repeated_hloModules_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(HloModuleGroupProto other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + hloModules_.Add(other.hloModules_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + hloModules_.AddEntriesFrom(input, _repeated_hloModules_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + hloModules_.AddEntriesFrom(ref input, _repeated_hloModules_codec); + break; + } + } + } + } + #endif + + } + + /// + /// Serialization of BufferAssignment. + /// + public sealed partial class BufferAssignmentProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BufferAssignmentProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloReflection.Descriptor.MessageTypes[11]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public BufferAssignmentProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public BufferAssignmentProto(BufferAssignmentProto other) : this() { + logicalBuffers_ = other.logicalBuffers_.Clone(); + bufferAliases_ = other.bufferAliases_.Clone(); + bufferAllocations_ = other.bufferAllocations_.Clone(); + heapSimulatorTraces_ = other.heapSimulatorTraces_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public BufferAssignmentProto Clone() { + return new BufferAssignmentProto(this); + } + + /// Field number for the "logical_buffers" field. + public const int LogicalBuffersFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_logicalBuffers_codec + = pb::FieldCodec.ForMessage(10, global::Xla.LogicalBufferProto.Parser); + private readonly pbc::RepeatedField logicalBuffers_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField LogicalBuffers { + get { return logicalBuffers_; } + } + + /// Field number for the "buffer_aliases" field. + public const int BufferAliasesFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_bufferAliases_codec + = pb::FieldCodec.ForMessage(18, global::Xla.BufferAssignmentProto.Types.BufferAlias.Parser); + private readonly pbc::RepeatedField bufferAliases_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField BufferAliases { + get { return bufferAliases_; } + } + + /// Field number for the "buffer_allocations" field. + public const int BufferAllocationsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_bufferAllocations_codec + = pb::FieldCodec.ForMessage(26, global::Xla.BufferAllocationProto.Parser); + private readonly pbc::RepeatedField bufferAllocations_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField BufferAllocations { + get { return bufferAllocations_; } + } + + /// Field number for the "heap_simulator_traces" field. + public const int HeapSimulatorTracesFieldNumber = 4; + private static readonly pb::FieldCodec _repeated_heapSimulatorTraces_codec + = pb::FieldCodec.ForMessage(34, global::Xla.HeapSimulatorTrace.Parser); + private readonly pbc::RepeatedField heapSimulatorTraces_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField HeapSimulatorTraces { + get { return heapSimulatorTraces_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as BufferAssignmentProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(BufferAssignmentProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!logicalBuffers_.Equals(other.logicalBuffers_)) return false; + if(!bufferAliases_.Equals(other.bufferAliases_)) return false; + if(!bufferAllocations_.Equals(other.bufferAllocations_)) return false; + if(!heapSimulatorTraces_.Equals(other.heapSimulatorTraces_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= logicalBuffers_.GetHashCode(); + hash ^= bufferAliases_.GetHashCode(); + hash ^= bufferAllocations_.GetHashCode(); + hash ^= heapSimulatorTraces_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + logicalBuffers_.WriteTo(output, _repeated_logicalBuffers_codec); + bufferAliases_.WriteTo(output, _repeated_bufferAliases_codec); + bufferAllocations_.WriteTo(output, _repeated_bufferAllocations_codec); + heapSimulatorTraces_.WriteTo(output, _repeated_heapSimulatorTraces_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + logicalBuffers_.WriteTo(ref output, _repeated_logicalBuffers_codec); + bufferAliases_.WriteTo(ref output, _repeated_bufferAliases_codec); + bufferAllocations_.WriteTo(ref output, _repeated_bufferAllocations_codec); + heapSimulatorTraces_.WriteTo(ref output, _repeated_heapSimulatorTraces_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += logicalBuffers_.CalculateSize(_repeated_logicalBuffers_codec); + size += bufferAliases_.CalculateSize(_repeated_bufferAliases_codec); + size += bufferAllocations_.CalculateSize(_repeated_bufferAllocations_codec); + size += heapSimulatorTraces_.CalculateSize(_repeated_heapSimulatorTraces_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(BufferAssignmentProto other) { + if (other == null) { + return; + } + logicalBuffers_.Add(other.logicalBuffers_); + bufferAliases_.Add(other.bufferAliases_); + bufferAllocations_.Add(other.bufferAllocations_); + heapSimulatorTraces_.Add(other.heapSimulatorTraces_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + logicalBuffers_.AddEntriesFrom(input, _repeated_logicalBuffers_codec); + break; + } + case 18: { + bufferAliases_.AddEntriesFrom(input, _repeated_bufferAliases_codec); + break; + } + case 26: { + bufferAllocations_.AddEntriesFrom(input, _repeated_bufferAllocations_codec); + break; + } + case 34: { + heapSimulatorTraces_.AddEntriesFrom(input, _repeated_heapSimulatorTraces_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + logicalBuffers_.AddEntriesFrom(ref input, _repeated_logicalBuffers_codec); + break; + } + case 18: { + bufferAliases_.AddEntriesFrom(ref input, _repeated_bufferAliases_codec); + break; + } + case 26: { + bufferAllocations_.AddEntriesFrom(ref input, _repeated_bufferAllocations_codec); + break; + } + case 34: { + heapSimulatorTraces_.AddEntriesFrom(ref input, _repeated_heapSimulatorTraces_codec); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the BufferAssignmentProto message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + /// + /// Alias represents a source LogicalBuffer, and the buffer location that + /// aliases it. + /// + public sealed partial class BufferAlias : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BufferAlias()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.BufferAssignmentProto.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public BufferAlias() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public BufferAlias(BufferAlias other) : this() { + sourceBufferId_ = other.sourceBufferId_; + location_ = other.location_ != null ? other.location_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public BufferAlias Clone() { + return new BufferAlias(this); + } + + /// Field number for the "source_buffer_id" field. + public const int SourceBufferIdFieldNumber = 1; + private long sourceBufferId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long SourceBufferId { + get { return sourceBufferId_; } + set { + sourceBufferId_ = value; + } + } + + /// Field number for the "location" field. + public const int LocationFieldNumber = 2; + private global::Xla.LogicalBufferProto.Types.Location location_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.LogicalBufferProto.Types.Location Location { + get { return location_; } + set { + location_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as BufferAlias); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(BufferAlias other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (SourceBufferId != other.SourceBufferId) return false; + if (!object.Equals(Location, other.Location)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (SourceBufferId != 0L) hash ^= SourceBufferId.GetHashCode(); + if (location_ != null) hash ^= Location.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (SourceBufferId != 0L) { + output.WriteRawTag(8); + output.WriteInt64(SourceBufferId); + } + if (location_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Location); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (SourceBufferId != 0L) { + output.WriteRawTag(8); + output.WriteInt64(SourceBufferId); + } + if (location_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Location); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (SourceBufferId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(SourceBufferId); + } + if (location_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Location); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(BufferAlias other) { + if (other == null) { + return; + } + if (other.SourceBufferId != 0L) { + SourceBufferId = other.SourceBufferId; + } + if (other.location_ != null) { + if (location_ == null) { + Location = new global::Xla.LogicalBufferProto.Types.Location(); + } + Location.MergeFrom(other.Location); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + SourceBufferId = input.ReadInt64(); + break; + } + case 18: { + if (location_ == null) { + Location = new global::Xla.LogicalBufferProto.Types.Location(); + } + input.ReadMessage(Location); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + SourceBufferId = input.ReadInt64(); + break; + } + case 18: { + if (location_ == null) { + Location = new global::Xla.LogicalBufferProto.Types.Location(); + } + input.ReadMessage(Location); + break; + } + } + } + } + #endif + + } + + } + #endregion + + } + + /// + /// Grouping message that contains all of the information above. + /// + public sealed partial class HloProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HloProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloReflection.Descriptor.MessageTypes[12]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloProto(HloProto other) : this() { + hloModule_ = other.hloModule_ != null ? other.hloModule_.Clone() : null; + bufferAssignment_ = other.bufferAssignment_ != null ? other.bufferAssignment_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloProto Clone() { + return new HloProto(this); + } + + /// Field number for the "hlo_module" field. + public const int HloModuleFieldNumber = 1; + private global::Xla.HloModuleProto hloModule_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.HloModuleProto HloModule { + get { return hloModule_; } + set { + hloModule_ = value; + } + } + + /// Field number for the "buffer_assignment" field. + public const int BufferAssignmentFieldNumber = 3; + private global::Xla.BufferAssignmentProto bufferAssignment_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.BufferAssignmentProto BufferAssignment { + get { return bufferAssignment_; } + set { + bufferAssignment_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as HloProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(HloProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(HloModule, other.HloModule)) return false; + if (!object.Equals(BufferAssignment, other.BufferAssignment)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (hloModule_ != null) hash ^= HloModule.GetHashCode(); + if (bufferAssignment_ != null) hash ^= BufferAssignment.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (hloModule_ != null) { + output.WriteRawTag(10); + output.WriteMessage(HloModule); + } + if (bufferAssignment_ != null) { + output.WriteRawTag(26); + output.WriteMessage(BufferAssignment); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (hloModule_ != null) { + output.WriteRawTag(10); + output.WriteMessage(HloModule); + } + if (bufferAssignment_ != null) { + output.WriteRawTag(26); + output.WriteMessage(BufferAssignment); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (hloModule_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(HloModule); + } + if (bufferAssignment_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(BufferAssignment); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(HloProto other) { + if (other == null) { + return; + } + if (other.hloModule_ != null) { + if (hloModule_ == null) { + HloModule = new global::Xla.HloModuleProto(); + } + HloModule.MergeFrom(other.HloModule); + } + if (other.bufferAssignment_ != null) { + if (bufferAssignment_ == null) { + BufferAssignment = new global::Xla.BufferAssignmentProto(); + } + BufferAssignment.MergeFrom(other.BufferAssignment); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (hloModule_ == null) { + HloModule = new global::Xla.HloModuleProto(); + } + input.ReadMessage(HloModule); + break; + } + case 26: { + if (bufferAssignment_ == null) { + BufferAssignment = new global::Xla.BufferAssignmentProto(); + } + input.ReadMessage(BufferAssignment); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (hloModule_ == null) { + HloModule = new global::Xla.HloModuleProto(); + } + input.ReadMessage(HloModule); + break; + } + case 26: { + if (bufferAssignment_ == null) { + BufferAssignment = new global::Xla.BufferAssignmentProto(); + } + input.ReadMessage(BufferAssignment); + break; + } + } + } + } + #endif + + } + + /// + /// Encapsulates HloProto together with the arguments, result, and + /// execution_platform. This message is used for purposes such as + /// analysis/replay/file-storage. + /// + public sealed partial class HloSnapshot : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HloSnapshot()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloReflection.Descriptor.MessageTypes[13]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloSnapshot() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloSnapshot(HloSnapshot other) : this() { + hlo_ = other.hlo_ != null ? other.hlo_.Clone() : null; + arguments_ = other.arguments_.Clone(); + result_ = other.result_ != null ? other.result_.Clone() : null; + executionPlatform_ = other.executionPlatform_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloSnapshot Clone() { + return new HloSnapshot(this); + } + + /// Field number for the "hlo" field. + public const int HloFieldNumber = 1; + private global::Xla.HloProto hlo_; + /// + /// The hlo graph. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.HloProto Hlo { + get { return hlo_; } + set { + hlo_ = value; + } + } + + /// Field number for the "arguments" field. + public const int ArgumentsFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_arguments_codec + = pb::FieldCodec.ForMessage(18, global::Xla.LiteralProto.Parser); + private readonly pbc::RepeatedField arguments_ = new pbc::RepeatedField(); + /// + /// The arguments passed to the graph. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Arguments { + get { return arguments_; } + } + + /// Field number for the "result" field. + public const int ResultFieldNumber = 3; + private global::Xla.LiteralProto result_; + /// + /// The result of the graph. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.LiteralProto Result { + get { return result_; } + set { + result_ = value; + } + } + + /// Field number for the "execution_platform" field. + public const int ExecutionPlatformFieldNumber = 4; + private string executionPlatform_ = ""; + /// + /// The name of the platform used to run the graph. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string ExecutionPlatform { + get { return executionPlatform_; } + set { + executionPlatform_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as HloSnapshot); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(HloSnapshot other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Hlo, other.Hlo)) return false; + if(!arguments_.Equals(other.arguments_)) return false; + if (!object.Equals(Result, other.Result)) return false; + if (ExecutionPlatform != other.ExecutionPlatform) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (hlo_ != null) hash ^= Hlo.GetHashCode(); + hash ^= arguments_.GetHashCode(); + if (result_ != null) hash ^= Result.GetHashCode(); + if (ExecutionPlatform.Length != 0) hash ^= ExecutionPlatform.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (hlo_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Hlo); + } + arguments_.WriteTo(output, _repeated_arguments_codec); + if (result_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Result); + } + if (ExecutionPlatform.Length != 0) { + output.WriteRawTag(34); + output.WriteString(ExecutionPlatform); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (hlo_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Hlo); + } + arguments_.WriteTo(ref output, _repeated_arguments_codec); + if (result_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Result); + } + if (ExecutionPlatform.Length != 0) { + output.WriteRawTag(34); + output.WriteString(ExecutionPlatform); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (hlo_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Hlo); + } + size += arguments_.CalculateSize(_repeated_arguments_codec); + if (result_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Result); + } + if (ExecutionPlatform.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ExecutionPlatform); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(HloSnapshot other) { + if (other == null) { + return; + } + if (other.hlo_ != null) { + if (hlo_ == null) { + Hlo = new global::Xla.HloProto(); + } + Hlo.MergeFrom(other.Hlo); + } + arguments_.Add(other.arguments_); + if (other.result_ != null) { + if (result_ == null) { + Result = new global::Xla.LiteralProto(); + } + Result.MergeFrom(other.Result); + } + if (other.ExecutionPlatform.Length != 0) { + ExecutionPlatform = other.ExecutionPlatform; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (hlo_ == null) { + Hlo = new global::Xla.HloProto(); + } + input.ReadMessage(Hlo); + break; + } + case 18: { + arguments_.AddEntriesFrom(input, _repeated_arguments_codec); + break; + } + case 26: { + if (result_ == null) { + Result = new global::Xla.LiteralProto(); + } + input.ReadMessage(Result); + break; + } + case 34: { + ExecutionPlatform = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (hlo_ == null) { + Hlo = new global::Xla.HloProto(); + } + input.ReadMessage(Hlo); + break; + } + case 18: { + arguments_.AddEntriesFrom(ref input, _repeated_arguments_codec); + break; + } + case 26: { + if (result_ == null) { + Result = new global::Xla.LiteralProto(); + } + input.ReadMessage(Result); + break; + } + case 34: { + ExecutionPlatform = input.ReadString(); + break; + } + } + } + } + #endif + + } + + /// + /// Metadata for an HLO module. Dumped after HLO passes and before LLO lowering + /// with filename module_####.metadata.textproto, where #### is + /// canonical_module_id. + /// + public sealed partial class HloModuleMetadataProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HloModuleMetadataProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloReflection.Descriptor.MessageTypes[14]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloModuleMetadataProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloModuleMetadataProto(HloModuleMetadataProto other) : this() { + canonicalModuleId_ = other.canonicalModuleId_; + moduleGroupName_ = other.moduleGroupName_; + originalModuleId_ = other.originalModuleId_; + partitionedModuleIds_ = other.partitionedModuleIds_.Clone(); + passMetadata_ = other.passMetadata_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloModuleMetadataProto Clone() { + return new HloModuleMetadataProto(this); + } + + /// Field number for the "canonical_module_id" field. + public const int CanonicalModuleIdFieldNumber = 1; + private long canonicalModuleId_; + /// + /// Uniquely identifies an HloModuleMetadata. Equal to the first unique_id + /// of the module (a module may go through multiple unique_ids). If a module + /// is partitioned into multiple modules, those modules will each have a new + /// HloModuleMetadata with a different canonical_module_id. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long CanonicalModuleId { + get { return canonicalModuleId_; } + set { + canonicalModuleId_ = value; + } + } + + /// Field number for the "module_group_name" field. + public const int ModuleGroupNameFieldNumber = 2; + private string moduleGroupName_ = ""; + /// + /// Name of the module group that the module is part of. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string ModuleGroupName { + get { return moduleGroupName_; } + set { + moduleGroupName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "original_module_id" field. + public const int OriginalModuleIdFieldNumber = 3; + private long originalModuleId_; + /// + /// The canonical module id of the module that this one is partitioned from, + /// if applicable. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long OriginalModuleId { + get { return originalModuleId_; } + set { + originalModuleId_ = value; + } + } + + /// Field number for the "partitioned_module_ids" field. + public const int PartitionedModuleIdsFieldNumber = 4; + private static readonly pb::FieldCodec _repeated_partitionedModuleIds_codec + = pb::FieldCodec.ForInt64(34); + private readonly pbc::RepeatedField partitionedModuleIds_ = new pbc::RepeatedField(); + /// + /// The canonical module ids of the modules that this one is partitioned into, + /// if applicable. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField PartitionedModuleIds { + get { return partitionedModuleIds_; } + } + + /// Field number for the "pass_metadata" field. + public const int PassMetadataFieldNumber = 5; + private static readonly pb::FieldCodec _repeated_passMetadata_codec + = pb::FieldCodec.ForMessage(42, global::Xla.HloPassMetadata.Parser); + private readonly pbc::RepeatedField passMetadata_ = new pbc::RepeatedField(); + /// + /// Metadata for the HLO passes that are run on the module. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField PassMetadata { + get { return passMetadata_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as HloModuleMetadataProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(HloModuleMetadataProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (CanonicalModuleId != other.CanonicalModuleId) return false; + if (ModuleGroupName != other.ModuleGroupName) return false; + if (OriginalModuleId != other.OriginalModuleId) return false; + if(!partitionedModuleIds_.Equals(other.partitionedModuleIds_)) return false; + if(!passMetadata_.Equals(other.passMetadata_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (CanonicalModuleId != 0L) hash ^= CanonicalModuleId.GetHashCode(); + if (ModuleGroupName.Length != 0) hash ^= ModuleGroupName.GetHashCode(); + if (OriginalModuleId != 0L) hash ^= OriginalModuleId.GetHashCode(); + hash ^= partitionedModuleIds_.GetHashCode(); + hash ^= passMetadata_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (CanonicalModuleId != 0L) { + output.WriteRawTag(8); + output.WriteInt64(CanonicalModuleId); + } + if (ModuleGroupName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ModuleGroupName); + } + if (OriginalModuleId != 0L) { + output.WriteRawTag(24); + output.WriteInt64(OriginalModuleId); + } + partitionedModuleIds_.WriteTo(output, _repeated_partitionedModuleIds_codec); + passMetadata_.WriteTo(output, _repeated_passMetadata_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (CanonicalModuleId != 0L) { + output.WriteRawTag(8); + output.WriteInt64(CanonicalModuleId); + } + if (ModuleGroupName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ModuleGroupName); + } + if (OriginalModuleId != 0L) { + output.WriteRawTag(24); + output.WriteInt64(OriginalModuleId); + } + partitionedModuleIds_.WriteTo(ref output, _repeated_partitionedModuleIds_codec); + passMetadata_.WriteTo(ref output, _repeated_passMetadata_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (CanonicalModuleId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(CanonicalModuleId); + } + if (ModuleGroupName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ModuleGroupName); + } + if (OriginalModuleId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(OriginalModuleId); + } + size += partitionedModuleIds_.CalculateSize(_repeated_partitionedModuleIds_codec); + size += passMetadata_.CalculateSize(_repeated_passMetadata_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(HloModuleMetadataProto other) { + if (other == null) { + return; + } + if (other.CanonicalModuleId != 0L) { + CanonicalModuleId = other.CanonicalModuleId; + } + if (other.ModuleGroupName.Length != 0) { + ModuleGroupName = other.ModuleGroupName; + } + if (other.OriginalModuleId != 0L) { + OriginalModuleId = other.OriginalModuleId; + } + partitionedModuleIds_.Add(other.partitionedModuleIds_); + passMetadata_.Add(other.passMetadata_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + CanonicalModuleId = input.ReadInt64(); + break; + } + case 18: { + ModuleGroupName = input.ReadString(); + break; + } + case 24: { + OriginalModuleId = input.ReadInt64(); + break; + } + case 34: + case 32: { + partitionedModuleIds_.AddEntriesFrom(input, _repeated_partitionedModuleIds_codec); + break; + } + case 42: { + passMetadata_.AddEntriesFrom(input, _repeated_passMetadata_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + CanonicalModuleId = input.ReadInt64(); + break; + } + case 18: { + ModuleGroupName = input.ReadString(); + break; + } + case 24: { + OriginalModuleId = input.ReadInt64(); + break; + } + case 34: + case 32: { + partitionedModuleIds_.AddEntriesFrom(ref input, _repeated_partitionedModuleIds_codec); + break; + } + case 42: { + passMetadata_.AddEntriesFrom(ref input, _repeated_passMetadata_codec); + break; + } + } + } + } + #endif + + } + + /// + /// Metadata for one run of an HLO pass on a module. Provides more information + /// when processing debug dumps of HloProtos about the order of HLO passes and + /// various other stats like duration. `pass_id` may also be used to identify a + /// particular run of a pass in debug info that propagates through stages of + /// compilation. + /// + public sealed partial class HloPassMetadata : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HloPassMetadata()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloReflection.Descriptor.MessageTypes[15]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloPassMetadata() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloPassMetadata(HloPassMetadata other) : this() { + passId_ = other.passId_; + passName_ = other.passName_; + pipelineName_ = other.pipelineName_; + dumpFilenames_ = other.dumpFilenames_.Clone(); + moduleChanged_ = other.moduleChanged_; + moduleId_ = other.moduleId_; + moduleGroupModuleIds_ = other.moduleGroupModuleIds_.Clone(); + startTimestampUsec_ = other.startTimestampUsec_; + endTimestampUsec_ = other.endTimestampUsec_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HloPassMetadata Clone() { + return new HloPassMetadata(this); + } + + /// Field number for the "pass_id" field. + public const int PassIdFieldNumber = 1; + private long passId_; + /// + /// For a given module, pass_id uniquely identifies a run of an HLO pass on + /// that module. Note that a pass_id may not always refer to the same pass + /// because the order of passes during compilation may change. For finding + /// metadata for a particular pass, pass_name and pipeline_name would be more + /// reliable, although note that they may not be unique. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long PassId { + get { return passId_; } + set { + passId_ = value; + } + } + + /// Field number for the "pass_name" field. + public const int PassNameFieldNumber = 2; + private string passName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string PassName { + get { return passName_; } + set { + passName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "pipeline_name" field. + public const int PipelineNameFieldNumber = 3; + private string pipelineName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string PipelineName { + get { return pipelineName_; } + set { + pipelineName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "dump_filenames" field. + public const int DumpFilenamesFieldNumber = 4; + private static readonly pb::FieldCodec _repeated_dumpFilenames_codec + = pb::FieldCodec.ForString(34); + private readonly pbc::RepeatedField dumpFilenames_ = new pbc::RepeatedField(); + /// + /// Filenames of the dumps of the module after this pass ran. Module may be + /// dumped in multiple formats, and the order of formats in this field will + /// stay consistent across passes. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField DumpFilenames { + get { return dumpFilenames_; } + } + + /// Field number for the "module_changed" field. + public const int ModuleChangedFieldNumber = 5; + private bool moduleChanged_; + /// + /// Return value of pass.Run(). True if this pass changed the module, or, in + /// the case where the module was run through this pass as part of a module + /// group, true if this pass changed any module in the same module group. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool ModuleChanged { + get { return moduleChanged_; } + set { + moduleChanged_ = value; + } + } + + /// Field number for the "module_id" field. + public const int ModuleIdFieldNumber = 6; + private long moduleId_; + /// + /// The unique_id of the module that this pass is run on. May be different from + /// the canonical_module_id of the HloModuleMetadata that this HloPassMetadata + /// is inside. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long ModuleId { + get { return moduleId_; } + set { + moduleId_ = value; + } + } + + /// Field number for the "module_group_module_ids" field. + public const int ModuleGroupModuleIdsFieldNumber = 7; + private static readonly pb::FieldCodec _repeated_moduleGroupModuleIds_codec + = pb::FieldCodec.ForInt64(58); + private readonly pbc::RepeatedField moduleGroupModuleIds_ = new pbc::RepeatedField(); + /// + /// If the module went through this pass as part of a module group, this is + /// set as the ids of all the modules in the module group. Empty otherwise. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField ModuleGroupModuleIds { + get { return moduleGroupModuleIds_; } + } + + /// Field number for the "start_timestamp_usec" field. + public const int StartTimestampUsecFieldNumber = 8; + private long startTimestampUsec_; + /// + /// Timestamp before and after the pass is run. Note they may be equal. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long StartTimestampUsec { + get { return startTimestampUsec_; } + set { + startTimestampUsec_ = value; + } + } + + /// Field number for the "end_timestamp_usec" field. + public const int EndTimestampUsecFieldNumber = 9; + private long endTimestampUsec_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long EndTimestampUsec { + get { return endTimestampUsec_; } + set { + endTimestampUsec_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as HloPassMetadata); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(HloPassMetadata other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (PassId != other.PassId) return false; + if (PassName != other.PassName) return false; + if (PipelineName != other.PipelineName) return false; + if(!dumpFilenames_.Equals(other.dumpFilenames_)) return false; + if (ModuleChanged != other.ModuleChanged) return false; + if (ModuleId != other.ModuleId) return false; + if(!moduleGroupModuleIds_.Equals(other.moduleGroupModuleIds_)) return false; + if (StartTimestampUsec != other.StartTimestampUsec) return false; + if (EndTimestampUsec != other.EndTimestampUsec) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (PassId != 0L) hash ^= PassId.GetHashCode(); + if (PassName.Length != 0) hash ^= PassName.GetHashCode(); + if (PipelineName.Length != 0) hash ^= PipelineName.GetHashCode(); + hash ^= dumpFilenames_.GetHashCode(); + if (ModuleChanged != false) hash ^= ModuleChanged.GetHashCode(); + if (ModuleId != 0L) hash ^= ModuleId.GetHashCode(); + hash ^= moduleGroupModuleIds_.GetHashCode(); + if (StartTimestampUsec != 0L) hash ^= StartTimestampUsec.GetHashCode(); + if (EndTimestampUsec != 0L) hash ^= EndTimestampUsec.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (PassId != 0L) { + output.WriteRawTag(8); + output.WriteInt64(PassId); + } + if (PassName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(PassName); + } + if (PipelineName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(PipelineName); + } + dumpFilenames_.WriteTo(output, _repeated_dumpFilenames_codec); + if (ModuleChanged != false) { + output.WriteRawTag(40); + output.WriteBool(ModuleChanged); + } + if (ModuleId != 0L) { + output.WriteRawTag(48); + output.WriteInt64(ModuleId); + } + moduleGroupModuleIds_.WriteTo(output, _repeated_moduleGroupModuleIds_codec); + if (StartTimestampUsec != 0L) { + output.WriteRawTag(64); + output.WriteInt64(StartTimestampUsec); + } + if (EndTimestampUsec != 0L) { + output.WriteRawTag(72); + output.WriteInt64(EndTimestampUsec); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (PassId != 0L) { + output.WriteRawTag(8); + output.WriteInt64(PassId); + } + if (PassName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(PassName); + } + if (PipelineName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(PipelineName); + } + dumpFilenames_.WriteTo(ref output, _repeated_dumpFilenames_codec); + if (ModuleChanged != false) { + output.WriteRawTag(40); + output.WriteBool(ModuleChanged); + } + if (ModuleId != 0L) { + output.WriteRawTag(48); + output.WriteInt64(ModuleId); + } + moduleGroupModuleIds_.WriteTo(ref output, _repeated_moduleGroupModuleIds_codec); + if (StartTimestampUsec != 0L) { + output.WriteRawTag(64); + output.WriteInt64(StartTimestampUsec); + } + if (EndTimestampUsec != 0L) { + output.WriteRawTag(72); + output.WriteInt64(EndTimestampUsec); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (PassId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(PassId); + } + if (PassName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(PassName); + } + if (PipelineName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(PipelineName); + } + size += dumpFilenames_.CalculateSize(_repeated_dumpFilenames_codec); + if (ModuleChanged != false) { + size += 1 + 1; + } + if (ModuleId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(ModuleId); + } + size += moduleGroupModuleIds_.CalculateSize(_repeated_moduleGroupModuleIds_codec); + if (StartTimestampUsec != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(StartTimestampUsec); + } + if (EndTimestampUsec != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(EndTimestampUsec); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(HloPassMetadata other) { + if (other == null) { + return; + } + if (other.PassId != 0L) { + PassId = other.PassId; + } + if (other.PassName.Length != 0) { + PassName = other.PassName; + } + if (other.PipelineName.Length != 0) { + PipelineName = other.PipelineName; + } + dumpFilenames_.Add(other.dumpFilenames_); + if (other.ModuleChanged != false) { + ModuleChanged = other.ModuleChanged; + } + if (other.ModuleId != 0L) { + ModuleId = other.ModuleId; + } + moduleGroupModuleIds_.Add(other.moduleGroupModuleIds_); + if (other.StartTimestampUsec != 0L) { + StartTimestampUsec = other.StartTimestampUsec; + } + if (other.EndTimestampUsec != 0L) { + EndTimestampUsec = other.EndTimestampUsec; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + PassId = input.ReadInt64(); + break; + } + case 18: { + PassName = input.ReadString(); + break; + } + case 26: { + PipelineName = input.ReadString(); + break; + } + case 34: { + dumpFilenames_.AddEntriesFrom(input, _repeated_dumpFilenames_codec); + break; + } + case 40: { + ModuleChanged = input.ReadBool(); + break; + } + case 48: { + ModuleId = input.ReadInt64(); + break; + } + case 58: + case 56: { + moduleGroupModuleIds_.AddEntriesFrom(input, _repeated_moduleGroupModuleIds_codec); + break; + } + case 64: { + StartTimestampUsec = input.ReadInt64(); + break; + } + case 72: { + EndTimestampUsec = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + PassId = input.ReadInt64(); + break; + } + case 18: { + PassName = input.ReadString(); + break; + } + case 26: { + PipelineName = input.ReadString(); + break; + } + case 34: { + dumpFilenames_.AddEntriesFrom(ref input, _repeated_dumpFilenames_codec); + break; + } + case 40: { + ModuleChanged = input.ReadBool(); + break; + } + case 48: { + ModuleId = input.ReadInt64(); + break; + } + case 58: + case 56: { + moduleGroupModuleIds_.AddEntriesFrom(ref input, _repeated_moduleGroupModuleIds_codec); + break; + } + case 64: { + StartTimestampUsec = input.ReadInt64(); + break; + } + case 72: { + EndTimestampUsec = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + /// + /// Encodes attributes for an entry function. + /// + public sealed partial class EntryFunctionAttributes : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EntryFunctionAttributes()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloReflection.Descriptor.MessageTypes[16]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public EntryFunctionAttributes() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public EntryFunctionAttributes(EntryFunctionAttributes other) : this() { + buffers_ = other.buffers_.Clone(); + resultXlaShape_ = other.resultXlaShape_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public EntryFunctionAttributes Clone() { + return new EntryFunctionAttributes(this); + } + + /// Field number for the "buffers" field. + public const int BuffersFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_buffers_codec + = pb::FieldCodec.ForMessage(10, global::Xla.EntryFunctionAttributes.Types.BufferParameterAttributes.Parser); + private readonly pbc::RepeatedField buffers_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Buffers { + get { return buffers_; } + } + + /// Field number for the "result_xla_shape" field. + public const int ResultXlaShapeFieldNumber = 2; + private string resultXlaShape_ = ""; + /// + /// xla::Shape in string format. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string ResultXlaShape { + get { return resultXlaShape_; } + set { + resultXlaShape_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as EntryFunctionAttributes); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(EntryFunctionAttributes other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!buffers_.Equals(other.buffers_)) return false; + if (ResultXlaShape != other.ResultXlaShape) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= buffers_.GetHashCode(); + if (ResultXlaShape.Length != 0) hash ^= ResultXlaShape.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + buffers_.WriteTo(output, _repeated_buffers_codec); + if (ResultXlaShape.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ResultXlaShape); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + buffers_.WriteTo(ref output, _repeated_buffers_codec); + if (ResultXlaShape.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ResultXlaShape); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += buffers_.CalculateSize(_repeated_buffers_codec); + if (ResultXlaShape.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ResultXlaShape); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(EntryFunctionAttributes other) { + if (other == null) { + return; + } + buffers_.Add(other.buffers_); + if (other.ResultXlaShape.Length != 0) { + ResultXlaShape = other.ResultXlaShape; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + buffers_.AddEntriesFrom(input, _repeated_buffers_codec); + break; + } + case 18: { + ResultXlaShape = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + buffers_.AddEntriesFrom(ref input, _repeated_buffers_codec); + break; + } + case 18: { + ResultXlaShape = input.ReadString(); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the EntryFunctionAttributes message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + /// + /// Acts as the underlying container for an xla::ShapeIndex. + /// + public sealed partial class ShapeIndex : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ShapeIndex()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.EntryFunctionAttributes.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ShapeIndex() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ShapeIndex(ShapeIndex other) : this() { + indices_ = other.indices_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ShapeIndex Clone() { + return new ShapeIndex(this); + } + + /// Field number for the "indices" field. + public const int IndicesFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_indices_codec + = pb::FieldCodec.ForInt64(10); + private readonly pbc::RepeatedField indices_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Indices { + get { return indices_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ShapeIndex); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ShapeIndex other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!indices_.Equals(other.indices_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= indices_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + indices_.WriteTo(output, _repeated_indices_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + indices_.WriteTo(ref output, _repeated_indices_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += indices_.CalculateSize(_repeated_indices_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ShapeIndex other) { + if (other == null) { + return; + } + indices_.Add(other.indices_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: + case 8: { + indices_.AddEntriesFrom(input, _repeated_indices_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: + case 8: { + indices_.AddEntriesFrom(ref input, _repeated_indices_codec); + break; + } + } + } + } + #endif + + } + + /// + /// Encodes attributes for a single buffer parameter. + /// + public sealed partial class BufferParameterAttributes : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BufferParameterAttributes()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.EntryFunctionAttributes.Descriptor.NestedTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public BufferParameterAttributes() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public BufferParameterAttributes(BufferParameterAttributes other) : this() { + lmhloParams_ = other.lmhloParams_; + lmhloParamsPresent_ = other.lmhloParamsPresent_; + lmhloParamShapeIndex_ = other.lmhloParamShapeIndex_ != null ? other.lmhloParamShapeIndex_.Clone() : null; + lmhloConstantName_ = other.lmhloConstantName_; + lmhloMustAlias_ = other.lmhloMustAlias_; + lmhloOutputIndex_ = other.lmhloOutputIndex_ != null ? other.lmhloOutputIndex_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public BufferParameterAttributes Clone() { + return new BufferParameterAttributes(this); + } + + /// Field number for the "lmhlo_params" field. + public const int LmhloParamsFieldNumber = 1; + private long lmhloParams_; + /// + /// Represents an lmhlo.params function argument attribute. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long LmhloParams { + get { return lmhloParams_; } + set { + lmhloParams_ = value; + } + } + + /// Field number for the "lmhlo_params_present" field. + public const int LmhloParamsPresentFieldNumber = 6; + private bool lmhloParamsPresent_; + /// + /// TODO(hanbinyoon): Deprecate when optional fields are available in proto3 + /// (Protocol Buffers v3.15.0). + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool LmhloParamsPresent { + get { return lmhloParamsPresent_; } + set { + lmhloParamsPresent_ = value; + } + } + + /// Field number for the "lmhlo_param_shape_index" field. + public const int LmhloParamShapeIndexFieldNumber = 2; + private global::Xla.EntryFunctionAttributes.Types.ShapeIndex lmhloParamShapeIndex_; + /// + /// Represents an lmhlo.param_shape_index function argument attribute. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.EntryFunctionAttributes.Types.ShapeIndex LmhloParamShapeIndex { + get { return lmhloParamShapeIndex_; } + set { + lmhloParamShapeIndex_ = value; + } + } + + /// Field number for the "lmhlo_constant_name" field. + public const int LmhloConstantNameFieldNumber = 3; + private string lmhloConstantName_ = ""; + /// + /// Represents an lmhlo.constant_name function argument attribute. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string LmhloConstantName { + get { return lmhloConstantName_; } + set { + lmhloConstantName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "lmhlo_must_alias" field. + public const int LmhloMustAliasFieldNumber = 4; + private bool lmhloMustAlias_; + /// + /// Represents an lmhlo.must_alias function argument attribute. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool LmhloMustAlias { + get { return lmhloMustAlias_; } + set { + lmhloMustAlias_ = value; + } + } + + /// Field number for the "lmhlo_output_index" field. + public const int LmhloOutputIndexFieldNumber = 5; + private global::Xla.EntryFunctionAttributes.Types.ShapeIndex lmhloOutputIndex_; + /// + /// Represents an lmhlo.params function argument attribute. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.EntryFunctionAttributes.Types.ShapeIndex LmhloOutputIndex { + get { return lmhloOutputIndex_; } + set { + lmhloOutputIndex_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as BufferParameterAttributes); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(BufferParameterAttributes other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (LmhloParams != other.LmhloParams) return false; + if (LmhloParamsPresent != other.LmhloParamsPresent) return false; + if (!object.Equals(LmhloParamShapeIndex, other.LmhloParamShapeIndex)) return false; + if (LmhloConstantName != other.LmhloConstantName) return false; + if (LmhloMustAlias != other.LmhloMustAlias) return false; + if (!object.Equals(LmhloOutputIndex, other.LmhloOutputIndex)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (LmhloParams != 0L) hash ^= LmhloParams.GetHashCode(); + if (LmhloParamsPresent != false) hash ^= LmhloParamsPresent.GetHashCode(); + if (lmhloParamShapeIndex_ != null) hash ^= LmhloParamShapeIndex.GetHashCode(); + if (LmhloConstantName.Length != 0) hash ^= LmhloConstantName.GetHashCode(); + if (LmhloMustAlias != false) hash ^= LmhloMustAlias.GetHashCode(); + if (lmhloOutputIndex_ != null) hash ^= LmhloOutputIndex.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (LmhloParams != 0L) { + output.WriteRawTag(8); + output.WriteInt64(LmhloParams); + } + if (lmhloParamShapeIndex_ != null) { + output.WriteRawTag(18); + output.WriteMessage(LmhloParamShapeIndex); + } + if (LmhloConstantName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(LmhloConstantName); + } + if (LmhloMustAlias != false) { + output.WriteRawTag(32); + output.WriteBool(LmhloMustAlias); + } + if (lmhloOutputIndex_ != null) { + output.WriteRawTag(42); + output.WriteMessage(LmhloOutputIndex); + } + if (LmhloParamsPresent != false) { + output.WriteRawTag(48); + output.WriteBool(LmhloParamsPresent); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (LmhloParams != 0L) { + output.WriteRawTag(8); + output.WriteInt64(LmhloParams); + } + if (lmhloParamShapeIndex_ != null) { + output.WriteRawTag(18); + output.WriteMessage(LmhloParamShapeIndex); + } + if (LmhloConstantName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(LmhloConstantName); + } + if (LmhloMustAlias != false) { + output.WriteRawTag(32); + output.WriteBool(LmhloMustAlias); + } + if (lmhloOutputIndex_ != null) { + output.WriteRawTag(42); + output.WriteMessage(LmhloOutputIndex); + } + if (LmhloParamsPresent != false) { + output.WriteRawTag(48); + output.WriteBool(LmhloParamsPresent); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (LmhloParams != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(LmhloParams); + } + if (LmhloParamsPresent != false) { + size += 1 + 1; + } + if (lmhloParamShapeIndex_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(LmhloParamShapeIndex); + } + if (LmhloConstantName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(LmhloConstantName); + } + if (LmhloMustAlias != false) { + size += 1 + 1; + } + if (lmhloOutputIndex_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(LmhloOutputIndex); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(BufferParameterAttributes other) { + if (other == null) { + return; + } + if (other.LmhloParams != 0L) { + LmhloParams = other.LmhloParams; + } + if (other.LmhloParamsPresent != false) { + LmhloParamsPresent = other.LmhloParamsPresent; + } + if (other.lmhloParamShapeIndex_ != null) { + if (lmhloParamShapeIndex_ == null) { + LmhloParamShapeIndex = new global::Xla.EntryFunctionAttributes.Types.ShapeIndex(); + } + LmhloParamShapeIndex.MergeFrom(other.LmhloParamShapeIndex); + } + if (other.LmhloConstantName.Length != 0) { + LmhloConstantName = other.LmhloConstantName; + } + if (other.LmhloMustAlias != false) { + LmhloMustAlias = other.LmhloMustAlias; + } + if (other.lmhloOutputIndex_ != null) { + if (lmhloOutputIndex_ == null) { + LmhloOutputIndex = new global::Xla.EntryFunctionAttributes.Types.ShapeIndex(); + } + LmhloOutputIndex.MergeFrom(other.LmhloOutputIndex); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + LmhloParams = input.ReadInt64(); + break; + } + case 18: { + if (lmhloParamShapeIndex_ == null) { + LmhloParamShapeIndex = new global::Xla.EntryFunctionAttributes.Types.ShapeIndex(); + } + input.ReadMessage(LmhloParamShapeIndex); + break; + } + case 26: { + LmhloConstantName = input.ReadString(); + break; + } + case 32: { + LmhloMustAlias = input.ReadBool(); + break; + } + case 42: { + if (lmhloOutputIndex_ == null) { + LmhloOutputIndex = new global::Xla.EntryFunctionAttributes.Types.ShapeIndex(); + } + input.ReadMessage(LmhloOutputIndex); + break; + } + case 48: { + LmhloParamsPresent = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + LmhloParams = input.ReadInt64(); + break; + } + case 18: { + if (lmhloParamShapeIndex_ == null) { + LmhloParamShapeIndex = new global::Xla.EntryFunctionAttributes.Types.ShapeIndex(); + } + input.ReadMessage(LmhloParamShapeIndex); + break; + } + case 26: { + LmhloConstantName = input.ReadString(); + break; + } + case 32: { + LmhloMustAlias = input.ReadBool(); + break; + } + case 42: { + if (lmhloOutputIndex_ == null) { + LmhloOutputIndex = new global::Xla.EntryFunctionAttributes.Types.ShapeIndex(); + } + input.ReadMessage(LmhloOutputIndex); + break; + } + case 48: { + LmhloParamsPresent = input.ReadBool(); + break; + } + } + } + } + #endif + + } + + } + #endregion + + } + + /// + /// Encodes the underlying Xla runtime executable compiled from the XLA module. + /// + public sealed partial class XlaRuntimeExecutableProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new XlaRuntimeExecutableProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.HloReflection.Descriptor.MessageTypes[17]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public XlaRuntimeExecutableProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public XlaRuntimeExecutableProto(XlaRuntimeExecutableProto other) : this() { + hloModuleProto_ = other.hloModuleProto_ != null ? other.hloModuleProto_.Clone() : null; + entryFuncAttrs_ = other.entryFuncAttrs_ != null ? other.entryFuncAttrs_.Clone() : null; + objFile_ = other.objFile_; + mlirModule_ = other.mlirModule_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public XlaRuntimeExecutableProto Clone() { + return new XlaRuntimeExecutableProto(this); + } + + /// Field number for the "hlo_module_proto" field. + public const int HloModuleProtoFieldNumber = 1; + private global::Xla.HloModuleProto hloModuleProto_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.HloModuleProto HloModuleProto { + get { return hloModuleProto_; } + set { + hloModuleProto_ = value; + } + } + + /// Field number for the "entry_func_attrs" field. + public const int EntryFuncAttrsFieldNumber = 2; + private global::Xla.EntryFunctionAttributes entryFuncAttrs_; + /// + /// XLA-specific attributes of the executable's entry function. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.EntryFunctionAttributes EntryFuncAttrs { + get { return entryFuncAttrs_; } + set { + entryFuncAttrs_ = value; + } + } + + /// Field number for the "obj_file" field. + public const int ObjFileFieldNumber = 3; + private pb::ByteString objFile_ = pb::ByteString.Empty; + /// + /// Serialized object file compiled from the XLA module. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pb::ByteString ObjFile { + get { return objFile_; } + set { + objFile_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "mlir_module" field. + public const int MlirModuleFieldNumber = 4; + private string mlirModule_ = ""; + /// + /// Serialized MLIR module corresponding to compiled object file. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string MlirModule { + get { return mlirModule_; } + set { + mlirModule_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as XlaRuntimeExecutableProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(XlaRuntimeExecutableProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(HloModuleProto, other.HloModuleProto)) return false; + if (!object.Equals(EntryFuncAttrs, other.EntryFuncAttrs)) return false; + if (ObjFile != other.ObjFile) return false; + if (MlirModule != other.MlirModule) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (hloModuleProto_ != null) hash ^= HloModuleProto.GetHashCode(); + if (entryFuncAttrs_ != null) hash ^= EntryFuncAttrs.GetHashCode(); + if (ObjFile.Length != 0) hash ^= ObjFile.GetHashCode(); + if (MlirModule.Length != 0) hash ^= MlirModule.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (hloModuleProto_ != null) { + output.WriteRawTag(10); + output.WriteMessage(HloModuleProto); + } + if (entryFuncAttrs_ != null) { + output.WriteRawTag(18); + output.WriteMessage(EntryFuncAttrs); + } + if (ObjFile.Length != 0) { + output.WriteRawTag(26); + output.WriteBytes(ObjFile); + } + if (MlirModule.Length != 0) { + output.WriteRawTag(34); + output.WriteString(MlirModule); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (hloModuleProto_ != null) { + output.WriteRawTag(10); + output.WriteMessage(HloModuleProto); + } + if (entryFuncAttrs_ != null) { + output.WriteRawTag(18); + output.WriteMessage(EntryFuncAttrs); + } + if (ObjFile.Length != 0) { + output.WriteRawTag(26); + output.WriteBytes(ObjFile); + } + if (MlirModule.Length != 0) { + output.WriteRawTag(34); + output.WriteString(MlirModule); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (hloModuleProto_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(HloModuleProto); + } + if (entryFuncAttrs_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(EntryFuncAttrs); + } + if (ObjFile.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(ObjFile); + } + if (MlirModule.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(MlirModule); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(XlaRuntimeExecutableProto other) { + if (other == null) { + return; + } + if (other.hloModuleProto_ != null) { + if (hloModuleProto_ == null) { + HloModuleProto = new global::Xla.HloModuleProto(); + } + HloModuleProto.MergeFrom(other.HloModuleProto); + } + if (other.entryFuncAttrs_ != null) { + if (entryFuncAttrs_ == null) { + EntryFuncAttrs = new global::Xla.EntryFunctionAttributes(); + } + EntryFuncAttrs.MergeFrom(other.EntryFuncAttrs); + } + if (other.ObjFile.Length != 0) { + ObjFile = other.ObjFile; + } + if (other.MlirModule.Length != 0) { + MlirModule = other.MlirModule; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (hloModuleProto_ == null) { + HloModuleProto = new global::Xla.HloModuleProto(); + } + input.ReadMessage(HloModuleProto); + break; + } + case 18: { + if (entryFuncAttrs_ == null) { + EntryFuncAttrs = new global::Xla.EntryFunctionAttributes(); + } + input.ReadMessage(EntryFuncAttrs); + break; + } + case 26: { + ObjFile = input.ReadBytes(); + break; + } + case 34: { + MlirModule = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (hloModuleProto_ == null) { + HloModuleProto = new global::Xla.HloModuleProto(); + } + input.ReadMessage(HloModuleProto); + break; + } + case 18: { + if (entryFuncAttrs_ == null) { + EntryFuncAttrs = new global::Xla.EntryFunctionAttributes(); + } + input.ReadMessage(EntryFuncAttrs); + break; + } + case 26: { + ObjFile = input.ReadBytes(); + break; + } + case 34: { + MlirModule = input.ReadString(); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/TensorFlowNET.Core/Protobuf/KernelDef.cs b/src/TensorFlowNET.Core/Protobuf/KernelDef.cs index b5ec68825..06928ad44 100644 --- a/src/TensorFlowNET.Core/Protobuf/KernelDef.cs +++ b/src/TensorFlowNET.Core/Protobuf/KernelDef.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/kernel_def.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -47,23 +47,31 @@ static KernelDefReflection() { } #region Messages - public sealed partial class KernelDef : pb::IMessage { + public sealed partial class KernelDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KernelDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.KernelDefReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public KernelDef() { OnConstruction(); } @@ -71,6 +79,7 @@ public KernelDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public KernelDef(KernelDef other) : this() { op_ = other.op_; deviceType_ = other.deviceType_; @@ -82,6 +91,7 @@ public KernelDef(KernelDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public KernelDef Clone() { return new KernelDef(this); } @@ -93,6 +103,7 @@ public KernelDef Clone() { /// Must match the name of an Op. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Op { get { return op_; } set { @@ -107,6 +118,7 @@ public string Op { /// Type of device this kernel runs on. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string DeviceType { get { return deviceType_; } set { @@ -120,6 +132,7 @@ public string DeviceType { = pb::FieldCodec.ForMessage(26, global::Tensorflow.KernelDef.Types.AttrConstraint.Parser); private readonly pbc::RepeatedField constraint_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Constraint { get { return constraint_; } } @@ -134,6 +147,7 @@ public string DeviceType { /// instead of device memory. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField HostMemoryArg { get { return hostMemoryArg_; } } @@ -147,6 +161,7 @@ public string DeviceType { /// value matching this. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Label { get { return label_; } set { @@ -163,6 +178,7 @@ public string Label { /// this is not set), we prefer GPU kernels over CPU. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int Priority { get { return priority_; } set { @@ -171,11 +187,13 @@ public int Priority { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as KernelDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(KernelDef other) { if (ReferenceEquals(other, null)) { return false; @@ -193,6 +211,7 @@ public bool Equals(KernelDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Op.Length != 0) hash ^= Op.GetHashCode(); @@ -208,12 +227,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Op.Length != 0) { output.WriteRawTag(10); output.WriteString(Op); @@ -235,9 +259,39 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Op.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Op); + } + if (DeviceType.Length != 0) { + output.WriteRawTag(18); + output.WriteString(DeviceType); + } + constraint_.WriteTo(ref output, _repeated_constraint_codec); + hostMemoryArg_.WriteTo(ref output, _repeated_hostMemoryArg_codec); + if (Label.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Label); + } + if (Priority != 0) { + output.WriteRawTag(48); + output.WriteInt32(Priority); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Op.Length != 0) { @@ -261,6 +315,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(KernelDef other) { if (other == null) { return; @@ -283,7 +338,11 @@ public void MergeFrom(KernelDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -316,29 +375,78 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Op = input.ReadString(); + break; + } + case 18: { + DeviceType = input.ReadString(); + break; + } + case 26: { + constraint_.AddEntriesFrom(ref input, _repeated_constraint_codec); + break; + } + case 34: { + hostMemoryArg_.AddEntriesFrom(ref input, _repeated_hostMemoryArg_codec); + break; + } + case 42: { + Label = input.ReadString(); + break; + } + case 48: { + Priority = input.ReadInt32(); + break; + } + } + } } + #endif #region Nested types /// Container for nested types declared in the KernelDef message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { - public sealed partial class AttrConstraint : pb::IMessage { + public sealed partial class AttrConstraint : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AttrConstraint()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.KernelDef.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AttrConstraint() { OnConstruction(); } @@ -346,6 +454,7 @@ public AttrConstraint() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AttrConstraint(AttrConstraint other) : this() { name_ = other.name_; allowedValues_ = other.allowedValues_ != null ? other.allowedValues_.Clone() : null; @@ -353,6 +462,7 @@ public AttrConstraint(AttrConstraint other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AttrConstraint Clone() { return new AttrConstraint(this); } @@ -364,6 +474,7 @@ public AttrConstraint Clone() { /// Name of an attr from the Op. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -379,6 +490,7 @@ public string Name { /// Like OpDef.AttrDef.allowed_values, except for kernels instead of Ops. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.AttrValue AllowedValues { get { return allowedValues_; } set { @@ -387,11 +499,13 @@ public string Name { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as AttrConstraint); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(AttrConstraint other) { if (ReferenceEquals(other, null)) { return false; @@ -405,6 +519,7 @@ public bool Equals(AttrConstraint other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -416,12 +531,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -433,9 +553,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (allowedValues_ != null) { + output.WriteRawTag(18); + output.WriteMessage(AllowedValues); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -451,6 +591,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(AttrConstraint other) { if (other == null) { return; @@ -468,7 +609,11 @@ public void MergeFrom(AttrConstraint other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -488,7 +633,34 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + if (allowedValues_ == null) { + AllowedValues = new global::Tensorflow.AttrValue(); + } + input.ReadMessage(AllowedValues); + break; + } + } + } } + #endif } @@ -500,23 +672,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// /// A collection of KernelDefs /// - public sealed partial class KernelList : pb::IMessage { + public sealed partial class KernelList : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KernelList()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.KernelDefReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public KernelList() { OnConstruction(); } @@ -524,12 +704,14 @@ public KernelList() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public KernelList(KernelList other) : this() { kernel_ = other.kernel_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public KernelList Clone() { return new KernelList(this); } @@ -540,16 +722,19 @@ public KernelList Clone() { = pb::FieldCodec.ForMessage(10, global::Tensorflow.KernelDef.Parser); private readonly pbc::RepeatedField kernel_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Kernel { get { return kernel_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as KernelList); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(KernelList other) { if (ReferenceEquals(other, null)) { return false; @@ -562,6 +747,7 @@ public bool Equals(KernelList other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= kernel_.GetHashCode(); @@ -572,19 +758,37 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else kernel_.WriteTo(output, _repeated_kernel_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + kernel_.WriteTo(ref output, _repeated_kernel_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += kernel_.CalculateSize(_repeated_kernel_codec); @@ -595,6 +799,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(KernelList other) { if (other == null) { return; @@ -604,7 +809,11 @@ public void MergeFrom(KernelList other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -617,7 +826,27 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + kernel_.AddEntriesFrom(ref input, _repeated_kernel_codec); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/LogMemory.cs b/src/TensorFlowNET.Core/Protobuf/LogMemory.cs index eb68b53a4..af16b3122 100644 --- a/src/TensorFlowNET.Core/Protobuf/LogMemory.cs +++ b/src/TensorFlowNET.Core/Protobuf/LogMemory.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/log_memory.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -59,23 +59,31 @@ static LogMemoryReflection() { } #region Messages - public sealed partial class MemoryLogStep : pb::IMessage { + public sealed partial class MemoryLogStep : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MemoryLogStep()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.LogMemoryReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemoryLogStep() { OnConstruction(); } @@ -83,6 +91,7 @@ public MemoryLogStep() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemoryLogStep(MemoryLogStep other) : this() { stepId_ = other.stepId_; handle_ = other.handle_; @@ -90,6 +99,7 @@ public MemoryLogStep(MemoryLogStep other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemoryLogStep Clone() { return new MemoryLogStep(this); } @@ -101,6 +111,7 @@ public MemoryLogStep Clone() { /// Process-unique step id. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long StepId { get { return stepId_; } set { @@ -115,6 +126,7 @@ public long StepId { /// Handle describing the feeds and fetches of the step. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Handle { get { return handle_; } set { @@ -123,11 +135,13 @@ public string Handle { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as MemoryLogStep); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(MemoryLogStep other) { if (ReferenceEquals(other, null)) { return false; @@ -141,6 +155,7 @@ public bool Equals(MemoryLogStep other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (StepId != 0L) hash ^= StepId.GetHashCode(); @@ -152,12 +167,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (StepId != 0L) { output.WriteRawTag(8); output.WriteInt64(StepId); @@ -169,9 +189,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (StepId != 0L) { + output.WriteRawTag(8); + output.WriteInt64(StepId); + } + if (Handle.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Handle); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (StepId != 0L) { @@ -187,6 +227,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(MemoryLogStep other) { if (other == null) { return; @@ -201,7 +242,11 @@ public void MergeFrom(MemoryLogStep other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -218,27 +263,59 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + StepId = input.ReadInt64(); + break; + } + case 18: { + Handle = input.ReadString(); + break; + } + } + } } + #endif } - public sealed partial class MemoryLogTensorAllocation : pb::IMessage { + public sealed partial class MemoryLogTensorAllocation : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MemoryLogTensorAllocation()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.LogMemoryReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemoryLogTensorAllocation() { OnConstruction(); } @@ -246,6 +323,7 @@ public MemoryLogTensorAllocation() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemoryLogTensorAllocation(MemoryLogTensorAllocation other) : this() { stepId_ = other.stepId_; kernelName_ = other.kernelName_; @@ -254,6 +332,7 @@ public MemoryLogTensorAllocation(MemoryLogTensorAllocation other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemoryLogTensorAllocation Clone() { return new MemoryLogTensorAllocation(this); } @@ -265,6 +344,7 @@ public MemoryLogTensorAllocation Clone() { /// Process-unique step id. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long StepId { get { return stepId_; } set { @@ -280,6 +360,7 @@ public long StepId { /// e.g., "affine2/weights/Assign". /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string KernelName { get { return kernelName_; } set { @@ -294,6 +375,7 @@ public string KernelName { /// Allocated tensor details. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorDescription Tensor { get { return tensor_; } set { @@ -302,11 +384,13 @@ public string KernelName { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as MemoryLogTensorAllocation); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(MemoryLogTensorAllocation other) { if (ReferenceEquals(other, null)) { return false; @@ -321,6 +405,7 @@ public bool Equals(MemoryLogTensorAllocation other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (StepId != 0L) hash ^= StepId.GetHashCode(); @@ -333,12 +418,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (StepId != 0L) { output.WriteRawTag(8); output.WriteInt64(StepId); @@ -354,9 +444,33 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (StepId != 0L) { + output.WriteRawTag(8); + output.WriteInt64(StepId); + } + if (KernelName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(KernelName); + } + if (tensor_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Tensor); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (StepId != 0L) { @@ -375,6 +489,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(MemoryLogTensorAllocation other) { if (other == null) { return; @@ -395,7 +510,11 @@ public void MergeFrom(MemoryLogTensorAllocation other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -419,27 +538,66 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + StepId = input.ReadInt64(); + break; + } + case 18: { + KernelName = input.ReadString(); + break; + } + case 26: { + if (tensor_ == null) { + Tensor = new global::Tensorflow.TensorDescription(); + } + input.ReadMessage(Tensor); + break; + } + } + } } + #endif } - public sealed partial class MemoryLogTensorDeallocation : pb::IMessage { + public sealed partial class MemoryLogTensorDeallocation : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MemoryLogTensorDeallocation()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.LogMemoryReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemoryLogTensorDeallocation() { OnConstruction(); } @@ -447,6 +605,7 @@ public MemoryLogTensorDeallocation() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemoryLogTensorDeallocation(MemoryLogTensorDeallocation other) : this() { allocationId_ = other.allocationId_; allocatorName_ = other.allocatorName_; @@ -454,6 +613,7 @@ public MemoryLogTensorDeallocation(MemoryLogTensorDeallocation other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemoryLogTensorDeallocation Clone() { return new MemoryLogTensorDeallocation(this); } @@ -466,6 +626,7 @@ public MemoryLogTensorDeallocation Clone() { /// corresponding allocation. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long AllocationId { get { return allocationId_; } set { @@ -480,6 +641,7 @@ public long AllocationId { /// Name of the allocator used. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string AllocatorName { get { return allocatorName_; } set { @@ -488,11 +650,13 @@ public string AllocatorName { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as MemoryLogTensorDeallocation); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(MemoryLogTensorDeallocation other) { if (ReferenceEquals(other, null)) { return false; @@ -506,6 +670,7 @@ public bool Equals(MemoryLogTensorDeallocation other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (AllocationId != 0L) hash ^= AllocationId.GetHashCode(); @@ -517,12 +682,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (AllocationId != 0L) { output.WriteRawTag(8); output.WriteInt64(AllocationId); @@ -534,9 +704,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (AllocationId != 0L) { + output.WriteRawTag(8); + output.WriteInt64(AllocationId); + } + if (AllocatorName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(AllocatorName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (AllocationId != 0L) { @@ -552,6 +742,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(MemoryLogTensorDeallocation other) { if (other == null) { return; @@ -566,7 +757,11 @@ public void MergeFrom(MemoryLogTensorDeallocation other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -583,27 +778,59 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + AllocationId = input.ReadInt64(); + break; + } + case 18: { + AllocatorName = input.ReadString(); + break; + } + } + } } + #endif } - public sealed partial class MemoryLogTensorOutput : pb::IMessage { + public sealed partial class MemoryLogTensorOutput : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MemoryLogTensorOutput()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.LogMemoryReflection.Descriptor.MessageTypes[3]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemoryLogTensorOutput() { OnConstruction(); } @@ -611,6 +838,7 @@ public MemoryLogTensorOutput() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemoryLogTensorOutput(MemoryLogTensorOutput other) : this() { stepId_ = other.stepId_; kernelName_ = other.kernelName_; @@ -620,6 +848,7 @@ public MemoryLogTensorOutput(MemoryLogTensorOutput other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemoryLogTensorOutput Clone() { return new MemoryLogTensorOutput(this); } @@ -631,6 +860,7 @@ public MemoryLogTensorOutput Clone() { /// Process-unique step id. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long StepId { get { return stepId_; } set { @@ -646,6 +876,7 @@ public long StepId { /// "affine2/weights/Assign". /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string KernelName { get { return kernelName_; } set { @@ -660,6 +891,7 @@ public string KernelName { /// Index of the output being set. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int Index { get { return index_; } set { @@ -674,6 +906,7 @@ public int Index { /// Output tensor details. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorDescription Tensor { get { return tensor_; } set { @@ -682,11 +915,13 @@ public int Index { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as MemoryLogTensorOutput); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(MemoryLogTensorOutput other) { if (ReferenceEquals(other, null)) { return false; @@ -702,6 +937,7 @@ public bool Equals(MemoryLogTensorOutput other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (StepId != 0L) hash ^= StepId.GetHashCode(); @@ -715,12 +951,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (StepId != 0L) { output.WriteRawTag(8); output.WriteInt64(StepId); @@ -740,9 +981,37 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (StepId != 0L) { + output.WriteRawTag(8); + output.WriteInt64(StepId); + } + if (KernelName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(KernelName); + } + if (Index != 0) { + output.WriteRawTag(24); + output.WriteInt32(Index); + } + if (tensor_ != null) { + output.WriteRawTag(34); + output.WriteMessage(Tensor); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (StepId != 0L) { @@ -764,6 +1033,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(MemoryLogTensorOutput other) { if (other == null) { return; @@ -787,7 +1057,11 @@ public void MergeFrom(MemoryLogTensorOutput other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -815,27 +1089,70 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + StepId = input.ReadInt64(); + break; + } + case 18: { + KernelName = input.ReadString(); + break; + } + case 24: { + Index = input.ReadInt32(); + break; + } + case 34: { + if (tensor_ == null) { + Tensor = new global::Tensorflow.TensorDescription(); + } + input.ReadMessage(Tensor); + break; + } + } + } } + #endif } - public sealed partial class MemoryLogRawAllocation : pb::IMessage { + public sealed partial class MemoryLogRawAllocation : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MemoryLogRawAllocation()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.LogMemoryReflection.Descriptor.MessageTypes[4]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemoryLogRawAllocation() { OnConstruction(); } @@ -843,6 +1160,7 @@ public MemoryLogRawAllocation() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemoryLogRawAllocation(MemoryLogRawAllocation other) : this() { stepId_ = other.stepId_; operation_ = other.operation_; @@ -854,6 +1172,7 @@ public MemoryLogRawAllocation(MemoryLogRawAllocation other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemoryLogRawAllocation Clone() { return new MemoryLogRawAllocation(this); } @@ -865,6 +1184,7 @@ public MemoryLogRawAllocation Clone() { /// Process-unique step id. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long StepId { get { return stepId_; } set { @@ -879,6 +1199,7 @@ public long StepId { /// Name of the operation making the allocation. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Operation { get { return operation_; } set { @@ -893,6 +1214,7 @@ public string Operation { /// Number of bytes in the allocation. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long NumBytes { get { return numBytes_; } set { @@ -907,6 +1229,7 @@ public long NumBytes { /// Address of the allocation. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ulong Ptr { get { return ptr_; } set { @@ -922,6 +1245,7 @@ public ulong Ptr { /// corresponding deallocation. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long AllocationId { get { return allocationId_; } set { @@ -936,6 +1260,7 @@ public long AllocationId { /// Name of the allocator used. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string AllocatorName { get { return allocatorName_; } set { @@ -944,11 +1269,13 @@ public string AllocatorName { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as MemoryLogRawAllocation); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(MemoryLogRawAllocation other) { if (ReferenceEquals(other, null)) { return false; @@ -966,6 +1293,7 @@ public bool Equals(MemoryLogRawAllocation other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (StepId != 0L) hash ^= StepId.GetHashCode(); @@ -981,12 +1309,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (StepId != 0L) { output.WriteRawTag(8); output.WriteInt64(StepId); @@ -1014,9 +1347,45 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (StepId != 0L) { + output.WriteRawTag(8); + output.WriteInt64(StepId); + } + if (Operation.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Operation); + } + if (NumBytes != 0L) { + output.WriteRawTag(24); + output.WriteInt64(NumBytes); + } + if (Ptr != 0UL) { + output.WriteRawTag(32); + output.WriteUInt64(Ptr); + } + if (AllocationId != 0L) { + output.WriteRawTag(40); + output.WriteInt64(AllocationId); + } + if (AllocatorName.Length != 0) { + output.WriteRawTag(50); + output.WriteString(AllocatorName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (StepId != 0L) { @@ -1044,6 +1413,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(MemoryLogRawAllocation other) { if (other == null) { return; @@ -1070,7 +1440,11 @@ public void MergeFrom(MemoryLogRawAllocation other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1103,27 +1477,75 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + StepId = input.ReadInt64(); + break; + } + case 18: { + Operation = input.ReadString(); + break; + } + case 24: { + NumBytes = input.ReadInt64(); + break; + } + case 32: { + Ptr = input.ReadUInt64(); + break; + } + case 40: { + AllocationId = input.ReadInt64(); + break; + } + case 50: { + AllocatorName = input.ReadString(); + break; + } + } + } } + #endif } - public sealed partial class MemoryLogRawDeallocation : pb::IMessage { + public sealed partial class MemoryLogRawDeallocation : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MemoryLogRawDeallocation()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.LogMemoryReflection.Descriptor.MessageTypes[5]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemoryLogRawDeallocation() { OnConstruction(); } @@ -1131,6 +1553,7 @@ public MemoryLogRawDeallocation() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemoryLogRawDeallocation(MemoryLogRawDeallocation other) : this() { stepId_ = other.stepId_; operation_ = other.operation_; @@ -1141,6 +1564,7 @@ public MemoryLogRawDeallocation(MemoryLogRawDeallocation other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemoryLogRawDeallocation Clone() { return new MemoryLogRawDeallocation(this); } @@ -1152,6 +1576,7 @@ public MemoryLogRawDeallocation Clone() { /// Process-unique step id. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long StepId { get { return stepId_; } set { @@ -1166,6 +1591,7 @@ public long StepId { /// Name of the operation making the deallocation. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Operation { get { return operation_; } set { @@ -1181,6 +1607,7 @@ public string Operation { /// corresponding allocation. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long AllocationId { get { return allocationId_; } set { @@ -1195,6 +1622,7 @@ public long AllocationId { /// Name of the allocator used. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string AllocatorName { get { return allocatorName_; } set { @@ -1210,6 +1638,7 @@ public string AllocatorName { /// e.g. for GPU lazy freeing of buffers. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Deferred { get { return deferred_; } set { @@ -1218,11 +1647,13 @@ public bool Deferred { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as MemoryLogRawDeallocation); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(MemoryLogRawDeallocation other) { if (ReferenceEquals(other, null)) { return false; @@ -1239,6 +1670,7 @@ public bool Equals(MemoryLogRawDeallocation other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (StepId != 0L) hash ^= StepId.GetHashCode(); @@ -1253,12 +1685,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (StepId != 0L) { output.WriteRawTag(8); output.WriteInt64(StepId); @@ -1282,9 +1719,41 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (StepId != 0L) { + output.WriteRawTag(8); + output.WriteInt64(StepId); + } + if (Operation.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Operation); + } + if (AllocationId != 0L) { + output.WriteRawTag(24); + output.WriteInt64(AllocationId); + } + if (AllocatorName.Length != 0) { + output.WriteRawTag(34); + output.WriteString(AllocatorName); + } + if (Deferred != false) { + output.WriteRawTag(40); + output.WriteBool(Deferred); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (StepId != 0L) { @@ -1309,6 +1778,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(MemoryLogRawDeallocation other) { if (other == null) { return; @@ -1332,7 +1802,11 @@ public void MergeFrom(MemoryLogRawDeallocation other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1361,7 +1835,43 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + StepId = input.ReadInt64(); + break; + } + case 18: { + Operation = input.ReadString(); + break; + } + case 24: { + AllocationId = input.ReadInt64(); + break; + } + case 34: { + AllocatorName = input.ReadString(); + break; + } + case 40: { + Deferred = input.ReadBool(); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/MemmappedFileSystem.cs b/src/TensorFlowNET.Core/Protobuf/MemmappedFileSystem.cs index 9a013fd75..b47599ea9 100644 --- a/src/TensorFlowNET.Core/Protobuf/MemmappedFileSystem.cs +++ b/src/TensorFlowNET.Core/Protobuf/MemmappedFileSystem.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/util/memmapped_file_system.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -44,23 +44,31 @@ static MemmappedFileSystemReflection() { /// /// A message that describes one region of memmapped file. /// - public sealed partial class MemmappedFileSystemDirectoryElement : pb::IMessage { + public sealed partial class MemmappedFileSystemDirectoryElement : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MemmappedFileSystemDirectoryElement()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.MemmappedFileSystemReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemmappedFileSystemDirectoryElement() { OnConstruction(); } @@ -68,6 +76,7 @@ public MemmappedFileSystemDirectoryElement() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemmappedFileSystemDirectoryElement(MemmappedFileSystemDirectoryElement other) : this() { offset_ = other.offset_; name_ = other.name_; @@ -76,6 +85,7 @@ public MemmappedFileSystemDirectoryElement(MemmappedFileSystemDirectoryElement o } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemmappedFileSystemDirectoryElement Clone() { return new MemmappedFileSystemDirectoryElement(this); } @@ -84,6 +94,7 @@ public MemmappedFileSystemDirectoryElement Clone() { public const int OffsetFieldNumber = 1; private ulong offset_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ulong Offset { get { return offset_; } set { @@ -95,6 +106,7 @@ public ulong Offset { public const int NameFieldNumber = 2; private string name_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -106,6 +118,7 @@ public string Name { public const int LengthFieldNumber = 3; private ulong length_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ulong Length { get { return length_; } set { @@ -114,11 +127,13 @@ public ulong Length { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as MemmappedFileSystemDirectoryElement); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(MemmappedFileSystemDirectoryElement other) { if (ReferenceEquals(other, null)) { return false; @@ -133,6 +148,7 @@ public bool Equals(MemmappedFileSystemDirectoryElement other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Offset != 0UL) hash ^= Offset.GetHashCode(); @@ -145,12 +161,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Offset != 0UL) { output.WriteRawTag(8); output.WriteUInt64(Offset); @@ -166,9 +187,33 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Offset != 0UL) { + output.WriteRawTag(8); + output.WriteUInt64(Offset); + } + if (Name.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Name); + } + if (Length != 0UL) { + output.WriteRawTag(24); + output.WriteUInt64(Length); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Offset != 0UL) { @@ -187,6 +232,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(MemmappedFileSystemDirectoryElement other) { if (other == null) { return; @@ -204,7 +250,11 @@ public void MergeFrom(MemmappedFileSystemDirectoryElement other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -225,30 +275,66 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Offset = input.ReadUInt64(); + break; + } + case 18: { + Name = input.ReadString(); + break; + } + case 24: { + Length = input.ReadUInt64(); + break; + } + } + } + } + #endif + } /// /// A directory of regions in a memmapped file. /// - public sealed partial class MemmappedFileSystemDirectory : pb::IMessage { + public sealed partial class MemmappedFileSystemDirectory : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MemmappedFileSystemDirectory()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.MemmappedFileSystemReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemmappedFileSystemDirectory() { OnConstruction(); } @@ -256,12 +342,14 @@ public MemmappedFileSystemDirectory() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemmappedFileSystemDirectory(MemmappedFileSystemDirectory other) : this() { element_ = other.element_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemmappedFileSystemDirectory Clone() { return new MemmappedFileSystemDirectory(this); } @@ -272,16 +360,19 @@ public MemmappedFileSystemDirectory Clone() { = pb::FieldCodec.ForMessage(10, global::Tensorflow.MemmappedFileSystemDirectoryElement.Parser); private readonly pbc::RepeatedField element_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Element { get { return element_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as MemmappedFileSystemDirectory); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(MemmappedFileSystemDirectory other) { if (ReferenceEquals(other, null)) { return false; @@ -294,6 +385,7 @@ public bool Equals(MemmappedFileSystemDirectory other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= element_.GetHashCode(); @@ -304,19 +396,37 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else element_.WriteTo(output, _repeated_element_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + element_.WriteTo(ref output, _repeated_element_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += element_.CalculateSize(_repeated_element_codec); @@ -327,6 +437,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(MemmappedFileSystemDirectory other) { if (other == null) { return; @@ -336,7 +447,11 @@ public void MergeFrom(MemmappedFileSystemDirectory other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -349,7 +464,27 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + element_.AddEntriesFrom(ref input, _repeated_element_codec); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/MetaGraph.cs b/src/TensorFlowNET.Core/Protobuf/MetaGraph.cs index d66429028..4cd62e025 100644 --- a/src/TensorFlowNET.Core/Protobuf/MetaGraph.cs +++ b/src/TensorFlowNET.Core/Protobuf/MetaGraph.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/protobuf/meta_graph.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -107,9 +107,6 @@ static MetaGraphReflection() { } #region Messages /// - /// NOTE: This protocol buffer is evolving, and will go through revisions in the - /// coming months. - /// /// Protocol buffer containing the following which are necessary to restart /// training, run inference. It can be used to serialize/de-serialize memory /// objects necessary for running computation in a graph when crossing the @@ -122,23 +119,31 @@ static MetaGraphReflection() { /// TensorInfo /// SignatureDef /// - public sealed partial class MetaGraphDef : pb::IMessage { + public sealed partial class MetaGraphDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MetaGraphDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.MetaGraphReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MetaGraphDef() { OnConstruction(); } @@ -146,6 +151,7 @@ public MetaGraphDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MetaGraphDef(MetaGraphDef other) : this() { metaInfoDef_ = other.metaInfoDef_ != null ? other.metaInfoDef_.Clone() : null; graphDef_ = other.graphDef_ != null ? other.graphDef_.Clone() : null; @@ -158,6 +164,7 @@ public MetaGraphDef(MetaGraphDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MetaGraphDef Clone() { return new MetaGraphDef(this); } @@ -166,6 +173,7 @@ public MetaGraphDef Clone() { public const int MetaInfoDefFieldNumber = 1; private global::Tensorflow.MetaGraphDef.Types.MetaInfoDef metaInfoDef_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.MetaGraphDef.Types.MetaInfoDef MetaInfoDef { get { return metaInfoDef_; } set { @@ -180,6 +188,7 @@ public MetaGraphDef Clone() { /// GraphDef. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.GraphDef GraphDef { get { return graphDef_; } set { @@ -194,6 +203,7 @@ public MetaGraphDef Clone() { /// SaverDef. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.SaverDef SaverDef { get { return saverDef_; } set { @@ -211,6 +221,7 @@ public MetaGraphDef Clone() { /// See CollectionDef section for details. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField CollectionDef { get { return collectionDef_; } } @@ -225,6 +236,7 @@ public MetaGraphDef Clone() { /// SignatureDef. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField SignatureDef { get { return signatureDef_; } } @@ -238,6 +250,7 @@ public MetaGraphDef Clone() { /// Asset file def to be used with the defined graph. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField AssetFileDef { get { return assetFileDef_; } } @@ -249,6 +262,7 @@ public MetaGraphDef Clone() { /// Extra information about the structure of functions and stateful objects. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.SavedObjectGraph ObjectGraphDef { get { return objectGraphDef_; } set { @@ -257,11 +271,13 @@ public MetaGraphDef Clone() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as MetaGraphDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(MetaGraphDef other) { if (ReferenceEquals(other, null)) { return false; @@ -280,6 +296,7 @@ public bool Equals(MetaGraphDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (metaInfoDef_ != null) hash ^= MetaInfoDef.GetHashCode(); @@ -296,12 +313,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (metaInfoDef_ != null) { output.WriteRawTag(10); output.WriteMessage(MetaInfoDef); @@ -324,9 +346,40 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (metaInfoDef_ != null) { + output.WriteRawTag(10); + output.WriteMessage(MetaInfoDef); + } + if (graphDef_ != null) { + output.WriteRawTag(18); + output.WriteMessage(GraphDef); + } + if (saverDef_ != null) { + output.WriteRawTag(26); + output.WriteMessage(SaverDef); + } + collectionDef_.WriteTo(ref output, _map_collectionDef_codec); + signatureDef_.WriteTo(ref output, _map_signatureDef_codec); + assetFileDef_.WriteTo(ref output, _repeated_assetFileDef_codec); + if (objectGraphDef_ != null) { + output.WriteRawTag(58); + output.WriteMessage(ObjectGraphDef); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (metaInfoDef_ != null) { @@ -351,6 +404,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(MetaGraphDef other) { if (other == null) { return; @@ -386,7 +440,11 @@ public void MergeFrom(MetaGraphDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -435,33 +493,98 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (metaInfoDef_ == null) { + MetaInfoDef = new global::Tensorflow.MetaGraphDef.Types.MetaInfoDef(); + } + input.ReadMessage(MetaInfoDef); + break; + } + case 18: { + if (graphDef_ == null) { + GraphDef = new global::Tensorflow.GraphDef(); + } + input.ReadMessage(GraphDef); + break; + } + case 26: { + if (saverDef_ == null) { + SaverDef = new global::Tensorflow.SaverDef(); + } + input.ReadMessage(SaverDef); + break; + } + case 34: { + collectionDef_.AddEntriesFrom(ref input, _map_collectionDef_codec); + break; + } + case 42: { + signatureDef_.AddEntriesFrom(ref input, _map_signatureDef_codec); + break; + } + case 50: { + assetFileDef_.AddEntriesFrom(ref input, _repeated_assetFileDef_codec); + break; + } + case 58: { + if (objectGraphDef_ == null) { + ObjectGraphDef = new global::Tensorflow.SavedObjectGraph(); + } + input.ReadMessage(ObjectGraphDef); + break; + } + } + } + } + #endif + #region Nested types /// Container for nested types declared in the MetaGraphDef message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { /// /// Meta information regarding the graph to be exported. To be used by users /// of this protocol buffer to encode information regarding their meta graph. /// - public sealed partial class MetaInfoDef : pb::IMessage { + public sealed partial class MetaInfoDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MetaInfoDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.MetaGraphDef.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MetaInfoDef() { OnConstruction(); } @@ -469,6 +592,7 @@ public MetaInfoDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MetaInfoDef(MetaInfoDef other) : this() { metaGraphVersion_ = other.metaGraphVersion_; strippedOpList_ = other.strippedOpList_ != null ? other.strippedOpList_.Clone() : null; @@ -482,6 +606,7 @@ public MetaInfoDef(MetaInfoDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MetaInfoDef Clone() { return new MetaInfoDef(this); } @@ -494,6 +619,7 @@ public MetaInfoDef Clone() { /// steps this model has been trained to, etc. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string MetaGraphVersion { get { return metaGraphVersion_; } set { @@ -509,6 +635,7 @@ public string MetaGraphVersion { /// Descriptions and Ops not used in graph_def are stripped out. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.OpList StrippedOpList { get { return strippedOpList_; } set { @@ -524,6 +651,7 @@ public string MetaGraphVersion { /// modified, or name of the model. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Google.Protobuf.WellKnownTypes.Any AnyInfo { get { return anyInfo_; } set { @@ -545,6 +673,7 @@ public string MetaGraphVersion { /// specific use-case or runtime environment. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Tags { get { return tags_; } } @@ -558,6 +687,7 @@ public string MetaGraphVersion { /// supplied value. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string TensorflowVersion { get { return tensorflowVersion_; } set { @@ -574,6 +704,7 @@ public string TensorflowVersion { /// user supplied value. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string TensorflowGitVersion { get { return tensorflowGitVersion_; } set { @@ -589,6 +720,7 @@ public string TensorflowGitVersion { /// the nodes in this graph_def. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool StrippedDefaultAttrs { get { return strippedDefaultAttrs_; } set { @@ -605,16 +737,19 @@ public bool StrippedDefaultAttrs { /// FunctionDef name to aliases mapping. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField FunctionAliases { get { return functionAliases_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as MetaInfoDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(MetaInfoDef other) { if (ReferenceEquals(other, null)) { return false; @@ -634,6 +769,7 @@ public bool Equals(MetaInfoDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (MetaGraphVersion.Length != 0) hash ^= MetaGraphVersion.GetHashCode(); @@ -651,12 +787,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (MetaGraphVersion.Length != 0) { output.WriteRawTag(10); output.WriteString(MetaGraphVersion); @@ -686,9 +827,47 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (MetaGraphVersion.Length != 0) { + output.WriteRawTag(10); + output.WriteString(MetaGraphVersion); + } + if (strippedOpList_ != null) { + output.WriteRawTag(18); + output.WriteMessage(StrippedOpList); + } + if (anyInfo_ != null) { + output.WriteRawTag(26); + output.WriteMessage(AnyInfo); + } + tags_.WriteTo(ref output, _repeated_tags_codec); + if (TensorflowVersion.Length != 0) { + output.WriteRawTag(42); + output.WriteString(TensorflowVersion); + } + if (TensorflowGitVersion.Length != 0) { + output.WriteRawTag(50); + output.WriteString(TensorflowGitVersion); + } + if (StrippedDefaultAttrs != false) { + output.WriteRawTag(56); + output.WriteBool(StrippedDefaultAttrs); + } + functionAliases_.WriteTo(ref output, _map_functionAliases_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (MetaGraphVersion.Length != 0) { @@ -718,6 +897,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(MetaInfoDef other) { if (other == null) { return; @@ -752,7 +932,11 @@ public void MergeFrom(MetaInfoDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -799,8 +983,62 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + MetaGraphVersion = input.ReadString(); + break; + } + case 18: { + if (strippedOpList_ == null) { + StrippedOpList = new global::Tensorflow.OpList(); + } + input.ReadMessage(StrippedOpList); + break; + } + case 26: { + if (anyInfo_ == null) { + AnyInfo = new global::Google.Protobuf.WellKnownTypes.Any(); + } + input.ReadMessage(AnyInfo); + break; + } + case 34: { + tags_.AddEntriesFrom(ref input, _repeated_tags_codec); + break; + } + case 42: { + TensorflowVersion = input.ReadString(); + break; + } + case 50: { + TensorflowGitVersion = input.ReadString(); + break; + } + case 56: { + StrippedDefaultAttrs = input.ReadBool(); + break; + } + case 66: { + functionAliases_.AddEntriesFrom(ref input, _map_functionAliases_codec); + break; + } + } + } + } + #endif + } } @@ -872,23 +1110,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// to_proto=Variable.to_proto, /// from_proto=Variable.from_proto) /// - public sealed partial class CollectionDef : pb::IMessage { + public sealed partial class CollectionDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CollectionDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.MetaGraphReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CollectionDef() { OnConstruction(); } @@ -896,6 +1142,7 @@ public CollectionDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CollectionDef(CollectionDef other) : this() { switch (other.KindCase) { case KindOneofCase.NodeList: @@ -919,6 +1166,7 @@ public CollectionDef(CollectionDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CollectionDef Clone() { return new CollectionDef(this); } @@ -926,6 +1174,7 @@ public CollectionDef Clone() { /// Field number for the "node_list" field. public const int NodeListFieldNumber = 1; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.CollectionDef.Types.NodeList NodeList { get { return kindCase_ == KindOneofCase.NodeList ? (global::Tensorflow.CollectionDef.Types.NodeList) kind_ : null; } set { @@ -937,6 +1186,7 @@ public CollectionDef Clone() { /// Field number for the "bytes_list" field. public const int BytesListFieldNumber = 2; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.CollectionDef.Types.BytesList BytesList { get { return kindCase_ == KindOneofCase.BytesList ? (global::Tensorflow.CollectionDef.Types.BytesList) kind_ : null; } set { @@ -948,6 +1198,7 @@ public CollectionDef Clone() { /// Field number for the "int64_list" field. public const int Int64ListFieldNumber = 3; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.CollectionDef.Types.Int64List Int64List { get { return kindCase_ == KindOneofCase.Int64List ? (global::Tensorflow.CollectionDef.Types.Int64List) kind_ : null; } set { @@ -959,6 +1210,7 @@ public CollectionDef Clone() { /// Field number for the "float_list" field. public const int FloatListFieldNumber = 4; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.CollectionDef.Types.FloatList FloatList { get { return kindCase_ == KindOneofCase.FloatList ? (global::Tensorflow.CollectionDef.Types.FloatList) kind_ : null; } set { @@ -970,6 +1222,7 @@ public CollectionDef Clone() { /// Field number for the "any_list" field. public const int AnyListFieldNumber = 5; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.CollectionDef.Types.AnyList AnyList { get { return kindCase_ == KindOneofCase.AnyList ? (global::Tensorflow.CollectionDef.Types.AnyList) kind_ : null; } set { @@ -990,22 +1243,26 @@ public enum KindOneofCase { } private KindOneofCase kindCase_ = KindOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public KindOneofCase KindCase { get { return kindCase_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void ClearKind() { kindCase_ = KindOneofCase.None; kind_ = null; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as CollectionDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(CollectionDef other) { if (ReferenceEquals(other, null)) { return false; @@ -1023,6 +1280,7 @@ public bool Equals(CollectionDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (kindCase_ == KindOneofCase.NodeList) hash ^= NodeList.GetHashCode(); @@ -1038,12 +1296,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (kindCase_ == KindOneofCase.NodeList) { output.WriteRawTag(10); output.WriteMessage(NodeList); @@ -1067,9 +1330,41 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (kindCase_ == KindOneofCase.NodeList) { + output.WriteRawTag(10); + output.WriteMessage(NodeList); + } + if (kindCase_ == KindOneofCase.BytesList) { + output.WriteRawTag(18); + output.WriteMessage(BytesList); + } + if (kindCase_ == KindOneofCase.Int64List) { + output.WriteRawTag(26); + output.WriteMessage(Int64List); + } + if (kindCase_ == KindOneofCase.FloatList) { + output.WriteRawTag(34); + output.WriteMessage(FloatList); + } + if (kindCase_ == KindOneofCase.AnyList) { + output.WriteRawTag(42); + output.WriteMessage(AnyList); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (kindCase_ == KindOneofCase.NodeList) { @@ -1094,6 +1389,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(CollectionDef other) { if (other == null) { return; @@ -1135,7 +1431,11 @@ public void MergeFrom(CollectionDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1189,11 +1489,73 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + global::Tensorflow.CollectionDef.Types.NodeList subBuilder = new global::Tensorflow.CollectionDef.Types.NodeList(); + if (kindCase_ == KindOneofCase.NodeList) { + subBuilder.MergeFrom(NodeList); + } + input.ReadMessage(subBuilder); + NodeList = subBuilder; + break; + } + case 18: { + global::Tensorflow.CollectionDef.Types.BytesList subBuilder = new global::Tensorflow.CollectionDef.Types.BytesList(); + if (kindCase_ == KindOneofCase.BytesList) { + subBuilder.MergeFrom(BytesList); + } + input.ReadMessage(subBuilder); + BytesList = subBuilder; + break; + } + case 26: { + global::Tensorflow.CollectionDef.Types.Int64List subBuilder = new global::Tensorflow.CollectionDef.Types.Int64List(); + if (kindCase_ == KindOneofCase.Int64List) { + subBuilder.MergeFrom(Int64List); + } + input.ReadMessage(subBuilder); + Int64List = subBuilder; + break; + } + case 34: { + global::Tensorflow.CollectionDef.Types.FloatList subBuilder = new global::Tensorflow.CollectionDef.Types.FloatList(); + if (kindCase_ == KindOneofCase.FloatList) { + subBuilder.MergeFrom(FloatList); + } + input.ReadMessage(subBuilder); + FloatList = subBuilder; + break; + } + case 42: { + global::Tensorflow.CollectionDef.Types.AnyList subBuilder = new global::Tensorflow.CollectionDef.Types.AnyList(); + if (kindCase_ == KindOneofCase.AnyList) { + subBuilder.MergeFrom(AnyList); + } + input.ReadMessage(subBuilder); + AnyList = subBuilder; + break; + } + } + } } + #endif #region Nested types /// Container for nested types declared in the CollectionDef message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { /// /// NodeList is used for collecting nodes in graph. For example @@ -1207,23 +1569,31 @@ public static partial class Types { /// } /// } /// - public sealed partial class NodeList : pb::IMessage { + public sealed partial class NodeList : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NodeList()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.CollectionDef.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NodeList() { OnConstruction(); } @@ -1231,12 +1601,14 @@ public NodeList() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NodeList(NodeList other) : this() { value_ = other.value_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NodeList Clone() { return new NodeList(this); } @@ -1247,16 +1619,19 @@ public NodeList Clone() { = pb::FieldCodec.ForString(10); private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Value { get { return value_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as NodeList); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(NodeList other) { if (ReferenceEquals(other, null)) { return false; @@ -1269,6 +1644,7 @@ public bool Equals(NodeList other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= value_.GetHashCode(); @@ -1279,19 +1655,37 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else value_.WriteTo(output, _repeated_value_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + value_.WriteTo(ref output, _repeated_value_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += value_.CalculateSize(_repeated_value_codec); @@ -1302,6 +1696,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(NodeList other) { if (other == null) { return; @@ -1311,7 +1706,11 @@ public void MergeFrom(NodeList other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1324,8 +1723,28 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + value_.AddEntriesFrom(ref input, _repeated_value_codec); + break; + } + } + } + } + #endif + } /// @@ -1343,23 +1762,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// } /// } /// - public sealed partial class BytesList : pb::IMessage { + public sealed partial class BytesList : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BytesList()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.CollectionDef.Descriptor.NestedTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public BytesList() { OnConstruction(); } @@ -1367,12 +1794,14 @@ public BytesList() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public BytesList(BytesList other) : this() { value_ = other.value_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public BytesList Clone() { return new BytesList(this); } @@ -1383,16 +1812,19 @@ public BytesList Clone() { = pb::FieldCodec.ForBytes(10); private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Value { get { return value_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as BytesList); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(BytesList other) { if (ReferenceEquals(other, null)) { return false; @@ -1405,6 +1837,7 @@ public bool Equals(BytesList other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= value_.GetHashCode(); @@ -1415,19 +1848,37 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else value_.WriteTo(output, _repeated_value_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + value_.WriteTo(ref output, _repeated_value_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += value_.CalculateSize(_repeated_value_codec); @@ -1438,6 +1889,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(BytesList other) { if (other == null) { return; @@ -1447,7 +1899,11 @@ public void MergeFrom(BytesList other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1455,35 +1911,63 @@ public void MergeFrom(pb::CodedInputStream input) { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - value_.AddEntriesFrom(input, _repeated_value_codec); + value_.AddEntriesFrom(input, _repeated_value_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + value_.AddEntriesFrom(ref input, _repeated_value_codec); break; } } } } + #endif } /// /// Int64List is used for collecting int, int64 and long values. /// - public sealed partial class Int64List : pb::IMessage { + public sealed partial class Int64List : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Int64List()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.CollectionDef.Descriptor.NestedTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Int64List() { OnConstruction(); } @@ -1491,12 +1975,14 @@ public Int64List() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Int64List(Int64List other) : this() { value_ = other.value_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Int64List Clone() { return new Int64List(this); } @@ -1507,16 +1993,19 @@ public Int64List Clone() { = pb::FieldCodec.ForInt64(10); private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Value { get { return value_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as Int64List); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(Int64List other) { if (ReferenceEquals(other, null)) { return false; @@ -1529,6 +2018,7 @@ public bool Equals(Int64List other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= value_.GetHashCode(); @@ -1539,19 +2029,37 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else value_.WriteTo(output, _repeated_value_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + value_.WriteTo(ref output, _repeated_value_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += value_.CalculateSize(_repeated_value_codec); @@ -1562,6 +2070,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(Int64List other) { if (other == null) { return; @@ -1571,7 +2080,11 @@ public void MergeFrom(Int64List other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1585,30 +2098,59 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: + case 8: { + value_.AddEntriesFrom(ref input, _repeated_value_codec); + break; + } + } + } } + #endif } /// /// FloatList is used for collecting float values. /// - public sealed partial class FloatList : pb::IMessage { + public sealed partial class FloatList : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FloatList()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.CollectionDef.Descriptor.NestedTypes[3]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public FloatList() { OnConstruction(); } @@ -1616,12 +2158,14 @@ public FloatList() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public FloatList(FloatList other) : this() { value_ = other.value_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public FloatList Clone() { return new FloatList(this); } @@ -1632,16 +2176,19 @@ public FloatList Clone() { = pb::FieldCodec.ForFloat(10); private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Value { get { return value_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as FloatList); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(FloatList other) { if (ReferenceEquals(other, null)) { return false; @@ -1654,6 +2201,7 @@ public bool Equals(FloatList other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= value_.GetHashCode(); @@ -1664,19 +2212,37 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else value_.WriteTo(output, _repeated_value_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + value_.WriteTo(ref output, _repeated_value_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += value_.CalculateSize(_repeated_value_codec); @@ -1687,6 +2253,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(FloatList other) { if (other == null) { return; @@ -1696,7 +2263,11 @@ public void MergeFrom(FloatList other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1710,30 +2281,59 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: + case 13: { + value_.AddEntriesFrom(ref input, _repeated_value_codec); + break; + } + } + } } + #endif } /// /// AnyList is used for collecting Any protos. /// - public sealed partial class AnyList : pb::IMessage { + public sealed partial class AnyList : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AnyList()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.CollectionDef.Descriptor.NestedTypes[4]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AnyList() { OnConstruction(); } @@ -1741,12 +2341,14 @@ public AnyList() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AnyList(AnyList other) : this() { value_ = other.value_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AnyList Clone() { return new AnyList(this); } @@ -1757,16 +2359,19 @@ public AnyList Clone() { = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.WellKnownTypes.Any.Parser); private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Value { get { return value_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as AnyList); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(AnyList other) { if (ReferenceEquals(other, null)) { return false; @@ -1779,6 +2384,7 @@ public bool Equals(AnyList other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= value_.GetHashCode(); @@ -1789,19 +2395,37 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else value_.WriteTo(output, _repeated_value_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + value_.WriteTo(ref output, _repeated_value_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += value_.CalculateSize(_repeated_value_codec); @@ -1812,6 +2436,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(AnyList other) { if (other == null) { return; @@ -1821,7 +2446,11 @@ public void MergeFrom(AnyList other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1834,7 +2463,27 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + value_.AddEntriesFrom(ref input, _repeated_value_codec); + break; + } + } + } } + #endif } @@ -1846,23 +2495,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// /// Information about a Tensor necessary for feeding or retrieval. /// - public sealed partial class TensorInfo : pb::IMessage { + public sealed partial class TensorInfo : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TensorInfo()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.MetaGraphReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TensorInfo() { OnConstruction(); } @@ -1870,6 +2527,7 @@ public TensorInfo() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TensorInfo(TensorInfo other) : this() { dtype_ = other.dtype_; tensorShape_ = other.tensorShape_ != null ? other.tensorShape_.Clone() : null; @@ -1889,6 +2547,7 @@ public TensorInfo(TensorInfo other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TensorInfo Clone() { return new TensorInfo(this); } @@ -1899,6 +2558,7 @@ public TensorInfo Clone() { /// For dense `Tensor`s, the name of the tensor in the graph. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return encodingCase_ == EncodingOneofCase.Name ? (string) encoding_ : ""; } set { @@ -1916,6 +2576,7 @@ public string Name { /// SparseTensor Python class. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorInfo.Types.CooSparse CooSparse { get { return encodingCase_ == EncodingOneofCase.CooSparse ? (global::Tensorflow.TensorInfo.Types.CooSparse) encoding_ : null; } set { @@ -1930,6 +2591,7 @@ public string Name { /// Generic encoding for CompositeTensors. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorInfo.Types.CompositeTensor CompositeTensor { get { return encodingCase_ == EncodingOneofCase.CompositeTensor ? (global::Tensorflow.TensorInfo.Types.CompositeTensor) encoding_ : null; } set { @@ -1942,6 +2604,7 @@ public string Name { public const int DtypeFieldNumber = 2; private global::Tensorflow.DataType dtype_ = global::Tensorflow.DataType.DtInvalid; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.DataType Dtype { get { return dtype_; } set { @@ -1958,6 +2621,7 @@ public string Name { /// the logical shape of the represented tensor (aka dense_shape). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorShapeProto TensorShape { get { return tensorShape_; } set { @@ -1975,22 +2639,26 @@ public enum EncodingOneofCase { } private EncodingOneofCase encodingCase_ = EncodingOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public EncodingOneofCase EncodingCase { get { return encodingCase_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void ClearEncoding() { encodingCase_ = EncodingOneofCase.None; encoding_ = null; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as TensorInfo); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(TensorInfo other) { if (ReferenceEquals(other, null)) { return false; @@ -2008,6 +2676,7 @@ public bool Equals(TensorInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (encodingCase_ == EncodingOneofCase.Name) hash ^= Name.GetHashCode(); @@ -2023,12 +2692,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (encodingCase_ == EncodingOneofCase.Name) { output.WriteRawTag(10); output.WriteString(Name); @@ -2052,9 +2726,41 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (encodingCase_ == EncodingOneofCase.Name) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (Dtype != global::Tensorflow.DataType.DtInvalid) { + output.WriteRawTag(16); + output.WriteEnum((int) Dtype); + } + if (tensorShape_ != null) { + output.WriteRawTag(26); + output.WriteMessage(TensorShape); + } + if (encodingCase_ == EncodingOneofCase.CooSparse) { + output.WriteRawTag(34); + output.WriteMessage(CooSparse); + } + if (encodingCase_ == EncodingOneofCase.CompositeTensor) { + output.WriteRawTag(42); + output.WriteMessage(CompositeTensor); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (encodingCase_ == EncodingOneofCase.Name) { @@ -2079,6 +2785,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(TensorInfo other) { if (other == null) { return; @@ -2114,7 +2821,11 @@ public void MergeFrom(TensorInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -2156,33 +2867,91 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 16: { + Dtype = (global::Tensorflow.DataType) input.ReadEnum(); + break; + } + case 26: { + if (tensorShape_ == null) { + TensorShape = new global::Tensorflow.TensorShapeProto(); + } + input.ReadMessage(TensorShape); + break; + } + case 34: { + global::Tensorflow.TensorInfo.Types.CooSparse subBuilder = new global::Tensorflow.TensorInfo.Types.CooSparse(); + if (encodingCase_ == EncodingOneofCase.CooSparse) { + subBuilder.MergeFrom(CooSparse); + } + input.ReadMessage(subBuilder); + CooSparse = subBuilder; + break; + } + case 42: { + global::Tensorflow.TensorInfo.Types.CompositeTensor subBuilder = new global::Tensorflow.TensorInfo.Types.CompositeTensor(); + if (encodingCase_ == EncodingOneofCase.CompositeTensor) { + subBuilder.MergeFrom(CompositeTensor); + } + input.ReadMessage(subBuilder); + CompositeTensor = subBuilder; + break; + } + } + } } + #endif #region Nested types /// Container for nested types declared in the TensorInfo message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { /// /// For sparse tensors, The COO encoding stores a triple of values, indices, /// and shape. /// - public sealed partial class CooSparse : pb::IMessage { + public sealed partial class CooSparse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CooSparse()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.TensorInfo.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CooSparse() { OnConstruction(); } @@ -2190,6 +2959,7 @@ public CooSparse() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CooSparse(CooSparse other) : this() { valuesTensorName_ = other.valuesTensorName_; indicesTensorName_ = other.indicesTensorName_; @@ -2198,6 +2968,7 @@ public CooSparse(CooSparse other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CooSparse Clone() { return new CooSparse(this); } @@ -2210,6 +2981,7 @@ public CooSparse Clone() { /// the SparseTensor as a whole, given in the enclosing TensorInfo. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string ValuesTensorName { get { return valuesTensorName_; } set { @@ -2224,6 +2996,7 @@ public string ValuesTensorName { /// The indices Tensor must have dtype int64 and shape [?, ?]. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string IndicesTensorName { get { return indicesTensorName_; } set { @@ -2239,6 +3012,7 @@ public string IndicesTensorName { /// the Tensor referenced here. It must have dtype int64 and shape [?]. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string DenseShapeTensorName { get { return denseShapeTensorName_; } set { @@ -2247,11 +3021,13 @@ public string DenseShapeTensorName { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as CooSparse); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(CooSparse other) { if (ReferenceEquals(other, null)) { return false; @@ -2266,6 +3042,7 @@ public bool Equals(CooSparse other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (ValuesTensorName.Length != 0) hash ^= ValuesTensorName.GetHashCode(); @@ -2278,12 +3055,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (ValuesTensorName.Length != 0) { output.WriteRawTag(10); output.WriteString(ValuesTensorName); @@ -2299,9 +3081,33 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ValuesTensorName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ValuesTensorName); + } + if (IndicesTensorName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(IndicesTensorName); + } + if (DenseShapeTensorName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(DenseShapeTensorName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (ValuesTensorName.Length != 0) { @@ -2320,6 +3126,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(CooSparse other) { if (other == null) { return; @@ -2337,7 +3144,11 @@ public void MergeFrom(CooSparse other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -2358,30 +3169,66 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + ValuesTensorName = input.ReadString(); + break; + } + case 18: { + IndicesTensorName = input.ReadString(); + break; + } + case 26: { + DenseShapeTensorName = input.ReadString(); + break; + } + } + } } + #endif } /// /// Generic encoding for composite tensors. /// - public sealed partial class CompositeTensor : pb::IMessage { + public sealed partial class CompositeTensor : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CompositeTensor()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.TensorInfo.Descriptor.NestedTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CompositeTensor() { OnConstruction(); } @@ -2389,6 +3236,7 @@ public CompositeTensor() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CompositeTensor(CompositeTensor other) : this() { typeSpec_ = other.typeSpec_ != null ? other.typeSpec_.Clone() : null; components_ = other.components_.Clone(); @@ -2396,6 +3244,7 @@ public CompositeTensor(CompositeTensor other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CompositeTensor Clone() { return new CompositeTensor(this); } @@ -2407,6 +3256,7 @@ public CompositeTensor Clone() { /// The serialized TypeSpec for the composite tensor. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TypeSpecProto TypeSpec { get { return typeSpec_; } set { @@ -2423,16 +3273,19 @@ public CompositeTensor Clone() { /// A TensorInfo for each flattened component tensor. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Components { get { return components_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as CompositeTensor); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(CompositeTensor other) { if (ReferenceEquals(other, null)) { return false; @@ -2446,6 +3299,7 @@ public bool Equals(CompositeTensor other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (typeSpec_ != null) hash ^= TypeSpec.GetHashCode(); @@ -2457,12 +3311,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (typeSpec_ != null) { output.WriteRawTag(10); output.WriteMessage(TypeSpec); @@ -2471,9 +3330,26 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (typeSpec_ != null) { + output.WriteRawTag(10); + output.WriteMessage(TypeSpec); + } + components_.WriteTo(ref output, _repeated_components_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (typeSpec_ != null) { @@ -2487,6 +3363,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(CompositeTensor other) { if (other == null) { return; @@ -2502,7 +3379,11 @@ public void MergeFrom(CompositeTensor other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -2522,7 +3403,34 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (typeSpec_ == null) { + TypeSpec = new global::Tensorflow.TypeSpecProto(); + } + input.ReadMessage(TypeSpec); + break; + } + case 18: { + components_.AddEntriesFrom(ref input, _repeated_components_codec); + break; + } + } + } } + #endif } @@ -2590,23 +3498,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// ... /// } /// - public sealed partial class SignatureDef : pb::IMessage { + public sealed partial class SignatureDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SignatureDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.MetaGraphReflection.Descriptor.MessageTypes[3]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SignatureDef() { OnConstruction(); } @@ -2614,6 +3530,7 @@ public SignatureDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SignatureDef(SignatureDef other) : this() { inputs_ = other.inputs_.Clone(); outputs_ = other.outputs_.Clone(); @@ -2622,6 +3539,7 @@ public SignatureDef(SignatureDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SignatureDef Clone() { return new SignatureDef(this); } @@ -2635,6 +3553,7 @@ public SignatureDef Clone() { /// Named input parameters. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField Inputs { get { return inputs_; } } @@ -2648,6 +3567,7 @@ public SignatureDef Clone() { /// Named output parameters. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField Outputs { get { return outputs_; } } @@ -2666,6 +3586,7 @@ public SignatureDef Clone() { /// where a single graph computation may return multiple results. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string MethodName { get { return methodName_; } set { @@ -2674,11 +3595,13 @@ public string MethodName { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as SignatureDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(SignatureDef other) { if (ReferenceEquals(other, null)) { return false; @@ -2693,6 +3616,7 @@ public bool Equals(SignatureDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= Inputs.GetHashCode(); @@ -2705,12 +3629,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else inputs_.WriteTo(output, _map_inputs_codec); outputs_.WriteTo(output, _map_outputs_codec); if (MethodName.Length != 0) { @@ -2720,9 +3649,27 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + inputs_.WriteTo(ref output, _map_inputs_codec); + outputs_.WriteTo(ref output, _map_outputs_codec); + if (MethodName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(MethodName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += inputs_.CalculateSize(_map_inputs_codec); @@ -2737,6 +3684,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(SignatureDef other) { if (other == null) { return; @@ -2750,7 +3698,11 @@ public void MergeFrom(SignatureDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -2771,7 +3723,35 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + inputs_.AddEntriesFrom(ref input, _map_inputs_codec); + break; + } + case 18: { + outputs_.AddEntriesFrom(ref input, _map_outputs_codec); + break; + } + case 26: { + MethodName = input.ReadString(); + break; + } + } + } } + #endif } @@ -2779,23 +3759,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// An asset file def for a single file or a set of sharded files with the same /// name. /// - public sealed partial class AssetFileDef : pb::IMessage { + public sealed partial class AssetFileDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AssetFileDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.MetaGraphReflection.Descriptor.MessageTypes[4]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AssetFileDef() { OnConstruction(); } @@ -2803,6 +3791,7 @@ public AssetFileDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AssetFileDef(AssetFileDef other) : this() { tensorInfo_ = other.tensorInfo_ != null ? other.tensorInfo_.Clone() : null; filename_ = other.filename_; @@ -2810,6 +3799,7 @@ public AssetFileDef(AssetFileDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AssetFileDef Clone() { return new AssetFileDef(this); } @@ -2821,6 +3811,7 @@ public AssetFileDef Clone() { /// The tensor to bind the asset filename to. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorInfo TensorInfo { get { return tensorInfo_; } set { @@ -2837,6 +3828,7 @@ public AssetFileDef Clone() { /// would be "vocab.txt". /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Filename { get { return filename_; } set { @@ -2845,11 +3837,13 @@ public string Filename { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as AssetFileDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(AssetFileDef other) { if (ReferenceEquals(other, null)) { return false; @@ -2863,6 +3857,7 @@ public bool Equals(AssetFileDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (tensorInfo_ != null) hash ^= TensorInfo.GetHashCode(); @@ -2874,12 +3869,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (tensorInfo_ != null) { output.WriteRawTag(10); output.WriteMessage(TensorInfo); @@ -2891,9 +3891,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (tensorInfo_ != null) { + output.WriteRawTag(10); + output.WriteMessage(TensorInfo); + } + if (Filename.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Filename); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (tensorInfo_ != null) { @@ -2909,6 +3929,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(AssetFileDef other) { if (other == null) { return; @@ -2926,7 +3947,11 @@ public void MergeFrom(AssetFileDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -2946,7 +3971,34 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (tensorInfo_ == null) { + TensorInfo = new global::Tensorflow.TensorInfo(); + } + input.ReadMessage(TensorInfo); + break; + } + case 18: { + Filename = input.ReadString(); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/NodeDef.cs b/src/TensorFlowNET.Core/Protobuf/NodeDef.cs index fd6e25792..657ef46eb 100644 --- a/src/TensorFlowNET.Core/Protobuf/NodeDef.cs +++ b/src/TensorFlowNET.Core/Protobuf/NodeDef.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/node_def.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -26,44 +26,54 @@ static NodeDefReflection() { string.Concat( "Cih0ZW5zb3JmbG93L2NvcmUvZnJhbWV3b3JrL25vZGVfZGVmLnByb3RvEgp0", "ZW5zb3JmbG93Gip0ZW5zb3JmbG93L2NvcmUvZnJhbWV3b3JrL2F0dHJfdmFs", - "dWUucHJvdG8i0gIKB05vZGVEZWYSDAoEbmFtZRgBIAEoCRIKCgJvcBgCIAEo", - "CRINCgVpbnB1dBgDIAMoCRIOCgZkZXZpY2UYBCABKAkSKwoEYXR0chgFIAMo", - "CzIdLnRlbnNvcmZsb3cuTm9kZURlZi5BdHRyRW50cnkSSgoXZXhwZXJpbWVu", - "dGFsX2RlYnVnX2luZm8YBiABKAsyKS50ZW5zb3JmbG93Lk5vZGVEZWYuRXhw", - "ZXJpbWVudGFsRGVidWdJbmZvGkIKCUF0dHJFbnRyeRILCgNrZXkYASABKAkS", - "JAoFdmFsdWUYAiABKAsyFS50ZW5zb3JmbG93LkF0dHJWYWx1ZToCOAEaUQoV", - "RXhwZXJpbWVudGFsRGVidWdJbmZvEhsKE29yaWdpbmFsX25vZGVfbmFtZXMY", - "ASADKAkSGwoTb3JpZ2luYWxfZnVuY19uYW1lcxgCIAMoCUJ7ChhvcmcudGVu", - "c29yZmxvdy5mcmFtZXdvcmtCCU5vZGVQcm90b1ABWk9naXRodWIuY29tL3Rl", - "bnNvcmZsb3cvdGVuc29yZmxvdy90ZW5zb3JmbG93L2dvL2NvcmUvZnJhbWV3", - "b3JrL25vZGVfZGVmX2dvX3Byb3Rv+AEBYgZwcm90bzM=")); + "dWUucHJvdG8aKXRlbnNvcmZsb3cvY29yZS9mcmFtZXdvcmsvZnVsbF90eXBl", + "LnByb3RvIoYDCgdOb2RlRGVmEgwKBG5hbWUYASABKAkSCgoCb3AYAiABKAkS", + "DQoFaW5wdXQYAyADKAkSDgoGZGV2aWNlGAQgASgJEisKBGF0dHIYBSADKAsy", + "HS50ZW5zb3JmbG93Lk5vZGVEZWYuQXR0ckVudHJ5EkoKF2V4cGVyaW1lbnRh", + "bF9kZWJ1Z19pbmZvGAYgASgLMikudGVuc29yZmxvdy5Ob2RlRGVmLkV4cGVy", + "aW1lbnRhbERlYnVnSW5mbxIyChFleHBlcmltZW50YWxfdHlwZRgHIAEoCzIX", + "LnRlbnNvcmZsb3cuRnVsbFR5cGVEZWYaQgoJQXR0ckVudHJ5EgsKA2tleRgB", + "IAEoCRIkCgV2YWx1ZRgCIAEoCzIVLnRlbnNvcmZsb3cuQXR0clZhbHVlOgI4", + "ARpRChVFeHBlcmltZW50YWxEZWJ1Z0luZm8SGwoTb3JpZ2luYWxfbm9kZV9u", + "YW1lcxgBIAMoCRIbChNvcmlnaW5hbF9mdW5jX25hbWVzGAIgAygJQnsKGG9y", + "Zy50ZW5zb3JmbG93LmZyYW1ld29ya0IJTm9kZVByb3RvUAFaT2dpdGh1Yi5j", + "b20vdGVuc29yZmxvdy90ZW5zb3JmbG93L3RlbnNvcmZsb3cvZ28vY29yZS9m", + "cmFtZXdvcmsvbm9kZV9kZWZfZ29fcHJvdG/4AQFiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Tensorflow.AttrValueReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::Tensorflow.AttrValueReflection.Descriptor, global::Tensorflow.FullTypeReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.NodeDef), global::Tensorflow.NodeDef.Parser, new[]{ "Name", "Op", "Input", "Device", "Attr", "ExperimentalDebugInfo" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.NodeDef.Types.ExperimentalDebugInfo), global::Tensorflow.NodeDef.Types.ExperimentalDebugInfo.Parser, new[]{ "OriginalNodeNames", "OriginalFuncNames" }, null, null, null, null)}) + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.NodeDef), global::Tensorflow.NodeDef.Parser, new[]{ "Name", "Op", "Input", "Device", "Attr", "ExperimentalDebugInfo", "ExperimentalType" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.NodeDef.Types.ExperimentalDebugInfo), global::Tensorflow.NodeDef.Types.ExperimentalDebugInfo.Parser, new[]{ "OriginalNodeNames", "OriginalFuncNames" }, null, null, null, null)}) })); } #endregion } #region Messages - public sealed partial class NodeDef : pb::IMessage { + public sealed partial class NodeDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NodeDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.NodeDefReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NodeDef() { OnConstruction(); } @@ -71,6 +81,7 @@ public NodeDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NodeDef(NodeDef other) : this() { name_ = other.name_; op_ = other.op_; @@ -78,10 +89,12 @@ public NodeDef(NodeDef other) : this() { device_ = other.device_; attr_ = other.attr_.Clone(); experimentalDebugInfo_ = other.experimentalDebugInfo_ != null ? other.experimentalDebugInfo_.Clone() : null; + experimentalType_ = other.experimentalType_ != null ? other.experimentalType_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NodeDef Clone() { return new NodeDef(this); } @@ -95,6 +108,7 @@ public NodeDef Clone() { /// Must match the regexp "[A-Za-z0-9.][A-Za-z0-9_>./]*". /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -110,6 +124,7 @@ public string Name { /// Op names starting with an underscore are reserved for internal use. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Op { get { return op_; } set { @@ -130,6 +145,7 @@ public string Op { /// "^node". /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Input { get { return input_; } } @@ -160,6 +176,7 @@ public string Op { /// choose a device automatically. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Device { get { return device_; } set { @@ -187,6 +204,7 @@ public string Device { /// TODO(josh11b): Add some examples here showing best practices. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField Attr { get { return attr_; } } @@ -198,6 +216,7 @@ public string Device { /// This stores debug information associated with the node. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.NodeDef.Types.ExperimentalDebugInfo ExperimentalDebugInfo { get { return experimentalDebugInfo_; } set { @@ -205,12 +224,32 @@ public string Device { } } + /// Field number for the "experimental_type" field. + public const int ExperimentalTypeFieldNumber = 7; + private global::Tensorflow.FullTypeDef experimentalType_; + /// + /// The complete type of this node. Experimental and subject to change. + /// Currently, the field only contains the return types of the node. That will + /// extend in the future to contain the entire signature of the node, as a + /// function type. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.FullTypeDef ExperimentalType { + get { return experimentalType_; } + set { + experimentalType_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as NodeDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(NodeDef other) { if (ReferenceEquals(other, null)) { return false; @@ -224,10 +263,12 @@ public bool Equals(NodeDef other) { if (Device != other.Device) return false; if (!Attr.Equals(other.Attr)) return false; if (!object.Equals(ExperimentalDebugInfo, other.ExperimentalDebugInfo)) return false; + if (!object.Equals(ExperimentalType, other.ExperimentalType)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -236,6 +277,7 @@ public override int GetHashCode() { if (Device.Length != 0) hash ^= Device.GetHashCode(); hash ^= Attr.GetHashCode(); if (experimentalDebugInfo_ != null) hash ^= ExperimentalDebugInfo.GetHashCode(); + if (experimentalType_ != null) hash ^= ExperimentalType.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -243,12 +285,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -267,12 +314,50 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(50); output.WriteMessage(ExperimentalDebugInfo); } + if (experimentalType_ != null) { + output.WriteRawTag(58); + output.WriteMessage(ExperimentalType); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (Op.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Op); + } + input_.WriteTo(ref output, _repeated_input_codec); + if (Device.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Device); + } + attr_.WriteTo(ref output, _map_attr_codec); + if (experimentalDebugInfo_ != null) { + output.WriteRawTag(50); + output.WriteMessage(ExperimentalDebugInfo); + } + if (experimentalType_ != null) { + output.WriteRawTag(58); + output.WriteMessage(ExperimentalType); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -289,6 +374,9 @@ public int CalculateSize() { if (experimentalDebugInfo_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(ExperimentalDebugInfo); } + if (experimentalType_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ExperimentalType); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -296,6 +384,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(NodeDef other) { if (other == null) { return; @@ -317,11 +406,21 @@ public void MergeFrom(NodeDef other) { } ExperimentalDebugInfo.MergeFrom(other.ExperimentalDebugInfo); } + if (other.experimentalType_ != null) { + if (experimentalType_ == null) { + ExperimentalType = new global::Tensorflow.FullTypeDef(); + } + ExperimentalType.MergeFrom(other.ExperimentalType); + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -355,31 +454,97 @@ public void MergeFrom(pb::CodedInputStream input) { input.ReadMessage(ExperimentalDebugInfo); break; } + case 58: { + if (experimentalType_ == null) { + ExperimentalType = new global::Tensorflow.FullTypeDef(); + } + input.ReadMessage(ExperimentalType); + break; + } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + Op = input.ReadString(); + break; + } + case 26: { + input_.AddEntriesFrom(ref input, _repeated_input_codec); + break; + } + case 34: { + Device = input.ReadString(); + break; + } + case 42: { + attr_.AddEntriesFrom(ref input, _map_attr_codec); + break; + } + case 50: { + if (experimentalDebugInfo_ == null) { + ExperimentalDebugInfo = new global::Tensorflow.NodeDef.Types.ExperimentalDebugInfo(); + } + input.ReadMessage(ExperimentalDebugInfo); + break; + } + case 58: { + if (experimentalType_ == null) { + ExperimentalType = new global::Tensorflow.FullTypeDef(); + } + input.ReadMessage(ExperimentalType); + break; + } + } + } + } + #endif + #region Nested types /// Container for nested types declared in the NodeDef message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { - public sealed partial class ExperimentalDebugInfo : pb::IMessage { + public sealed partial class ExperimentalDebugInfo : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExperimentalDebugInfo()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.NodeDef.Descriptor.NestedTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ExperimentalDebugInfo() { OnConstruction(); } @@ -387,6 +552,7 @@ public ExperimentalDebugInfo() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ExperimentalDebugInfo(ExperimentalDebugInfo other) : this() { originalNodeNames_ = other.originalNodeNames_.Clone(); originalFuncNames_ = other.originalFuncNames_.Clone(); @@ -394,6 +560,7 @@ public ExperimentalDebugInfo(ExperimentalDebugInfo other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ExperimentalDebugInfo Clone() { return new ExperimentalDebugInfo(this); } @@ -413,6 +580,7 @@ public ExperimentalDebugInfo Clone() { /// current node to some top level source code. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField OriginalNodeNames { get { return originalNodeNames_; } } @@ -432,16 +600,19 @@ public ExperimentalDebugInfo Clone() { /// current ndoe to some top level source code. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField OriginalFuncNames { get { return originalFuncNames_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as ExperimentalDebugInfo); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(ExperimentalDebugInfo other) { if (ReferenceEquals(other, null)) { return false; @@ -455,6 +626,7 @@ public bool Equals(ExperimentalDebugInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= originalNodeNames_.GetHashCode(); @@ -466,20 +638,39 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else originalNodeNames_.WriteTo(output, _repeated_originalNodeNames_codec); originalFuncNames_.WriteTo(output, _repeated_originalFuncNames_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + originalNodeNames_.WriteTo(ref output, _repeated_originalNodeNames_codec); + originalFuncNames_.WriteTo(ref output, _repeated_originalFuncNames_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += originalNodeNames_.CalculateSize(_repeated_originalNodeNames_codec); @@ -491,6 +682,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(ExperimentalDebugInfo other) { if (other == null) { return; @@ -501,7 +693,11 @@ public void MergeFrom(ExperimentalDebugInfo other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -518,7 +714,31 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + originalNodeNames_.AddEntriesFrom(ref input, _repeated_originalNodeNames_codec); + break; + } + case 18: { + originalFuncNames_.AddEntriesFrom(ref input, _repeated_originalFuncNames_codec); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/OpDef.cs b/src/TensorFlowNET.Core/Protobuf/OpDef.cs index df26be91c..dd6a26450 100644 --- a/src/TensorFlowNET.Core/Protobuf/OpDef.cs +++ b/src/TensorFlowNET.Core/Protobuf/OpDef.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/op_def.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -72,23 +72,31 @@ static OpDefReflection() { /// using the "op" field which should match the name of a OpDef. /// LINT.IfChange /// - public sealed partial class OpDef : pb::IMessage { + public sealed partial class OpDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OpDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.OpDefReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public OpDef() { OnConstruction(); } @@ -96,6 +104,7 @@ public OpDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public OpDef(OpDef other) : this() { name_ = other.name_; inputArg_ = other.inputArg_.Clone(); @@ -114,6 +123,7 @@ public OpDef(OpDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public OpDef Clone() { return new OpDef(this); } @@ -126,6 +136,7 @@ public OpDef Clone() { /// Names should be CamelCase and match the regexp "[A-Z][a-zA-Z0-9>_]*". /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -142,6 +153,7 @@ public string Name { /// Description of the input(s). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField InputArg { get { return inputArg_; } } @@ -155,6 +167,7 @@ public string Name { /// Description of the output(s). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField OutputArg { get { return outputArg_; } } @@ -169,6 +182,7 @@ public string Name { /// operations (i.e. functions) which want to name different control outputs. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField ControlOutput { get { return controlOutput_; } } @@ -179,6 +193,7 @@ public string Name { = pb::FieldCodec.ForMessage(34, global::Tensorflow.OpDef.Types.AttrDef.Parser); private readonly pbc::RepeatedField attr_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Attr { get { return attr_; } } @@ -190,6 +205,7 @@ public string Name { /// Optional deprecation based on GraphDef versions. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.OpDeprecation Deprecation { get { return deprecation_; } set { @@ -204,6 +220,7 @@ public string Name { /// One-line human-readable description of what the Op does. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Summary { get { return summary_; } set { @@ -218,6 +235,7 @@ public string Summary { /// Additional, longer human-readable description of what the Op does. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Description { get { return description_; } set { @@ -232,6 +250,7 @@ public string Description { /// True if the operation is commutative ("op(a,b) == op(b,a)" for all inputs) /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool IsCommutative { get { return isCommutative_; } set { @@ -253,6 +272,7 @@ public bool IsCommutative { /// TODO(josh11b): Implement that optimization. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool IsAggregate { get { return isAggregate_; } set { @@ -277,6 +297,7 @@ public bool IsAggregate { /// Subexpression Elimination (CSE). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool IsStateful { get { return isStateful_; } set { @@ -294,6 +315,7 @@ public bool IsStateful { /// input. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool AllowsUninitializedInput { get { return allowsUninitializedInput_; } set { @@ -310,6 +332,7 @@ public bool AllowsUninitializedInput { /// trigger TF network failure handling logics. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool IsDistributedCommunication { get { return isDistributedCommunication_; } set { @@ -318,11 +341,13 @@ public bool IsDistributedCommunication { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as OpDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(OpDef other) { if (ReferenceEquals(other, null)) { return false; @@ -347,6 +372,7 @@ public bool Equals(OpDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -369,12 +395,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -418,9 +449,61 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + inputArg_.WriteTo(ref output, _repeated_inputArg_codec); + outputArg_.WriteTo(ref output, _repeated_outputArg_codec); + attr_.WriteTo(ref output, _repeated_attr_codec); + if (Summary.Length != 0) { + output.WriteRawTag(42); + output.WriteString(Summary); + } + if (Description.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Description); + } + if (deprecation_ != null) { + output.WriteRawTag(66); + output.WriteMessage(Deprecation); + } + if (IsAggregate != false) { + output.WriteRawTag(128, 1); + output.WriteBool(IsAggregate); + } + if (IsStateful != false) { + output.WriteRawTag(136, 1); + output.WriteBool(IsStateful); + } + if (IsCommutative != false) { + output.WriteRawTag(144, 1); + output.WriteBool(IsCommutative); + } + if (AllowsUninitializedInput != false) { + output.WriteRawTag(152, 1); + output.WriteBool(AllowsUninitializedInput); + } + controlOutput_.WriteTo(ref output, _repeated_controlOutput_codec); + if (IsDistributedCommunication != false) { + output.WriteRawTag(168, 1); + output.WriteBool(IsDistributedCommunication); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -461,6 +544,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(OpDef other) { if (other == null) { return; @@ -503,7 +587,11 @@ public void MergeFrom(OpDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -567,32 +655,112 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + inputArg_.AddEntriesFrom(ref input, _repeated_inputArg_codec); + break; + } + case 26: { + outputArg_.AddEntriesFrom(ref input, _repeated_outputArg_codec); + break; + } + case 34: { + attr_.AddEntriesFrom(ref input, _repeated_attr_codec); + break; + } + case 42: { + Summary = input.ReadString(); + break; + } + case 50: { + Description = input.ReadString(); + break; + } + case 66: { + if (deprecation_ == null) { + Deprecation = new global::Tensorflow.OpDeprecation(); + } + input.ReadMessage(Deprecation); + break; + } + case 128: { + IsAggregate = input.ReadBool(); + break; + } + case 136: { + IsStateful = input.ReadBool(); + break; + } + case 144: { + IsCommutative = input.ReadBool(); + break; + } + case 152: { + AllowsUninitializedInput = input.ReadBool(); + break; + } + case 162: { + controlOutput_.AddEntriesFrom(ref input, _repeated_controlOutput_codec); + break; + } + case 168: { + IsDistributedCommunication = input.ReadBool(); + break; + } + } + } + } + #endif + #region Nested types /// Container for nested types declared in the OpDef message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { /// /// For describing inputs and outputs. /// - public sealed partial class ArgDef : pb::IMessage { + public sealed partial class ArgDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ArgDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.OpDef.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ArgDef() { OnConstruction(); } @@ -600,6 +768,7 @@ public ArgDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ArgDef(ArgDef other) : this() { name_ = other.name_; description_ = other.description_; @@ -614,6 +783,7 @@ public ArgDef(ArgDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ArgDef Clone() { return new ArgDef(this); } @@ -625,6 +795,7 @@ public ArgDef Clone() { /// Name for the input/output. Should match the regexp "[a-z][a-z0-9_]*". /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -639,6 +810,7 @@ public string Name { /// Human readable description. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Description { get { return description_; } set { @@ -662,6 +834,7 @@ public string Description { /// to the name of an attr with type "list(type)". /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.DataType Type { get { return type_; } set { @@ -676,6 +849,7 @@ public string Description { /// if specified, attr must have type "type" /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string TypeAttr { get { return typeAttr_; } set { @@ -690,6 +864,7 @@ public string TypeAttr { /// if specified, attr must have type "int" /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string NumberAttr { get { return numberAttr_; } set { @@ -705,6 +880,7 @@ public string NumberAttr { /// type, type_attr, and number_attr may be specified. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string TypeListAttr { get { return typeListAttr_; } set { @@ -721,6 +897,7 @@ public string TypeListAttr { /// The handle data for resource inputs. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField HandleData { get { return handleData_; } } @@ -734,6 +911,7 @@ public string TypeListAttr { /// For outputs: if true, outputs are refs, otherwise they are not. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool IsRef { get { return isRef_; } set { @@ -756,6 +934,7 @@ public bool IsRef { /// just the type of a single argument. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.FullTypeDef ExperimentalFullType { get { return experimentalFullType_; } set { @@ -764,11 +943,13 @@ public bool IsRef { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as ArgDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(ArgDef other) { if (ReferenceEquals(other, null)) { return false; @@ -789,6 +970,7 @@ public bool Equals(ArgDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -807,12 +989,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -849,9 +1036,54 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (Description.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Description); + } + if (Type != global::Tensorflow.DataType.DtInvalid) { + output.WriteRawTag(24); + output.WriteEnum((int) Type); + } + if (TypeAttr.Length != 0) { + output.WriteRawTag(34); + output.WriteString(TypeAttr); + } + if (NumberAttr.Length != 0) { + output.WriteRawTag(42); + output.WriteString(NumberAttr); + } + if (TypeListAttr.Length != 0) { + output.WriteRawTag(50); + output.WriteString(TypeListAttr); + } + handleData_.WriteTo(ref output, _repeated_handleData_codec); + if (IsRef != false) { + output.WriteRawTag(128, 1); + output.WriteBool(IsRef); + } + if (experimentalFullType_ != null) { + output.WriteRawTag(138, 1); + output.WriteMessage(ExperimentalFullType); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -886,6 +1118,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(ArgDef other) { if (other == null) { return; @@ -922,7 +1155,11 @@ public void MergeFrom(ArgDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -970,8 +1207,63 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + Description = input.ReadString(); + break; + } + case 24: { + Type = (global::Tensorflow.DataType) input.ReadEnum(); + break; + } + case 34: { + TypeAttr = input.ReadString(); + break; + } + case 42: { + NumberAttr = input.ReadString(); + break; + } + case 50: { + TypeListAttr = input.ReadString(); + break; + } + case 58: { + handleData_.AddEntriesFrom(ref input, _repeated_handleData_codec); + break; + } + case 128: { + IsRef = input.ReadBool(); + break; + } + case 138: { + if (experimentalFullType_ == null) { + ExperimentalFullType = new global::Tensorflow.FullTypeDef(); + } + input.ReadMessage(ExperimentalFullType); + break; + } + } + } + } + #endif + } /// @@ -979,23 +1271,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// Op. That is to say, this describes the attr fields that will /// be specified in the NodeDef. /// - public sealed partial class AttrDef : pb::IMessage { + public sealed partial class AttrDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AttrDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.OpDef.Descriptor.NestedTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AttrDef() { OnConstruction(); } @@ -1003,6 +1303,7 @@ public AttrDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AttrDef(AttrDef other) : this() { name_ = other.name_; type_ = other.type_; @@ -1015,6 +1316,7 @@ public AttrDef(AttrDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AttrDef Clone() { return new AttrDef(this); } @@ -1028,6 +1330,7 @@ public AttrDef Clone() { /// the regexp "[a-z][a-z0-9_]+". /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -1043,6 +1346,7 @@ public string Name { /// "int", etc.). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Type { get { return type_; } set { @@ -1058,6 +1362,7 @@ public string Type { /// a value. If not specified, the user must supply a value. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.AttrValue DefaultValue { get { return defaultValue_; } set { @@ -1072,6 +1377,7 @@ public string Type { /// Human-readable description. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Description { get { return description_; } set { @@ -1087,6 +1393,7 @@ public string Description { /// types, this is the minimum length. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool HasMinimum { get { return hasMinimum_; } set { @@ -1098,6 +1405,7 @@ public bool HasMinimum { public const int MinimumFieldNumber = 6; private long minimum_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long Minimum { get { return minimum_; } set { @@ -1117,6 +1425,7 @@ public long Minimum { /// "allowed_values.list" has the set of allowed strings. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.AttrValue AllowedValues { get { return allowedValues_; } set { @@ -1125,11 +1434,13 @@ public long Minimum { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as AttrDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(AttrDef other) { if (ReferenceEquals(other, null)) { return false; @@ -1148,6 +1459,7 @@ public bool Equals(AttrDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -1164,12 +1476,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -1201,9 +1518,49 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (Type.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Type); + } + if (defaultValue_ != null) { + output.WriteRawTag(26); + output.WriteMessage(DefaultValue); + } + if (Description.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Description); + } + if (HasMinimum != false) { + output.WriteRawTag(40); + output.WriteBool(HasMinimum); + } + if (Minimum != 0L) { + output.WriteRawTag(48); + output.WriteInt64(Minimum); + } + if (allowedValues_ != null) { + output.WriteRawTag(58); + output.WriteMessage(AllowedValues); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -1234,6 +1591,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(AttrDef other) { if (other == null) { return; @@ -1269,7 +1627,11 @@ public void MergeFrom(AttrDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1312,7 +1674,57 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + Type = input.ReadString(); + break; + } + case 26: { + if (defaultValue_ == null) { + DefaultValue = new global::Tensorflow.AttrValue(); + } + input.ReadMessage(DefaultValue); + break; + } + case 34: { + Description = input.ReadString(); + break; + } + case 40: { + HasMinimum = input.ReadBool(); + break; + } + case 48: { + Minimum = input.ReadInt64(); + break; + } + case 58: { + if (allowedValues_ == null) { + AllowedValues = new global::Tensorflow.AttrValue(); + } + input.ReadMessage(AllowedValues); + break; + } + } + } } + #endif } @@ -1324,23 +1736,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// /// Information about version-dependent deprecation of an op /// - public sealed partial class OpDeprecation : pb::IMessage { + public sealed partial class OpDeprecation : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OpDeprecation()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.OpDefReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public OpDeprecation() { OnConstruction(); } @@ -1348,6 +1768,7 @@ public OpDeprecation() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public OpDeprecation(OpDeprecation other) : this() { version_ = other.version_; explanation_ = other.explanation_; @@ -1355,6 +1776,7 @@ public OpDeprecation(OpDeprecation other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public OpDeprecation Clone() { return new OpDeprecation(this); } @@ -1366,6 +1788,7 @@ public OpDeprecation Clone() { /// First GraphDef version at which the op is disallowed. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int Version { get { return version_; } set { @@ -1380,6 +1803,7 @@ public int Version { /// Explanation of why it was deprecated and what to use instead. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Explanation { get { return explanation_; } set { @@ -1388,11 +1812,13 @@ public string Explanation { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as OpDeprecation); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(OpDeprecation other) { if (ReferenceEquals(other, null)) { return false; @@ -1406,6 +1832,7 @@ public bool Equals(OpDeprecation other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Version != 0) hash ^= Version.GetHashCode(); @@ -1417,12 +1844,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Version != 0) { output.WriteRawTag(8); output.WriteInt32(Version); @@ -1434,9 +1866,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Version != 0) { + output.WriteRawTag(8); + output.WriteInt32(Version); + } + if (Explanation.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Explanation); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Version != 0) { @@ -1452,6 +1904,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(OpDeprecation other) { if (other == null) { return; @@ -1466,7 +1919,11 @@ public void MergeFrom(OpDeprecation other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1483,30 +1940,62 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Version = input.ReadInt32(); + break; + } + case 18: { + Explanation = input.ReadString(); + break; + } + } + } + } + #endif + } /// /// A collection of OpDefs /// - public sealed partial class OpList : pb::IMessage { + public sealed partial class OpList : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OpList()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.OpDefReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public OpList() { OnConstruction(); } @@ -1514,12 +2003,14 @@ public OpList() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public OpList(OpList other) : this() { op_ = other.op_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public OpList Clone() { return new OpList(this); } @@ -1530,16 +2021,19 @@ public OpList Clone() { = pb::FieldCodec.ForMessage(10, global::Tensorflow.OpDef.Parser); private readonly pbc::RepeatedField op_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Op { get { return op_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as OpList); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(OpList other) { if (ReferenceEquals(other, null)) { return false; @@ -1552,6 +2046,7 @@ public bool Equals(OpList other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= op_.GetHashCode(); @@ -1562,19 +2057,37 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else op_.WriteTo(output, _repeated_op_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + op_.WriteTo(ref output, _repeated_op_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += op_.CalculateSize(_repeated_op_codec); @@ -1585,6 +2098,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(OpList other) { if (other == null) { return; @@ -1594,7 +2108,11 @@ public void MergeFrom(OpList other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1607,7 +2125,27 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + op_.AddEntriesFrom(ref input, _repeated_op_codec); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/Protocol.cs b/src/TensorFlowNET.Core/Protobuf/Protocol.cs new file mode 100644 index 000000000..6463a9b54 --- /dev/null +++ b/src/TensorFlowNET.Core/Protobuf/Protocol.cs @@ -0,0 +1,3840 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tensorflow/compiler/xla/pjrt/distributed/protocol.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Xla { + + /// Holder for reflection information generated from tensorflow/compiler/xla/pjrt/distributed/protocol.proto + public static partial class ProtocolReflection { + + #region Descriptor + /// File descriptor for tensorflow/compiler/xla/pjrt/distributed/protocol.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ProtocolReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Cjd0ZW5zb3JmbG93L2NvbXBpbGVyL3hsYS9wanJ0L2Rpc3RyaWJ1dGVkL3By", + "b3RvY29sLnByb3RvEgN4bGEiYwoLRGV2aWNlUHJvdG8SHAoUbG9jYWxfZGV2", + "aWNlX29yZGluYWwYASABKAUSDAoEbmFtZRgCIAEoCRIOCgZ2ZW5kb3IYAyAB", + "KAkSGAoQZ2xvYmFsX2RldmljZV9pZBgEIAEoBSJIChJMb2NhbFRvcG9sb2d5", + "UHJvdG8SDwoHbm9kZV9pZBgBIAEoBRIhCgdkZXZpY2VzGAIgAygLMhAueGxh", + "LkRldmljZVByb3RvIj0KE0dsb2JhbFRvcG9sb2d5UHJvdG8SJgoFbm9kZXMY", + "ASADKAsyFy54bGEuTG9jYWxUb3BvbG9neVByb3RvImwKDkNvbm5lY3RSZXF1", + "ZXN0EhgKEHByb3RvY29sX3ZlcnNpb24YASABKAUSHAoUdGltZW91dF9taWxs", + "aXNlY29uZHMYAiABKAUSDwoHbm9kZV9pZBgDIAEoBRIRCgljbGllbnRfaWQY", + "BCABKAQiJQoPQ29ubmVjdFJlc3BvbnNlEhIKCnNlc3Npb25faWQYASABKAQi", + "XgoXRW51bWVyYXRlRGV2aWNlc1JlcXVlc3QSEgoKc2Vzc2lvbl9pZBgBIAEo", + "BBIvCg5sb2NhbF90b3BvbG9neRgDIAEoCzIXLnhsYS5Mb2NhbFRvcG9sb2d5", + "UHJvdG8iTQoYRW51bWVyYXRlRGV2aWNlc1Jlc3BvbnNlEjEKD2dsb2JhbF90", + "b3BvbG9neRgBIAEoCzIYLnhsYS5HbG9iYWxUb3BvbG9neVByb3RvIlMKEktl", + "eVZhbHVlR2V0UmVxdWVzdBISCgpzZXNzaW9uX2lkGAEgASgEEgsKA2tleRgC", + "IAEoDBIcChR0aW1lb3V0X21pbGxpc2Vjb25kcxgDIAEoBSIzChNLZXlWYWx1", + "ZUdldFJlc3BvbnNlEg0KBWZvdW5kGAEgASgIEg0KBXZhbHVlGAIgASgMIkQK", + "EktleVZhbHVlU2V0UmVxdWVzdBISCgpzZXNzaW9uX2lkGAEgASgEEgsKA2tl", + "eRgCIAEoDBINCgV2YWx1ZRgDIAEoDCIVChNLZXlWYWx1ZVNldFJlc3BvbnNl", + "Im0KFFdhaXRBdEJhcnJpZXJSZXF1ZXN0EhIKCnNlc3Npb25faWQYASABKAQS", + "EgoKYmFycmllcl9pZBgCIAEoDBIPCgdub2RlX2lkGAMgASgFEhwKFHRpbWVv", + "dXRfbWlsbGlzZWNvbmRzGAQgASgFIhcKFVdhaXRBdEJhcnJpZXJSZXNwb25z", + "ZSI3ChBIZWFydGJlYXRSZXF1ZXN0EhIKCnNlc3Npb25faWQYASABKAQSDwoH", + "bm9kZV9pZBgCIAEoBSITChFIZWFydGJlYXRSZXNwb25zZSI2Cg9TaHV0ZG93", + "blJlcXVlc3QSEgoKc2Vzc2lvbl9pZBgBIAEoBBIPCgdub2RlX2lkGAIgASgF", + "IhIKEFNodXRkb3duUmVzcG9uc2Uy8QMKGURpc3RyaWJ1dGVkUnVudGltZVNl", + "cnZpY2USNgoHQ29ubmVjdBITLnhsYS5Db25uZWN0UmVxdWVzdBoULnhsYS5D", + "b25uZWN0UmVzcG9uc2UiABJRChBFbnVtZXJhdGVEZXZpY2VzEhwueGxhLkVu", + "dW1lcmF0ZURldmljZXNSZXF1ZXN0Gh0ueGxhLkVudW1lcmF0ZURldmljZXNS", + "ZXNwb25zZSIAEjwKCUhlYXJ0YmVhdBIVLnhsYS5IZWFydGJlYXRSZXF1ZXN0", + "GhYueGxhLkhlYXJ0YmVhdFJlc3BvbnNlIgASOQoIU2h1dGRvd24SFC54bGEu", + "U2h1dGRvd25SZXF1ZXN0GhUueGxhLlNodXRkb3duUmVzcG9uc2UiABJCCgtL", + "ZXlWYWx1ZUdldBIXLnhsYS5LZXlWYWx1ZUdldFJlcXVlc3QaGC54bGEuS2V5", + "VmFsdWVHZXRSZXNwb25zZSIAEkIKC0tleVZhbHVlU2V0EhcueGxhLktleVZh", + "bHVlU2V0UmVxdWVzdBoYLnhsYS5LZXlWYWx1ZVNldFJlc3BvbnNlIgASSAoN", + "V2FpdEF0QmFycmllchIZLnhsYS5XYWl0QXRCYXJyaWVyUmVxdWVzdBoaLnhs", + "YS5XYWl0QXRCYXJyaWVyUmVzcG9uc2UiAEJgWl5naXRodWIuY29tL3RlbnNv", + "cmZsb3cvdGVuc29yZmxvdy90ZW5zb3JmbG93L2dvL2NvbXBpbGVyL3hsYS9w", + "anJ0L2Rpc3RyaWJ1dGVkL3Byb3RvY29sX2dvX3Byb3RvYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.DeviceProto), global::Xla.DeviceProto.Parser, new[]{ "LocalDeviceOrdinal", "Name", "Vendor", "GlobalDeviceId" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.LocalTopologyProto), global::Xla.LocalTopologyProto.Parser, new[]{ "NodeId", "Devices" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.GlobalTopologyProto), global::Xla.GlobalTopologyProto.Parser, new[]{ "Nodes" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ConnectRequest), global::Xla.ConnectRequest.Parser, new[]{ "ProtocolVersion", "TimeoutMilliseconds", "NodeId", "ClientId" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ConnectResponse), global::Xla.ConnectResponse.Parser, new[]{ "SessionId" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.EnumerateDevicesRequest), global::Xla.EnumerateDevicesRequest.Parser, new[]{ "SessionId", "LocalTopology" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.EnumerateDevicesResponse), global::Xla.EnumerateDevicesResponse.Parser, new[]{ "GlobalTopology" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.KeyValueGetRequest), global::Xla.KeyValueGetRequest.Parser, new[]{ "SessionId", "Key", "TimeoutMilliseconds" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.KeyValueGetResponse), global::Xla.KeyValueGetResponse.Parser, new[]{ "Found", "Value" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.KeyValueSetRequest), global::Xla.KeyValueSetRequest.Parser, new[]{ "SessionId", "Key", "Value" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.KeyValueSetResponse), global::Xla.KeyValueSetResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.WaitAtBarrierRequest), global::Xla.WaitAtBarrierRequest.Parser, new[]{ "SessionId", "BarrierId", "NodeId", "TimeoutMilliseconds" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.WaitAtBarrierResponse), global::Xla.WaitAtBarrierResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.HeartbeatRequest), global::Xla.HeartbeatRequest.Parser, new[]{ "SessionId", "NodeId" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.HeartbeatResponse), global::Xla.HeartbeatResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ShutdownRequest), global::Xla.ShutdownRequest.Parser, new[]{ "SessionId", "NodeId" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ShutdownResponse), global::Xla.ShutdownResponse.Parser, null, null, null, null, null) + })); + } + #endregion + + } + #region Messages + /// + /// Describes a device local to a host. + /// + public sealed partial class DeviceProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeviceProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.ProtocolReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeviceProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeviceProto(DeviceProto other) : this() { + localDeviceOrdinal_ = other.localDeviceOrdinal_; + name_ = other.name_; + vendor_ = other.vendor_; + globalDeviceId_ = other.globalDeviceId_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeviceProto Clone() { + return new DeviceProto(this); + } + + /// Field number for the "local_device_ordinal" field. + public const int LocalDeviceOrdinalFieldNumber = 1; + private int localDeviceOrdinal_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int LocalDeviceOrdinal { + get { return localDeviceOrdinal_; } + set { + localDeviceOrdinal_ = value; + } + } + + /// Field number for the "name" field. + public const int NameFieldNumber = 2; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "vendor" field. + public const int VendorFieldNumber = 3; + private string vendor_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Vendor { + get { return vendor_; } + set { + vendor_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "global_device_id" field. + public const int GlobalDeviceIdFieldNumber = 4; + private int globalDeviceId_; + /// + /// The following fields are present in the GlobalTopologyProto message + /// returned by EnumerateDevices() but not in the LocalTopologyProto messages + /// passed to EnumerateDevices(). In other words, the coordinator node + /// determines the global device IDs during EnumerateDevices(). + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int GlobalDeviceId { + get { return globalDeviceId_; } + set { + globalDeviceId_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as DeviceProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(DeviceProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (LocalDeviceOrdinal != other.LocalDeviceOrdinal) return false; + if (Name != other.Name) return false; + if (Vendor != other.Vendor) return false; + if (GlobalDeviceId != other.GlobalDeviceId) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (LocalDeviceOrdinal != 0) hash ^= LocalDeviceOrdinal.GetHashCode(); + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (Vendor.Length != 0) hash ^= Vendor.GetHashCode(); + if (GlobalDeviceId != 0) hash ^= GlobalDeviceId.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (LocalDeviceOrdinal != 0) { + output.WriteRawTag(8); + output.WriteInt32(LocalDeviceOrdinal); + } + if (Name.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Name); + } + if (Vendor.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Vendor); + } + if (GlobalDeviceId != 0) { + output.WriteRawTag(32); + output.WriteInt32(GlobalDeviceId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (LocalDeviceOrdinal != 0) { + output.WriteRawTag(8); + output.WriteInt32(LocalDeviceOrdinal); + } + if (Name.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Name); + } + if (Vendor.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Vendor); + } + if (GlobalDeviceId != 0) { + output.WriteRawTag(32); + output.WriteInt32(GlobalDeviceId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (LocalDeviceOrdinal != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(LocalDeviceOrdinal); + } + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (Vendor.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Vendor); + } + if (GlobalDeviceId != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(GlobalDeviceId); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(DeviceProto other) { + if (other == null) { + return; + } + if (other.LocalDeviceOrdinal != 0) { + LocalDeviceOrdinal = other.LocalDeviceOrdinal; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + if (other.Vendor.Length != 0) { + Vendor = other.Vendor; + } + if (other.GlobalDeviceId != 0) { + GlobalDeviceId = other.GlobalDeviceId; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + LocalDeviceOrdinal = input.ReadInt32(); + break; + } + case 18: { + Name = input.ReadString(); + break; + } + case 26: { + Vendor = input.ReadString(); + break; + } + case 32: { + GlobalDeviceId = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + LocalDeviceOrdinal = input.ReadInt32(); + break; + } + case 18: { + Name = input.ReadString(); + break; + } + case 26: { + Vendor = input.ReadString(); + break; + } + case 32: { + GlobalDeviceId = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + public sealed partial class LocalTopologyProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new LocalTopologyProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.ProtocolReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LocalTopologyProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LocalTopologyProto(LocalTopologyProto other) : this() { + nodeId_ = other.nodeId_; + devices_ = other.devices_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LocalTopologyProto Clone() { + return new LocalTopologyProto(this); + } + + /// Field number for the "node_id" field. + public const int NodeIdFieldNumber = 1; + private int nodeId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int NodeId { + get { return nodeId_; } + set { + nodeId_ = value; + } + } + + /// Field number for the "devices" field. + public const int DevicesFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_devices_codec + = pb::FieldCodec.ForMessage(18, global::Xla.DeviceProto.Parser); + private readonly pbc::RepeatedField devices_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Devices { + get { return devices_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as LocalTopologyProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(LocalTopologyProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (NodeId != other.NodeId) return false; + if(!devices_.Equals(other.devices_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (NodeId != 0) hash ^= NodeId.GetHashCode(); + hash ^= devices_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (NodeId != 0) { + output.WriteRawTag(8); + output.WriteInt32(NodeId); + } + devices_.WriteTo(output, _repeated_devices_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (NodeId != 0) { + output.WriteRawTag(8); + output.WriteInt32(NodeId); + } + devices_.WriteTo(ref output, _repeated_devices_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (NodeId != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(NodeId); + } + size += devices_.CalculateSize(_repeated_devices_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(LocalTopologyProto other) { + if (other == null) { + return; + } + if (other.NodeId != 0) { + NodeId = other.NodeId; + } + devices_.Add(other.devices_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + NodeId = input.ReadInt32(); + break; + } + case 18: { + devices_.AddEntriesFrom(input, _repeated_devices_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + NodeId = input.ReadInt32(); + break; + } + case 18: { + devices_.AddEntriesFrom(ref input, _repeated_devices_codec); + break; + } + } + } + } + #endif + + } + + public sealed partial class GlobalTopologyProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GlobalTopologyProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.ProtocolReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GlobalTopologyProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GlobalTopologyProto(GlobalTopologyProto other) : this() { + nodes_ = other.nodes_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GlobalTopologyProto Clone() { + return new GlobalTopologyProto(this); + } + + /// Field number for the "nodes" field. + public const int NodesFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_nodes_codec + = pb::FieldCodec.ForMessage(10, global::Xla.LocalTopologyProto.Parser); + private readonly pbc::RepeatedField nodes_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Nodes { + get { return nodes_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as GlobalTopologyProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(GlobalTopologyProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!nodes_.Equals(other.nodes_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= nodes_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + nodes_.WriteTo(output, _repeated_nodes_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + nodes_.WriteTo(ref output, _repeated_nodes_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += nodes_.CalculateSize(_repeated_nodes_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(GlobalTopologyProto other) { + if (other == null) { + return; + } + nodes_.Add(other.nodes_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + nodes_.AddEntriesFrom(input, _repeated_nodes_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + nodes_.AddEntriesFrom(ref input, _repeated_nodes_codec); + break; + } + } + } + } + #endif + + } + + public sealed partial class ConnectRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ConnectRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.ProtocolReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ConnectRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ConnectRequest(ConnectRequest other) : this() { + protocolVersion_ = other.protocolVersion_; + timeoutMilliseconds_ = other.timeoutMilliseconds_; + nodeId_ = other.nodeId_; + clientId_ = other.clientId_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ConnectRequest Clone() { + return new ConnectRequest(this); + } + + /// Field number for the "protocol_version" field. + public const int ProtocolVersionFieldNumber = 1; + private int protocolVersion_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int ProtocolVersion { + get { return protocolVersion_; } + set { + protocolVersion_ = value; + } + } + + /// Field number for the "timeout_milliseconds" field. + public const int TimeoutMillisecondsFieldNumber = 2; + private int timeoutMilliseconds_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int TimeoutMilliseconds { + get { return timeoutMilliseconds_; } + set { + timeoutMilliseconds_ = value; + } + } + + /// Field number for the "node_id" field. + public const int NodeIdFieldNumber = 3; + private int nodeId_; + /// + /// We assume that each node knows its globally-unique node ID, provided by + /// whatever mechanism launches the tasks. Node IDs should form a dense range + /// of integers [0, num_nodes). + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int NodeId { + get { return nodeId_; } + set { + nodeId_ = value; + } + } + + /// Field number for the "client_id" field. + public const int ClientIdFieldNumber = 4; + private ulong clientId_; + /// + /// A unique ID number for the client. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ulong ClientId { + get { return clientId_; } + set { + clientId_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ConnectRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ConnectRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ProtocolVersion != other.ProtocolVersion) return false; + if (TimeoutMilliseconds != other.TimeoutMilliseconds) return false; + if (NodeId != other.NodeId) return false; + if (ClientId != other.ClientId) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (ProtocolVersion != 0) hash ^= ProtocolVersion.GetHashCode(); + if (TimeoutMilliseconds != 0) hash ^= TimeoutMilliseconds.GetHashCode(); + if (NodeId != 0) hash ^= NodeId.GetHashCode(); + if (ClientId != 0UL) hash ^= ClientId.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ProtocolVersion != 0) { + output.WriteRawTag(8); + output.WriteInt32(ProtocolVersion); + } + if (TimeoutMilliseconds != 0) { + output.WriteRawTag(16); + output.WriteInt32(TimeoutMilliseconds); + } + if (NodeId != 0) { + output.WriteRawTag(24); + output.WriteInt32(NodeId); + } + if (ClientId != 0UL) { + output.WriteRawTag(32); + output.WriteUInt64(ClientId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ProtocolVersion != 0) { + output.WriteRawTag(8); + output.WriteInt32(ProtocolVersion); + } + if (TimeoutMilliseconds != 0) { + output.WriteRawTag(16); + output.WriteInt32(TimeoutMilliseconds); + } + if (NodeId != 0) { + output.WriteRawTag(24); + output.WriteInt32(NodeId); + } + if (ClientId != 0UL) { + output.WriteRawTag(32); + output.WriteUInt64(ClientId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (ProtocolVersion != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(ProtocolVersion); + } + if (TimeoutMilliseconds != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(TimeoutMilliseconds); + } + if (NodeId != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(NodeId); + } + if (ClientId != 0UL) { + size += 1 + pb::CodedOutputStream.ComputeUInt64Size(ClientId); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ConnectRequest other) { + if (other == null) { + return; + } + if (other.ProtocolVersion != 0) { + ProtocolVersion = other.ProtocolVersion; + } + if (other.TimeoutMilliseconds != 0) { + TimeoutMilliseconds = other.TimeoutMilliseconds; + } + if (other.NodeId != 0) { + NodeId = other.NodeId; + } + if (other.ClientId != 0UL) { + ClientId = other.ClientId; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + ProtocolVersion = input.ReadInt32(); + break; + } + case 16: { + TimeoutMilliseconds = input.ReadInt32(); + break; + } + case 24: { + NodeId = input.ReadInt32(); + break; + } + case 32: { + ClientId = input.ReadUInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + ProtocolVersion = input.ReadInt32(); + break; + } + case 16: { + TimeoutMilliseconds = input.ReadInt32(); + break; + } + case 24: { + NodeId = input.ReadInt32(); + break; + } + case 32: { + ClientId = input.ReadUInt64(); + break; + } + } + } + } + #endif + + } + + public sealed partial class ConnectResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ConnectResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.ProtocolReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ConnectResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ConnectResponse(ConnectResponse other) : this() { + sessionId_ = other.sessionId_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ConnectResponse Clone() { + return new ConnectResponse(this); + } + + /// Field number for the "session_id" field. + public const int SessionIdFieldNumber = 1; + private ulong sessionId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ulong SessionId { + get { return sessionId_; } + set { + sessionId_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ConnectResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ConnectResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (SessionId != other.SessionId) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (SessionId != 0UL) hash ^= SessionId.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (SessionId != 0UL) { + output.WriteRawTag(8); + output.WriteUInt64(SessionId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (SessionId != 0UL) { + output.WriteRawTag(8); + output.WriteUInt64(SessionId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (SessionId != 0UL) { + size += 1 + pb::CodedOutputStream.ComputeUInt64Size(SessionId); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ConnectResponse other) { + if (other == null) { + return; + } + if (other.SessionId != 0UL) { + SessionId = other.SessionId; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + SessionId = input.ReadUInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + SessionId = input.ReadUInt64(); + break; + } + } + } + } + #endif + + } + + public sealed partial class EnumerateDevicesRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumerateDevicesRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.ProtocolReflection.Descriptor.MessageTypes[5]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public EnumerateDevicesRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public EnumerateDevicesRequest(EnumerateDevicesRequest other) : this() { + sessionId_ = other.sessionId_; + localTopology_ = other.localTopology_ != null ? other.localTopology_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public EnumerateDevicesRequest Clone() { + return new EnumerateDevicesRequest(this); + } + + /// Field number for the "session_id" field. + public const int SessionIdFieldNumber = 1; + private ulong sessionId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ulong SessionId { + get { return sessionId_; } + set { + sessionId_ = value; + } + } + + /// Field number for the "local_topology" field. + public const int LocalTopologyFieldNumber = 3; + private global::Xla.LocalTopologyProto localTopology_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.LocalTopologyProto LocalTopology { + get { return localTopology_; } + set { + localTopology_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as EnumerateDevicesRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(EnumerateDevicesRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (SessionId != other.SessionId) return false; + if (!object.Equals(LocalTopology, other.LocalTopology)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (SessionId != 0UL) hash ^= SessionId.GetHashCode(); + if (localTopology_ != null) hash ^= LocalTopology.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (SessionId != 0UL) { + output.WriteRawTag(8); + output.WriteUInt64(SessionId); + } + if (localTopology_ != null) { + output.WriteRawTag(26); + output.WriteMessage(LocalTopology); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (SessionId != 0UL) { + output.WriteRawTag(8); + output.WriteUInt64(SessionId); + } + if (localTopology_ != null) { + output.WriteRawTag(26); + output.WriteMessage(LocalTopology); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (SessionId != 0UL) { + size += 1 + pb::CodedOutputStream.ComputeUInt64Size(SessionId); + } + if (localTopology_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(LocalTopology); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(EnumerateDevicesRequest other) { + if (other == null) { + return; + } + if (other.SessionId != 0UL) { + SessionId = other.SessionId; + } + if (other.localTopology_ != null) { + if (localTopology_ == null) { + LocalTopology = new global::Xla.LocalTopologyProto(); + } + LocalTopology.MergeFrom(other.LocalTopology); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + SessionId = input.ReadUInt64(); + break; + } + case 26: { + if (localTopology_ == null) { + LocalTopology = new global::Xla.LocalTopologyProto(); + } + input.ReadMessage(LocalTopology); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + SessionId = input.ReadUInt64(); + break; + } + case 26: { + if (localTopology_ == null) { + LocalTopology = new global::Xla.LocalTopologyProto(); + } + input.ReadMessage(LocalTopology); + break; + } + } + } + } + #endif + + } + + public sealed partial class EnumerateDevicesResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumerateDevicesResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.ProtocolReflection.Descriptor.MessageTypes[6]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public EnumerateDevicesResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public EnumerateDevicesResponse(EnumerateDevicesResponse other) : this() { + globalTopology_ = other.globalTopology_ != null ? other.globalTopology_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public EnumerateDevicesResponse Clone() { + return new EnumerateDevicesResponse(this); + } + + /// Field number for the "global_topology" field. + public const int GlobalTopologyFieldNumber = 1; + private global::Xla.GlobalTopologyProto globalTopology_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.GlobalTopologyProto GlobalTopology { + get { return globalTopology_; } + set { + globalTopology_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as EnumerateDevicesResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(EnumerateDevicesResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(GlobalTopology, other.GlobalTopology)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (globalTopology_ != null) hash ^= GlobalTopology.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (globalTopology_ != null) { + output.WriteRawTag(10); + output.WriteMessage(GlobalTopology); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (globalTopology_ != null) { + output.WriteRawTag(10); + output.WriteMessage(GlobalTopology); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (globalTopology_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(GlobalTopology); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(EnumerateDevicesResponse other) { + if (other == null) { + return; + } + if (other.globalTopology_ != null) { + if (globalTopology_ == null) { + GlobalTopology = new global::Xla.GlobalTopologyProto(); + } + GlobalTopology.MergeFrom(other.GlobalTopology); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (globalTopology_ == null) { + GlobalTopology = new global::Xla.GlobalTopologyProto(); + } + input.ReadMessage(GlobalTopology); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (globalTopology_ == null) { + GlobalTopology = new global::Xla.GlobalTopologyProto(); + } + input.ReadMessage(GlobalTopology); + break; + } + } + } + } + #endif + + } + + public sealed partial class KeyValueGetRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KeyValueGetRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.ProtocolReflection.Descriptor.MessageTypes[7]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public KeyValueGetRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public KeyValueGetRequest(KeyValueGetRequest other) : this() { + sessionId_ = other.sessionId_; + key_ = other.key_; + timeoutMilliseconds_ = other.timeoutMilliseconds_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public KeyValueGetRequest Clone() { + return new KeyValueGetRequest(this); + } + + /// Field number for the "session_id" field. + public const int SessionIdFieldNumber = 1; + private ulong sessionId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ulong SessionId { + get { return sessionId_; } + set { + sessionId_ = value; + } + } + + /// Field number for the "key" field. + public const int KeyFieldNumber = 2; + private pb::ByteString key_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pb::ByteString Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "timeout_milliseconds" field. + public const int TimeoutMillisecondsFieldNumber = 3; + private int timeoutMilliseconds_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int TimeoutMilliseconds { + get { return timeoutMilliseconds_; } + set { + timeoutMilliseconds_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as KeyValueGetRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(KeyValueGetRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (SessionId != other.SessionId) return false; + if (Key != other.Key) return false; + if (TimeoutMilliseconds != other.TimeoutMilliseconds) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (SessionId != 0UL) hash ^= SessionId.GetHashCode(); + if (Key.Length != 0) hash ^= Key.GetHashCode(); + if (TimeoutMilliseconds != 0) hash ^= TimeoutMilliseconds.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (SessionId != 0UL) { + output.WriteRawTag(8); + output.WriteUInt64(SessionId); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteBytes(Key); + } + if (TimeoutMilliseconds != 0) { + output.WriteRawTag(24); + output.WriteInt32(TimeoutMilliseconds); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (SessionId != 0UL) { + output.WriteRawTag(8); + output.WriteUInt64(SessionId); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteBytes(Key); + } + if (TimeoutMilliseconds != 0) { + output.WriteRawTag(24); + output.WriteInt32(TimeoutMilliseconds); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (SessionId != 0UL) { + size += 1 + pb::CodedOutputStream.ComputeUInt64Size(SessionId); + } + if (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(Key); + } + if (TimeoutMilliseconds != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(TimeoutMilliseconds); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(KeyValueGetRequest other) { + if (other == null) { + return; + } + if (other.SessionId != 0UL) { + SessionId = other.SessionId; + } + if (other.Key.Length != 0) { + Key = other.Key; + } + if (other.TimeoutMilliseconds != 0) { + TimeoutMilliseconds = other.TimeoutMilliseconds; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + SessionId = input.ReadUInt64(); + break; + } + case 18: { + Key = input.ReadBytes(); + break; + } + case 24: { + TimeoutMilliseconds = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + SessionId = input.ReadUInt64(); + break; + } + case 18: { + Key = input.ReadBytes(); + break; + } + case 24: { + TimeoutMilliseconds = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + public sealed partial class KeyValueGetResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KeyValueGetResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.ProtocolReflection.Descriptor.MessageTypes[8]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public KeyValueGetResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public KeyValueGetResponse(KeyValueGetResponse other) : this() { + found_ = other.found_; + value_ = other.value_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public KeyValueGetResponse Clone() { + return new KeyValueGetResponse(this); + } + + /// Field number for the "found" field. + public const int FoundFieldNumber = 1; + private bool found_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Found { + get { return found_; } + set { + found_ = value; + } + } + + /// Field number for the "value" field. + public const int ValueFieldNumber = 2; + private pb::ByteString value_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pb::ByteString Value { + get { return value_; } + set { + value_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as KeyValueGetResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(KeyValueGetResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Found != other.Found) return false; + if (Value != other.Value) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Found != false) hash ^= Found.GetHashCode(); + if (Value.Length != 0) hash ^= Value.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Found != false) { + output.WriteRawTag(8); + output.WriteBool(Found); + } + if (Value.Length != 0) { + output.WriteRawTag(18); + output.WriteBytes(Value); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Found != false) { + output.WriteRawTag(8); + output.WriteBool(Found); + } + if (Value.Length != 0) { + output.WriteRawTag(18); + output.WriteBytes(Value); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Found != false) { + size += 1 + 1; + } + if (Value.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(Value); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(KeyValueGetResponse other) { + if (other == null) { + return; + } + if (other.Found != false) { + Found = other.Found; + } + if (other.Value.Length != 0) { + Value = other.Value; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Found = input.ReadBool(); + break; + } + case 18: { + Value = input.ReadBytes(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Found = input.ReadBool(); + break; + } + case 18: { + Value = input.ReadBytes(); + break; + } + } + } + } + #endif + + } + + public sealed partial class KeyValueSetRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KeyValueSetRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.ProtocolReflection.Descriptor.MessageTypes[9]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public KeyValueSetRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public KeyValueSetRequest(KeyValueSetRequest other) : this() { + sessionId_ = other.sessionId_; + key_ = other.key_; + value_ = other.value_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public KeyValueSetRequest Clone() { + return new KeyValueSetRequest(this); + } + + /// Field number for the "session_id" field. + public const int SessionIdFieldNumber = 1; + private ulong sessionId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ulong SessionId { + get { return sessionId_; } + set { + sessionId_ = value; + } + } + + /// Field number for the "key" field. + public const int KeyFieldNumber = 2; + private pb::ByteString key_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pb::ByteString Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "value" field. + public const int ValueFieldNumber = 3; + private pb::ByteString value_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pb::ByteString Value { + get { return value_; } + set { + value_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as KeyValueSetRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(KeyValueSetRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (SessionId != other.SessionId) return false; + if (Key != other.Key) return false; + if (Value != other.Value) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (SessionId != 0UL) hash ^= SessionId.GetHashCode(); + if (Key.Length != 0) hash ^= Key.GetHashCode(); + if (Value.Length != 0) hash ^= Value.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (SessionId != 0UL) { + output.WriteRawTag(8); + output.WriteUInt64(SessionId); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteBytes(Key); + } + if (Value.Length != 0) { + output.WriteRawTag(26); + output.WriteBytes(Value); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (SessionId != 0UL) { + output.WriteRawTag(8); + output.WriteUInt64(SessionId); + } + if (Key.Length != 0) { + output.WriteRawTag(18); + output.WriteBytes(Key); + } + if (Value.Length != 0) { + output.WriteRawTag(26); + output.WriteBytes(Value); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (SessionId != 0UL) { + size += 1 + pb::CodedOutputStream.ComputeUInt64Size(SessionId); + } + if (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(Key); + } + if (Value.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(Value); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(KeyValueSetRequest other) { + if (other == null) { + return; + } + if (other.SessionId != 0UL) { + SessionId = other.SessionId; + } + if (other.Key.Length != 0) { + Key = other.Key; + } + if (other.Value.Length != 0) { + Value = other.Value; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + SessionId = input.ReadUInt64(); + break; + } + case 18: { + Key = input.ReadBytes(); + break; + } + case 26: { + Value = input.ReadBytes(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + SessionId = input.ReadUInt64(); + break; + } + case 18: { + Key = input.ReadBytes(); + break; + } + case 26: { + Value = input.ReadBytes(); + break; + } + } + } + } + #endif + + } + + public sealed partial class KeyValueSetResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KeyValueSetResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.ProtocolReflection.Descriptor.MessageTypes[10]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public KeyValueSetResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public KeyValueSetResponse(KeyValueSetResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public KeyValueSetResponse Clone() { + return new KeyValueSetResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as KeyValueSetResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(KeyValueSetResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(KeyValueSetResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + public sealed partial class WaitAtBarrierRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WaitAtBarrierRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.ProtocolReflection.Descriptor.MessageTypes[11]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WaitAtBarrierRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WaitAtBarrierRequest(WaitAtBarrierRequest other) : this() { + sessionId_ = other.sessionId_; + barrierId_ = other.barrierId_; + nodeId_ = other.nodeId_; + timeoutMilliseconds_ = other.timeoutMilliseconds_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WaitAtBarrierRequest Clone() { + return new WaitAtBarrierRequest(this); + } + + /// Field number for the "session_id" field. + public const int SessionIdFieldNumber = 1; + private ulong sessionId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ulong SessionId { + get { return sessionId_; } + set { + sessionId_ = value; + } + } + + /// Field number for the "barrier_id" field. + public const int BarrierIdFieldNumber = 2; + private pb::ByteString barrierId_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pb::ByteString BarrierId { + get { return barrierId_; } + set { + barrierId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "node_id" field. + public const int NodeIdFieldNumber = 3; + private int nodeId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int NodeId { + get { return nodeId_; } + set { + nodeId_ = value; + } + } + + /// Field number for the "timeout_milliseconds" field. + public const int TimeoutMillisecondsFieldNumber = 4; + private int timeoutMilliseconds_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int TimeoutMilliseconds { + get { return timeoutMilliseconds_; } + set { + timeoutMilliseconds_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as WaitAtBarrierRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(WaitAtBarrierRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (SessionId != other.SessionId) return false; + if (BarrierId != other.BarrierId) return false; + if (NodeId != other.NodeId) return false; + if (TimeoutMilliseconds != other.TimeoutMilliseconds) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (SessionId != 0UL) hash ^= SessionId.GetHashCode(); + if (BarrierId.Length != 0) hash ^= BarrierId.GetHashCode(); + if (NodeId != 0) hash ^= NodeId.GetHashCode(); + if (TimeoutMilliseconds != 0) hash ^= TimeoutMilliseconds.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (SessionId != 0UL) { + output.WriteRawTag(8); + output.WriteUInt64(SessionId); + } + if (BarrierId.Length != 0) { + output.WriteRawTag(18); + output.WriteBytes(BarrierId); + } + if (NodeId != 0) { + output.WriteRawTag(24); + output.WriteInt32(NodeId); + } + if (TimeoutMilliseconds != 0) { + output.WriteRawTag(32); + output.WriteInt32(TimeoutMilliseconds); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (SessionId != 0UL) { + output.WriteRawTag(8); + output.WriteUInt64(SessionId); + } + if (BarrierId.Length != 0) { + output.WriteRawTag(18); + output.WriteBytes(BarrierId); + } + if (NodeId != 0) { + output.WriteRawTag(24); + output.WriteInt32(NodeId); + } + if (TimeoutMilliseconds != 0) { + output.WriteRawTag(32); + output.WriteInt32(TimeoutMilliseconds); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (SessionId != 0UL) { + size += 1 + pb::CodedOutputStream.ComputeUInt64Size(SessionId); + } + if (BarrierId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(BarrierId); + } + if (NodeId != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(NodeId); + } + if (TimeoutMilliseconds != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(TimeoutMilliseconds); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(WaitAtBarrierRequest other) { + if (other == null) { + return; + } + if (other.SessionId != 0UL) { + SessionId = other.SessionId; + } + if (other.BarrierId.Length != 0) { + BarrierId = other.BarrierId; + } + if (other.NodeId != 0) { + NodeId = other.NodeId; + } + if (other.TimeoutMilliseconds != 0) { + TimeoutMilliseconds = other.TimeoutMilliseconds; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + SessionId = input.ReadUInt64(); + break; + } + case 18: { + BarrierId = input.ReadBytes(); + break; + } + case 24: { + NodeId = input.ReadInt32(); + break; + } + case 32: { + TimeoutMilliseconds = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + SessionId = input.ReadUInt64(); + break; + } + case 18: { + BarrierId = input.ReadBytes(); + break; + } + case 24: { + NodeId = input.ReadInt32(); + break; + } + case 32: { + TimeoutMilliseconds = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + public sealed partial class WaitAtBarrierResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WaitAtBarrierResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.ProtocolReflection.Descriptor.MessageTypes[12]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WaitAtBarrierResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WaitAtBarrierResponse(WaitAtBarrierResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WaitAtBarrierResponse Clone() { + return new WaitAtBarrierResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as WaitAtBarrierResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(WaitAtBarrierResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(WaitAtBarrierResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + public sealed partial class HeartbeatRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HeartbeatRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.ProtocolReflection.Descriptor.MessageTypes[13]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HeartbeatRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HeartbeatRequest(HeartbeatRequest other) : this() { + sessionId_ = other.sessionId_; + nodeId_ = other.nodeId_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HeartbeatRequest Clone() { + return new HeartbeatRequest(this); + } + + /// Field number for the "session_id" field. + public const int SessionIdFieldNumber = 1; + private ulong sessionId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ulong SessionId { + get { return sessionId_; } + set { + sessionId_ = value; + } + } + + /// Field number for the "node_id" field. + public const int NodeIdFieldNumber = 2; + private int nodeId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int NodeId { + get { return nodeId_; } + set { + nodeId_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as HeartbeatRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(HeartbeatRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (SessionId != other.SessionId) return false; + if (NodeId != other.NodeId) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (SessionId != 0UL) hash ^= SessionId.GetHashCode(); + if (NodeId != 0) hash ^= NodeId.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (SessionId != 0UL) { + output.WriteRawTag(8); + output.WriteUInt64(SessionId); + } + if (NodeId != 0) { + output.WriteRawTag(16); + output.WriteInt32(NodeId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (SessionId != 0UL) { + output.WriteRawTag(8); + output.WriteUInt64(SessionId); + } + if (NodeId != 0) { + output.WriteRawTag(16); + output.WriteInt32(NodeId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (SessionId != 0UL) { + size += 1 + pb::CodedOutputStream.ComputeUInt64Size(SessionId); + } + if (NodeId != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(NodeId); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(HeartbeatRequest other) { + if (other == null) { + return; + } + if (other.SessionId != 0UL) { + SessionId = other.SessionId; + } + if (other.NodeId != 0) { + NodeId = other.NodeId; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + SessionId = input.ReadUInt64(); + break; + } + case 16: { + NodeId = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + SessionId = input.ReadUInt64(); + break; + } + case 16: { + NodeId = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + public sealed partial class HeartbeatResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HeartbeatResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.ProtocolReflection.Descriptor.MessageTypes[14]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HeartbeatResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HeartbeatResponse(HeartbeatResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public HeartbeatResponse Clone() { + return new HeartbeatResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as HeartbeatResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(HeartbeatResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(HeartbeatResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + public sealed partial class ShutdownRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ShutdownRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.ProtocolReflection.Descriptor.MessageTypes[15]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ShutdownRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ShutdownRequest(ShutdownRequest other) : this() { + sessionId_ = other.sessionId_; + nodeId_ = other.nodeId_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ShutdownRequest Clone() { + return new ShutdownRequest(this); + } + + /// Field number for the "session_id" field. + public const int SessionIdFieldNumber = 1; + private ulong sessionId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ulong SessionId { + get { return sessionId_; } + set { + sessionId_ = value; + } + } + + /// Field number for the "node_id" field. + public const int NodeIdFieldNumber = 2; + private int nodeId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int NodeId { + get { return nodeId_; } + set { + nodeId_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ShutdownRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ShutdownRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (SessionId != other.SessionId) return false; + if (NodeId != other.NodeId) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (SessionId != 0UL) hash ^= SessionId.GetHashCode(); + if (NodeId != 0) hash ^= NodeId.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (SessionId != 0UL) { + output.WriteRawTag(8); + output.WriteUInt64(SessionId); + } + if (NodeId != 0) { + output.WriteRawTag(16); + output.WriteInt32(NodeId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (SessionId != 0UL) { + output.WriteRawTag(8); + output.WriteUInt64(SessionId); + } + if (NodeId != 0) { + output.WriteRawTag(16); + output.WriteInt32(NodeId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (SessionId != 0UL) { + size += 1 + pb::CodedOutputStream.ComputeUInt64Size(SessionId); + } + if (NodeId != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(NodeId); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ShutdownRequest other) { + if (other == null) { + return; + } + if (other.SessionId != 0UL) { + SessionId = other.SessionId; + } + if (other.NodeId != 0) { + NodeId = other.NodeId; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + SessionId = input.ReadUInt64(); + break; + } + case 16: { + NodeId = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + SessionId = input.ReadUInt64(); + break; + } + case 16: { + NodeId = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + public sealed partial class ShutdownResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ShutdownResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.ProtocolReflection.Descriptor.MessageTypes[16]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ShutdownResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ShutdownResponse(ShutdownResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ShutdownResponse Clone() { + return new ShutdownResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ShutdownResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ShutdownResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ShutdownResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/TensorFlowNET.Core/Protobuf/ResourceHandle.cs b/src/TensorFlowNET.Core/Protobuf/ResourceHandle.cs index 1ca38bee5..77e84cc53 100644 --- a/src/TensorFlowNET.Core/Protobuf/ResourceHandle.cs +++ b/src/TensorFlowNET.Core/Protobuf/ResourceHandle.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/resource_handle.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -53,23 +53,31 @@ static ResourceHandleReflection() { /// not valid across executions, but can be serialized back and forth from within /// a single run. /// - public sealed partial class ResourceHandleProto : pb::IMessage { + public sealed partial class ResourceHandleProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ResourceHandleProto()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ResourceHandleReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ResourceHandleProto() { OnConstruction(); } @@ -77,6 +85,7 @@ public ResourceHandleProto() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ResourceHandleProto(ResourceHandleProto other) : this() { device_ = other.device_; container_ = other.container_; @@ -88,6 +97,7 @@ public ResourceHandleProto(ResourceHandleProto other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ResourceHandleProto Clone() { return new ResourceHandleProto(this); } @@ -99,6 +109,7 @@ public ResourceHandleProto Clone() { /// Unique name for the device containing the resource. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Device { get { return device_; } set { @@ -113,6 +124,7 @@ public string Device { /// Container in which this resource is placed. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Container { get { return container_; } set { @@ -127,6 +139,7 @@ public string Container { /// Unique name of this resource. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -142,6 +155,7 @@ public string Name { /// and in the same execution. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ulong HashCode { get { return hashCode_; } set { @@ -157,6 +171,7 @@ public ulong HashCode { /// available. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string MaybeTypeName { get { return maybeTypeName_; } set { @@ -173,16 +188,19 @@ public string MaybeTypeName { /// Data types and shapes for the underlying resource. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField DtypesAndShapes { get { return dtypesAndShapes_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as ResourceHandleProto); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(ResourceHandleProto other) { if (ReferenceEquals(other, null)) { return false; @@ -200,6 +218,7 @@ public bool Equals(ResourceHandleProto other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Device.Length != 0) hash ^= Device.GetHashCode(); @@ -215,12 +234,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Device.Length != 0) { output.WriteRawTag(10); output.WriteString(Device); @@ -245,9 +269,42 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Device.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Device); + } + if (Container.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Container); + } + if (Name.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Name); + } + if (HashCode != 0UL) { + output.WriteRawTag(32); + output.WriteUInt64(HashCode); + } + if (MaybeTypeName.Length != 0) { + output.WriteRawTag(42); + output.WriteString(MaybeTypeName); + } + dtypesAndShapes_.WriteTo(ref output, _repeated_dtypesAndShapes_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Device.Length != 0) { @@ -273,6 +330,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(ResourceHandleProto other) { if (other == null) { return; @@ -297,7 +355,11 @@ public void MergeFrom(ResourceHandleProto other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -330,32 +392,81 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Device = input.ReadString(); + break; + } + case 18: { + Container = input.ReadString(); + break; + } + case 26: { + Name = input.ReadString(); + break; + } + case 32: { + HashCode = input.ReadUInt64(); + break; + } + case 42: { + MaybeTypeName = input.ReadString(); + break; + } + case 50: { + dtypesAndShapes_.AddEntriesFrom(ref input, _repeated_dtypesAndShapes_codec); + break; + } + } + } } + #endif #region Nested types /// Container for nested types declared in the ResourceHandleProto message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { /// /// Protocol buffer representing a pair of (data type, tensor shape). /// - public sealed partial class DtypeAndShape : pb::IMessage { + public sealed partial class DtypeAndShape : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DtypeAndShape()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.ResourceHandleProto.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DtypeAndShape() { OnConstruction(); } @@ -363,6 +474,7 @@ public DtypeAndShape() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DtypeAndShape(DtypeAndShape other) : this() { dtype_ = other.dtype_; shape_ = other.shape_ != null ? other.shape_.Clone() : null; @@ -370,6 +482,7 @@ public DtypeAndShape(DtypeAndShape other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DtypeAndShape Clone() { return new DtypeAndShape(this); } @@ -378,6 +491,7 @@ public DtypeAndShape Clone() { public const int DtypeFieldNumber = 1; private global::Tensorflow.DataType dtype_ = global::Tensorflow.DataType.DtInvalid; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.DataType Dtype { get { return dtype_; } set { @@ -389,6 +503,7 @@ public DtypeAndShape Clone() { public const int ShapeFieldNumber = 2; private global::Tensorflow.TensorShapeProto shape_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorShapeProto Shape { get { return shape_; } set { @@ -397,11 +512,13 @@ public DtypeAndShape Clone() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as DtypeAndShape); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(DtypeAndShape other) { if (ReferenceEquals(other, null)) { return false; @@ -415,6 +532,7 @@ public bool Equals(DtypeAndShape other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Dtype != global::Tensorflow.DataType.DtInvalid) hash ^= Dtype.GetHashCode(); @@ -426,12 +544,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Dtype != global::Tensorflow.DataType.DtInvalid) { output.WriteRawTag(8); output.WriteEnum((int) Dtype); @@ -443,9 +566,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Dtype != global::Tensorflow.DataType.DtInvalid) { + output.WriteRawTag(8); + output.WriteEnum((int) Dtype); + } + if (shape_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Shape); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Dtype != global::Tensorflow.DataType.DtInvalid) { @@ -461,6 +604,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(DtypeAndShape other) { if (other == null) { return; @@ -478,7 +622,11 @@ public void MergeFrom(DtypeAndShape other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -498,7 +646,34 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Dtype = (global::Tensorflow.DataType) input.ReadEnum(); + break; + } + case 18: { + if (shape_ == null) { + Shape = new global::Tensorflow.TensorShapeProto(); + } + input.ReadMessage(Shape); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/RewriterConfig.cs b/src/TensorFlowNET.Core/Protobuf/RewriterConfig.cs index 2804ca26d..eae000206 100644 --- a/src/TensorFlowNET.Core/Protobuf/RewriterConfig.cs +++ b/src/TensorFlowNET.Core/Protobuf/RewriterConfig.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/protobuf/rewriter_config.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -29,7 +29,7 @@ static RewriterConfigReflection() { "dHJfdmFsdWUucHJvdG8aLnRlbnNvcmZsb3cvY29yZS9wcm90b2J1Zi92ZXJp", "Zmllcl9jb25maWcucHJvdG8iOwoTQXV0b1BhcmFsbGVsT3B0aW9ucxIOCgZl", "bmFibGUYASABKAgSFAoMbnVtX3JlcGxpY2FzGAIgASgFIisKFlNjb3BlZEFs", - "bG9jYXRvck9wdGlvbnMSEQoJZW5hYmxlX29wGAEgAygJIuETCg5SZXdyaXRl", + "bG9jYXRvck9wdGlvbnMSEQoJZW5hYmxlX29wGAEgAygJIvYVCg5SZXdyaXRl", "ckNvbmZpZxJDChVjcHVfbGF5b3V0X2NvbnZlcnNpb24YMiABKA4yJC50ZW5z", "b3JmbG93LlJld3JpdGVyQ29uZmlnLkNwdUxheW91dBI7ChBsYXlvdXRfb3B0", "aW1pemVyGAEgASgOMiEudGVuc29yZmxvdy5SZXdyaXRlckNvbmZpZy5Ub2dn", @@ -54,71 +54,85 @@ static RewriterConfigReflection() { "LlRvZ2dsZRI/ChRhdXRvX21peGVkX3ByZWNpc2lvbhgXIAEoDjIhLnRlbnNv", "cmZsb3cuUmV3cml0ZXJDb25maWcuVG9nZ2xlEkMKGGF1dG9fbWl4ZWRfcHJl", "Y2lzaW9uX21rbBgZIAEoDjIhLnRlbnNvcmZsb3cuUmV3cml0ZXJDb25maWcu", - "VG9nZ2xlEh4KFmRpc2FibGVfbWV0YV9vcHRpbWl6ZXIYEyABKAgSQAoVdXNl", - "X3BsdWdpbl9vcHRpbWl6ZXJzGBwgASgOMiEudGVuc29yZmxvdy5SZXdyaXRl", - "ckNvbmZpZy5Ub2dnbGUSTwoZbWV0YV9vcHRpbWl6ZXJfaXRlcmF0aW9ucxgM", - "IAEoDjIsLnRlbnNvcmZsb3cuUmV3cml0ZXJDb25maWcuTnVtSXRlcmF0aW9u", - "c1R5cGUSFwoPbWluX2dyYXBoX25vZGVzGBEgASgFEjsKM2V4cGVyaW1lbnRh", - "bF9kaXNhYmxlX2NvbXByZXNzZWRfdGVuc29yX29wdGltaXphdGlvbhgaIAEo", - "CBI7CjNleHBlcmltZW50YWxfZGlzYWJsZV9mb2xkaW5nX3F1YW50aXphdGlv", - "bl9lbXVsYXRpb24YGyABKAgSQgoTbWVtb3J5X29wdGltaXphdGlvbhgEIAEo", - "DjIlLnRlbnNvcmZsb3cuUmV3cml0ZXJDb25maWcuTWVtT3B0VHlwZRIvCidt", - "ZW1vcnlfb3B0aW1pemVyX3RhcmdldF9ub2RlX25hbWVfc2NvcGUYBiABKAkS", - "IQoZbWV0YV9vcHRpbWl6ZXJfdGltZW91dF9tcxgUIAEoAxI2Cg1hdXRvX3Bh", - "cmFsbGVsGAUgASgLMh8udGVuc29yZmxvdy5BdXRvUGFyYWxsZWxPcHRpb25z", - "EiAKGGZhaWxfb25fb3B0aW1pemVyX2Vycm9ycxgVIAEoCBJBChVzY29wZWRf", - "YWxsb2NhdG9yX29wdHMYECABKAsyIi50ZW5zb3JmbG93LlNjb3BlZEFsbG9j", - "YXRvck9wdGlvbnMSEgoKb3B0aW1pemVycxhkIAMoCRJLChFjdXN0b21fb3B0", - "aW1pemVycxjIASADKAsyLy50ZW5zb3JmbG93LlJld3JpdGVyQ29uZmlnLkN1", - "c3RvbUdyYXBoT3B0aW1pemVyEkQKH2ludGVyX29wdGltaXplcl92ZXJpZmll", - "cl9jb25maWcYrAIgASgLMhoudGVuc29yZmxvdy5WZXJpZmllckNvbmZpZxJG", - "CiFwb3N0X29wdGltaXphdGlvbl92ZXJpZmllcl9jb25maWcYrQIgASgLMhou", - "dGVuc29yZmxvdy5WZXJpZmllckNvbmZpZxrKAQoUQ3VzdG9tR3JhcGhPcHRp", - "bWl6ZXISDAoEbmFtZRgBIAEoCRJYCg1wYXJhbWV0ZXJfbWFwGAIgAygLMkEu", - "dGVuc29yZmxvdy5SZXdyaXRlckNvbmZpZy5DdXN0b21HcmFwaE9wdGltaXpl", - "ci5QYXJhbWV0ZXJNYXBFbnRyeRpKChFQYXJhbWV0ZXJNYXBFbnRyeRILCgNr", - "ZXkYASABKAkSJAoFdmFsdWUYAiABKAsyFS50ZW5zb3JmbG93LkF0dHJWYWx1", - "ZToCOAEiNgoGVG9nZ2xlEgsKB0RFRkFVTFQQABIGCgJPThABEgcKA09GRhAC", - "Eg4KCkFHR1JFU1NJVkUQAyJJCglDcHVMYXlvdXQSGAoUTk9fQ09OVkVSU0lP", - "Tl9PTl9DUFUQABIQCgxOQ0hXX1RPX05IV0MQARIQCgxOSFdDX1RPX05DSFcQ", - "AiI8ChFOdW1JdGVyYXRpb25zVHlwZRIVChFERUZBVUxUX05VTV9JVEVSUxAA", - "EgcKA09ORRABEgcKA1RXTxACIp8BCgpNZW1PcHRUeXBlEhMKD0RFRkFVTFRf", - "TUVNX09QVBAAEg4KCk5PX01FTV9PUFQQARIKCgZNQU5VQUwQAhIXChNTV0FQ", - "UElOR19IRVVSSVNUSUNTEAQSHAoYUkVDT01QVVRBVElPTl9IRVVSSVNUSUNT", - "EAUSGQoVU0NIRURVTElOR19IRVVSSVNUSUNTEAYSDgoKSEVVUklTVElDUxAD", - "QowBChhvcmcudGVuc29yZmxvdy5mcmFtZXdvcmtCFFJld3JpdGVyQ29uZmln", - "UHJvdG9zUAFaVWdpdGh1Yi5jb20vdGVuc29yZmxvdy90ZW5zb3JmbG93L3Rl", - "bnNvcmZsb3cvZ28vY29yZS9wcm90b2J1Zi9mb3JfY29yZV9wcm90b3NfZ29f", - "cHJvdG/4AQFiBnByb3RvMw==")); + "VG9nZ2xlEk8KJGF1dG9fbWl4ZWRfcHJlY2lzaW9uX29uZWRubl9iZmxvYXQx", + "NhgfIAEoDjIhLnRlbnNvcmZsb3cuUmV3cml0ZXJDb25maWcuVG9nZ2xlEkMK", + "GGF1dG9fbWl4ZWRfcHJlY2lzaW9uX2NwdRgdIAEoDjIhLnRlbnNvcmZsb3cu", + "UmV3cml0ZXJDb25maWcuVG9nZ2xlEh4KFmRpc2FibGVfbWV0YV9vcHRpbWl6", + "ZXIYEyABKAgSQAoVdXNlX3BsdWdpbl9vcHRpbWl6ZXJzGBwgASgOMiEudGVu", + "c29yZmxvdy5SZXdyaXRlckNvbmZpZy5Ub2dnbGUSTwokZXhwZXJpbWVudGFs", + "X2NvbmRpdGlvbmFsX2NvZGVfbW90aW9uGB4gASgOMiEudGVuc29yZmxvdy5S", + "ZXdyaXRlckNvbmZpZy5Ub2dnbGUSTwoZbWV0YV9vcHRpbWl6ZXJfaXRlcmF0", + "aW9ucxgMIAEoDjIsLnRlbnNvcmZsb3cuUmV3cml0ZXJDb25maWcuTnVtSXRl", + "cmF0aW9uc1R5cGUSFwoPbWluX2dyYXBoX25vZGVzGBEgASgFEjsKM2V4cGVy", + "aW1lbnRhbF9kaXNhYmxlX2NvbXByZXNzZWRfdGVuc29yX29wdGltaXphdGlv", + "bhgaIAEoCBI7CjNleHBlcmltZW50YWxfZGlzYWJsZV9mb2xkaW5nX3F1YW50", + "aXphdGlvbl9lbXVsYXRpb24YGyABKAgSQgoTbWVtb3J5X29wdGltaXphdGlv", + "bhgEIAEoDjIlLnRlbnNvcmZsb3cuUmV3cml0ZXJDb25maWcuTWVtT3B0VHlw", + "ZRIvCidtZW1vcnlfb3B0aW1pemVyX3RhcmdldF9ub2RlX25hbWVfc2NvcGUY", + "BiABKAkSIQoZbWV0YV9vcHRpbWl6ZXJfdGltZW91dF9tcxgUIAEoAxI2Cg1h", + "dXRvX3BhcmFsbGVsGAUgASgLMh8udGVuc29yZmxvdy5BdXRvUGFyYWxsZWxP", + "cHRpb25zEiAKGGZhaWxfb25fb3B0aW1pemVyX2Vycm9ycxgVIAEoCBJBChVz", + "Y29wZWRfYWxsb2NhdG9yX29wdHMYECABKAsyIi50ZW5zb3JmbG93LlNjb3Bl", + "ZEFsbG9jYXRvck9wdGlvbnMSEgoKb3B0aW1pemVycxhkIAMoCRJLChFjdXN0", + "b21fb3B0aW1pemVycxjIASADKAsyLy50ZW5zb3JmbG93LlJld3JpdGVyQ29u", + "ZmlnLkN1c3RvbUdyYXBoT3B0aW1pemVyEkQKH2ludGVyX29wdGltaXplcl92", + "ZXJpZmllcl9jb25maWcYrAIgASgLMhoudGVuc29yZmxvdy5WZXJpZmllckNv", + "bmZpZxJGCiFwb3N0X29wdGltaXphdGlvbl92ZXJpZmllcl9jb25maWcYrQIg", + "ASgLMhoudGVuc29yZmxvdy5WZXJpZmllckNvbmZpZxrKAQoUQ3VzdG9tR3Jh", + "cGhPcHRpbWl6ZXISDAoEbmFtZRgBIAEoCRJYCg1wYXJhbWV0ZXJfbWFwGAIg", + "AygLMkEudGVuc29yZmxvdy5SZXdyaXRlckNvbmZpZy5DdXN0b21HcmFwaE9w", + "dGltaXplci5QYXJhbWV0ZXJNYXBFbnRyeRpKChFQYXJhbWV0ZXJNYXBFbnRy", + "eRILCgNrZXkYASABKAkSJAoFdmFsdWUYAiABKAsyFS50ZW5zb3JmbG93LkF0", + "dHJWYWx1ZToCOAEiZAoGVG9nZ2xlEgsKB0RFRkFVTFQQABIGCgJPThABEgcK", + "A09GRhACEg4KCkFHR1JFU1NJVkUQAxIVChFFWFBFUklNRU5UQUxfTUxJUhAE", + "EhUKEUVYUEVSSU1FTlRBTF9CT1RIEAUiSQoJQ3B1TGF5b3V0EhgKFE5PX0NP", + "TlZFUlNJT05fT05fQ1BVEAASEAoMTkNIV19UT19OSFdDEAESEAoMTkhXQ19U", + "T19OQ0hXEAIiPAoRTnVtSXRlcmF0aW9uc1R5cGUSFQoRREVGQVVMVF9OVU1f", + "SVRFUlMQABIHCgNPTkUQARIHCgNUV08QAiKfAQoKTWVtT3B0VHlwZRITCg9E", + "RUZBVUxUX01FTV9PUFQQABIOCgpOT19NRU1fT1BUEAESCgoGTUFOVUFMEAIS", + "FwoTU1dBUFBJTkdfSEVVUklTVElDUxAEEhwKGFJFQ09NUFVUQVRJT05fSEVV", + "UklTVElDUxAFEhkKFVNDSEVEVUxJTkdfSEVVUklTVElDUxAGEg4KCkhFVVJJ", + "U1RJQ1MQA0KMAQoYb3JnLnRlbnNvcmZsb3cuZnJhbWV3b3JrQhRSZXdyaXRl", + "ckNvbmZpZ1Byb3Rvc1ABWlVnaXRodWIuY29tL3RlbnNvcmZsb3cvdGVuc29y", + "Zmxvdy90ZW5zb3JmbG93L2dvL2NvcmUvcHJvdG9idWYvZm9yX2NvcmVfcHJv", + "dG9zX2dvX3Byb3Rv+AEBYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Tensorflow.AttrValueReflection.Descriptor, global::Tensorflow.VerifierConfigReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.AutoParallelOptions), global::Tensorflow.AutoParallelOptions.Parser, new[]{ "Enable", "NumReplicas" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.ScopedAllocatorOptions), global::Tensorflow.ScopedAllocatorOptions.Parser, new[]{ "EnableOp" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.RewriterConfig), global::Tensorflow.RewriterConfig.Parser, new[]{ "CpuLayoutConversion", "LayoutOptimizer", "ConstantFolding", "ShapeOptimization", "Remapping", "CommonSubgraphElimination", "ArithmeticOptimization", "DependencyOptimization", "LoopOptimization", "FunctionOptimization", "DebugStripper", "DisableModelPruning", "ScopedAllocatorOptimization", "PinToHostOptimization", "ImplementationSelector", "AutoMixedPrecision", "AutoMixedPrecisionMkl", "DisableMetaOptimizer", "UsePluginOptimizers", "MetaOptimizerIterations", "MinGraphNodes", "ExperimentalDisableCompressedTensorOptimization", "ExperimentalDisableFoldingQuantizationEmulation", "MemoryOptimization", "MemoryOptimizerTargetNodeNameScope", "MetaOptimizerTimeoutMs", "AutoParallel", "FailOnOptimizerErrors", "ScopedAllocatorOpts", "Optimizers", "CustomOptimizers", "InterOptimizerVerifierConfig", "PostOptimizationVerifierConfig" }, null, new[]{ typeof(global::Tensorflow.RewriterConfig.Types.Toggle), typeof(global::Tensorflow.RewriterConfig.Types.CpuLayout), typeof(global::Tensorflow.RewriterConfig.Types.NumIterationsType), typeof(global::Tensorflow.RewriterConfig.Types.MemOptType) }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.RewriterConfig.Types.CustomGraphOptimizer), global::Tensorflow.RewriterConfig.Types.CustomGraphOptimizer.Parser, new[]{ "Name", "ParameterMap" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, })}) + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.RewriterConfig), global::Tensorflow.RewriterConfig.Parser, new[]{ "CpuLayoutConversion", "LayoutOptimizer", "ConstantFolding", "ShapeOptimization", "Remapping", "CommonSubgraphElimination", "ArithmeticOptimization", "DependencyOptimization", "LoopOptimization", "FunctionOptimization", "DebugStripper", "DisableModelPruning", "ScopedAllocatorOptimization", "PinToHostOptimization", "ImplementationSelector", "AutoMixedPrecision", "AutoMixedPrecisionMkl", "AutoMixedPrecisionOnednnBfloat16", "AutoMixedPrecisionCpu", "DisableMetaOptimizer", "UsePluginOptimizers", "ExperimentalConditionalCodeMotion", "MetaOptimizerIterations", "MinGraphNodes", "ExperimentalDisableCompressedTensorOptimization", "ExperimentalDisableFoldingQuantizationEmulation", "MemoryOptimization", "MemoryOptimizerTargetNodeNameScope", "MetaOptimizerTimeoutMs", "AutoParallel", "FailOnOptimizerErrors", "ScopedAllocatorOpts", "Optimizers", "CustomOptimizers", "InterOptimizerVerifierConfig", "PostOptimizationVerifierConfig" }, null, new[]{ typeof(global::Tensorflow.RewriterConfig.Types.Toggle), typeof(global::Tensorflow.RewriterConfig.Types.CpuLayout), typeof(global::Tensorflow.RewriterConfig.Types.NumIterationsType), typeof(global::Tensorflow.RewriterConfig.Types.MemOptType) }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.RewriterConfig.Types.CustomGraphOptimizer), global::Tensorflow.RewriterConfig.Types.CustomGraphOptimizer.Parser, new[]{ "Name", "ParameterMap" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, })}) })); } #endregion } #region Messages - public sealed partial class AutoParallelOptions : pb::IMessage { + public sealed partial class AutoParallelOptions : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AutoParallelOptions()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.RewriterConfigReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AutoParallelOptions() { OnConstruction(); } @@ -126,6 +140,7 @@ public AutoParallelOptions() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AutoParallelOptions(AutoParallelOptions other) : this() { enable_ = other.enable_; numReplicas_ = other.numReplicas_; @@ -133,6 +148,7 @@ public AutoParallelOptions(AutoParallelOptions other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AutoParallelOptions Clone() { return new AutoParallelOptions(this); } @@ -141,6 +157,7 @@ public AutoParallelOptions Clone() { public const int EnableFieldNumber = 1; private bool enable_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Enable { get { return enable_; } set { @@ -152,6 +169,7 @@ public bool Enable { public const int NumReplicasFieldNumber = 2; private int numReplicas_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int NumReplicas { get { return numReplicas_; } set { @@ -160,11 +178,13 @@ public int NumReplicas { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as AutoParallelOptions); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(AutoParallelOptions other) { if (ReferenceEquals(other, null)) { return false; @@ -178,6 +198,7 @@ public bool Equals(AutoParallelOptions other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Enable != false) hash ^= Enable.GetHashCode(); @@ -189,12 +210,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Enable != false) { output.WriteRawTag(8); output.WriteBool(Enable); @@ -206,9 +232,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Enable != false) { + output.WriteRawTag(8); + output.WriteBool(Enable); + } + if (NumReplicas != 0) { + output.WriteRawTag(16); + output.WriteInt32(NumReplicas); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Enable != false) { @@ -224,6 +270,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(AutoParallelOptions other) { if (other == null) { return; @@ -238,7 +285,11 @@ public void MergeFrom(AutoParallelOptions other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -255,27 +306,59 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Enable = input.ReadBool(); + break; + } + case 16: { + NumReplicas = input.ReadInt32(); + break; + } + } + } + } + #endif + } - public sealed partial class ScopedAllocatorOptions : pb::IMessage { + public sealed partial class ScopedAllocatorOptions : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ScopedAllocatorOptions()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.RewriterConfigReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ScopedAllocatorOptions() { OnConstruction(); } @@ -283,12 +366,14 @@ public ScopedAllocatorOptions() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ScopedAllocatorOptions(ScopedAllocatorOptions other) : this() { enableOp_ = other.enableOp_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ScopedAllocatorOptions Clone() { return new ScopedAllocatorOptions(this); } @@ -302,16 +387,19 @@ public ScopedAllocatorOptions Clone() { /// If present, only perform optimization for these ops. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField EnableOp { get { return enableOp_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as ScopedAllocatorOptions); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(ScopedAllocatorOptions other) { if (ReferenceEquals(other, null)) { return false; @@ -324,6 +412,7 @@ public bool Equals(ScopedAllocatorOptions other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= enableOp_.GetHashCode(); @@ -334,19 +423,37 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else enableOp_.WriteTo(output, _repeated_enableOp_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + enableOp_.WriteTo(ref output, _repeated_enableOp_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += enableOp_.CalculateSize(_repeated_enableOp_codec); @@ -357,6 +464,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(ScopedAllocatorOptions other) { if (other == null) { return; @@ -366,7 +474,11 @@ public void MergeFrom(ScopedAllocatorOptions other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -379,31 +491,59 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + enableOp_.AddEntriesFrom(ref input, _repeated_enableOp_codec); + break; + } + } + } + } + #endif + } /// /// Graph rewriting is experimental and subject to change, not covered by any /// API stability guarantees. /// - public sealed partial class RewriterConfig : pb::IMessage { + public sealed partial class RewriterConfig : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RewriterConfig()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.RewriterConfigReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public RewriterConfig() { OnConstruction(); } @@ -411,6 +551,7 @@ public RewriterConfig() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public RewriterConfig(RewriterConfig other) : this() { cpuLayoutConversion_ = other.cpuLayoutConversion_; layoutOptimizer_ = other.layoutOptimizer_; @@ -429,8 +570,11 @@ public RewriterConfig(RewriterConfig other) : this() { implementationSelector_ = other.implementationSelector_; autoMixedPrecision_ = other.autoMixedPrecision_; autoMixedPrecisionMkl_ = other.autoMixedPrecisionMkl_; + autoMixedPrecisionOnednnBfloat16_ = other.autoMixedPrecisionOnednnBfloat16_; + autoMixedPrecisionCpu_ = other.autoMixedPrecisionCpu_; disableMetaOptimizer_ = other.disableMetaOptimizer_; usePluginOptimizers_ = other.usePluginOptimizers_; + experimentalConditionalCodeMotion_ = other.experimentalConditionalCodeMotion_; metaOptimizerIterations_ = other.metaOptimizerIterations_; minGraphNodes_ = other.minGraphNodes_; experimentalDisableCompressedTensorOptimization_ = other.experimentalDisableCompressedTensorOptimization_; @@ -449,6 +593,7 @@ public RewriterConfig(RewriterConfig other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public RewriterConfig Clone() { return new RewriterConfig(this); } @@ -460,6 +605,7 @@ public RewriterConfig Clone() { /// CPU Conversion settings between NHCW and NCHW. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RewriterConfig.Types.CpuLayout CpuLayoutConversion { get { return cpuLayoutConversion_; } set { @@ -475,6 +621,7 @@ public RewriterConfig Clone() { /// e.g. This will try to use NCHW layout on GPU which is faster. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RewriterConfig.Types.Toggle LayoutOptimizer { get { return layoutOptimizer_; } set { @@ -491,6 +638,7 @@ public RewriterConfig Clone() { /// result using constants. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RewriterConfig.Types.Toggle ConstantFolding { get { return constantFolding_; } set { @@ -506,6 +654,7 @@ public RewriterConfig Clone() { /// Simplify computations made on shapes. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RewriterConfig.Types.Toggle ShapeOptimization { get { return shapeOptimization_; } set { @@ -521,6 +670,7 @@ public RewriterConfig Clone() { /// Remap subgraphs onto more efficient implementations. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RewriterConfig.Types.Toggle Remapping { get { return remapping_; } set { @@ -536,6 +686,7 @@ public RewriterConfig Clone() { /// e.g. Simplify arithmetic ops; merge ops with same value (like constants). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RewriterConfig.Types.Toggle CommonSubgraphElimination { get { return commonSubgraphElimination_; } set { @@ -551,6 +702,7 @@ public RewriterConfig Clone() { /// e.g. Simplify arithmetic ops; merge ops with same value (like constants). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RewriterConfig.Types.Toggle ArithmeticOptimization { get { return arithmeticOptimization_; } set { @@ -566,6 +718,7 @@ public RewriterConfig Clone() { /// Remove redundant control dependencies, which may enable other optimization. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RewriterConfig.Types.Toggle DependencyOptimization { get { return dependencyOptimization_; } set { @@ -580,6 +733,7 @@ public RewriterConfig Clone() { /// Loop optimizations (default is ON). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RewriterConfig.Types.Toggle LoopOptimization { get { return loopOptimization_; } set { @@ -594,6 +748,7 @@ public RewriterConfig Clone() { /// Function optimizations (default is ON). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RewriterConfig.Types.Toggle FunctionOptimization { get { return functionOptimization_; } set { @@ -608,6 +763,7 @@ public RewriterConfig Clone() { /// Strips debug-related nodes from the graph (off by default). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RewriterConfig.Types.Toggle DebugStripper { get { return debugStripper_; } set { @@ -622,6 +778,7 @@ public RewriterConfig Clone() { /// If true, don't remove unnecessary ops from the graph /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool DisableModelPruning { get { return disableModelPruning_; } set { @@ -637,6 +794,7 @@ public bool DisableModelPruning { /// merge or eliminate downstream Ops (off by default). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RewriterConfig.Types.Toggle ScopedAllocatorOptimization { get { return scopedAllocatorOptimization_; } set { @@ -651,6 +809,7 @@ public bool DisableModelPruning { /// Force small ops onto the CPU (default is OFF). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RewriterConfig.Types.Toggle PinToHostOptimization { get { return pinToHostOptimization_; } set { @@ -666,6 +825,7 @@ public bool DisableModelPruning { /// (default is ON). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RewriterConfig.Types.Toggle ImplementationSelector { get { return implementationSelector_; } set { @@ -683,6 +843,7 @@ public bool DisableModelPruning { /// require the use of loss scaling to maintain model convergence. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RewriterConfig.Types.Toggle AutoMixedPrecision { get { return autoMixedPrecision_; } set { @@ -694,11 +855,14 @@ public bool DisableModelPruning { public const int AutoMixedPrecisionMklFieldNumber = 25; private global::Tensorflow.RewriterConfig.Types.Toggle autoMixedPrecisionMkl_ = global::Tensorflow.RewriterConfig.Types.Toggle.Default; /// - /// Optimize data types for MKL (default is OFF). + /// Optimize data types for oneDNN (default is OFF). /// This will try to use bfloat16 on CPUs, which is faster. /// Note that this can change the numerical stability of the graph. + /// Note: this is deprecated. + /// It is replaced by auto_mixed_precision_onednn_bfloat16 /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RewriterConfig.Types.Toggle AutoMixedPrecisionMkl { get { return autoMixedPrecisionMkl_; } set { @@ -706,6 +870,43 @@ public bool DisableModelPruning { } } + /// Field number for the "auto_mixed_precision_onednn_bfloat16" field. + public const int AutoMixedPrecisionOnednnBfloat16FieldNumber = 31; + private global::Tensorflow.RewriterConfig.Types.Toggle autoMixedPrecisionOnednnBfloat16_ = global::Tensorflow.RewriterConfig.Types.Toggle.Default; + /// + /// Optimize data types for oneDNN (default is OFF). + /// This will try to use bfloat16 on CPUs, which is faster. + /// Note that this can change the numerical stability of the graph. + /// Note: this is equivalent to the deprecated option auto_mixed_precision_mkl + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.RewriterConfig.Types.Toggle AutoMixedPrecisionOnednnBfloat16 { + get { return autoMixedPrecisionOnednnBfloat16_; } + set { + autoMixedPrecisionOnednnBfloat16_ = value; + } + } + + /// Field number for the "auto_mixed_precision_cpu" field. + public const int AutoMixedPrecisionCpuFieldNumber = 29; + private global::Tensorflow.RewriterConfig.Types.Toggle autoMixedPrecisionCpu_ = global::Tensorflow.RewriterConfig.Types.Toggle.Default; + /// + /// Emulate a model using data type float16 on CPU (default is OFF). + /// This will try to emulate the float16 inputs and outputs of an operator + /// on CPU to have better correlation with float16 on GPU; however the + /// computation in the operator is based on float32. + /// Note that this can change the numerical stability of the graph. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.RewriterConfig.Types.Toggle AutoMixedPrecisionCpu { + get { return autoMixedPrecisionCpu_; } + set { + autoMixedPrecisionCpu_ = value; + } + } + /// Field number for the "disable_meta_optimizer" field. public const int DisableMetaOptimizerFieldNumber = 19; private bool disableMetaOptimizer_; @@ -713,6 +914,7 @@ public bool DisableModelPruning { /// Disable the entire meta optimizer (off by default). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool DisableMetaOptimizer { get { return disableMetaOptimizer_; } set { @@ -727,6 +929,7 @@ public bool DisableMetaOptimizer { /// Optimizers registered by plugin (default is ON) /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RewriterConfig.Types.Toggle UsePluginOptimizers { get { return usePluginOptimizers_; } set { @@ -734,6 +937,21 @@ public bool DisableMetaOptimizer { } } + /// Field number for the "experimental_conditional_code_motion" field. + public const int ExperimentalConditionalCodeMotionFieldNumber = 30; + private global::Tensorflow.RewriterConfig.Types.Toggle experimentalConditionalCodeMotion_ = global::Tensorflow.RewriterConfig.Types.Toggle.Default; + /// + /// Conditional code motion (default is ON). + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.RewriterConfig.Types.Toggle ExperimentalConditionalCodeMotion { + get { return experimentalConditionalCodeMotion_; } + set { + experimentalConditionalCodeMotion_ = value; + } + } + /// Field number for the "meta_optimizer_iterations" field. public const int MetaOptimizerIterationsFieldNumber = 12; private global::Tensorflow.RewriterConfig.Types.NumIterationsType metaOptimizerIterations_ = global::Tensorflow.RewriterConfig.Types.NumIterationsType.DefaultNumIters; @@ -742,6 +960,7 @@ public bool DisableMetaOptimizer { /// is once). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RewriterConfig.Types.NumIterationsType MetaOptimizerIterations { get { return metaOptimizerIterations_; } set { @@ -759,6 +978,7 @@ public bool DisableMetaOptimizer { /// < 0 means do not skip optimization. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int MinGraphNodes { get { return minGraphNodes_; } set { @@ -774,6 +994,7 @@ public int MinGraphNodes { /// is experimental and may be removed in the future. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool ExperimentalDisableCompressedTensorOptimization { get { return experimentalDisableCompressedTensorOptimization_; } set { @@ -793,6 +1014,7 @@ public bool ExperimentalDisableCompressedTensorOptimization { /// details. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool ExperimentalDisableFoldingQuantizationEmulation { get { return experimentalDisableFoldingQuantizationEmulation_; } set { @@ -809,6 +1031,7 @@ public bool ExperimentalDisableFoldingQuantizationEmulation { /// field. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.RewriterConfig.Types.MemOptType MemoryOptimization { get { return memoryOptimization_; } set { @@ -830,6 +1053,7 @@ public bool ExperimentalDisableFoldingQuantizationEmulation { /// "foo/gradients/bar", but not "foo_gradients/" /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string MemoryOptimizerTargetNodeNameScope { get { return memoryOptimizerTargetNodeNameScope_; } set { @@ -846,6 +1070,7 @@ public string MemoryOptimizerTargetNodeNameScope { /// never time out. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long MetaOptimizerTimeoutMs { get { return metaOptimizerTimeoutMs_; } set { @@ -861,6 +1086,7 @@ public long MetaOptimizerTimeoutMs { /// meta-optimizer or when manually specified through the optimizers field. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.AutoParallelOptions AutoParallel { get { return autoParallel_; } set { @@ -877,6 +1103,7 @@ public long MetaOptimizerTimeoutMs { /// skipped silently. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool FailOnOptimizerErrors { get { return failOnOptimizerErrors_; } set { @@ -888,6 +1115,7 @@ public bool FailOnOptimizerErrors { public const int ScopedAllocatorOptsFieldNumber = 16; private global::Tensorflow.ScopedAllocatorOptions scopedAllocatorOpts_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.ScopedAllocatorOptions ScopedAllocatorOpts { get { return scopedAllocatorOpts_; } set { @@ -915,6 +1143,7 @@ public bool FailOnOptimizerErrors { /// schedule will be run after - in the order that they were specified. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Optimizers { get { return optimizers_; } } @@ -928,6 +1157,7 @@ public bool FailOnOptimizerErrors { /// list of CustomGraphOptimizers to apply. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField CustomOptimizers { get { return customOptimizers_; } } @@ -939,6 +1169,7 @@ public bool FailOnOptimizerErrors { /// VerifierConfig specifying the verifiers to be run after every optimizer. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.VerifierConfig InterOptimizerVerifierConfig { get { return interOptimizerVerifierConfig_; } set { @@ -954,6 +1185,7 @@ public bool FailOnOptimizerErrors { /// optimizers have run. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.VerifierConfig PostOptimizationVerifierConfig { get { return postOptimizationVerifierConfig_; } set { @@ -962,11 +1194,13 @@ public bool FailOnOptimizerErrors { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as RewriterConfig); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(RewriterConfig other) { if (ReferenceEquals(other, null)) { return false; @@ -991,8 +1225,11 @@ public bool Equals(RewriterConfig other) { if (ImplementationSelector != other.ImplementationSelector) return false; if (AutoMixedPrecision != other.AutoMixedPrecision) return false; if (AutoMixedPrecisionMkl != other.AutoMixedPrecisionMkl) return false; + if (AutoMixedPrecisionOnednnBfloat16 != other.AutoMixedPrecisionOnednnBfloat16) return false; + if (AutoMixedPrecisionCpu != other.AutoMixedPrecisionCpu) return false; if (DisableMetaOptimizer != other.DisableMetaOptimizer) return false; if (UsePluginOptimizers != other.UsePluginOptimizers) return false; + if (ExperimentalConditionalCodeMotion != other.ExperimentalConditionalCodeMotion) return false; if (MetaOptimizerIterations != other.MetaOptimizerIterations) return false; if (MinGraphNodes != other.MinGraphNodes) return false; if (ExperimentalDisableCompressedTensorOptimization != other.ExperimentalDisableCompressedTensorOptimization) return false; @@ -1011,6 +1248,7 @@ public bool Equals(RewriterConfig other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (CpuLayoutConversion != global::Tensorflow.RewriterConfig.Types.CpuLayout.NoConversionOnCpu) hash ^= CpuLayoutConversion.GetHashCode(); @@ -1030,8 +1268,11 @@ public override int GetHashCode() { if (ImplementationSelector != global::Tensorflow.RewriterConfig.Types.Toggle.Default) hash ^= ImplementationSelector.GetHashCode(); if (AutoMixedPrecision != global::Tensorflow.RewriterConfig.Types.Toggle.Default) hash ^= AutoMixedPrecision.GetHashCode(); if (AutoMixedPrecisionMkl != global::Tensorflow.RewriterConfig.Types.Toggle.Default) hash ^= AutoMixedPrecisionMkl.GetHashCode(); + if (AutoMixedPrecisionOnednnBfloat16 != global::Tensorflow.RewriterConfig.Types.Toggle.Default) hash ^= AutoMixedPrecisionOnednnBfloat16.GetHashCode(); + if (AutoMixedPrecisionCpu != global::Tensorflow.RewriterConfig.Types.Toggle.Default) hash ^= AutoMixedPrecisionCpu.GetHashCode(); if (DisableMetaOptimizer != false) hash ^= DisableMetaOptimizer.GetHashCode(); if (UsePluginOptimizers != global::Tensorflow.RewriterConfig.Types.Toggle.Default) hash ^= UsePluginOptimizers.GetHashCode(); + if (ExperimentalConditionalCodeMotion != global::Tensorflow.RewriterConfig.Types.Toggle.Default) hash ^= ExperimentalConditionalCodeMotion.GetHashCode(); if (MetaOptimizerIterations != global::Tensorflow.RewriterConfig.Types.NumIterationsType.DefaultNumIters) hash ^= MetaOptimizerIterations.GetHashCode(); if (MinGraphNodes != 0) hash ^= MinGraphNodes.GetHashCode(); if (ExperimentalDisableCompressedTensorOptimization != false) hash ^= ExperimentalDisableCompressedTensorOptimization.GetHashCode(); @@ -1053,12 +1294,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (LayoutOptimizer != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { output.WriteRawTag(8); output.WriteEnum((int) LayoutOptimizer); @@ -1171,6 +1417,18 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(224, 1); output.WriteEnum((int) UsePluginOptimizers); } + if (AutoMixedPrecisionCpu != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(232, 1); + output.WriteEnum((int) AutoMixedPrecisionCpu); + } + if (ExperimentalConditionalCodeMotion != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(240, 1); + output.WriteEnum((int) ExperimentalConditionalCodeMotion); + } + if (AutoMixedPrecisionOnednnBfloat16 != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(248, 1); + output.WriteEnum((int) AutoMixedPrecisionOnednnBfloat16); + } if (CpuLayoutConversion != global::Tensorflow.RewriterConfig.Types.CpuLayout.NoConversionOnCpu) { output.WriteRawTag(144, 3); output.WriteEnum((int) CpuLayoutConversion); @@ -1188,9 +1446,159 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (LayoutOptimizer != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(8); + output.WriteEnum((int) LayoutOptimizer); + } + if (DisableModelPruning != false) { + output.WriteRawTag(16); + output.WriteBool(DisableModelPruning); + } + if (ConstantFolding != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(24); + output.WriteEnum((int) ConstantFolding); + } + if (MemoryOptimization != global::Tensorflow.RewriterConfig.Types.MemOptType.DefaultMemOpt) { + output.WriteRawTag(32); + output.WriteEnum((int) MemoryOptimization); + } + if (autoParallel_ != null) { + output.WriteRawTag(42); + output.WriteMessage(AutoParallel); + } + if (MemoryOptimizerTargetNodeNameScope.Length != 0) { + output.WriteRawTag(50); + output.WriteString(MemoryOptimizerTargetNodeNameScope); + } + if (ArithmeticOptimization != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(56); + output.WriteEnum((int) ArithmeticOptimization); + } + if (DependencyOptimization != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(64); + output.WriteEnum((int) DependencyOptimization); + } + if (LoopOptimization != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(72); + output.WriteEnum((int) LoopOptimization); + } + if (FunctionOptimization != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(80); + output.WriteEnum((int) FunctionOptimization); + } + if (DebugStripper != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(88); + output.WriteEnum((int) DebugStripper); + } + if (MetaOptimizerIterations != global::Tensorflow.RewriterConfig.Types.NumIterationsType.DefaultNumIters) { + output.WriteRawTag(96); + output.WriteEnum((int) MetaOptimizerIterations); + } + if (ShapeOptimization != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(104); + output.WriteEnum((int) ShapeOptimization); + } + if (Remapping != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(112); + output.WriteEnum((int) Remapping); + } + if (ScopedAllocatorOptimization != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(120); + output.WriteEnum((int) ScopedAllocatorOptimization); + } + if (scopedAllocatorOpts_ != null) { + output.WriteRawTag(130, 1); + output.WriteMessage(ScopedAllocatorOpts); + } + if (MinGraphNodes != 0) { + output.WriteRawTag(136, 1); + output.WriteInt32(MinGraphNodes); + } + if (PinToHostOptimization != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(144, 1); + output.WriteEnum((int) PinToHostOptimization); + } + if (DisableMetaOptimizer != false) { + output.WriteRawTag(152, 1); + output.WriteBool(DisableMetaOptimizer); + } + if (MetaOptimizerTimeoutMs != 0L) { + output.WriteRawTag(160, 1); + output.WriteInt64(MetaOptimizerTimeoutMs); + } + if (FailOnOptimizerErrors != false) { + output.WriteRawTag(168, 1); + output.WriteBool(FailOnOptimizerErrors); + } + if (ImplementationSelector != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(176, 1); + output.WriteEnum((int) ImplementationSelector); + } + if (AutoMixedPrecision != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(184, 1); + output.WriteEnum((int) AutoMixedPrecision); + } + if (CommonSubgraphElimination != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(192, 1); + output.WriteEnum((int) CommonSubgraphElimination); + } + if (AutoMixedPrecisionMkl != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(200, 1); + output.WriteEnum((int) AutoMixedPrecisionMkl); + } + if (ExperimentalDisableCompressedTensorOptimization != false) { + output.WriteRawTag(208, 1); + output.WriteBool(ExperimentalDisableCompressedTensorOptimization); + } + if (ExperimentalDisableFoldingQuantizationEmulation != false) { + output.WriteRawTag(216, 1); + output.WriteBool(ExperimentalDisableFoldingQuantizationEmulation); + } + if (UsePluginOptimizers != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(224, 1); + output.WriteEnum((int) UsePluginOptimizers); + } + if (AutoMixedPrecisionCpu != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(232, 1); + output.WriteEnum((int) AutoMixedPrecisionCpu); + } + if (ExperimentalConditionalCodeMotion != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(240, 1); + output.WriteEnum((int) ExperimentalConditionalCodeMotion); + } + if (AutoMixedPrecisionOnednnBfloat16 != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + output.WriteRawTag(248, 1); + output.WriteEnum((int) AutoMixedPrecisionOnednnBfloat16); + } + if (CpuLayoutConversion != global::Tensorflow.RewriterConfig.Types.CpuLayout.NoConversionOnCpu) { + output.WriteRawTag(144, 3); + output.WriteEnum((int) CpuLayoutConversion); + } + optimizers_.WriteTo(ref output, _repeated_optimizers_codec); + customOptimizers_.WriteTo(ref output, _repeated_customOptimizers_codec); + if (interOptimizerVerifierConfig_ != null) { + output.WriteRawTag(226, 18); + output.WriteMessage(InterOptimizerVerifierConfig); + } + if (postOptimizationVerifierConfig_ != null) { + output.WriteRawTag(234, 18); + output.WriteMessage(PostOptimizationVerifierConfig); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (CpuLayoutConversion != global::Tensorflow.RewriterConfig.Types.CpuLayout.NoConversionOnCpu) { @@ -1244,12 +1652,21 @@ public int CalculateSize() { if (AutoMixedPrecisionMkl != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) AutoMixedPrecisionMkl); } + if (AutoMixedPrecisionOnednnBfloat16 != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) AutoMixedPrecisionOnednnBfloat16); + } + if (AutoMixedPrecisionCpu != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) AutoMixedPrecisionCpu); + } if (DisableMetaOptimizer != false) { size += 2 + 1; } if (UsePluginOptimizers != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) UsePluginOptimizers); } + if (ExperimentalConditionalCodeMotion != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) ExperimentalConditionalCodeMotion); + } if (MetaOptimizerIterations != global::Tensorflow.RewriterConfig.Types.NumIterationsType.DefaultNumIters) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) MetaOptimizerIterations); } @@ -1295,6 +1712,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(RewriterConfig other) { if (other == null) { return; @@ -1350,12 +1768,21 @@ public void MergeFrom(RewriterConfig other) { if (other.AutoMixedPrecisionMkl != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { AutoMixedPrecisionMkl = other.AutoMixedPrecisionMkl; } + if (other.AutoMixedPrecisionOnednnBfloat16 != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + AutoMixedPrecisionOnednnBfloat16 = other.AutoMixedPrecisionOnednnBfloat16; + } + if (other.AutoMixedPrecisionCpu != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + AutoMixedPrecisionCpu = other.AutoMixedPrecisionCpu; + } if (other.DisableMetaOptimizer != false) { DisableMetaOptimizer = other.DisableMetaOptimizer; } if (other.UsePluginOptimizers != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { UsePluginOptimizers = other.UsePluginOptimizers; } + if (other.ExperimentalConditionalCodeMotion != global::Tensorflow.RewriterConfig.Types.Toggle.Default) { + ExperimentalConditionalCodeMotion = other.ExperimentalConditionalCodeMotion; + } if (other.MetaOptimizerIterations != global::Tensorflow.RewriterConfig.Types.NumIterationsType.DefaultNumIters) { MetaOptimizerIterations = other.MetaOptimizerIterations; } @@ -1410,7 +1837,11 @@ public void MergeFrom(RewriterConfig other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1535,6 +1966,18 @@ public void MergeFrom(pb::CodedInputStream input) { UsePluginOptimizers = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); break; } + case 232: { + AutoMixedPrecisionCpu = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } + case 240: { + ExperimentalConditionalCodeMotion = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } + case 248: { + AutoMixedPrecisionOnednnBfloat16 = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } case 400: { CpuLayoutConversion = (global::Tensorflow.RewriterConfig.Types.CpuLayout) input.ReadEnum(); break; @@ -1563,11 +2006,184 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + LayoutOptimizer = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } + case 16: { + DisableModelPruning = input.ReadBool(); + break; + } + case 24: { + ConstantFolding = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } + case 32: { + MemoryOptimization = (global::Tensorflow.RewriterConfig.Types.MemOptType) input.ReadEnum(); + break; + } + case 42: { + if (autoParallel_ == null) { + AutoParallel = new global::Tensorflow.AutoParallelOptions(); + } + input.ReadMessage(AutoParallel); + break; + } + case 50: { + MemoryOptimizerTargetNodeNameScope = input.ReadString(); + break; + } + case 56: { + ArithmeticOptimization = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } + case 64: { + DependencyOptimization = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } + case 72: { + LoopOptimization = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } + case 80: { + FunctionOptimization = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } + case 88: { + DebugStripper = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } + case 96: { + MetaOptimizerIterations = (global::Tensorflow.RewriterConfig.Types.NumIterationsType) input.ReadEnum(); + break; + } + case 104: { + ShapeOptimization = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } + case 112: { + Remapping = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } + case 120: { + ScopedAllocatorOptimization = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } + case 130: { + if (scopedAllocatorOpts_ == null) { + ScopedAllocatorOpts = new global::Tensorflow.ScopedAllocatorOptions(); + } + input.ReadMessage(ScopedAllocatorOpts); + break; + } + case 136: { + MinGraphNodes = input.ReadInt32(); + break; + } + case 144: { + PinToHostOptimization = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } + case 152: { + DisableMetaOptimizer = input.ReadBool(); + break; + } + case 160: { + MetaOptimizerTimeoutMs = input.ReadInt64(); + break; + } + case 168: { + FailOnOptimizerErrors = input.ReadBool(); + break; + } + case 176: { + ImplementationSelector = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } + case 184: { + AutoMixedPrecision = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } + case 192: { + CommonSubgraphElimination = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } + case 200: { + AutoMixedPrecisionMkl = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } + case 208: { + ExperimentalDisableCompressedTensorOptimization = input.ReadBool(); + break; + } + case 216: { + ExperimentalDisableFoldingQuantizationEmulation = input.ReadBool(); + break; + } + case 224: { + UsePluginOptimizers = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } + case 232: { + AutoMixedPrecisionCpu = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } + case 240: { + ExperimentalConditionalCodeMotion = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } + case 248: { + AutoMixedPrecisionOnednnBfloat16 = (global::Tensorflow.RewriterConfig.Types.Toggle) input.ReadEnum(); + break; + } + case 400: { + CpuLayoutConversion = (global::Tensorflow.RewriterConfig.Types.CpuLayout) input.ReadEnum(); + break; + } + case 802: { + optimizers_.AddEntriesFrom(ref input, _repeated_optimizers_codec); + break; + } + case 1602: { + customOptimizers_.AddEntriesFrom(ref input, _repeated_customOptimizers_codec); + break; + } + case 2402: { + if (interOptimizerVerifierConfig_ == null) { + InterOptimizerVerifierConfig = new global::Tensorflow.VerifierConfig(); + } + input.ReadMessage(InterOptimizerVerifierConfig); + break; + } + case 2410: { + if (postOptimizationVerifierConfig_ == null) { + PostOptimizationVerifierConfig = new global::Tensorflow.VerifierConfig(); + } + input.ReadMessage(PostOptimizationVerifierConfig); + break; + } + } + } } + #endif #region Nested types /// Container for nested types declared in the RewriterConfig message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { public enum Toggle { [pbr::OriginalName("DEFAULT")] Default = 0, @@ -1579,6 +2195,17 @@ public enum Toggle { /// actual feed. /// [pbr::OriginalName("AGGRESSIVE")] Aggressive = 3, + /// + /// Run MLIR pass if there's one implemented in TFG, do nothing otherwise. + /// I.e., if there's no corresponding TFG pass, it's an OFF. This is supposed + /// to be mapped with `ON` and there's no `AGGRESSIVE` in MLIR pass now. + /// + [pbr::OriginalName("EXPERIMENTAL_MLIR")] ExperimentalMlir = 4, + /// + /// Run both MLIR and Grappler passes consecutively and MLIR pass will come + /// first. + /// + [pbr::OriginalName("EXPERIMENTAL_BOTH")] ExperimentalBoth = 5, } /// @@ -1637,23 +2264,31 @@ public enum MemOptType { /// /// Message to describe custom graph optimizer and its parameters /// - public sealed partial class CustomGraphOptimizer : pb::IMessage { + public sealed partial class CustomGraphOptimizer : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomGraphOptimizer()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.RewriterConfig.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CustomGraphOptimizer() { OnConstruction(); } @@ -1661,6 +2296,7 @@ public CustomGraphOptimizer() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CustomGraphOptimizer(CustomGraphOptimizer other) : this() { name_ = other.name_; parameterMap_ = other.parameterMap_.Clone(); @@ -1668,6 +2304,7 @@ public CustomGraphOptimizer(CustomGraphOptimizer other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CustomGraphOptimizer Clone() { return new CustomGraphOptimizer(this); } @@ -1676,6 +2313,7 @@ public CustomGraphOptimizer Clone() { public const int NameFieldNumber = 1; private string name_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -1689,16 +2327,19 @@ public string Name { = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Tensorflow.AttrValue.Parser), 18); private readonly pbc::MapField parameterMap_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField ParameterMap { get { return parameterMap_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as CustomGraphOptimizer); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(CustomGraphOptimizer other) { if (ReferenceEquals(other, null)) { return false; @@ -1712,6 +2353,7 @@ public bool Equals(CustomGraphOptimizer other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -1723,12 +2365,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -1737,9 +2384,26 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + parameterMap_.WriteTo(ref output, _map_parameterMap_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -1753,6 +2417,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(CustomGraphOptimizer other) { if (other == null) { return; @@ -1765,7 +2430,11 @@ public void MergeFrom(CustomGraphOptimizer other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1782,7 +2451,31 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + parameterMap_.AddEntriesFrom(ref input, _map_parameterMap_codec); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/SavedModel.cs b/src/TensorFlowNET.Core/Protobuf/SavedModel.cs index a42481b4d..67cea4889 100644 --- a/src/TensorFlowNET.Core/Protobuf/SavedModel.cs +++ b/src/TensorFlowNET.Core/Protobuf/SavedModel.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/protobuf/saved_model.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -46,23 +46,31 @@ static SavedModelReflection() { /// SavedModel is the high level serialization format for TensorFlow Models. /// See [todo: doc links, similar to session_bundle] for more information. /// - public sealed partial class SavedModel : pb::IMessage { + public sealed partial class SavedModel : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SavedModel()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.SavedModelReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedModel() { OnConstruction(); } @@ -70,6 +78,7 @@ public SavedModel() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedModel(SavedModel other) : this() { savedModelSchemaVersion_ = other.savedModelSchemaVersion_; metaGraphs_ = other.metaGraphs_.Clone(); @@ -77,6 +86,7 @@ public SavedModel(SavedModel other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedModel Clone() { return new SavedModel(this); } @@ -90,6 +100,7 @@ public SavedModel Clone() { /// at release will be 1. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long SavedModelSchemaVersion { get { return savedModelSchemaVersion_; } set { @@ -106,16 +117,19 @@ public long SavedModelSchemaVersion { /// One or more MetaGraphs. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField MetaGraphs { get { return metaGraphs_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as SavedModel); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(SavedModel other) { if (ReferenceEquals(other, null)) { return false; @@ -129,6 +143,7 @@ public bool Equals(SavedModel other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (SavedModelSchemaVersion != 0L) hash ^= SavedModelSchemaVersion.GetHashCode(); @@ -140,12 +155,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (SavedModelSchemaVersion != 0L) { output.WriteRawTag(8); output.WriteInt64(SavedModelSchemaVersion); @@ -154,9 +174,26 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (SavedModelSchemaVersion != 0L) { + output.WriteRawTag(8); + output.WriteInt64(SavedModelSchemaVersion); + } + metaGraphs_.WriteTo(ref output, _repeated_metaGraphs_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (SavedModelSchemaVersion != 0L) { @@ -170,6 +207,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(SavedModel other) { if (other == null) { return; @@ -182,7 +220,11 @@ public void MergeFrom(SavedModel other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -199,7 +241,31 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + SavedModelSchemaVersion = input.ReadInt64(); + break; + } + case 18: { + metaGraphs_.AddEntriesFrom(ref input, _repeated_metaGraphs_codec); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/SavedObjectGraph.cs b/src/TensorFlowNET.Core/Protobuf/SavedObjectGraph.cs index f2597574b..df7019ad4 100644 --- a/src/TensorFlowNET.Core/Protobuf/SavedObjectGraph.cs +++ b/src/TensorFlowNET.Core/Protobuf/SavedObjectGraph.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/protobuf/saved_object_graph.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -25,73 +25,78 @@ static SavedObjectGraphReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CjF0ZW5zb3JmbG93L2NvcmUvcHJvdG9idWYvc2F2ZWRfb2JqZWN0X2dyYXBo", - "LnByb3RvEgp0ZW5zb3JmbG93Gix0ZW5zb3JmbG93L2NvcmUvZnJhbWV3b3Jr", - "L3RlbnNvcl9zaGFwZS5wcm90bxoldGVuc29yZmxvdy9jb3JlL2ZyYW1ld29y", - "ay90eXBlcy5wcm90bxoodGVuc29yZmxvdy9jb3JlL2ZyYW1ld29yay92YXJp", - "YWJsZS5wcm90bxoodGVuc29yZmxvdy9jb3JlL2ZyYW1ld29yay92ZXJzaW9u", - "cy5wcm90bxoldGVuc29yZmxvdy9jb3JlL3Byb3RvYnVmL3N0cnVjdC5wcm90", - "bxo1dGVuc29yZmxvdy9jb3JlL3Byb3RvYnVmL3RyYWNrYWJsZV9vYmplY3Rf", - "Z3JhcGgucHJvdG8i6AEKEFNhdmVkT2JqZWN0R3JhcGgSJgoFbm9kZXMYASAD", - "KAsyFy50ZW5zb3JmbG93LlNhdmVkT2JqZWN0Ek8KEmNvbmNyZXRlX2Z1bmN0", - "aW9ucxgCIAMoCzIzLnRlbnNvcmZsb3cuU2F2ZWRPYmplY3RHcmFwaC5Db25j", - "cmV0ZUZ1bmN0aW9uc0VudHJ5GlsKFkNvbmNyZXRlRnVuY3Rpb25zRW50cnkS", - "CwoDa2V5GAEgASgJEjAKBXZhbHVlGAIgASgLMiEudGVuc29yZmxvdy5TYXZl", - "ZENvbmNyZXRlRnVuY3Rpb246AjgBIpAGCgtTYXZlZE9iamVjdBJSCghjaGls", - "ZHJlbhgBIAMoCzJALnRlbnNvcmZsb3cuVHJhY2thYmxlT2JqZWN0R3JhcGgu", - "VHJhY2thYmxlT2JqZWN0Lk9iamVjdFJlZmVyZW5jZRJeCg5zbG90X3Zhcmlh", - "YmxlcxgDIAMoCzJGLnRlbnNvcmZsb3cuVHJhY2thYmxlT2JqZWN0R3JhcGgu", - "VHJhY2thYmxlT2JqZWN0LlNsb3RWYXJpYWJsZVJlZmVyZW5jZRIyCgt1c2Vy", - "X29iamVjdBgEIAEoCzIbLnRlbnNvcmZsb3cuU2F2ZWRVc2VyT2JqZWN0SAAS", - "JwoFYXNzZXQYBSABKAsyFi50ZW5zb3JmbG93LlNhdmVkQXNzZXRIABItCghm", - "dW5jdGlvbhgGIAEoCzIZLnRlbnNvcmZsb3cuU2F2ZWRGdW5jdGlvbkgAEi0K", - "CHZhcmlhYmxlGAcgASgLMhkudGVuc29yZmxvdy5TYXZlZFZhcmlhYmxlSAAS", - "RwoWYmFyZV9jb25jcmV0ZV9mdW5jdGlvbhgIIAEoCzIlLnRlbnNvcmZsb3cu", - "U2F2ZWRCYXJlQ29uY3JldGVGdW5jdGlvbkgAEi0KCGNvbnN0YW50GAkgASgL", - "MhkudGVuc29yZmxvdy5TYXZlZENvbnN0YW50SAASLQoIcmVzb3VyY2UYCiAB", - "KAsyGS50ZW5zb3JmbG93LlNhdmVkUmVzb3VyY2VIABI1Cg9jYXB0dXJlZF90", - "ZW5zb3IYDCABKAsyGi50ZW5zb3JmbG93LkNhcHR1cmVkVGVuc29ySAASRgoQ", - "c2F2ZWFibGVfb2JqZWN0cxgLIAMoCzIsLnRlbnNvcmZsb3cuU2F2ZWRPYmpl", - "Y3QuU2F2ZWFibGVPYmplY3RzRW50cnkaUgoUU2F2ZWFibGVPYmplY3RzRW50", - "cnkSCwoDa2V5GAEgASgJEikKBXZhbHVlGAIgASgLMhoudGVuc29yZmxvdy5T", - "YXZlYWJsZU9iamVjdDoCOAFCBgoEa2luZEoECAIQA1IKYXR0cmlidXRlcyJk", - "Cg9TYXZlZFVzZXJPYmplY3QSEgoKaWRlbnRpZmllchgBIAEoCRInCgd2ZXJz", - "aW9uGAIgASgLMhYudGVuc29yZmxvdy5WZXJzaW9uRGVmEhQKCG1ldGFkYXRh", - "GAMgASgJQgIYASIqCgpTYXZlZEFzc2V0EhwKFGFzc2V0X2ZpbGVfZGVmX2lu", - "ZGV4GAEgASgFIlwKDVNhdmVkRnVuY3Rpb24SGgoSY29uY3JldGVfZnVuY3Rp", - "b25zGAEgAygJEi8KDWZ1bmN0aW9uX3NwZWMYAiABKAsyGC50ZW5zb3JmbG93", - "LkZ1bmN0aW9uU3BlYyI5Cg5DYXB0dXJlZFRlbnNvchIMCgRuYW1lGAEgASgJ", - "EhkKEWNvbmNyZXRlX2Z1bmN0aW9uGAIgASgJIqgBChVTYXZlZENvbmNyZXRl", - "RnVuY3Rpb24SFAoMYm91bmRfaW5wdXRzGAIgAygFEkIKHWNhbm9uaWNhbGl6", - "ZWRfaW5wdXRfc2lnbmF0dXJlGAMgASgLMhsudGVuc29yZmxvdy5TdHJ1Y3R1", - "cmVkVmFsdWUSNQoQb3V0cHV0X3NpZ25hdHVyZRgEIAEoCzIbLnRlbnNvcmZs", - "b3cuU3RydWN0dXJlZFZhbHVlIq0BChlTYXZlZEJhcmVDb25jcmV0ZUZ1bmN0", - "aW9uEh4KFmNvbmNyZXRlX2Z1bmN0aW9uX25hbWUYASABKAkSGQoRYXJndW1l", - "bnRfa2V5d29yZHMYAiADKAkSJAocYWxsb3dlZF9wb3NpdGlvbmFsX2FyZ3Vt", - "ZW50cxgDIAEoAxIvCg1mdW5jdGlvbl9zcGVjGAQgASgLMhgudGVuc29yZmxv", - "dy5GdW5jdGlvblNwZWMiIgoNU2F2ZWRDb25zdGFudBIRCglvcGVyYXRpb24Y", - "ASABKAki1wIKDVNhdmVkVmFyaWFibGUSIwoFZHR5cGUYASABKA4yFC50ZW5z", - "b3JmbG93LkRhdGFUeXBlEisKBXNoYXBlGAIgASgLMhwudGVuc29yZmxvdy5U", - "ZW5zb3JTaGFwZVByb3RvEhEKCXRyYWluYWJsZRgDIAEoCBI8Cg9zeW5jaHJv", - "bml6YXRpb24YBCABKA4yIy50ZW5zb3JmbG93LlZhcmlhYmxlU3luY2hyb25p", - "emF0aW9uEjQKC2FnZ3JlZ2F0aW9uGAUgASgOMh8udGVuc29yZmxvdy5WYXJp", - "YWJsZUFnZ3JlZ2F0aW9uEgwKBG5hbWUYBiABKAkSDgoGZGV2aWNlGAcgASgJ", - "Ek8KLGV4cGVyaW1lbnRhbF9kaXN0cmlidXRlZF92YXJpYWJsZV9jb21wb25l", - "bnRzGAggAygLMhkudGVuc29yZmxvdy5TYXZlZFZhcmlhYmxlIvsBCgxGdW5j", - "dGlvblNwZWMSMAoLZnVsbGFyZ3NwZWMYASABKAsyGy50ZW5zb3JmbG93LlN0", - "cnVjdHVyZWRWYWx1ZRIRCglpc19tZXRob2QYAiABKAgSNAoPaW5wdXRfc2ln", - "bmF0dXJlGAUgASgLMhsudGVuc29yZmxvdy5TdHJ1Y3R1cmVkVmFsdWUSOAoL", - "aml0X2NvbXBpbGUYBiABKA4yIy50ZW5zb3JmbG93LkZ1bmN0aW9uU3BlYy5K", - "aXRDb21waWxlIioKCkppdENvbXBpbGUSCwoHREVGQVVMVBAAEgYKAk9OEAES", - "BwoDT0ZGEAJKBAgDEARKBAgEEAUiHwoNU2F2ZWRSZXNvdXJjZRIOCgZkZXZp", - "Y2UYASABKAkiQQoOU2F2ZWFibGVPYmplY3QSFQoNc2F2ZV9mdW5jdGlvbhgC", - "IAEoBRIYChByZXN0b3JlX2Z1bmN0aW9uGAMgASgFQlpaVWdpdGh1Yi5jb20v", - "dGVuc29yZmxvdy90ZW5zb3JmbG93L3RlbnNvcmZsb3cvZ28vY29yZS9wcm90", - "b2J1Zi9mb3JfY29yZV9wcm90b3NfZ29fcHJvdG/4AQFiBnByb3RvMw==")); + "LnByb3RvEgp0ZW5zb3JmbG93Ghlnb29nbGUvcHJvdG9idWYvYW55LnByb3Rv", + "Gix0ZW5zb3JmbG93L2NvcmUvZnJhbWV3b3JrL3RlbnNvcl9zaGFwZS5wcm90", + "bxoldGVuc29yZmxvdy9jb3JlL2ZyYW1ld29yay90eXBlcy5wcm90bxoodGVu", + "c29yZmxvdy9jb3JlL2ZyYW1ld29yay92YXJpYWJsZS5wcm90bxoodGVuc29y", + "Zmxvdy9jb3JlL2ZyYW1ld29yay92ZXJzaW9ucy5wcm90bxoldGVuc29yZmxv", + "dy9jb3JlL3Byb3RvYnVmL3N0cnVjdC5wcm90bxo1dGVuc29yZmxvdy9jb3Jl", + "L3Byb3RvYnVmL3RyYWNrYWJsZV9vYmplY3RfZ3JhcGgucHJvdG8i6AEKEFNh", + "dmVkT2JqZWN0R3JhcGgSJgoFbm9kZXMYASADKAsyFy50ZW5zb3JmbG93LlNh", + "dmVkT2JqZWN0Ek8KEmNvbmNyZXRlX2Z1bmN0aW9ucxgCIAMoCzIzLnRlbnNv", + "cmZsb3cuU2F2ZWRPYmplY3RHcmFwaC5Db25jcmV0ZUZ1bmN0aW9uc0VudHJ5", + "GlsKFkNvbmNyZXRlRnVuY3Rpb25zRW50cnkSCwoDa2V5GAEgASgJEjAKBXZh", + "bHVlGAIgASgLMiEudGVuc29yZmxvdy5TYXZlZENvbmNyZXRlRnVuY3Rpb246", + "AjgBItAHCgtTYXZlZE9iamVjdBJSCghjaGlsZHJlbhgBIAMoCzJALnRlbnNv", + "cmZsb3cuVHJhY2thYmxlT2JqZWN0R3JhcGguVHJhY2thYmxlT2JqZWN0Lk9i", + "amVjdFJlZmVyZW5jZRJWCgxkZXBlbmRlbmNpZXMYDyADKAsyQC50ZW5zb3Jm", + "bG93LlRyYWNrYWJsZU9iamVjdEdyYXBoLlRyYWNrYWJsZU9iamVjdC5PYmpl", + "Y3RSZWZlcmVuY2USXgoOc2xvdF92YXJpYWJsZXMYAyADKAsyRi50ZW5zb3Jm", + "bG93LlRyYWNrYWJsZU9iamVjdEdyYXBoLlRyYWNrYWJsZU9iamVjdC5TbG90", + "VmFyaWFibGVSZWZlcmVuY2USMgoLdXNlcl9vYmplY3QYBCABKAsyGy50ZW5z", + "b3JmbG93LlNhdmVkVXNlck9iamVjdEgAEicKBWFzc2V0GAUgASgLMhYudGVu", + "c29yZmxvdy5TYXZlZEFzc2V0SAASLQoIZnVuY3Rpb24YBiABKAsyGS50ZW5z", + "b3JmbG93LlNhdmVkRnVuY3Rpb25IABItCgh2YXJpYWJsZRgHIAEoCzIZLnRl", + "bnNvcmZsb3cuU2F2ZWRWYXJpYWJsZUgAEkcKFmJhcmVfY29uY3JldGVfZnVu", + "Y3Rpb24YCCABKAsyJS50ZW5zb3JmbG93LlNhdmVkQmFyZUNvbmNyZXRlRnVu", + "Y3Rpb25IABItCghjb25zdGFudBgJIAEoCzIZLnRlbnNvcmZsb3cuU2F2ZWRD", + "b25zdGFudEgAEi0KCHJlc291cmNlGAogASgLMhkudGVuc29yZmxvdy5TYXZl", + "ZFJlc291cmNlSAASNQoPY2FwdHVyZWRfdGVuc29yGAwgASgLMhoudGVuc29y", + "Zmxvdy5DYXB0dXJlZFRlbnNvckgAEkYKEHNhdmVhYmxlX29iamVjdHMYCyAD", + "KAsyLC50ZW5zb3JmbG93LlNhdmVkT2JqZWN0LlNhdmVhYmxlT2JqZWN0c0Vu", + "dHJ5EhcKD3JlZ2lzdGVyZWRfbmFtZRgNIAEoCRIzChVzZXJpYWxpemVkX3Vz", + "ZXJfcHJvdG8YDiABKAsyFC5nb29nbGUucHJvdG9idWYuQW55EhgKEHJlZ2lz", + "dGVyZWRfc2F2ZXIYECABKAkaUgoUU2F2ZWFibGVPYmplY3RzRW50cnkSCwoD", + "a2V5GAEgASgJEikKBXZhbHVlGAIgASgLMhoudGVuc29yZmxvdy5TYXZlYWJs", + "ZU9iamVjdDoCOAFCBgoEa2luZEoECAIQA1IKYXR0cmlidXRlcyJkCg9TYXZl", + "ZFVzZXJPYmplY3QSEgoKaWRlbnRpZmllchgBIAEoCRInCgd2ZXJzaW9uGAIg", + "ASgLMhYudGVuc29yZmxvdy5WZXJzaW9uRGVmEhQKCG1ldGFkYXRhGAMgASgJ", + "QgIYASIqCgpTYXZlZEFzc2V0EhwKFGFzc2V0X2ZpbGVfZGVmX2luZGV4GAEg", + "ASgFIlwKDVNhdmVkRnVuY3Rpb24SGgoSY29uY3JldGVfZnVuY3Rpb25zGAEg", + "AygJEi8KDWZ1bmN0aW9uX3NwZWMYAiABKAsyGC50ZW5zb3JmbG93LkZ1bmN0", + "aW9uU3BlYyI5Cg5DYXB0dXJlZFRlbnNvchIMCgRuYW1lGAEgASgJEhkKEWNv", + "bmNyZXRlX2Z1bmN0aW9uGAIgASgJIqgBChVTYXZlZENvbmNyZXRlRnVuY3Rp", + "b24SFAoMYm91bmRfaW5wdXRzGAIgAygFEkIKHWNhbm9uaWNhbGl6ZWRfaW5w", + "dXRfc2lnbmF0dXJlGAMgASgLMhsudGVuc29yZmxvdy5TdHJ1Y3R1cmVkVmFs", + "dWUSNQoQb3V0cHV0X3NpZ25hdHVyZRgEIAEoCzIbLnRlbnNvcmZsb3cuU3Ry", + "dWN0dXJlZFZhbHVlIq0BChlTYXZlZEJhcmVDb25jcmV0ZUZ1bmN0aW9uEh4K", + "FmNvbmNyZXRlX2Z1bmN0aW9uX25hbWUYASABKAkSGQoRYXJndW1lbnRfa2V5", + "d29yZHMYAiADKAkSJAocYWxsb3dlZF9wb3NpdGlvbmFsX2FyZ3VtZW50cxgD", + "IAEoAxIvCg1mdW5jdGlvbl9zcGVjGAQgASgLMhgudGVuc29yZmxvdy5GdW5j", + "dGlvblNwZWMiIgoNU2F2ZWRDb25zdGFudBIRCglvcGVyYXRpb24YASABKAki", + "1wIKDVNhdmVkVmFyaWFibGUSIwoFZHR5cGUYASABKA4yFC50ZW5zb3JmbG93", + "LkRhdGFUeXBlEisKBXNoYXBlGAIgASgLMhwudGVuc29yZmxvdy5UZW5zb3JT", + "aGFwZVByb3RvEhEKCXRyYWluYWJsZRgDIAEoCBI8Cg9zeW5jaHJvbml6YXRp", + "b24YBCABKA4yIy50ZW5zb3JmbG93LlZhcmlhYmxlU3luY2hyb25pemF0aW9u", + "EjQKC2FnZ3JlZ2F0aW9uGAUgASgOMh8udGVuc29yZmxvdy5WYXJpYWJsZUFn", + "Z3JlZ2F0aW9uEgwKBG5hbWUYBiABKAkSDgoGZGV2aWNlGAcgASgJEk8KLGV4", + "cGVyaW1lbnRhbF9kaXN0cmlidXRlZF92YXJpYWJsZV9jb21wb25lbnRzGAgg", + "AygLMhkudGVuc29yZmxvdy5TYXZlZFZhcmlhYmxlIvsBCgxGdW5jdGlvblNw", + "ZWMSMAoLZnVsbGFyZ3NwZWMYASABKAsyGy50ZW5zb3JmbG93LlN0cnVjdHVy", + "ZWRWYWx1ZRIRCglpc19tZXRob2QYAiABKAgSNAoPaW5wdXRfc2lnbmF0dXJl", + "GAUgASgLMhsudGVuc29yZmxvdy5TdHJ1Y3R1cmVkVmFsdWUSOAoLaml0X2Nv", + "bXBpbGUYBiABKA4yIy50ZW5zb3JmbG93LkZ1bmN0aW9uU3BlYy5KaXRDb21w", + "aWxlIioKCkppdENvbXBpbGUSCwoHREVGQVVMVBAAEgYKAk9OEAESBwoDT0ZG", + "EAJKBAgDEARKBAgEEAUiHwoNU2F2ZWRSZXNvdXJjZRIOCgZkZXZpY2UYASAB", + "KAkiQQoOU2F2ZWFibGVPYmplY3QSFQoNc2F2ZV9mdW5jdGlvbhgCIAEoBRIY", + "ChByZXN0b3JlX2Z1bmN0aW9uGAMgASgFQlpaVWdpdGh1Yi5jb20vdGVuc29y", + "Zmxvdy90ZW5zb3JmbG93L3RlbnNvcmZsb3cvZ28vY29yZS9wcm90b2J1Zi9m", + "b3JfY29yZV9wcm90b3NfZ29fcHJvdG/4AQFiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Tensorflow.TensorShapeReflection.Descriptor, global::Tensorflow.TypesReflection.Descriptor, global::Tensorflow.VariableReflection.Descriptor, global::Tensorflow.VersionsReflection.Descriptor, global::Tensorflow.StructReflection.Descriptor, global::Tensorflow.TrackableObjectGraphReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor, global::Tensorflow.TensorShapeReflection.Descriptor, global::Tensorflow.TypesReflection.Descriptor, global::Tensorflow.VariableReflection.Descriptor, global::Tensorflow.VersionsReflection.Descriptor, global::Tensorflow.StructReflection.Descriptor, global::Tensorflow.TrackableObjectGraphReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.SavedObjectGraph), global::Tensorflow.SavedObjectGraph.Parser, new[]{ "Nodes", "ConcreteFunctions" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.SavedObject), global::Tensorflow.SavedObject.Parser, new[]{ "Children", "SlotVariables", "UserObject", "Asset", "Function", "Variable", "BareConcreteFunction", "Constant", "Resource", "CapturedTensor", "SaveableObjects" }, new[]{ "Kind" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.SavedObject), global::Tensorflow.SavedObject.Parser, new[]{ "Children", "Dependencies", "SlotVariables", "UserObject", "Asset", "Function", "Variable", "BareConcreteFunction", "Constant", "Resource", "CapturedTensor", "SaveableObjects", "RegisteredName", "SerializedUserProto", "RegisteredSaver" }, new[]{ "Kind" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.SavedUserObject), global::Tensorflow.SavedUserObject.Parser, new[]{ "Identifier", "Version", "Metadata" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.SavedAsset), global::Tensorflow.SavedAsset.Parser, new[]{ "AssetFileDefIndex" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.SavedFunction), global::Tensorflow.SavedFunction.Parser, new[]{ "ConcreteFunctions", "FunctionSpec" }, null, null, null, null), @@ -109,23 +114,31 @@ static SavedObjectGraphReflection() { } #region Messages - public sealed partial class SavedObjectGraph : pb::IMessage { + public sealed partial class SavedObjectGraph : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SavedObjectGraph()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.SavedObjectGraphReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedObjectGraph() { OnConstruction(); } @@ -133,6 +146,7 @@ public SavedObjectGraph() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedObjectGraph(SavedObjectGraph other) : this() { nodes_ = other.nodes_.Clone(); concreteFunctions_ = other.concreteFunctions_.Clone(); @@ -140,6 +154,7 @@ public SavedObjectGraph(SavedObjectGraph other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedObjectGraph Clone() { return new SavedObjectGraph(this); } @@ -156,7 +171,8 @@ public SavedObjectGraph Clone() { /// Nodes[0] is considered the root node. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Nodes { + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Nodes { get { return nodes_; } } @@ -170,16 +186,19 @@ public SavedObjectGraph Clone() { /// Referenced from SavedBareConcreteFunction and SavedFunction. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField ConcreteFunctions { get { return concreteFunctions_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as SavedObjectGraph); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(SavedObjectGraph other) { if (ReferenceEquals(other, null)) { return false; @@ -193,6 +212,7 @@ public bool Equals(SavedObjectGraph other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= nodes_.GetHashCode(); @@ -204,20 +224,39 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else nodes_.WriteTo(output, _repeated_nodes_codec); concreteFunctions_.WriteTo(output, _map_concreteFunctions_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + nodes_.WriteTo(ref output, _repeated_nodes_codec); + concreteFunctions_.WriteTo(ref output, _map_concreteFunctions_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += nodes_.CalculateSize(_repeated_nodes_codec); @@ -229,6 +268,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(SavedObjectGraph other) { if (other == null) { return; @@ -239,7 +279,11 @@ public void MergeFrom(SavedObjectGraph other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -256,27 +300,59 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + nodes_.AddEntriesFrom(ref input, _repeated_nodes_codec); + break; + } + case 18: { + concreteFunctions_.AddEntriesFrom(ref input, _map_concreteFunctions_codec); + break; + } + } + } } + #endif } - public sealed partial class SavedObject : pb::IMessage { + public sealed partial class SavedObject : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SavedObject()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.SavedObjectGraphReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedObject() { OnConstruction(); } @@ -284,11 +360,15 @@ public SavedObject() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedObject(SavedObject other) : this() { children_ = other.children_.Clone(); dependencies_ = other.dependencies_.Clone(); slotVariables_ = other.slotVariables_.Clone(); saveableObjects_ = other.saveableObjects_.Clone(); + registeredName_ = other.registeredName_; + serializedUserProto_ = other.serializedUserProto_ != null ? other.serializedUserProto_.Clone() : null; + registeredSaver_ = other.registeredSaver_; switch (other.KindCase) { case KindOneofCase.UserObject: UserObject = other.UserObject.Clone(); @@ -320,6 +400,7 @@ public SavedObject(SavedObject other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedObject Clone() { return new SavedObject(this); } @@ -329,19 +410,31 @@ public SavedObject Clone() { private static readonly pb::FieldCodec _repeated_children_codec = pb::FieldCodec.ForMessage(10, global::Tensorflow.TrackableObjectGraph.Types.TrackableObject.Types.ObjectReference.Parser); private readonly pbc::RepeatedField children_ = new pbc::RepeatedField(); - private readonly pbc::RepeatedField dependencies_ = new pbc::RepeatedField(); /// /// Objects which this object depends on: named edges in the dependency /// graph. /// - /// Note: currently only valid if kind == "user_object" or "resource". + /// Note: All kinds of SavedObject may have children, except + /// "constant" and "captured_tensor". /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Children { get { return children_; } } - + + /// Field number for the "dependencies" field. + public const int DependenciesFieldNumber = 15; + private static readonly pb::FieldCodec _repeated_dependencies_codec + = pb::FieldCodec.ForMessage(122, global::Tensorflow.TrackableObjectGraph.Types.TrackableObject.Types.ObjectReference.Parser); + private readonly pbc::RepeatedField dependencies_ = new pbc::RepeatedField(); + /// + /// Ordered list of dependencies that must be loaded before this object. + /// SavedModel loads with the bottom-up approach, by first creating all objects + /// (in the order defined by the dependencies), then connecting the edges. + /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Dependencies { get { return dependencies_; } } @@ -359,6 +452,7 @@ public SavedObject Clone() { /// Note: currently only valid if kind == "user_object". /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField SlotVariables { get { return slotVariables_; } } @@ -366,6 +460,7 @@ public SavedObject Clone() { /// Field number for the "user_object" field. public const int UserObjectFieldNumber = 4; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.SavedUserObject UserObject { get { return kindCase_ == KindOneofCase.UserObject ? (global::Tensorflow.SavedUserObject) kind_ : null; } set { @@ -377,6 +472,7 @@ public SavedObject Clone() { /// Field number for the "asset" field. public const int AssetFieldNumber = 5; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.SavedAsset Asset { get { return kindCase_ == KindOneofCase.Asset ? (global::Tensorflow.SavedAsset) kind_ : null; } set { @@ -388,6 +484,7 @@ public SavedObject Clone() { /// Field number for the "function" field. public const int FunctionFieldNumber = 6; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.SavedFunction Function { get { return kindCase_ == KindOneofCase.Function ? (global::Tensorflow.SavedFunction) kind_ : null; } set { @@ -399,6 +496,7 @@ public SavedObject Clone() { /// Field number for the "variable" field. public const int VariableFieldNumber = 7; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.SavedVariable Variable { get { return kindCase_ == KindOneofCase.Variable ? (global::Tensorflow.SavedVariable) kind_ : null; } set { @@ -410,6 +508,7 @@ public SavedObject Clone() { /// Field number for the "bare_concrete_function" field. public const int BareConcreteFunctionFieldNumber = 8; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.SavedBareConcreteFunction BareConcreteFunction { get { return kindCase_ == KindOneofCase.BareConcreteFunction ? (global::Tensorflow.SavedBareConcreteFunction) kind_ : null; } set { @@ -421,6 +520,7 @@ public SavedObject Clone() { /// Field number for the "constant" field. public const int ConstantFieldNumber = 9; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.SavedConstant Constant { get { return kindCase_ == KindOneofCase.Constant ? (global::Tensorflow.SavedConstant) kind_ : null; } set { @@ -432,6 +532,7 @@ public SavedObject Clone() { /// Field number for the "resource" field. public const int ResourceFieldNumber = 10; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.SavedResource Resource { get { return kindCase_ == KindOneofCase.Resource ? (global::Tensorflow.SavedResource) kind_ : null; } set { @@ -443,6 +544,7 @@ public SavedObject Clone() { /// Field number for the "captured_tensor" field. public const int CapturedTensorFieldNumber = 12; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.CapturedTensor CapturedTensor { get { return kindCase_ == KindOneofCase.CapturedTensor ? (global::Tensorflow.CapturedTensor) kind_ : null; } set { @@ -456,11 +558,67 @@ public SavedObject Clone() { private static readonly pbc::MapField.Codec _map_saveableObjects_codec = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Tensorflow.SaveableObject.Parser), 90); private readonly pbc::MapField saveableObjects_ = new pbc::MapField(); + /// + /// Stores the functions used to save and restore this object. At most one of + /// `saveable_objects` or `registered_saver` is defined for each SavedObject. + /// See the comment below for the difference between SaveableObject and + /// registered savers. + /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField SaveableObjects { get { return saveableObjects_; } } + /// Field number for the "registered_name" field. + public const int RegisteredNameFieldNumber = 13; + private string registeredName_ = ""; + /// + /// The name of the registered class of the form "{package}.{class_name}". + /// This field is used to search for the registered class at loading time. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string RegisteredName { + get { return registeredName_; } + set { + registeredName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "serialized_user_proto" field. + public const int SerializedUserProtoFieldNumber = 14; + private global::Google.Protobuf.WellKnownTypes.Any serializedUserProto_; + /// + /// The user-generated proto storing metadata for this object, to be passed to + /// the registered classes's _deserialize_from_proto method when this object is + /// loaded from the SavedModel. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Google.Protobuf.WellKnownTypes.Any SerializedUserProto { + get { return serializedUserProto_; } + set { + serializedUserProto_ = value; + } + } + + /// Field number for the "registered_saver" field. + public const int RegisteredSaverFieldNumber = 16; + private string registeredSaver_ = ""; + /// + /// String name of the registered saver. At most one of `saveable_objects` or + /// `registered_saver` is defined for each SavedObject. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string RegisteredSaver { + get { return registeredSaver_; } + set { + registeredSaver_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + private object kind_; /// Enum of possible cases for the "kind" oneof. public enum KindOneofCase { @@ -476,22 +634,26 @@ public enum KindOneofCase { } private KindOneofCase kindCase_ = KindOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public KindOneofCase KindCase { get { return kindCase_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void ClearKind() { kindCase_ = KindOneofCase.None; kind_ = null; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as SavedObject); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(SavedObject other) { if (ReferenceEquals(other, null)) { return false; @@ -500,6 +662,7 @@ public bool Equals(SavedObject other) { return true; } if(!children_.Equals(other.children_)) return false; + if(!dependencies_.Equals(other.dependencies_)) return false; if(!slotVariables_.Equals(other.slotVariables_)) return false; if (!object.Equals(UserObject, other.UserObject)) return false; if (!object.Equals(Asset, other.Asset)) return false; @@ -510,14 +673,19 @@ public bool Equals(SavedObject other) { if (!object.Equals(Resource, other.Resource)) return false; if (!object.Equals(CapturedTensor, other.CapturedTensor)) return false; if (!SaveableObjects.Equals(other.SaveableObjects)) return false; + if (RegisteredName != other.RegisteredName) return false; + if (!object.Equals(SerializedUserProto, other.SerializedUserProto)) return false; + if (RegisteredSaver != other.RegisteredSaver) return false; if (KindCase != other.KindCase) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= children_.GetHashCode(); + hash ^= dependencies_.GetHashCode(); hash ^= slotVariables_.GetHashCode(); if (kindCase_ == KindOneofCase.UserObject) hash ^= UserObject.GetHashCode(); if (kindCase_ == KindOneofCase.Asset) hash ^= Asset.GetHashCode(); @@ -528,6 +696,9 @@ public override int GetHashCode() { if (kindCase_ == KindOneofCase.Resource) hash ^= Resource.GetHashCode(); if (kindCase_ == KindOneofCase.CapturedTensor) hash ^= CapturedTensor.GetHashCode(); hash ^= SaveableObjects.GetHashCode(); + if (RegisteredName.Length != 0) hash ^= RegisteredName.GetHashCode(); + if (serializedUserProto_ != null) hash ^= SerializedUserProto.GetHashCode(); + if (RegisteredSaver.Length != 0) hash ^= RegisteredSaver.GetHashCode(); hash ^= (int) kindCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -536,12 +707,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else children_.WriteTo(output, _repeated_children_codec); slotVariables_.WriteTo(output, _repeated_slotVariables_codec); if (kindCase_ == KindOneofCase.UserObject) { @@ -577,15 +753,89 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(98); output.WriteMessage(CapturedTensor); } + if (RegisteredName.Length != 0) { + output.WriteRawTag(106); + output.WriteString(RegisteredName); + } + if (serializedUserProto_ != null) { + output.WriteRawTag(114); + output.WriteMessage(SerializedUserProto); + } + dependencies_.WriteTo(output, _repeated_dependencies_codec); + if (RegisteredSaver.Length != 0) { + output.WriteRawTag(130, 1); + output.WriteString(RegisteredSaver); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + children_.WriteTo(ref output, _repeated_children_codec); + slotVariables_.WriteTo(ref output, _repeated_slotVariables_codec); + if (kindCase_ == KindOneofCase.UserObject) { + output.WriteRawTag(34); + output.WriteMessage(UserObject); + } + if (kindCase_ == KindOneofCase.Asset) { + output.WriteRawTag(42); + output.WriteMessage(Asset); + } + if (kindCase_ == KindOneofCase.Function) { + output.WriteRawTag(50); + output.WriteMessage(Function); + } + if (kindCase_ == KindOneofCase.Variable) { + output.WriteRawTag(58); + output.WriteMessage(Variable); + } + if (kindCase_ == KindOneofCase.BareConcreteFunction) { + output.WriteRawTag(66); + output.WriteMessage(BareConcreteFunction); + } + if (kindCase_ == KindOneofCase.Constant) { + output.WriteRawTag(74); + output.WriteMessage(Constant); + } + if (kindCase_ == KindOneofCase.Resource) { + output.WriteRawTag(82); + output.WriteMessage(Resource); + } + saveableObjects_.WriteTo(ref output, _map_saveableObjects_codec); + if (kindCase_ == KindOneofCase.CapturedTensor) { + output.WriteRawTag(98); + output.WriteMessage(CapturedTensor); + } + if (RegisteredName.Length != 0) { + output.WriteRawTag(106); + output.WriteString(RegisteredName); + } + if (serializedUserProto_ != null) { + output.WriteRawTag(114); + output.WriteMessage(SerializedUserProto); + } + dependencies_.WriteTo(ref output, _repeated_dependencies_codec); + if (RegisteredSaver.Length != 0) { + output.WriteRawTag(130, 1); + output.WriteString(RegisteredSaver); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += children_.CalculateSize(_repeated_children_codec); + size += dependencies_.CalculateSize(_repeated_dependencies_codec); size += slotVariables_.CalculateSize(_repeated_slotVariables_codec); if (kindCase_ == KindOneofCase.UserObject) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(UserObject); @@ -612,6 +862,15 @@ public int CalculateSize() { size += 1 + pb::CodedOutputStream.ComputeMessageSize(CapturedTensor); } size += saveableObjects_.CalculateSize(_map_saveableObjects_codec); + if (RegisteredName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(RegisteredName); + } + if (serializedUserProto_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(SerializedUserProto); + } + if (RegisteredSaver.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(RegisteredSaver); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -619,6 +878,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(SavedObject other) { if (other == null) { return; @@ -627,6 +887,18 @@ public void MergeFrom(SavedObject other) { dependencies_.Add(other.dependencies_); slotVariables_.Add(other.slotVariables_); saveableObjects_.Add(other.saveableObjects_); + if (other.RegisteredName.Length != 0) { + RegisteredName = other.RegisteredName; + } + if (other.serializedUserProto_ != null) { + if (serializedUserProto_ == null) { + SerializedUserProto = new global::Google.Protobuf.WellKnownTypes.Any(); + } + SerializedUserProto.MergeFrom(other.SerializedUserProto); + } + if (other.RegisteredSaver.Length != 0) { + RegisteredSaver = other.RegisteredSaver; + } switch (other.KindCase) { case KindOneofCase.UserObject: if (UserObject == null) { @@ -682,7 +954,11 @@ public void MergeFrom(SavedObject other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -773,9 +1049,147 @@ public void MergeFrom(pb::CodedInputStream input) { CapturedTensor = subBuilder; break; } + case 106: { + RegisteredName = input.ReadString(); + break; + } + case 114: { + if (serializedUserProto_ == null) { + SerializedUserProto = new global::Google.Protobuf.WellKnownTypes.Any(); + } + input.ReadMessage(SerializedUserProto); + break; + } + case 122: { + dependencies_.AddEntriesFrom(input, _repeated_dependencies_codec); + break; + } + case 130: { + RegisteredSaver = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + children_.AddEntriesFrom(ref input, _repeated_children_codec); + break; + } + case 26: { + slotVariables_.AddEntriesFrom(ref input, _repeated_slotVariables_codec); + break; + } + case 34: { + global::Tensorflow.SavedUserObject subBuilder = new global::Tensorflow.SavedUserObject(); + if (kindCase_ == KindOneofCase.UserObject) { + subBuilder.MergeFrom(UserObject); + } + input.ReadMessage(subBuilder); + UserObject = subBuilder; + break; + } + case 42: { + global::Tensorflow.SavedAsset subBuilder = new global::Tensorflow.SavedAsset(); + if (kindCase_ == KindOneofCase.Asset) { + subBuilder.MergeFrom(Asset); + } + input.ReadMessage(subBuilder); + Asset = subBuilder; + break; + } + case 50: { + global::Tensorflow.SavedFunction subBuilder = new global::Tensorflow.SavedFunction(); + if (kindCase_ == KindOneofCase.Function) { + subBuilder.MergeFrom(Function); + } + input.ReadMessage(subBuilder); + Function = subBuilder; + break; + } + case 58: { + global::Tensorflow.SavedVariable subBuilder = new global::Tensorflow.SavedVariable(); + if (kindCase_ == KindOneofCase.Variable) { + subBuilder.MergeFrom(Variable); + } + input.ReadMessage(subBuilder); + Variable = subBuilder; + break; + } + case 66: { + global::Tensorflow.SavedBareConcreteFunction subBuilder = new global::Tensorflow.SavedBareConcreteFunction(); + if (kindCase_ == KindOneofCase.BareConcreteFunction) { + subBuilder.MergeFrom(BareConcreteFunction); + } + input.ReadMessage(subBuilder); + BareConcreteFunction = subBuilder; + break; + } + case 74: { + global::Tensorflow.SavedConstant subBuilder = new global::Tensorflow.SavedConstant(); + if (kindCase_ == KindOneofCase.Constant) { + subBuilder.MergeFrom(Constant); + } + input.ReadMessage(subBuilder); + Constant = subBuilder; + break; + } + case 82: { + global::Tensorflow.SavedResource subBuilder = new global::Tensorflow.SavedResource(); + if (kindCase_ == KindOneofCase.Resource) { + subBuilder.MergeFrom(Resource); + } + input.ReadMessage(subBuilder); + Resource = subBuilder; + break; + } + case 90: { + saveableObjects_.AddEntriesFrom(ref input, _map_saveableObjects_codec); + break; + } + case 98: { + global::Tensorflow.CapturedTensor subBuilder = new global::Tensorflow.CapturedTensor(); + if (kindCase_ == KindOneofCase.CapturedTensor) { + subBuilder.MergeFrom(CapturedTensor); + } + input.ReadMessage(subBuilder); + CapturedTensor = subBuilder; + break; + } + case 106: { + RegisteredName = input.ReadString(); + break; + } + case 114: { + if (serializedUserProto_ == null) { + SerializedUserProto = new global::Google.Protobuf.WellKnownTypes.Any(); + } + input.ReadMessage(SerializedUserProto); + break; + } + case 122: { + dependencies_.AddEntriesFrom(ref input, _repeated_dependencies_codec); + break; + } + case 130: { + RegisteredSaver = input.ReadString(); + break; + } } } } + #endif } @@ -787,23 +1201,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// This object cannot be evaluated as a tensor, and therefore cannot be bound /// to an input of a function. /// - public sealed partial class SavedUserObject : pb::IMessage { + public sealed partial class SavedUserObject : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SavedUserObject()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.SavedObjectGraphReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedUserObject() { OnConstruction(); } @@ -811,6 +1233,7 @@ public SavedUserObject() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedUserObject(SavedUserObject other) : this() { identifier_ = other.identifier_; version_ = other.version_ != null ? other.version_.Clone() : null; @@ -819,6 +1242,7 @@ public SavedUserObject(SavedUserObject other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedUserObject Clone() { return new SavedUserObject(this); } @@ -830,6 +1254,7 @@ public SavedUserObject Clone() { /// Corresponds to a registration of the type to use in the loading program. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Identifier { get { return identifier_; } set { @@ -844,6 +1269,7 @@ public string Identifier { /// Version information from the producer of this SavedUserObject. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.VersionDef Version { get { return version_; } set { @@ -863,6 +1289,7 @@ public string Identifier { /// [global::System.ObsoleteAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Metadata { get { return metadata_; } set { @@ -871,11 +1298,13 @@ public string Metadata { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as SavedUserObject); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(SavedUserObject other) { if (ReferenceEquals(other, null)) { return false; @@ -890,6 +1319,7 @@ public bool Equals(SavedUserObject other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Identifier.Length != 0) hash ^= Identifier.GetHashCode(); @@ -902,12 +1332,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Identifier.Length != 0) { output.WriteRawTag(10); output.WriteString(Identifier); @@ -923,9 +1358,33 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Identifier.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Identifier); + } + if (version_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Version); + } + if (Metadata.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Metadata); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Identifier.Length != 0) { @@ -944,6 +1403,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(SavedUserObject other) { if (other == null) { return; @@ -964,7 +1424,11 @@ public void MergeFrom(SavedUserObject other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -988,8 +1452,39 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Identifier = input.ReadString(); + break; + } + case 18: { + if (version_ == null) { + Version = new global::Tensorflow.VersionDef(); + } + input.ReadMessage(Version); + break; + } + case 26: { + Metadata = input.ReadString(); + break; + } + } + } + } + #endif + } /// @@ -999,23 +1494,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// filename. Users should not depend on a particular part of the filename to /// remain stable (e.g. basename could be changed). /// - public sealed partial class SavedAsset : pb::IMessage { + public sealed partial class SavedAsset : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SavedAsset()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.SavedObjectGraphReflection.Descriptor.MessageTypes[3]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedAsset() { OnConstruction(); } @@ -1023,12 +1526,14 @@ public SavedAsset() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedAsset(SavedAsset other) : this() { assetFileDefIndex_ = other.assetFileDefIndex_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedAsset Clone() { return new SavedAsset(this); } @@ -1043,6 +1548,7 @@ public SavedAsset Clone() { /// `AssetFileDef.tensor_info`, MUST be ignored. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int AssetFileDefIndex { get { return assetFileDefIndex_; } set { @@ -1051,11 +1557,13 @@ public int AssetFileDefIndex { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as SavedAsset); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(SavedAsset other) { if (ReferenceEquals(other, null)) { return false; @@ -1068,6 +1576,7 @@ public bool Equals(SavedAsset other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (AssetFileDefIndex != 0) hash ^= AssetFileDefIndex.GetHashCode(); @@ -1078,12 +1587,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (AssetFileDefIndex != 0) { output.WriteRawTag(8); output.WriteInt32(AssetFileDefIndex); @@ -1091,9 +1605,25 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (AssetFileDefIndex != 0) { + output.WriteRawTag(8); + output.WriteInt32(AssetFileDefIndex); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (AssetFileDefIndex != 0) { @@ -1106,6 +1636,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(SavedAsset other) { if (other == null) { return; @@ -1117,7 +1648,11 @@ public void MergeFrom(SavedAsset other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1130,30 +1665,58 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + AssetFileDefIndex = input.ReadInt32(); + break; + } + } + } + } + #endif + } /// /// A function with multiple signatures, possibly with non-Tensor arguments. /// - public sealed partial class SavedFunction : pb::IMessage { + public sealed partial class SavedFunction : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SavedFunction()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.SavedObjectGraphReflection.Descriptor.MessageTypes[4]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedFunction() { OnConstruction(); } @@ -1161,6 +1724,7 @@ public SavedFunction() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedFunction(SavedFunction other) : this() { concreteFunctions_ = other.concreteFunctions_.Clone(); functionSpec_ = other.functionSpec_ != null ? other.functionSpec_.Clone() : null; @@ -1168,6 +1732,7 @@ public SavedFunction(SavedFunction other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedFunction Clone() { return new SavedFunction(this); } @@ -1178,6 +1743,7 @@ public SavedFunction Clone() { = pb::FieldCodec.ForString(10); private readonly pbc::RepeatedField concreteFunctions_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField ConcreteFunctions { get { return concreteFunctions_; } } @@ -1186,6 +1752,7 @@ public SavedFunction Clone() { public const int FunctionSpecFieldNumber = 2; private global::Tensorflow.FunctionSpec functionSpec_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.FunctionSpec FunctionSpec { get { return functionSpec_; } set { @@ -1194,11 +1761,13 @@ public SavedFunction Clone() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as SavedFunction); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(SavedFunction other) { if (ReferenceEquals(other, null)) { return false; @@ -1212,6 +1781,7 @@ public bool Equals(SavedFunction other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= concreteFunctions_.GetHashCode(); @@ -1223,12 +1793,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else concreteFunctions_.WriteTo(output, _repeated_concreteFunctions_codec); if (functionSpec_ != null) { output.WriteRawTag(18); @@ -1237,9 +1812,26 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + concreteFunctions_.WriteTo(ref output, _repeated_concreteFunctions_codec); + if (functionSpec_ != null) { + output.WriteRawTag(18); + output.WriteMessage(FunctionSpec); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += concreteFunctions_.CalculateSize(_repeated_concreteFunctions_codec); @@ -1253,6 +1845,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(SavedFunction other) { if (other == null) { return; @@ -1268,7 +1861,11 @@ public void MergeFrom(SavedFunction other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1288,27 +1885,62 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + concreteFunctions_.AddEntriesFrom(ref input, _repeated_concreteFunctions_codec); + break; + } + case 18: { + if (functionSpec_ == null) { + FunctionSpec = new global::Tensorflow.FunctionSpec(); + } + input.ReadMessage(FunctionSpec); + break; + } + } + } + } + #endif + } - public sealed partial class CapturedTensor : pb::IMessage { + public sealed partial class CapturedTensor : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CapturedTensor()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.SavedObjectGraphReflection.Descriptor.MessageTypes[5]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CapturedTensor() { OnConstruction(); } @@ -1316,6 +1948,7 @@ public CapturedTensor() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CapturedTensor(CapturedTensor other) : this() { name_ = other.name_; concreteFunction_ = other.concreteFunction_; @@ -1323,6 +1956,7 @@ public CapturedTensor(CapturedTensor other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public CapturedTensor Clone() { return new CapturedTensor(this); } @@ -1334,6 +1968,7 @@ public CapturedTensor Clone() { /// Name of captured tensor /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -1348,6 +1983,7 @@ public string Name { /// Name of concrete function which contains the computed graph tensor. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string ConcreteFunction { get { return concreteFunction_; } set { @@ -1356,11 +1992,13 @@ public string ConcreteFunction { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as CapturedTensor); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(CapturedTensor other) { if (ReferenceEquals(other, null)) { return false; @@ -1374,6 +2012,7 @@ public bool Equals(CapturedTensor other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -1385,12 +2024,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -1402,9 +2046,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (ConcreteFunction.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ConcreteFunction); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -1420,6 +2084,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(CapturedTensor other) { if (other == null) { return; @@ -1434,7 +2099,11 @@ public void MergeFrom(CapturedTensor other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1451,7 +2120,31 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + ConcreteFunction = input.ReadString(); + break; + } + } + } } + #endif } @@ -1459,23 +2152,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// Stores low-level information about a concrete function. Referenced in either /// a SavedFunction or a SavedBareConcreteFunction. /// - public sealed partial class SavedConcreteFunction : pb::IMessage { + public sealed partial class SavedConcreteFunction : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SavedConcreteFunction()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.SavedObjectGraphReflection.Descriptor.MessageTypes[6]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedConcreteFunction() { OnConstruction(); } @@ -1483,6 +2184,7 @@ public SavedConcreteFunction() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedConcreteFunction(SavedConcreteFunction other) : this() { boundInputs_ = other.boundInputs_.Clone(); canonicalizedInputSignature_ = other.canonicalizedInputSignature_ != null ? other.canonicalizedInputSignature_.Clone() : null; @@ -1491,6 +2193,7 @@ public SavedConcreteFunction(SavedConcreteFunction other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedConcreteFunction Clone() { return new SavedConcreteFunction(this); } @@ -1501,6 +2204,7 @@ public SavedConcreteFunction Clone() { = pb::FieldCodec.ForInt32(18); private readonly pbc::RepeatedField boundInputs_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField BoundInputs { get { return boundInputs_; } } @@ -1513,6 +2217,7 @@ public SavedConcreteFunction Clone() { /// function. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.StructuredValue CanonicalizedInputSignature { get { return canonicalizedInputSignature_; } set { @@ -1529,6 +2234,7 @@ public SavedConcreteFunction Clone() { /// be used to reconstruct the full structure from pure tensors. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.StructuredValue OutputSignature { get { return outputSignature_; } set { @@ -1537,11 +2243,13 @@ public SavedConcreteFunction Clone() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as SavedConcreteFunction); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(SavedConcreteFunction other) { if (ReferenceEquals(other, null)) { return false; @@ -1556,6 +2264,7 @@ public bool Equals(SavedConcreteFunction other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= boundInputs_.GetHashCode(); @@ -1568,12 +2277,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else boundInputs_.WriteTo(output, _repeated_boundInputs_codec); if (canonicalizedInputSignature_ != null) { output.WriteRawTag(26); @@ -1586,9 +2300,30 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + boundInputs_.WriteTo(ref output, _repeated_boundInputs_codec); + if (canonicalizedInputSignature_ != null) { + output.WriteRawTag(26); + output.WriteMessage(CanonicalizedInputSignature); + } + if (outputSignature_ != null) { + output.WriteRawTag(34); + output.WriteMessage(OutputSignature); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += boundInputs_.CalculateSize(_repeated_boundInputs_codec); @@ -1605,6 +2340,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(SavedConcreteFunction other) { if (other == null) { return; @@ -1622,20 +2358,58 @@ public void MergeFrom(SavedConcreteFunction other) { } OutputSignature.MergeFrom(other.OutputSignature); } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 18: + case 16: { + boundInputs_.AddEntriesFrom(input, _repeated_boundInputs_codec); + break; + } + case 26: { + if (canonicalizedInputSignature_ == null) { + CanonicalizedInputSignature = new global::Tensorflow.StructuredValue(); + } + input.ReadMessage(CanonicalizedInputSignature); + break; + } + case 34: { + if (outputSignature_ == null) { + OutputSignature = new global::Tensorflow.StructuredValue(); + } + input.ReadMessage(OutputSignature); + break; + } + } + } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 18: case 16: { - boundInputs_.AddEntriesFrom(input, _repeated_boundInputs_codec); + boundInputs_.AddEntriesFrom(ref input, _repeated_boundInputs_codec); break; } case 26: { @@ -1655,26 +2429,35 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } - public sealed partial class SavedBareConcreteFunction : pb::IMessage { + public sealed partial class SavedBareConcreteFunction : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SavedBareConcreteFunction()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.SavedObjectGraphReflection.Descriptor.MessageTypes[7]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedBareConcreteFunction() { OnConstruction(); } @@ -1682,6 +2465,7 @@ public SavedBareConcreteFunction() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedBareConcreteFunction(SavedBareConcreteFunction other) : this() { concreteFunctionName_ = other.concreteFunctionName_; argumentKeywords_ = other.argumentKeywords_.Clone(); @@ -1691,6 +2475,7 @@ public SavedBareConcreteFunction(SavedBareConcreteFunction other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedBareConcreteFunction Clone() { return new SavedBareConcreteFunction(this); } @@ -1702,6 +2487,7 @@ public SavedBareConcreteFunction Clone() { /// Identifies a SavedConcreteFunction. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string ConcreteFunctionName { get { return concreteFunctionName_; } set { @@ -1718,6 +2504,7 @@ public string ConcreteFunctionName { /// A sequence of unique strings, one per Tensor argument. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField ArgumentKeywords { get { return argumentKeywords_; } } @@ -1729,6 +2516,7 @@ public string ConcreteFunctionName { /// The prefix of `argument_keywords` which may be identified by position. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long AllowedPositionalArguments { get { return allowedPositionalArguments_; } set { @@ -1748,6 +2536,7 @@ public long AllowedPositionalArguments { /// inputs in C++ SavedModel API. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.FunctionSpec FunctionSpec { get { return functionSpec_; } set { @@ -1756,11 +2545,13 @@ public long AllowedPositionalArguments { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as SavedBareConcreteFunction); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(SavedBareConcreteFunction other) { if (ReferenceEquals(other, null)) { return false; @@ -1776,6 +2567,7 @@ public bool Equals(SavedBareConcreteFunction other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (ConcreteFunctionName.Length != 0) hash ^= ConcreteFunctionName.GetHashCode(); @@ -1789,12 +2581,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (ConcreteFunctionName.Length != 0) { output.WriteRawTag(10); output.WriteString(ConcreteFunctionName); @@ -1811,9 +2608,34 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ConcreteFunctionName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ConcreteFunctionName); + } + argumentKeywords_.WriteTo(ref output, _repeated_argumentKeywords_codec); + if (AllowedPositionalArguments != 0L) { + output.WriteRawTag(24); + output.WriteInt64(AllowedPositionalArguments); + } + if (functionSpec_ != null) { + output.WriteRawTag(34); + output.WriteMessage(FunctionSpec); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (ConcreteFunctionName.Length != 0) { @@ -1833,6 +2655,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(SavedBareConcreteFunction other) { if (other == null) { return; @@ -1854,7 +2677,11 @@ public void MergeFrom(SavedBareConcreteFunction other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1882,27 +2709,70 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + ConcreteFunctionName = input.ReadString(); + break; + } + case 18: { + argumentKeywords_.AddEntriesFrom(ref input, _repeated_argumentKeywords_codec); + break; + } + case 24: { + AllowedPositionalArguments = input.ReadInt64(); + break; + } + case 34: { + if (functionSpec_ == null) { + FunctionSpec = new global::Tensorflow.FunctionSpec(); + } + input.ReadMessage(FunctionSpec); + break; + } + } + } } + #endif } - public sealed partial class SavedConstant : pb::IMessage { + public sealed partial class SavedConstant : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SavedConstant()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.SavedObjectGraphReflection.Descriptor.MessageTypes[8]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedConstant() { OnConstruction(); } @@ -1910,12 +2780,14 @@ public SavedConstant() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedConstant(SavedConstant other) : this() { operation_ = other.operation_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedConstant Clone() { return new SavedConstant(this); } @@ -1927,6 +2799,7 @@ public SavedConstant Clone() { /// An Operation name for a ConstantOp in this SavedObjectGraph's MetaGraph. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Operation { get { return operation_; } set { @@ -1935,11 +2808,13 @@ public string Operation { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as SavedConstant); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(SavedConstant other) { if (ReferenceEquals(other, null)) { return false; @@ -1952,6 +2827,7 @@ public bool Equals(SavedConstant other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Operation.Length != 0) hash ^= Operation.GetHashCode(); @@ -1962,12 +2838,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Operation.Length != 0) { output.WriteRawTag(10); output.WriteString(Operation); @@ -1975,9 +2856,25 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Operation.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Operation); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Operation.Length != 0) { @@ -1990,6 +2887,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(SavedConstant other) { if (other == null) { return; @@ -2001,7 +2899,11 @@ public void MergeFrom(SavedConstant other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -2014,7 +2916,27 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Operation = input.ReadString(); + break; + } + } + } } + #endif } @@ -2022,23 +2944,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// Represents a Variable that is initialized by loading the contents from the /// checkpoint. /// - public sealed partial class SavedVariable : pb::IMessage { + public sealed partial class SavedVariable : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SavedVariable()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.SavedObjectGraphReflection.Descriptor.MessageTypes[9]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedVariable() { OnConstruction(); } @@ -2046,6 +2976,7 @@ public SavedVariable() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedVariable(SavedVariable other) : this() { dtype_ = other.dtype_; shape_ = other.shape_ != null ? other.shape_.Clone() : null; @@ -2059,6 +2990,7 @@ public SavedVariable(SavedVariable other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedVariable Clone() { return new SavedVariable(this); } @@ -2067,6 +2999,7 @@ public SavedVariable Clone() { public const int DtypeFieldNumber = 1; private global::Tensorflow.DataType dtype_ = global::Tensorflow.DataType.DtInvalid; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.DataType Dtype { get { return dtype_; } set { @@ -2078,6 +3011,7 @@ public SavedVariable Clone() { public const int ShapeFieldNumber = 2; private global::Tensorflow.TensorShapeProto shape_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorShapeProto Shape { get { return shape_; } set { @@ -2089,6 +3023,7 @@ public SavedVariable Clone() { public const int TrainableFieldNumber = 3; private bool trainable_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Trainable { get { return trainable_; } set { @@ -2100,6 +3035,7 @@ public bool Trainable { public const int SynchronizationFieldNumber = 4; private global::Tensorflow.VariableSynchronization synchronization_ = global::Tensorflow.VariableSynchronization.Auto; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.VariableSynchronization Synchronization { get { return synchronization_; } set { @@ -2111,6 +3047,7 @@ public bool Trainable { public const int AggregationFieldNumber = 5; private global::Tensorflow.VariableAggregation aggregation_ = global::Tensorflow.VariableAggregation.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.VariableAggregation Aggregation { get { return aggregation_; } set { @@ -2122,6 +3059,7 @@ public bool Trainable { public const int NameFieldNumber = 6; private string name_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -2133,6 +3071,7 @@ public string Name { public const int DeviceFieldNumber = 7; private string device_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Device { get { return device_; } set { @@ -2154,16 +3093,19 @@ public string Device { /// This is only supported by experimental loaders at the moment. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField ExperimentalDistributedVariableComponents { get { return experimentalDistributedVariableComponents_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as SavedVariable); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(SavedVariable other) { if (ReferenceEquals(other, null)) { return false; @@ -2183,6 +3125,7 @@ public bool Equals(SavedVariable other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Dtype != global::Tensorflow.DataType.DtInvalid) hash ^= Dtype.GetHashCode(); @@ -2200,12 +3143,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Dtype != global::Tensorflow.DataType.DtInvalid) { output.WriteRawTag(8); output.WriteEnum((int) Dtype); @@ -2238,9 +3186,50 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Dtype != global::Tensorflow.DataType.DtInvalid) { + output.WriteRawTag(8); + output.WriteEnum((int) Dtype); + } + if (shape_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Shape); + } + if (Trainable != false) { + output.WriteRawTag(24); + output.WriteBool(Trainable); + } + if (Synchronization != global::Tensorflow.VariableSynchronization.Auto) { + output.WriteRawTag(32); + output.WriteEnum((int) Synchronization); + } + if (Aggregation != global::Tensorflow.VariableAggregation.None) { + output.WriteRawTag(40); + output.WriteEnum((int) Aggregation); + } + if (Name.Length != 0) { + output.WriteRawTag(50); + output.WriteString(Name); + } + if (Device.Length != 0) { + output.WriteRawTag(58); + output.WriteString(Device); + } + experimentalDistributedVariableComponents_.WriteTo(ref output, _repeated_experimentalDistributedVariableComponents_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Dtype != global::Tensorflow.DataType.DtInvalid) { @@ -2272,6 +3261,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(SavedVariable other) { if (other == null) { return; @@ -2305,7 +3295,11 @@ public void MergeFrom(SavedVariable other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -2349,7 +3343,58 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Dtype = (global::Tensorflow.DataType) input.ReadEnum(); + break; + } + case 18: { + if (shape_ == null) { + Shape = new global::Tensorflow.TensorShapeProto(); + } + input.ReadMessage(Shape); + break; + } + case 24: { + Trainable = input.ReadBool(); + break; + } + case 32: { + Synchronization = (global::Tensorflow.VariableSynchronization) input.ReadEnum(); + break; + } + case 40: { + Aggregation = (global::Tensorflow.VariableAggregation) input.ReadEnum(); + break; + } + case 50: { + Name = input.ReadString(); + break; + } + case 58: { + Device = input.ReadString(); + break; + } + case 66: { + experimentalDistributedVariableComponents_.AddEntriesFrom(ref input, _repeated_experimentalDistributedVariableComponents_codec); + break; + } + } + } } + #endif } @@ -2357,23 +3402,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// Represents `FunctionSpec` used in `Function`. This represents a /// function that has been wrapped as a TensorFlow `Function`. /// - public sealed partial class FunctionSpec : pb::IMessage { + public sealed partial class FunctionSpec : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FunctionSpec()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.SavedObjectGraphReflection.Descriptor.MessageTypes[10]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public FunctionSpec() { OnConstruction(); } @@ -2381,6 +3434,7 @@ public FunctionSpec() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public FunctionSpec(FunctionSpec other) : this() { fullargspec_ = other.fullargspec_ != null ? other.fullargspec_.Clone() : null; isMethod_ = other.isMethod_; @@ -2390,6 +3444,7 @@ public FunctionSpec(FunctionSpec other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public FunctionSpec Clone() { return new FunctionSpec(this); } @@ -2401,6 +3456,7 @@ public FunctionSpec Clone() { /// Full arg spec from inspect.getfullargspec(). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.StructuredValue Fullargspec { get { return fullargspec_; } set { @@ -2415,6 +3471,7 @@ public FunctionSpec Clone() { /// Whether this represents a class method. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool IsMethod { get { return isMethod_; } set { @@ -2429,6 +3486,7 @@ public bool IsMethod { /// The input signature, if specified. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.StructuredValue InputSignature { get { return inputSignature_; } set { @@ -2440,6 +3498,7 @@ public bool IsMethod { public const int JitCompileFieldNumber = 6; private global::Tensorflow.FunctionSpec.Types.JitCompile jitCompile_ = global::Tensorflow.FunctionSpec.Types.JitCompile.Default; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.FunctionSpec.Types.JitCompile JitCompile { get { return jitCompile_; } set { @@ -2448,11 +3507,13 @@ public bool IsMethod { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as FunctionSpec); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(FunctionSpec other) { if (ReferenceEquals(other, null)) { return false; @@ -2468,6 +3529,7 @@ public bool Equals(FunctionSpec other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (fullargspec_ != null) hash ^= Fullargspec.GetHashCode(); @@ -2481,12 +3543,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (fullargspec_ != null) { output.WriteRawTag(10); output.WriteMessage(Fullargspec); @@ -2506,9 +3573,37 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (fullargspec_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Fullargspec); + } + if (IsMethod != false) { + output.WriteRawTag(16); + output.WriteBool(IsMethod); + } + if (inputSignature_ != null) { + output.WriteRawTag(42); + output.WriteMessage(InputSignature); + } + if (JitCompile != global::Tensorflow.FunctionSpec.Types.JitCompile.Default) { + output.WriteRawTag(48); + output.WriteEnum((int) JitCompile); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (fullargspec_ != null) { @@ -2530,6 +3625,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(FunctionSpec other) { if (other == null) { return; @@ -2556,7 +3652,11 @@ public void MergeFrom(FunctionSpec other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -2587,11 +3687,50 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (fullargspec_ == null) { + Fullargspec = new global::Tensorflow.StructuredValue(); + } + input.ReadMessage(Fullargspec); + break; + } + case 16: { + IsMethod = input.ReadBool(); + break; + } + case 42: { + if (inputSignature_ == null) { + InputSignature = new global::Tensorflow.StructuredValue(); + } + input.ReadMessage(InputSignature); + break; + } + case 48: { + JitCompile = (global::Tensorflow.FunctionSpec.Types.JitCompile) input.ReadEnum(); + break; + } + } + } } + #endif #region Nested types /// Container for nested types declared in the FunctionSpec message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { /// /// Whether the function should be compiled by XLA. @@ -2619,23 +3758,31 @@ public enum JitCompile { /// An object of this type can have a reference to a: /// create_resource() and an initialize() function. /// - public sealed partial class SavedResource : pb::IMessage { + public sealed partial class SavedResource : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SavedResource()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.SavedObjectGraphReflection.Descriptor.MessageTypes[11]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedResource() { OnConstruction(); } @@ -2643,12 +3790,14 @@ public SavedResource() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedResource(SavedResource other) : this() { device_ = other.device_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SavedResource Clone() { return new SavedResource(this); } @@ -2662,6 +3811,7 @@ public SavedResource Clone() { /// device. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Device { get { return device_; } set { @@ -2670,11 +3820,13 @@ public string Device { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as SavedResource); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(SavedResource other) { if (ReferenceEquals(other, null)) { return false; @@ -2687,6 +3839,7 @@ public bool Equals(SavedResource other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Device.Length != 0) hash ^= Device.GetHashCode(); @@ -2697,12 +3850,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Device.Length != 0) { output.WriteRawTag(10); output.WriteString(Device); @@ -2710,9 +3868,25 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Device.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Device); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Device.Length != 0) { @@ -2725,6 +3899,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(SavedResource other) { if (other == null) { return; @@ -2736,7 +3911,11 @@ public void MergeFrom(SavedResource other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -2749,27 +3928,55 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Device = input.ReadString(); + break; + } + } + } } + #endif } - public sealed partial class SaveableObject : pb::IMessage { + public sealed partial class SaveableObject : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SaveableObject()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.SavedObjectGraphReflection.Descriptor.MessageTypes[12]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SaveableObject() { OnConstruction(); } @@ -2777,6 +3984,7 @@ public SaveableObject() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SaveableObject(SaveableObject other) : this() { saveFunction_ = other.saveFunction_; restoreFunction_ = other.restoreFunction_; @@ -2784,6 +3992,7 @@ public SaveableObject(SaveableObject other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SaveableObject Clone() { return new SaveableObject(this); } @@ -2793,8 +4002,10 @@ public SaveableObject Clone() { private int saveFunction_; /// /// Node ids of concrete functions for saving and loading from a checkpoint. + /// These functions save and restore directly from tensors. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int SaveFunction { get { return saveFunction_; } set { @@ -2806,6 +4017,7 @@ public int SaveFunction { public const int RestoreFunctionFieldNumber = 3; private int restoreFunction_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int RestoreFunction { get { return restoreFunction_; } set { @@ -2814,11 +4026,13 @@ public int RestoreFunction { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as SaveableObject); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(SaveableObject other) { if (ReferenceEquals(other, null)) { return false; @@ -2832,6 +4046,7 @@ public bool Equals(SaveableObject other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (SaveFunction != 0) hash ^= SaveFunction.GetHashCode(); @@ -2843,12 +4058,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (SaveFunction != 0) { output.WriteRawTag(16); output.WriteInt32(SaveFunction); @@ -2860,9 +4080,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (SaveFunction != 0) { + output.WriteRawTag(16); + output.WriteInt32(SaveFunction); + } + if (RestoreFunction != 0) { + output.WriteRawTag(24); + output.WriteInt32(RestoreFunction); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (SaveFunction != 0) { @@ -2878,6 +4118,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(SaveableObject other) { if (other == null) { return; @@ -2892,7 +4133,11 @@ public void MergeFrom(SaveableObject other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -2909,7 +4154,31 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 16: { + SaveFunction = input.ReadInt32(); + break; + } + case 24: { + RestoreFunction = input.ReadInt32(); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/Saver.cs b/src/TensorFlowNET.Core/Protobuf/Saver.cs index 51857418a..fac25e329 100644 --- a/src/TensorFlowNET.Core/Protobuf/Saver.cs +++ b/src/TensorFlowNET.Core/Protobuf/Saver.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/protobuf/saver.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -48,23 +48,31 @@ static SaverReflection() { /// /// Protocol buffer representing the configuration of a Saver. /// - public sealed partial class SaverDef : pb::IMessage { + public sealed partial class SaverDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SaverDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.SaverReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SaverDef() { OnConstruction(); } @@ -72,6 +80,7 @@ public SaverDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SaverDef(SaverDef other) : this() { filenameTensorName_ = other.filenameTensorName_; saveTensorName_ = other.saveTensorName_; @@ -84,6 +93,7 @@ public SaverDef(SaverDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SaverDef Clone() { return new SaverDef(this); } @@ -96,6 +106,7 @@ public SaverDef Clone() { /// restoring a model checkpoint. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string FilenameTensorName { get { return filenameTensorName_; } set { @@ -110,6 +121,7 @@ public string FilenameTensorName { /// The operation to run when saving a model checkpoint. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string SaveTensorName { get { return saveTensorName_; } set { @@ -124,6 +136,7 @@ public string SaveTensorName { /// The operation to run when restoring a model checkpoint. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string RestoreOpName { get { return restoreOpName_; } set { @@ -138,6 +151,7 @@ public string RestoreOpName { /// Maximum number of checkpoints to keep. If 0, no checkpoints are deleted. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int MaxToKeep { get { return maxToKeep_; } set { @@ -152,6 +166,7 @@ public int MaxToKeep { /// Shard the save files, one per device that has Variable nodes. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Sharded { get { return sharded_; } set { @@ -169,6 +184,7 @@ public bool Sharded { /// for every n hours of training. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public float KeepCheckpointEveryNHours { get { return keepCheckpointEveryNHours_; } set { @@ -180,6 +196,7 @@ public float KeepCheckpointEveryNHours { public const int VersionFieldNumber = 7; private global::Tensorflow.SaverDef.Types.CheckpointFormatVersion version_ = global::Tensorflow.SaverDef.Types.CheckpointFormatVersion.Legacy; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.SaverDef.Types.CheckpointFormatVersion Version { get { return version_; } set { @@ -188,11 +205,13 @@ public float KeepCheckpointEveryNHours { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as SaverDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(SaverDef other) { if (ReferenceEquals(other, null)) { return false; @@ -211,6 +230,7 @@ public bool Equals(SaverDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (FilenameTensorName.Length != 0) hash ^= FilenameTensorName.GetHashCode(); @@ -227,12 +247,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (FilenameTensorName.Length != 0) { output.WriteRawTag(10); output.WriteString(FilenameTensorName); @@ -264,9 +289,49 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (FilenameTensorName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FilenameTensorName); + } + if (SaveTensorName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(SaveTensorName); + } + if (RestoreOpName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(RestoreOpName); + } + if (MaxToKeep != 0) { + output.WriteRawTag(32); + output.WriteInt32(MaxToKeep); + } + if (Sharded != false) { + output.WriteRawTag(40); + output.WriteBool(Sharded); + } + if (KeepCheckpointEveryNHours != 0F) { + output.WriteRawTag(53); + output.WriteFloat(KeepCheckpointEveryNHours); + } + if (Version != global::Tensorflow.SaverDef.Types.CheckpointFormatVersion.Legacy) { + output.WriteRawTag(56); + output.WriteEnum((int) Version); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (FilenameTensorName.Length != 0) { @@ -297,6 +362,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(SaverDef other) { if (other == null) { return; @@ -326,7 +392,11 @@ public void MergeFrom(SaverDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -363,11 +433,56 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + FilenameTensorName = input.ReadString(); + break; + } + case 18: { + SaveTensorName = input.ReadString(); + break; + } + case 26: { + RestoreOpName = input.ReadString(); + break; + } + case 32: { + MaxToKeep = input.ReadInt32(); + break; + } + case 40: { + Sharded = input.ReadBool(); + break; + } + case 53: { + KeepCheckpointEveryNHours = input.ReadFloat(); + break; + } + case 56: { + Version = (global::Tensorflow.SaverDef.Types.CheckpointFormatVersion) input.ReadEnum(); + break; + } + } + } } + #endif #region Nested types /// Container for nested types declared in the SaverDef message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { /// /// A version number that identifies a different on-disk checkpoint format. diff --git a/src/TensorFlowNET.Core/Protobuf/ServiceConfig.cs b/src/TensorFlowNET.Core/Protobuf/ServiceConfig.cs new file mode 100644 index 000000000..2197b4bac --- /dev/null +++ b/src/TensorFlowNET.Core/Protobuf/ServiceConfig.cs @@ -0,0 +1,1179 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tensorflow/core/protobuf/service_config.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tensorflow.Data.Experimental { + + /// Holder for reflection information generated from tensorflow/core/protobuf/service_config.proto + public static partial class ServiceConfigReflection { + + #region Descriptor + /// File descriptor for tensorflow/core/protobuf/service_config.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ServiceConfigReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ci10ZW5zb3JmbG93L2NvcmUvcHJvdG9idWYvc2VydmljZV9jb25maWcucHJv", + "dG8SHHRlbnNvcmZsb3cuZGF0YS5leHBlcmltZW50YWwaK3RlbnNvcmZsb3cv", + "Y29yZS9wcm90b2J1Zi9kYXRhX3NlcnZpY2UucHJvdG8ijQIKEERpc3BhdGNo", + "ZXJDb25maWcSDAoEcG9ydBgBIAEoAxIQCghwcm90b2NvbBgCIAEoCRIQCgh3", + "b3JrX2RpchgDIAEoCRIbChNmYXVsdF90b2xlcmFudF9tb2RlGAQgASgIEhgK", + "EHdvcmtlcl9hZGRyZXNzZXMYByADKAkSOAoPZGVwbG95bWVudF9tb2RlGAkg", + "ASgOMh8udGVuc29yZmxvdy5kYXRhLkRlcGxveW1lbnRNb2RlEiAKGGpvYl9n", + "Y19jaGVja19pbnRlcnZhbF9tcxgFIAEoAxIZChFqb2JfZ2NfdGltZW91dF9t", + "cxgGIAEoAxIZChFjbGllbnRfdGltZW91dF9tcxgIIAEoAyK+AgoMV29ya2Vy", + "Q29uZmlnEgwKBHBvcnQYASABKAMSEAoIcHJvdG9jb2wYAiABKAkSGgoSZGlz", + "cGF0Y2hlcl9hZGRyZXNzGAMgASgJEhYKDndvcmtlcl9hZGRyZXNzGAQgASgJ", + "EhMKC3dvcmtlcl90YWdzGAogAygJEh0KFWhlYXJ0YmVhdF9pbnRlcnZhbF9t", + "cxgFIAEoAxIdChVkaXNwYXRjaGVyX3RpbWVvdXRfbXMYBiABKAMSHgoWZGF0", + "YV90cmFuc2Zlcl9wcm90b2NvbBgHIAEoCRIdChVkYXRhX3RyYW5zZmVyX2Fk", + "ZHJlc3MYCCABKAkSJgoeY3Jvc3NfdHJhaW5lcl9jYWNoZV9zaXplX2J5dGVz", + "GAsgASgDEiAKGHNodXRkb3duX3F1aWV0X3BlcmlvZF9tcxgJIAEoA0JXWlVn", + "aXRodWIuY29tL3RlbnNvcmZsb3cvdGVuc29yZmxvdy90ZW5zb3JmbG93L2dv", + "L2NvcmUvcHJvdG9idWYvZm9yX2NvcmVfcHJvdG9zX2dvX3Byb3RvYgZwcm90", + "bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Tensorflow.Data.DataServiceReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.Data.Experimental.DispatcherConfig), global::Tensorflow.Data.Experimental.DispatcherConfig.Parser, new[]{ "Port", "Protocol", "WorkDir", "FaultTolerantMode", "WorkerAddresses", "DeploymentMode", "JobGcCheckIntervalMs", "JobGcTimeoutMs", "ClientTimeoutMs" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.Data.Experimental.WorkerConfig), global::Tensorflow.Data.Experimental.WorkerConfig.Parser, new[]{ "Port", "Protocol", "DispatcherAddress", "WorkerAddress", "WorkerTags", "HeartbeatIntervalMs", "DispatcherTimeoutMs", "DataTransferProtocol", "DataTransferAddress", "CrossTrainerCacheSizeBytes", "ShutdownQuietPeriodMs" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + /// + /// Configuration for a tf.data service DispatchServer. + /// Next id: 10 + /// + public sealed partial class DispatcherConfig : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DispatcherConfig()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.Data.Experimental.ServiceConfigReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DispatcherConfig() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DispatcherConfig(DispatcherConfig other) : this() { + port_ = other.port_; + protocol_ = other.protocol_; + workDir_ = other.workDir_; + faultTolerantMode_ = other.faultTolerantMode_; + workerAddresses_ = other.workerAddresses_.Clone(); + deploymentMode_ = other.deploymentMode_; + jobGcCheckIntervalMs_ = other.jobGcCheckIntervalMs_; + jobGcTimeoutMs_ = other.jobGcTimeoutMs_; + clientTimeoutMs_ = other.clientTimeoutMs_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DispatcherConfig Clone() { + return new DispatcherConfig(this); + } + + /// Field number for the "port" field. + public const int PortFieldNumber = 1; + private long port_; + /// + /// The port for the dispatcher to bind to. A value of 0 indicates that the + /// dispatcher may bind to any available port. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Port { + get { return port_; } + set { + port_ = value; + } + } + + /// Field number for the "protocol" field. + public const int ProtocolFieldNumber = 2; + private string protocol_ = ""; + /// + /// The protocol for the dispatcher to use when connecting to workers. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Protocol { + get { return protocol_; } + set { + protocol_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "work_dir" field. + public const int WorkDirFieldNumber = 3; + private string workDir_ = ""; + /// + /// A work directory to use for storing dispatcher state, and for recovering + /// during restarts. The empty string indicates not to use any work directory. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string WorkDir { + get { return workDir_; } + set { + workDir_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "fault_tolerant_mode" field. + public const int FaultTolerantModeFieldNumber = 4; + private bool faultTolerantMode_; + /// + /// Whether to run in fault tolerant mode, where dispatcher state is saved + /// across restarts. Requires that `work_dir` is nonempty. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool FaultTolerantMode { + get { return faultTolerantMode_; } + set { + faultTolerantMode_ = value; + } + } + + /// Field number for the "worker_addresses" field. + public const int WorkerAddressesFieldNumber = 7; + private static readonly pb::FieldCodec _repeated_workerAddresses_codec + = pb::FieldCodec.ForString(58); + private readonly pbc::RepeatedField workerAddresses_ = new pbc::RepeatedField(); + /// + /// (Optional.) If the job uses auto-sharding, it needs to specify a fixed list + /// of worker addresses that will register with the dispatcher. The worker + /// addresses should be in the format "host" or "host:port", where "port" is an + /// integer, named port, or %port% to match any port. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField WorkerAddresses { + get { return workerAddresses_; } + } + + /// Field number for the "deployment_mode" field. + public const int DeploymentModeFieldNumber = 9; + private global::Tensorflow.Data.DeploymentMode deploymentMode_ = global::Tensorflow.Data.DeploymentMode.Unspecified; + /// + /// (Optional.) tf.data service deployment mode. Supported values are "REMOTE", + /// "COLOCATED", and "HYBRID". If unspecified, it is assumed to be "REMOTE". + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.Data.DeploymentMode DeploymentMode { + get { return deploymentMode_; } + set { + deploymentMode_ = value; + } + } + + /// Field number for the "job_gc_check_interval_ms" field. + public const int JobGcCheckIntervalMsFieldNumber = 5; + private long jobGcCheckIntervalMs_; + /// + /// How often the dispatcher should scan through to delete old and unused + /// jobs. A value of 0 indicates that the decision should be left up to the + /// runtime. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long JobGcCheckIntervalMs { + get { return jobGcCheckIntervalMs_; } + set { + jobGcCheckIntervalMs_ = value; + } + } + + /// Field number for the "job_gc_timeout_ms" field. + public const int JobGcTimeoutMsFieldNumber = 6; + private long jobGcTimeoutMs_; + /// + /// How long a job needs to be unused before it becomes a candidate for garbage + /// collection. A value of -1 indicates that jobs should never be garbage + /// collected. A value of 0 indicates that the decision should be left up to + /// the runtime. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long JobGcTimeoutMs { + get { return jobGcTimeoutMs_; } + set { + jobGcTimeoutMs_ = value; + } + } + + /// Field number for the "client_timeout_ms" field. + public const int ClientTimeoutMsFieldNumber = 8; + private long clientTimeoutMs_; + /// + /// How long to wait before garbage-collecting a client that hasn't + /// heartbeated to the dispatcher. A value of 0 indicates that the timeout + /// should be left to the runtime. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long ClientTimeoutMs { + get { return clientTimeoutMs_; } + set { + clientTimeoutMs_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as DispatcherConfig); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(DispatcherConfig other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Port != other.Port) return false; + if (Protocol != other.Protocol) return false; + if (WorkDir != other.WorkDir) return false; + if (FaultTolerantMode != other.FaultTolerantMode) return false; + if(!workerAddresses_.Equals(other.workerAddresses_)) return false; + if (DeploymentMode != other.DeploymentMode) return false; + if (JobGcCheckIntervalMs != other.JobGcCheckIntervalMs) return false; + if (JobGcTimeoutMs != other.JobGcTimeoutMs) return false; + if (ClientTimeoutMs != other.ClientTimeoutMs) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Port != 0L) hash ^= Port.GetHashCode(); + if (Protocol.Length != 0) hash ^= Protocol.GetHashCode(); + if (WorkDir.Length != 0) hash ^= WorkDir.GetHashCode(); + if (FaultTolerantMode != false) hash ^= FaultTolerantMode.GetHashCode(); + hash ^= workerAddresses_.GetHashCode(); + if (DeploymentMode != global::Tensorflow.Data.DeploymentMode.Unspecified) hash ^= DeploymentMode.GetHashCode(); + if (JobGcCheckIntervalMs != 0L) hash ^= JobGcCheckIntervalMs.GetHashCode(); + if (JobGcTimeoutMs != 0L) hash ^= JobGcTimeoutMs.GetHashCode(); + if (ClientTimeoutMs != 0L) hash ^= ClientTimeoutMs.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Port != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Port); + } + if (Protocol.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Protocol); + } + if (WorkDir.Length != 0) { + output.WriteRawTag(26); + output.WriteString(WorkDir); + } + if (FaultTolerantMode != false) { + output.WriteRawTag(32); + output.WriteBool(FaultTolerantMode); + } + if (JobGcCheckIntervalMs != 0L) { + output.WriteRawTag(40); + output.WriteInt64(JobGcCheckIntervalMs); + } + if (JobGcTimeoutMs != 0L) { + output.WriteRawTag(48); + output.WriteInt64(JobGcTimeoutMs); + } + workerAddresses_.WriteTo(output, _repeated_workerAddresses_codec); + if (ClientTimeoutMs != 0L) { + output.WriteRawTag(64); + output.WriteInt64(ClientTimeoutMs); + } + if (DeploymentMode != global::Tensorflow.Data.DeploymentMode.Unspecified) { + output.WriteRawTag(72); + output.WriteEnum((int) DeploymentMode); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Port != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Port); + } + if (Protocol.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Protocol); + } + if (WorkDir.Length != 0) { + output.WriteRawTag(26); + output.WriteString(WorkDir); + } + if (FaultTolerantMode != false) { + output.WriteRawTag(32); + output.WriteBool(FaultTolerantMode); + } + if (JobGcCheckIntervalMs != 0L) { + output.WriteRawTag(40); + output.WriteInt64(JobGcCheckIntervalMs); + } + if (JobGcTimeoutMs != 0L) { + output.WriteRawTag(48); + output.WriteInt64(JobGcTimeoutMs); + } + workerAddresses_.WriteTo(ref output, _repeated_workerAddresses_codec); + if (ClientTimeoutMs != 0L) { + output.WriteRawTag(64); + output.WriteInt64(ClientTimeoutMs); + } + if (DeploymentMode != global::Tensorflow.Data.DeploymentMode.Unspecified) { + output.WriteRawTag(72); + output.WriteEnum((int) DeploymentMode); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Port != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Port); + } + if (Protocol.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Protocol); + } + if (WorkDir.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(WorkDir); + } + if (FaultTolerantMode != false) { + size += 1 + 1; + } + size += workerAddresses_.CalculateSize(_repeated_workerAddresses_codec); + if (DeploymentMode != global::Tensorflow.Data.DeploymentMode.Unspecified) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) DeploymentMode); + } + if (JobGcCheckIntervalMs != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(JobGcCheckIntervalMs); + } + if (JobGcTimeoutMs != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(JobGcTimeoutMs); + } + if (ClientTimeoutMs != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(ClientTimeoutMs); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(DispatcherConfig other) { + if (other == null) { + return; + } + if (other.Port != 0L) { + Port = other.Port; + } + if (other.Protocol.Length != 0) { + Protocol = other.Protocol; + } + if (other.WorkDir.Length != 0) { + WorkDir = other.WorkDir; + } + if (other.FaultTolerantMode != false) { + FaultTolerantMode = other.FaultTolerantMode; + } + workerAddresses_.Add(other.workerAddresses_); + if (other.DeploymentMode != global::Tensorflow.Data.DeploymentMode.Unspecified) { + DeploymentMode = other.DeploymentMode; + } + if (other.JobGcCheckIntervalMs != 0L) { + JobGcCheckIntervalMs = other.JobGcCheckIntervalMs; + } + if (other.JobGcTimeoutMs != 0L) { + JobGcTimeoutMs = other.JobGcTimeoutMs; + } + if (other.ClientTimeoutMs != 0L) { + ClientTimeoutMs = other.ClientTimeoutMs; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Port = input.ReadInt64(); + break; + } + case 18: { + Protocol = input.ReadString(); + break; + } + case 26: { + WorkDir = input.ReadString(); + break; + } + case 32: { + FaultTolerantMode = input.ReadBool(); + break; + } + case 40: { + JobGcCheckIntervalMs = input.ReadInt64(); + break; + } + case 48: { + JobGcTimeoutMs = input.ReadInt64(); + break; + } + case 58: { + workerAddresses_.AddEntriesFrom(input, _repeated_workerAddresses_codec); + break; + } + case 64: { + ClientTimeoutMs = input.ReadInt64(); + break; + } + case 72: { + DeploymentMode = (global::Tensorflow.Data.DeploymentMode) input.ReadEnum(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Port = input.ReadInt64(); + break; + } + case 18: { + Protocol = input.ReadString(); + break; + } + case 26: { + WorkDir = input.ReadString(); + break; + } + case 32: { + FaultTolerantMode = input.ReadBool(); + break; + } + case 40: { + JobGcCheckIntervalMs = input.ReadInt64(); + break; + } + case 48: { + JobGcTimeoutMs = input.ReadInt64(); + break; + } + case 58: { + workerAddresses_.AddEntriesFrom(ref input, _repeated_workerAddresses_codec); + break; + } + case 64: { + ClientTimeoutMs = input.ReadInt64(); + break; + } + case 72: { + DeploymentMode = (global::Tensorflow.Data.DeploymentMode) input.ReadEnum(); + break; + } + } + } + } + #endif + + } + + /// + /// Configuration for a tf.data service WorkerServer. + /// Next id: 12 + /// + public sealed partial class WorkerConfig : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WorkerConfig()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.Data.Experimental.ServiceConfigReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WorkerConfig() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WorkerConfig(WorkerConfig other) : this() { + port_ = other.port_; + protocol_ = other.protocol_; + dispatcherAddress_ = other.dispatcherAddress_; + workerAddress_ = other.workerAddress_; + workerTags_ = other.workerTags_.Clone(); + heartbeatIntervalMs_ = other.heartbeatIntervalMs_; + dispatcherTimeoutMs_ = other.dispatcherTimeoutMs_; + dataTransferProtocol_ = other.dataTransferProtocol_; + dataTransferAddress_ = other.dataTransferAddress_; + crossTrainerCacheSizeBytes_ = other.crossTrainerCacheSizeBytes_; + shutdownQuietPeriodMs_ = other.shutdownQuietPeriodMs_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WorkerConfig Clone() { + return new WorkerConfig(this); + } + + /// Field number for the "port" field. + public const int PortFieldNumber = 1; + private long port_; + /// + /// The port for the worker to bind to. A value of 0 indicates that the + /// worker may bind to any available port. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Port { + get { return port_; } + set { + port_ = value; + } + } + + /// Field number for the "protocol" field. + public const int ProtocolFieldNumber = 2; + private string protocol_ = ""; + /// + /// The protocol for the worker to use when connecting to the dispatcher. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Protocol { + get { return protocol_; } + set { + protocol_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "dispatcher_address" field. + public const int DispatcherAddressFieldNumber = 3; + private string dispatcherAddress_ = ""; + /// + /// The address of the dispatcher to register with. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string DispatcherAddress { + get { return dispatcherAddress_; } + set { + dispatcherAddress_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "worker_address" field. + public const int WorkerAddressFieldNumber = 4; + private string workerAddress_ = ""; + /// + /// The address of the worker server. The substring "%port%", if specified, + /// will be replaced with the worker's bound port. This is useful when the port + /// is set to `0`. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string WorkerAddress { + get { return workerAddress_; } + set { + workerAddress_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "worker_tags" field. + public const int WorkerTagsFieldNumber = 10; + private static readonly pb::FieldCodec _repeated_workerTags_codec + = pb::FieldCodec.ForString(82); + private readonly pbc::RepeatedField workerTags_ = new pbc::RepeatedField(); + /// + /// Tags attached to the worker. This allows reading from selected workers. + /// For example, by applying a "COLOCATED" tag, tf.data service is able to read + /// from the local tf.data worker if one exists, then from off-TF-host workers, + /// to avoid cross-TF-host reads. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField WorkerTags { + get { return workerTags_; } + } + + /// Field number for the "heartbeat_interval_ms" field. + public const int HeartbeatIntervalMsFieldNumber = 5; + private long heartbeatIntervalMs_; + /// + /// How often the worker should heartbeat to the master. A value of 0 indicates + /// that the decision should be left up to the runtime. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long HeartbeatIntervalMs { + get { return heartbeatIntervalMs_; } + set { + heartbeatIntervalMs_ = value; + } + } + + /// Field number for the "dispatcher_timeout_ms" field. + public const int DispatcherTimeoutMsFieldNumber = 6; + private long dispatcherTimeoutMs_; + /// + /// How long to retry requests to the dispatcher before giving up and reporting + /// an error. A value of 0 indicates that the decision should be left up to the + /// runtime. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long DispatcherTimeoutMs { + get { return dispatcherTimeoutMs_; } + set { + dispatcherTimeoutMs_ = value; + } + } + + /// Field number for the "data_transfer_protocol" field. + public const int DataTransferProtocolFieldNumber = 7; + private string dataTransferProtocol_ = ""; + /// + /// The protocol for the worker to use when transferring data to clients. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string DataTransferProtocol { + get { return dataTransferProtocol_; } + set { + dataTransferProtocol_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "data_transfer_address" field. + public const int DataTransferAddressFieldNumber = 8; + private string dataTransferAddress_ = ""; + /// + /// The data transfer address of the worker server. The substring "%port%", if + /// specified, will be replaced with the worker's bound port. This is useful + /// when the port is set to `0`. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string DataTransferAddress { + get { return dataTransferAddress_; } + set { + dataTransferAddress_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "cross_trainer_cache_size_bytes" field. + public const int CrossTrainerCacheSizeBytesFieldNumber = 11; + private long crossTrainerCacheSizeBytes_; + /// + /// Maximum size of the cross-trainer cache in bytes. If enabled, make sure + /// your training job provides sufficient memory resources. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long CrossTrainerCacheSizeBytes { + get { return crossTrainerCacheSizeBytes_; } + set { + crossTrainerCacheSizeBytes_ = value; + } + } + + /// Field number for the "shutdown_quiet_period_ms" field. + public const int ShutdownQuietPeriodMsFieldNumber = 9; + private long shutdownQuietPeriodMs_; + /// + /// When shutting down a worker, how long to wait for the gRPC server to + /// process the final requests. This is used to achieve clean shutdown in unit + /// tests. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long ShutdownQuietPeriodMs { + get { return shutdownQuietPeriodMs_; } + set { + shutdownQuietPeriodMs_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as WorkerConfig); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(WorkerConfig other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Port != other.Port) return false; + if (Protocol != other.Protocol) return false; + if (DispatcherAddress != other.DispatcherAddress) return false; + if (WorkerAddress != other.WorkerAddress) return false; + if(!workerTags_.Equals(other.workerTags_)) return false; + if (HeartbeatIntervalMs != other.HeartbeatIntervalMs) return false; + if (DispatcherTimeoutMs != other.DispatcherTimeoutMs) return false; + if (DataTransferProtocol != other.DataTransferProtocol) return false; + if (DataTransferAddress != other.DataTransferAddress) return false; + if (CrossTrainerCacheSizeBytes != other.CrossTrainerCacheSizeBytes) return false; + if (ShutdownQuietPeriodMs != other.ShutdownQuietPeriodMs) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Port != 0L) hash ^= Port.GetHashCode(); + if (Protocol.Length != 0) hash ^= Protocol.GetHashCode(); + if (DispatcherAddress.Length != 0) hash ^= DispatcherAddress.GetHashCode(); + if (WorkerAddress.Length != 0) hash ^= WorkerAddress.GetHashCode(); + hash ^= workerTags_.GetHashCode(); + if (HeartbeatIntervalMs != 0L) hash ^= HeartbeatIntervalMs.GetHashCode(); + if (DispatcherTimeoutMs != 0L) hash ^= DispatcherTimeoutMs.GetHashCode(); + if (DataTransferProtocol.Length != 0) hash ^= DataTransferProtocol.GetHashCode(); + if (DataTransferAddress.Length != 0) hash ^= DataTransferAddress.GetHashCode(); + if (CrossTrainerCacheSizeBytes != 0L) hash ^= CrossTrainerCacheSizeBytes.GetHashCode(); + if (ShutdownQuietPeriodMs != 0L) hash ^= ShutdownQuietPeriodMs.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Port != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Port); + } + if (Protocol.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Protocol); + } + if (DispatcherAddress.Length != 0) { + output.WriteRawTag(26); + output.WriteString(DispatcherAddress); + } + if (WorkerAddress.Length != 0) { + output.WriteRawTag(34); + output.WriteString(WorkerAddress); + } + if (HeartbeatIntervalMs != 0L) { + output.WriteRawTag(40); + output.WriteInt64(HeartbeatIntervalMs); + } + if (DispatcherTimeoutMs != 0L) { + output.WriteRawTag(48); + output.WriteInt64(DispatcherTimeoutMs); + } + if (DataTransferProtocol.Length != 0) { + output.WriteRawTag(58); + output.WriteString(DataTransferProtocol); + } + if (DataTransferAddress.Length != 0) { + output.WriteRawTag(66); + output.WriteString(DataTransferAddress); + } + if (ShutdownQuietPeriodMs != 0L) { + output.WriteRawTag(72); + output.WriteInt64(ShutdownQuietPeriodMs); + } + workerTags_.WriteTo(output, _repeated_workerTags_codec); + if (CrossTrainerCacheSizeBytes != 0L) { + output.WriteRawTag(88); + output.WriteInt64(CrossTrainerCacheSizeBytes); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Port != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Port); + } + if (Protocol.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Protocol); + } + if (DispatcherAddress.Length != 0) { + output.WriteRawTag(26); + output.WriteString(DispatcherAddress); + } + if (WorkerAddress.Length != 0) { + output.WriteRawTag(34); + output.WriteString(WorkerAddress); + } + if (HeartbeatIntervalMs != 0L) { + output.WriteRawTag(40); + output.WriteInt64(HeartbeatIntervalMs); + } + if (DispatcherTimeoutMs != 0L) { + output.WriteRawTag(48); + output.WriteInt64(DispatcherTimeoutMs); + } + if (DataTransferProtocol.Length != 0) { + output.WriteRawTag(58); + output.WriteString(DataTransferProtocol); + } + if (DataTransferAddress.Length != 0) { + output.WriteRawTag(66); + output.WriteString(DataTransferAddress); + } + if (ShutdownQuietPeriodMs != 0L) { + output.WriteRawTag(72); + output.WriteInt64(ShutdownQuietPeriodMs); + } + workerTags_.WriteTo(ref output, _repeated_workerTags_codec); + if (CrossTrainerCacheSizeBytes != 0L) { + output.WriteRawTag(88); + output.WriteInt64(CrossTrainerCacheSizeBytes); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Port != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Port); + } + if (Protocol.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Protocol); + } + if (DispatcherAddress.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(DispatcherAddress); + } + if (WorkerAddress.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(WorkerAddress); + } + size += workerTags_.CalculateSize(_repeated_workerTags_codec); + if (HeartbeatIntervalMs != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(HeartbeatIntervalMs); + } + if (DispatcherTimeoutMs != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(DispatcherTimeoutMs); + } + if (DataTransferProtocol.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(DataTransferProtocol); + } + if (DataTransferAddress.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(DataTransferAddress); + } + if (CrossTrainerCacheSizeBytes != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(CrossTrainerCacheSizeBytes); + } + if (ShutdownQuietPeriodMs != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(ShutdownQuietPeriodMs); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(WorkerConfig other) { + if (other == null) { + return; + } + if (other.Port != 0L) { + Port = other.Port; + } + if (other.Protocol.Length != 0) { + Protocol = other.Protocol; + } + if (other.DispatcherAddress.Length != 0) { + DispatcherAddress = other.DispatcherAddress; + } + if (other.WorkerAddress.Length != 0) { + WorkerAddress = other.WorkerAddress; + } + workerTags_.Add(other.workerTags_); + if (other.HeartbeatIntervalMs != 0L) { + HeartbeatIntervalMs = other.HeartbeatIntervalMs; + } + if (other.DispatcherTimeoutMs != 0L) { + DispatcherTimeoutMs = other.DispatcherTimeoutMs; + } + if (other.DataTransferProtocol.Length != 0) { + DataTransferProtocol = other.DataTransferProtocol; + } + if (other.DataTransferAddress.Length != 0) { + DataTransferAddress = other.DataTransferAddress; + } + if (other.CrossTrainerCacheSizeBytes != 0L) { + CrossTrainerCacheSizeBytes = other.CrossTrainerCacheSizeBytes; + } + if (other.ShutdownQuietPeriodMs != 0L) { + ShutdownQuietPeriodMs = other.ShutdownQuietPeriodMs; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Port = input.ReadInt64(); + break; + } + case 18: { + Protocol = input.ReadString(); + break; + } + case 26: { + DispatcherAddress = input.ReadString(); + break; + } + case 34: { + WorkerAddress = input.ReadString(); + break; + } + case 40: { + HeartbeatIntervalMs = input.ReadInt64(); + break; + } + case 48: { + DispatcherTimeoutMs = input.ReadInt64(); + break; + } + case 58: { + DataTransferProtocol = input.ReadString(); + break; + } + case 66: { + DataTransferAddress = input.ReadString(); + break; + } + case 72: { + ShutdownQuietPeriodMs = input.ReadInt64(); + break; + } + case 82: { + workerTags_.AddEntriesFrom(input, _repeated_workerTags_codec); + break; + } + case 88: { + CrossTrainerCacheSizeBytes = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Port = input.ReadInt64(); + break; + } + case 18: { + Protocol = input.ReadString(); + break; + } + case 26: { + DispatcherAddress = input.ReadString(); + break; + } + case 34: { + WorkerAddress = input.ReadString(); + break; + } + case 40: { + HeartbeatIntervalMs = input.ReadInt64(); + break; + } + case 48: { + DispatcherTimeoutMs = input.ReadInt64(); + break; + } + case 58: { + DataTransferProtocol = input.ReadString(); + break; + } + case 66: { + DataTransferAddress = input.ReadString(); + break; + } + case 72: { + ShutdownQuietPeriodMs = input.ReadInt64(); + break; + } + case 82: { + workerTags_.AddEntriesFrom(ref input, _repeated_workerTags_codec); + break; + } + case 88: { + CrossTrainerCacheSizeBytes = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/TensorFlowNET.Core/Protobuf/StepStats.cs b/src/TensorFlowNET.Core/Protobuf/StepStats.cs index bff1645d0..48ecd0d50 100644 --- a/src/TensorFlowNET.Core/Protobuf/StepStats.cs +++ b/src/TensorFlowNET.Core/Protobuf/StepStats.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/step_stats.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -81,23 +81,31 @@ static StepStatsReflection() { /// /// An allocation/de-allocation operation performed by the allocator. /// - public sealed partial class AllocationRecord : pb::IMessage { + public sealed partial class AllocationRecord : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AllocationRecord()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.StepStatsReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AllocationRecord() { OnConstruction(); } @@ -105,6 +113,7 @@ public AllocationRecord() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AllocationRecord(AllocationRecord other) : this() { allocMicros_ = other.allocMicros_; allocBytes_ = other.allocBytes_; @@ -112,6 +121,7 @@ public AllocationRecord(AllocationRecord other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AllocationRecord Clone() { return new AllocationRecord(this); } @@ -123,6 +133,7 @@ public AllocationRecord Clone() { /// The timestamp of the operation. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long AllocMicros { get { return allocMicros_; } set { @@ -137,6 +148,7 @@ public long AllocMicros { /// Number of bytes allocated, or de-allocated if negative. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long AllocBytes { get { return allocBytes_; } set { @@ -145,11 +157,13 @@ public long AllocBytes { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as AllocationRecord); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(AllocationRecord other) { if (ReferenceEquals(other, null)) { return false; @@ -163,6 +177,7 @@ public bool Equals(AllocationRecord other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (AllocMicros != 0L) hash ^= AllocMicros.GetHashCode(); @@ -174,12 +189,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (AllocMicros != 0L) { output.WriteRawTag(8); output.WriteInt64(AllocMicros); @@ -191,9 +211,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (AllocMicros != 0L) { + output.WriteRawTag(8); + output.WriteInt64(AllocMicros); + } + if (AllocBytes != 0L) { + output.WriteRawTag(16); + output.WriteInt64(AllocBytes); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (AllocMicros != 0L) { @@ -209,6 +249,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(AllocationRecord other) { if (other == null) { return; @@ -223,7 +264,11 @@ public void MergeFrom(AllocationRecord other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -240,27 +285,59 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + AllocMicros = input.ReadInt64(); + break; + } + case 16: { + AllocBytes = input.ReadInt64(); + break; + } + } + } } + #endif } - public sealed partial class AllocatorMemoryUsed : pb::IMessage { + public sealed partial class AllocatorMemoryUsed : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AllocatorMemoryUsed()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.StepStatsReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AllocatorMemoryUsed() { OnConstruction(); } @@ -268,6 +345,7 @@ public AllocatorMemoryUsed() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AllocatorMemoryUsed(AllocatorMemoryUsed other) : this() { allocatorName_ = other.allocatorName_; totalBytes_ = other.totalBytes_; @@ -279,6 +357,7 @@ public AllocatorMemoryUsed(AllocatorMemoryUsed other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public AllocatorMemoryUsed Clone() { return new AllocatorMemoryUsed(this); } @@ -287,6 +366,7 @@ public AllocatorMemoryUsed Clone() { public const int AllocatorNameFieldNumber = 1; private string allocatorName_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string AllocatorName { get { return allocatorName_; } set { @@ -301,6 +381,7 @@ public string AllocatorName { /// These are per-node allocator memory stats. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long TotalBytes { get { return totalBytes_; } set { @@ -312,6 +393,7 @@ public long TotalBytes { public const int PeakBytesFieldNumber = 3; private long peakBytes_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long PeakBytes { get { return peakBytes_; } set { @@ -326,6 +408,7 @@ public long PeakBytes { /// The bytes that are not deallocated. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long LiveBytes { get { return liveBytes_; } set { @@ -342,6 +425,7 @@ public long LiveBytes { /// The allocation and deallocation timeline. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField AllocationRecords { get { return allocationRecords_; } } @@ -354,6 +438,7 @@ public long LiveBytes { /// The number of live bytes currently allocated by the allocator. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long AllocatorBytesInUse { get { return allocatorBytesInUse_; } set { @@ -362,11 +447,13 @@ public long AllocatorBytesInUse { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as AllocatorMemoryUsed); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(AllocatorMemoryUsed other) { if (ReferenceEquals(other, null)) { return false; @@ -384,6 +471,7 @@ public bool Equals(AllocatorMemoryUsed other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (AllocatorName.Length != 0) hash ^= AllocatorName.GetHashCode(); @@ -399,12 +487,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (AllocatorName.Length != 0) { output.WriteRawTag(10); output.WriteString(AllocatorName); @@ -429,9 +522,42 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (AllocatorName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(AllocatorName); + } + if (TotalBytes != 0L) { + output.WriteRawTag(16); + output.WriteInt64(TotalBytes); + } + if (PeakBytes != 0L) { + output.WriteRawTag(24); + output.WriteInt64(PeakBytes); + } + if (LiveBytes != 0L) { + output.WriteRawTag(32); + output.WriteInt64(LiveBytes); + } + if (AllocatorBytesInUse != 0L) { + output.WriteRawTag(40); + output.WriteInt64(AllocatorBytesInUse); + } + allocationRecords_.WriteTo(ref output, _repeated_allocationRecords_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (AllocatorName.Length != 0) { @@ -457,6 +583,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(AllocatorMemoryUsed other) { if (other == null) { return; @@ -481,7 +608,11 @@ public void MergeFrom(AllocatorMemoryUsed other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -514,30 +645,78 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + AllocatorName = input.ReadString(); + break; + } + case 16: { + TotalBytes = input.ReadInt64(); + break; + } + case 24: { + PeakBytes = input.ReadInt64(); + break; + } + case 32: { + LiveBytes = input.ReadInt64(); + break; + } + case 40: { + AllocatorBytesInUse = input.ReadInt64(); + break; + } + case 50: { + allocationRecords_.AddEntriesFrom(ref input, _repeated_allocationRecords_codec); + break; + } + } + } + } + #endif + } /// /// Output sizes recorded for a single execution of a graph node. /// - public sealed partial class NodeOutput : pb::IMessage { + public sealed partial class NodeOutput : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NodeOutput()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.StepStatsReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NodeOutput() { OnConstruction(); } @@ -545,6 +724,7 @@ public NodeOutput() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NodeOutput(NodeOutput other) : this() { slot_ = other.slot_; tensorDescription_ = other.tensorDescription_ != null ? other.tensorDescription_.Clone() : null; @@ -552,6 +732,7 @@ public NodeOutput(NodeOutput other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NodeOutput Clone() { return new NodeOutput(this); } @@ -560,6 +741,7 @@ public NodeOutput Clone() { public const int SlotFieldNumber = 1; private int slot_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int Slot { get { return slot_; } set { @@ -571,6 +753,7 @@ public int Slot { public const int TensorDescriptionFieldNumber = 3; private global::Tensorflow.TensorDescription tensorDescription_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorDescription TensorDescription { get { return tensorDescription_; } set { @@ -579,11 +762,13 @@ public int Slot { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as NodeOutput); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(NodeOutput other) { if (ReferenceEquals(other, null)) { return false; @@ -597,6 +782,7 @@ public bool Equals(NodeOutput other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Slot != 0) hash ^= Slot.GetHashCode(); @@ -608,12 +794,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Slot != 0) { output.WriteRawTag(8); output.WriteInt32(Slot); @@ -625,9 +816,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Slot != 0) { + output.WriteRawTag(8); + output.WriteInt32(Slot); + } + if (tensorDescription_ != null) { + output.WriteRawTag(26); + output.WriteMessage(TensorDescription); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Slot != 0) { @@ -643,6 +854,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(NodeOutput other) { if (other == null) { return; @@ -660,7 +872,11 @@ public void MergeFrom(NodeOutput other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -680,30 +896,65 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Slot = input.ReadInt32(); + break; + } + case 26: { + if (tensorDescription_ == null) { + TensorDescription = new global::Tensorflow.TensorDescription(); + } + input.ReadMessage(TensorDescription); + break; + } + } + } } + #endif } /// /// For memory tracking. /// - public sealed partial class MemoryStats : pb::IMessage { + public sealed partial class MemoryStats : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MemoryStats()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.StepStatsReflection.Descriptor.MessageTypes[3]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemoryStats() { OnConstruction(); } @@ -711,6 +962,7 @@ public MemoryStats() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemoryStats(MemoryStats other) : this() { tempMemorySize_ = other.tempMemorySize_; persistentMemorySize_ = other.persistentMemorySize_; @@ -722,6 +974,7 @@ public MemoryStats(MemoryStats other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public MemoryStats Clone() { return new MemoryStats(this); } @@ -730,6 +983,7 @@ public MemoryStats Clone() { public const int TempMemorySizeFieldNumber = 1; private long tempMemorySize_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long TempMemorySize { get { return tempMemorySize_; } set { @@ -741,6 +995,7 @@ public long TempMemorySize { public const int PersistentMemorySizeFieldNumber = 3; private long persistentMemorySize_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long PersistentMemorySize { get { return persistentMemorySize_; } set { @@ -754,6 +1009,7 @@ public long PersistentMemorySize { = pb::FieldCodec.ForInt64(42); private readonly pbc::RepeatedField persistentTensorAllocIds_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField PersistentTensorAllocIds { get { return persistentTensorAllocIds_; } } @@ -763,6 +1019,7 @@ public long PersistentMemorySize { private long deviceTempMemorySize_; [global::System.ObsoleteAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long DeviceTempMemorySize { get { return deviceTempMemorySize_; } set { @@ -775,6 +1032,7 @@ public long DeviceTempMemorySize { private long devicePersistentMemorySize_; [global::System.ObsoleteAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long DevicePersistentMemorySize { get { return devicePersistentMemorySize_; } set { @@ -789,16 +1047,19 @@ public long DevicePersistentMemorySize { private readonly pbc::RepeatedField devicePersistentTensorAllocIds_ = new pbc::RepeatedField(); [global::System.ObsoleteAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField DevicePersistentTensorAllocIds { get { return devicePersistentTensorAllocIds_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as MemoryStats); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(MemoryStats other) { if (ReferenceEquals(other, null)) { return false; @@ -816,6 +1077,7 @@ public bool Equals(MemoryStats other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (TempMemorySize != 0L) hash ^= TempMemorySize.GetHashCode(); @@ -831,12 +1093,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (TempMemorySize != 0L) { output.WriteRawTag(8); output.WriteInt64(TempMemorySize); @@ -858,9 +1125,39 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (TempMemorySize != 0L) { + output.WriteRawTag(8); + output.WriteInt64(TempMemorySize); + } + if (DeviceTempMemorySize != 0L) { + output.WriteRawTag(16); + output.WriteInt64(DeviceTempMemorySize); + } + if (PersistentMemorySize != 0L) { + output.WriteRawTag(24); + output.WriteInt64(PersistentMemorySize); + } + if (DevicePersistentMemorySize != 0L) { + output.WriteRawTag(32); + output.WriteInt64(DevicePersistentMemorySize); + } + persistentTensorAllocIds_.WriteTo(ref output, _repeated_persistentTensorAllocIds_codec); + devicePersistentTensorAllocIds_.WriteTo(ref output, _repeated_devicePersistentTensorAllocIds_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (TempMemorySize != 0L) { @@ -884,6 +1181,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(MemoryStats other) { if (other == null) { return; @@ -906,7 +1204,11 @@ public void MergeFrom(MemoryStats other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -941,30 +1243,80 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + TempMemorySize = input.ReadInt64(); + break; + } + case 16: { + DeviceTempMemorySize = input.ReadInt64(); + break; + } + case 24: { + PersistentMemorySize = input.ReadInt64(); + break; + } + case 32: { + DevicePersistentMemorySize = input.ReadInt64(); + break; + } + case 42: + case 40: { + persistentTensorAllocIds_.AddEntriesFrom(ref input, _repeated_persistentTensorAllocIds_codec); + break; + } + case 50: + case 48: { + devicePersistentTensorAllocIds_.AddEntriesFrom(ref input, _repeated_devicePersistentTensorAllocIds_codec); + break; + } + } + } + } + #endif + } /// /// Time/size stats recorded for a single execution of a graph node. /// - public sealed partial class NodeExecStats : pb::IMessage { + public sealed partial class NodeExecStats : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NodeExecStats()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.StepStatsReflection.Descriptor.MessageTypes[4]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NodeExecStats() { OnConstruction(); } @@ -972,6 +1324,7 @@ public NodeExecStats() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NodeExecStats(NodeExecStats other) : this() { nodeName_ = other.nodeName_; allStartMicros_ = other.allStartMicros_; @@ -994,6 +1347,7 @@ public NodeExecStats(NodeExecStats other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NodeExecStats Clone() { return new NodeExecStats(this); } @@ -1008,6 +1362,7 @@ public NodeExecStats Clone() { /// the name. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string NodeName { get { return nodeName_; } set { @@ -1019,6 +1374,7 @@ public string NodeName { public const int AllStartMicrosFieldNumber = 2; private long allStartMicros_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long AllStartMicros { get { return allStartMicros_; } set { @@ -1030,6 +1386,7 @@ public long AllStartMicros { public const int OpStartRelMicrosFieldNumber = 3; private long opStartRelMicros_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long OpStartRelMicros { get { return opStartRelMicros_; } set { @@ -1041,6 +1398,7 @@ public long OpStartRelMicros { public const int OpEndRelMicrosFieldNumber = 4; private long opEndRelMicros_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long OpEndRelMicros { get { return opEndRelMicros_; } set { @@ -1052,6 +1410,7 @@ public long OpEndRelMicros { public const int AllEndRelMicrosFieldNumber = 5; private long allEndRelMicros_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long AllEndRelMicros { get { return allEndRelMicros_; } set { @@ -1065,6 +1424,7 @@ public long AllEndRelMicros { = pb::FieldCodec.ForMessage(50, global::Tensorflow.AllocatorMemoryUsed.Parser); private readonly pbc::RepeatedField memory_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Memory { get { return memory_; } } @@ -1075,6 +1435,7 @@ public long AllEndRelMicros { = pb::FieldCodec.ForMessage(58, global::Tensorflow.NodeOutput.Parser); private readonly pbc::RepeatedField output_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Output { get { return output_; } } @@ -1083,6 +1444,7 @@ public long AllEndRelMicros { public const int TimelineLabelFieldNumber = 8; private string timelineLabel_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string TimelineLabel { get { return timelineLabel_; } set { @@ -1094,6 +1456,7 @@ public string TimelineLabel { public const int ScheduledMicrosFieldNumber = 9; private long scheduledMicros_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long ScheduledMicros { get { return scheduledMicros_; } set { @@ -1105,6 +1468,7 @@ public long ScheduledMicros { public const int ThreadIdFieldNumber = 10; private uint threadId_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public uint ThreadId { get { return threadId_; } set { @@ -1118,6 +1482,7 @@ public uint ThreadId { = pb::FieldCodec.ForMessage(90, global::Tensorflow.AllocationDescription.Parser); private readonly pbc::RepeatedField referencedTensor_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField ReferencedTensor { get { return referencedTensor_; } } @@ -1126,6 +1491,7 @@ public uint ThreadId { public const int MemoryStatsFieldNumber = 12; private global::Tensorflow.MemoryStats memoryStats_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.MemoryStats MemoryStats { get { return memoryStats_; } set { @@ -1137,6 +1503,7 @@ public uint ThreadId { public const int AllStartNanosFieldNumber = 13; private long allStartNanos_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long AllStartNanos { get { return allStartNanos_; } set { @@ -1148,6 +1515,7 @@ public long AllStartNanos { public const int OpStartRelNanosFieldNumber = 14; private long opStartRelNanos_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long OpStartRelNanos { get { return opStartRelNanos_; } set { @@ -1159,6 +1527,7 @@ public long OpStartRelNanos { public const int OpEndRelNanosFieldNumber = 15; private long opEndRelNanos_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long OpEndRelNanos { get { return opEndRelNanos_; } set { @@ -1170,6 +1539,7 @@ public long OpEndRelNanos { public const int AllEndRelNanosFieldNumber = 16; private long allEndRelNanos_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long AllEndRelNanos { get { return allEndRelNanos_; } set { @@ -1181,6 +1551,7 @@ public long AllEndRelNanos { public const int ScheduledNanosFieldNumber = 17; private long scheduledNanos_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long ScheduledNanos { get { return scheduledNanos_; } set { @@ -1189,11 +1560,13 @@ public long ScheduledNanos { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as NodeExecStats); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(NodeExecStats other) { if (ReferenceEquals(other, null)) { return false; @@ -1222,6 +1595,7 @@ public bool Equals(NodeExecStats other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (NodeName.Length != 0) hash ^= NodeName.GetHashCode(); @@ -1248,12 +1622,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (NodeName.Length != 0) { output.WriteRawTag(10); output.WriteString(NodeName); @@ -1316,9 +1695,80 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (NodeName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(NodeName); + } + if (AllStartMicros != 0L) { + output.WriteRawTag(16); + output.WriteInt64(AllStartMicros); + } + if (OpStartRelMicros != 0L) { + output.WriteRawTag(24); + output.WriteInt64(OpStartRelMicros); + } + if (OpEndRelMicros != 0L) { + output.WriteRawTag(32); + output.WriteInt64(OpEndRelMicros); + } + if (AllEndRelMicros != 0L) { + output.WriteRawTag(40); + output.WriteInt64(AllEndRelMicros); + } + memory_.WriteTo(ref output, _repeated_memory_codec); + output_.WriteTo(ref output, _repeated_output_codec); + if (TimelineLabel.Length != 0) { + output.WriteRawTag(66); + output.WriteString(TimelineLabel); + } + if (ScheduledMicros != 0L) { + output.WriteRawTag(72); + output.WriteInt64(ScheduledMicros); + } + if (ThreadId != 0) { + output.WriteRawTag(80); + output.WriteUInt32(ThreadId); + } + referencedTensor_.WriteTo(ref output, _repeated_referencedTensor_codec); + if (memoryStats_ != null) { + output.WriteRawTag(98); + output.WriteMessage(MemoryStats); + } + if (AllStartNanos != 0L) { + output.WriteRawTag(104); + output.WriteInt64(AllStartNanos); + } + if (OpStartRelNanos != 0L) { + output.WriteRawTag(112); + output.WriteInt64(OpStartRelNanos); + } + if (OpEndRelNanos != 0L) { + output.WriteRawTag(120); + output.WriteInt64(OpEndRelNanos); + } + if (AllEndRelNanos != 0L) { + output.WriteRawTag(128, 1); + output.WriteInt64(AllEndRelNanos); + } + if (ScheduledNanos != 0L) { + output.WriteRawTag(136, 1); + output.WriteInt64(ScheduledNanos); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (NodeName.Length != 0) { @@ -1373,6 +1823,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(NodeExecStats other) { if (other == null) { return; @@ -1429,7 +1880,11 @@ public void MergeFrom(NodeExecStats other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1509,27 +1964,122 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + NodeName = input.ReadString(); + break; + } + case 16: { + AllStartMicros = input.ReadInt64(); + break; + } + case 24: { + OpStartRelMicros = input.ReadInt64(); + break; + } + case 32: { + OpEndRelMicros = input.ReadInt64(); + break; + } + case 40: { + AllEndRelMicros = input.ReadInt64(); + break; + } + case 50: { + memory_.AddEntriesFrom(ref input, _repeated_memory_codec); + break; + } + case 58: { + output_.AddEntriesFrom(ref input, _repeated_output_codec); + break; + } + case 66: { + TimelineLabel = input.ReadString(); + break; + } + case 72: { + ScheduledMicros = input.ReadInt64(); + break; + } + case 80: { + ThreadId = input.ReadUInt32(); + break; + } + case 90: { + referencedTensor_.AddEntriesFrom(ref input, _repeated_referencedTensor_codec); + break; + } + case 98: { + if (memoryStats_ == null) { + MemoryStats = new global::Tensorflow.MemoryStats(); + } + input.ReadMessage(MemoryStats); + break; + } + case 104: { + AllStartNanos = input.ReadInt64(); + break; + } + case 112: { + OpStartRelNanos = input.ReadInt64(); + break; + } + case 120: { + OpEndRelNanos = input.ReadInt64(); + break; + } + case 128: { + AllEndRelNanos = input.ReadInt64(); + break; + } + case 136: { + ScheduledNanos = input.ReadInt64(); + break; + } + } + } } + #endif } - public sealed partial class DeviceStepStats : pb::IMessage { + public sealed partial class DeviceStepStats : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeviceStepStats()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.StepStatsReflection.Descriptor.MessageTypes[5]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DeviceStepStats() { OnConstruction(); } @@ -1537,6 +2087,7 @@ public DeviceStepStats() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DeviceStepStats(DeviceStepStats other) : this() { device_ = other.device_; nodeStats_ = other.nodeStats_.Clone(); @@ -1545,6 +2096,7 @@ public DeviceStepStats(DeviceStepStats other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DeviceStepStats Clone() { return new DeviceStepStats(this); } @@ -1553,6 +2105,7 @@ public DeviceStepStats Clone() { public const int DeviceFieldNumber = 1; private string device_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Device { get { return device_; } set { @@ -1566,6 +2119,7 @@ public string Device { = pb::FieldCodec.ForMessage(18, global::Tensorflow.NodeExecStats.Parser); private readonly pbc::RepeatedField nodeStats_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField NodeStats { get { return nodeStats_; } } @@ -1579,16 +2133,19 @@ public string Device { /// Its key is thread id. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField ThreadNames { get { return threadNames_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as DeviceStepStats); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(DeviceStepStats other) { if (ReferenceEquals(other, null)) { return false; @@ -1603,6 +2160,7 @@ public bool Equals(DeviceStepStats other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Device.Length != 0) hash ^= Device.GetHashCode(); @@ -1615,12 +2173,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Device.Length != 0) { output.WriteRawTag(10); output.WriteString(Device); @@ -1630,9 +2193,27 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Device.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Device); + } + nodeStats_.WriteTo(ref output, _repeated_nodeStats_codec); + threadNames_.WriteTo(ref output, _map_threadNames_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Device.Length != 0) { @@ -1647,6 +2228,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(DeviceStepStats other) { if (other == null) { return; @@ -1660,7 +2242,11 @@ public void MergeFrom(DeviceStepStats other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1681,27 +2267,63 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Device = input.ReadString(); + break; + } + case 18: { + nodeStats_.AddEntriesFrom(ref input, _repeated_nodeStats_codec); + break; + } + case 26: { + threadNames_.AddEntriesFrom(ref input, _map_threadNames_codec); + break; + } + } + } + } + #endif + } - public sealed partial class StepStats : pb::IMessage { + public sealed partial class StepStats : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StepStats()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.StepStatsReflection.Descriptor.MessageTypes[6]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public StepStats() { OnConstruction(); } @@ -1709,12 +2331,14 @@ public StepStats() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public StepStats(StepStats other) : this() { devStats_ = other.devStats_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public StepStats Clone() { return new StepStats(this); } @@ -1725,16 +2349,19 @@ public StepStats Clone() { = pb::FieldCodec.ForMessage(10, global::Tensorflow.DeviceStepStats.Parser); private readonly pbc::RepeatedField devStats_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField DevStats { get { return devStats_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as StepStats); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(StepStats other) { if (ReferenceEquals(other, null)) { return false; @@ -1747,6 +2374,7 @@ public bool Equals(StepStats other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= devStats_.GetHashCode(); @@ -1757,19 +2385,37 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else devStats_.WriteTo(output, _repeated_devStats_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + devStats_.WriteTo(ref output, _repeated_devStats_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += devStats_.CalculateSize(_repeated_devStats_codec); @@ -1780,6 +2426,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(StepStats other) { if (other == null) { return; @@ -1789,7 +2436,11 @@ public void MergeFrom(StepStats other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1802,7 +2453,27 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + devStats_.AddEntriesFrom(ref input, _repeated_devStats_codec); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/Struct.cs b/src/TensorFlowNET.Core/Protobuf/Struct.cs index c0879bc9f..6a2e39f37 100644 --- a/src/TensorFlowNET.Core/Protobuf/Struct.cs +++ b/src/TensorFlowNET.Core/Protobuf/Struct.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/protobuf/struct.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -58,20 +58,21 @@ static StructReflection() { "YW1lGAEgASgJEisKBXNoYXBlGAIgASgLMhwudGVuc29yZmxvdy5UZW5zb3JT", "aGFwZVByb3RvEiMKBWR0eXBlGAMgASgOMhQudGVuc29yZmxvdy5EYXRhVHlw", "ZRIoCgdtaW5pbXVtGAQgASgLMhcudGVuc29yZmxvdy5UZW5zb3JQcm90bxIo", - "CgdtYXhpbXVtGAUgASgLMhcudGVuc29yZmxvdy5UZW5zb3JQcm90byLbAwoN", + "CgdtYXhpbXVtGAUgASgLMhcudGVuc29yZmxvdy5UZW5zb3JQcm90byL4AwoN", "VHlwZVNwZWNQcm90bxJACg90eXBlX3NwZWNfY2xhc3MYASABKA4yJy50ZW5z", "b3JmbG93LlR5cGVTcGVjUHJvdG8uVHlwZVNwZWNDbGFzcxIvCgp0eXBlX3N0", "YXRlGAIgASgLMhsudGVuc29yZmxvdy5TdHJ1Y3R1cmVkVmFsdWUSHAoUdHlw", - "ZV9zcGVjX2NsYXNzX25hbWUYAyABKAkiuAIKDVR5cGVTcGVjQ2xhc3MSCwoH", - "VU5LTk9XThAAEhYKElNQQVJTRV9URU5TT1JfU1BFQxABEhcKE0lOREVYRURf", - "U0xJQ0VTX1NQRUMQAhIWChJSQUdHRURfVEVOU09SX1NQRUMQAxIVChFURU5T", - "T1JfQVJSQVlfU1BFQxAEEhUKEURBVEFfREFUQVNFVF9TUEVDEAUSFgoSREFU", - "QV9JVEVSQVRPUl9TUEVDEAYSEQoNT1BUSU9OQUxfU1BFQxAHEhQKEFBFUl9S", - "RVBMSUNBX1NQRUMQCBIRCg1WQVJJQUJMRV9TUEVDEAkSFgoSUk9XX1BBUlRJ", - "VElPTl9TUEVDEAoSGAoUUkVHSVNURVJFRF9UWVBFX1NQRUMQDBIXChNFWFRF", - "TlNJT05fVFlQRV9TUEVDEA0iBAgLEAtCV1pVZ2l0aHViLmNvbS90ZW5zb3Jm", - "bG93L3RlbnNvcmZsb3cvdGVuc29yZmxvdy9nby9jb3JlL3Byb3RvYnVmL2Zv", - "cl9jb3JlX3Byb3Rvc19nb19wcm90b2IGcHJvdG8z")); + "ZV9zcGVjX2NsYXNzX25hbWUYAyABKAkSGwoTbnVtX2ZsYXRfY29tcG9uZW50", + "cxgEIAEoBSK4AgoNVHlwZVNwZWNDbGFzcxILCgdVTktOT1dOEAASFgoSU1BB", + "UlNFX1RFTlNPUl9TUEVDEAESFwoTSU5ERVhFRF9TTElDRVNfU1BFQxACEhYK", + "ElJBR0dFRF9URU5TT1JfU1BFQxADEhUKEVRFTlNPUl9BUlJBWV9TUEVDEAQS", + "FQoRREFUQV9EQVRBU0VUX1NQRUMQBRIWChJEQVRBX0lURVJBVE9SX1NQRUMQ", + "BhIRCg1PUFRJT05BTF9TUEVDEAcSFAoQUEVSX1JFUExJQ0FfU1BFQxAIEhEK", + "DVZBUklBQkxFX1NQRUMQCRIWChJST1dfUEFSVElUSU9OX1NQRUMQChIYChRS", + "RUdJU1RFUkVEX1RZUEVfU1BFQxAMEhcKE0VYVEVOU0lPTl9UWVBFX1NQRUMQ", + "DSIECAsQC0JXWlVnaXRodWIuY29tL3RlbnNvcmZsb3cvdGVuc29yZmxvdy90", + "ZW5zb3JmbG93L2dvL2NvcmUvcHJvdG9idWYvZm9yX2NvcmVfcHJvdG9zX2dv", + "X3Byb3RvYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Tensorflow.TensorReflection.Descriptor, global::Tensorflow.TensorShapeReflection.Descriptor, global::Tensorflow.TypesReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { @@ -84,7 +85,7 @@ static StructReflection() { new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.NamedTupleValue), global::Tensorflow.NamedTupleValue.Parser, new[]{ "Name", "Values" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.TensorSpecProto), global::Tensorflow.TensorSpecProto.Parser, new[]{ "Name", "Shape", "Dtype" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.BoundedTensorSpecProto), global::Tensorflow.BoundedTensorSpecProto.Parser, new[]{ "Name", "Shape", "Dtype", "Minimum", "Maximum" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.TypeSpecProto), global::Tensorflow.TypeSpecProto.Parser, new[]{ "TypeSpecClass", "TypeState", "TypeSpecClassName" }, null, new[]{ typeof(global::Tensorflow.TypeSpecProto.Types.TypeSpecClass) }, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.TypeSpecProto), global::Tensorflow.TypeSpecProto.Parser, new[]{ "TypeSpecClass", "TypeState", "TypeSpecClassName", "NumFlatComponents" }, null, new[]{ typeof(global::Tensorflow.TypeSpecProto.Types.TypeSpecClass) }, null, null) })); } #endregion @@ -117,23 +118,31 @@ static StructReflection() { /// to serialize all possible function signatures. For example we do not expect /// to pickle generic Python objects, and ideally we'd stay language-agnostic. /// - public sealed partial class StructuredValue : pb::IMessage { + public sealed partial class StructuredValue : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StructuredValue()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.StructReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public StructuredValue() { OnConstruction(); } @@ -141,6 +150,7 @@ public StructuredValue() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public StructuredValue(StructuredValue other) : this() { switch (other.KindCase) { case KindOneofCase.NoneValue: @@ -191,6 +201,7 @@ public StructuredValue(StructuredValue other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public StructuredValue Clone() { return new StructuredValue(this); } @@ -201,6 +212,7 @@ public StructuredValue Clone() { /// Represents None. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.NoneValue NoneValue { get { return kindCase_ == KindOneofCase.NoneValue ? (global::Tensorflow.NoneValue) kind_ : null; } set { @@ -215,6 +227,7 @@ public StructuredValue Clone() { /// Represents a double-precision floating-point value (a Python `float`). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public double Float64Value { get { return kindCase_ == KindOneofCase.Float64Value ? (double) kind_ : 0D; } set { @@ -230,6 +243,7 @@ public double Float64Value { /// Larger values from Python's arbitrary-precision integers are unsupported. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long Int64Value { get { return kindCase_ == KindOneofCase.Int64Value ? (long) kind_ : 0L; } set { @@ -249,6 +263,7 @@ public long Int64Value { /// The obsolescent `unicode` type of Python 2 is not supported here. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string StringValue { get { return kindCase_ == KindOneofCase.StringValue ? (string) kind_ : ""; } set { @@ -263,6 +278,7 @@ public string StringValue { /// Represents a boolean value. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool BoolValue { get { return kindCase_ == KindOneofCase.BoolValue ? (bool) kind_ : false; } set { @@ -277,6 +293,7 @@ public bool BoolValue { /// Represents a TensorShape. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorShapeProto TensorShapeValue { get { return kindCase_ == KindOneofCase.TensorShapeValue ? (global::Tensorflow.TensorShapeProto) kind_ : null; } set { @@ -291,6 +308,7 @@ public bool BoolValue { /// Represents an enum value for dtype. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.DataType TensorDtypeValue { get { return kindCase_ == KindOneofCase.TensorDtypeValue ? (global::Tensorflow.DataType) kind_ : global::Tensorflow.DataType.DtInvalid; } set { @@ -305,6 +323,7 @@ public bool BoolValue { /// Represents a value for tf.TensorSpec. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorSpecProto TensorSpecValue { get { return kindCase_ == KindOneofCase.TensorSpecValue ? (global::Tensorflow.TensorSpecProto) kind_ : null; } set { @@ -319,6 +338,7 @@ public bool BoolValue { /// Represents a value for tf.TypeSpec. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TypeSpecProto TypeSpecValue { get { return kindCase_ == KindOneofCase.TypeSpecValue ? (global::Tensorflow.TypeSpecProto) kind_ : null; } set { @@ -333,6 +353,7 @@ public bool BoolValue { /// Represents a value for tf.BoundedTensorSpec. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.BoundedTensorSpecProto BoundedTensorSpecValue { get { return kindCase_ == KindOneofCase.BoundedTensorSpecValue ? (global::Tensorflow.BoundedTensorSpecProto) kind_ : null; } set { @@ -347,6 +368,7 @@ public bool BoolValue { /// Represents a list of `Value`. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.ListValue ListValue { get { return kindCase_ == KindOneofCase.ListValue ? (global::Tensorflow.ListValue) kind_ : null; } set { @@ -361,6 +383,7 @@ public bool BoolValue { /// Represents a tuple of `Value`. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TupleValue TupleValue { get { return kindCase_ == KindOneofCase.TupleValue ? (global::Tensorflow.TupleValue) kind_ : null; } set { @@ -375,6 +398,7 @@ public bool BoolValue { /// Represents a dict `Value`. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.DictValue DictValue { get { return kindCase_ == KindOneofCase.DictValue ? (global::Tensorflow.DictValue) kind_ : null; } set { @@ -389,6 +413,7 @@ public bool BoolValue { /// Represents Python's namedtuple. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.NamedTupleValue NamedTupleValue { get { return kindCase_ == KindOneofCase.NamedTupleValue ? (global::Tensorflow.NamedTupleValue) kind_ : null; } set { @@ -418,22 +443,26 @@ public enum KindOneofCase { } private KindOneofCase kindCase_ = KindOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public KindOneofCase KindCase { get { return kindCase_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void ClearKind() { kindCase_ = KindOneofCase.None; kind_ = null; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as StructuredValue); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(StructuredValue other) { if (ReferenceEquals(other, null)) { return false; @@ -460,6 +489,7 @@ public bool Equals(StructuredValue other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (kindCase_ == KindOneofCase.NoneValue) hash ^= NoneValue.GetHashCode(); @@ -484,12 +514,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (kindCase_ == KindOneofCase.NoneValue) { output.WriteRawTag(10); output.WriteMessage(NoneValue); @@ -549,9 +584,77 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (kindCase_ == KindOneofCase.NoneValue) { + output.WriteRawTag(10); + output.WriteMessage(NoneValue); + } + if (kindCase_ == KindOneofCase.Float64Value) { + output.WriteRawTag(89); + output.WriteDouble(Float64Value); + } + if (kindCase_ == KindOneofCase.Int64Value) { + output.WriteRawTag(96); + output.WriteSInt64(Int64Value); + } + if (kindCase_ == KindOneofCase.StringValue) { + output.WriteRawTag(106); + output.WriteString(StringValue); + } + if (kindCase_ == KindOneofCase.BoolValue) { + output.WriteRawTag(112); + output.WriteBool(BoolValue); + } + if (kindCase_ == KindOneofCase.TensorShapeValue) { + output.WriteRawTag(250, 1); + output.WriteMessage(TensorShapeValue); + } + if (kindCase_ == KindOneofCase.TensorDtypeValue) { + output.WriteRawTag(128, 2); + output.WriteEnum((int) TensorDtypeValue); + } + if (kindCase_ == KindOneofCase.TensorSpecValue) { + output.WriteRawTag(138, 2); + output.WriteMessage(TensorSpecValue); + } + if (kindCase_ == KindOneofCase.TypeSpecValue) { + output.WriteRawTag(146, 2); + output.WriteMessage(TypeSpecValue); + } + if (kindCase_ == KindOneofCase.BoundedTensorSpecValue) { + output.WriteRawTag(154, 2); + output.WriteMessage(BoundedTensorSpecValue); + } + if (kindCase_ == KindOneofCase.ListValue) { + output.WriteRawTag(154, 3); + output.WriteMessage(ListValue); + } + if (kindCase_ == KindOneofCase.TupleValue) { + output.WriteRawTag(162, 3); + output.WriteMessage(TupleValue); + } + if (kindCase_ == KindOneofCase.DictValue) { + output.WriteRawTag(170, 3); + output.WriteMessage(DictValue); + } + if (kindCase_ == KindOneofCase.NamedTupleValue) { + output.WriteRawTag(178, 3); + output.WriteMessage(NamedTupleValue); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (kindCase_ == KindOneofCase.NoneValue) { @@ -603,6 +706,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(StructuredValue other) { if (other == null) { return; @@ -683,7 +787,11 @@ public void MergeFrom(StructuredValue other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -794,30 +902,156 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + global::Tensorflow.NoneValue subBuilder = new global::Tensorflow.NoneValue(); + if (kindCase_ == KindOneofCase.NoneValue) { + subBuilder.MergeFrom(NoneValue); + } + input.ReadMessage(subBuilder); + NoneValue = subBuilder; + break; + } + case 89: { + Float64Value = input.ReadDouble(); + break; + } + case 96: { + Int64Value = input.ReadSInt64(); + break; + } + case 106: { + StringValue = input.ReadString(); + break; + } + case 112: { + BoolValue = input.ReadBool(); + break; + } + case 250: { + global::Tensorflow.TensorShapeProto subBuilder = new global::Tensorflow.TensorShapeProto(); + if (kindCase_ == KindOneofCase.TensorShapeValue) { + subBuilder.MergeFrom(TensorShapeValue); + } + input.ReadMessage(subBuilder); + TensorShapeValue = subBuilder; + break; + } + case 256: { + kind_ = input.ReadEnum(); + kindCase_ = KindOneofCase.TensorDtypeValue; + break; + } + case 266: { + global::Tensorflow.TensorSpecProto subBuilder = new global::Tensorflow.TensorSpecProto(); + if (kindCase_ == KindOneofCase.TensorSpecValue) { + subBuilder.MergeFrom(TensorSpecValue); + } + input.ReadMessage(subBuilder); + TensorSpecValue = subBuilder; + break; + } + case 274: { + global::Tensorflow.TypeSpecProto subBuilder = new global::Tensorflow.TypeSpecProto(); + if (kindCase_ == KindOneofCase.TypeSpecValue) { + subBuilder.MergeFrom(TypeSpecValue); + } + input.ReadMessage(subBuilder); + TypeSpecValue = subBuilder; + break; + } + case 282: { + global::Tensorflow.BoundedTensorSpecProto subBuilder = new global::Tensorflow.BoundedTensorSpecProto(); + if (kindCase_ == KindOneofCase.BoundedTensorSpecValue) { + subBuilder.MergeFrom(BoundedTensorSpecValue); + } + input.ReadMessage(subBuilder); + BoundedTensorSpecValue = subBuilder; + break; + } + case 410: { + global::Tensorflow.ListValue subBuilder = new global::Tensorflow.ListValue(); + if (kindCase_ == KindOneofCase.ListValue) { + subBuilder.MergeFrom(ListValue); + } + input.ReadMessage(subBuilder); + ListValue = subBuilder; + break; + } + case 418: { + global::Tensorflow.TupleValue subBuilder = new global::Tensorflow.TupleValue(); + if (kindCase_ == KindOneofCase.TupleValue) { + subBuilder.MergeFrom(TupleValue); + } + input.ReadMessage(subBuilder); + TupleValue = subBuilder; + break; + } + case 426: { + global::Tensorflow.DictValue subBuilder = new global::Tensorflow.DictValue(); + if (kindCase_ == KindOneofCase.DictValue) { + subBuilder.MergeFrom(DictValue); + } + input.ReadMessage(subBuilder); + DictValue = subBuilder; + break; + } + case 434: { + global::Tensorflow.NamedTupleValue subBuilder = new global::Tensorflow.NamedTupleValue(); + if (kindCase_ == KindOneofCase.NamedTupleValue) { + subBuilder.MergeFrom(NamedTupleValue); + } + input.ReadMessage(subBuilder); + NamedTupleValue = subBuilder; + break; + } + } + } + } + #endif + } /// /// Represents None. /// - public sealed partial class NoneValue : pb::IMessage { + public sealed partial class NoneValue : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NoneValue()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.StructReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NoneValue() { OnConstruction(); } @@ -825,21 +1059,25 @@ public NoneValue() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NoneValue(NoneValue other) : this() { _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NoneValue Clone() { return new NoneValue(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as NoneValue); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(NoneValue other) { if (ReferenceEquals(other, null)) { return false; @@ -851,6 +1089,7 @@ public bool Equals(NoneValue other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (_unknownFields != null) { @@ -860,18 +1099,35 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (_unknownFields != null) { @@ -881,6 +1137,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(NoneValue other) { if (other == null) { return; @@ -889,7 +1146,11 @@ public void MergeFrom(NoneValue other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -898,30 +1159,54 @@ public void MergeFrom(pb::CodedInputStream input) { break; } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + } /// /// Represents a Python list. /// - public sealed partial class ListValue : pb::IMessage { + public sealed partial class ListValue : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ListValue()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.StructReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ListValue() { OnConstruction(); } @@ -929,12 +1214,14 @@ public ListValue() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ListValue(ListValue other) : this() { values_ = other.values_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ListValue Clone() { return new ListValue(this); } @@ -945,16 +1232,19 @@ public ListValue Clone() { = pb::FieldCodec.ForMessage(10, global::Tensorflow.StructuredValue.Parser); private readonly pbc::RepeatedField values_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Values { get { return values_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as ListValue); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(ListValue other) { if (ReferenceEquals(other, null)) { return false; @@ -967,6 +1257,7 @@ public bool Equals(ListValue other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= values_.GetHashCode(); @@ -977,19 +1268,37 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else values_.WriteTo(output, _repeated_values_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + values_.WriteTo(ref output, _repeated_values_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += values_.CalculateSize(_repeated_values_codec); @@ -1000,6 +1309,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(ListValue other) { if (other == null) { return; @@ -1009,7 +1319,11 @@ public void MergeFrom(ListValue other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1022,30 +1336,58 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + values_.AddEntriesFrom(ref input, _repeated_values_codec); + break; + } + } + } } + #endif } /// /// Represents a Python tuple. /// - public sealed partial class TupleValue : pb::IMessage { + public sealed partial class TupleValue : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TupleValue()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.StructReflection.Descriptor.MessageTypes[3]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TupleValue() { OnConstruction(); } @@ -1053,12 +1395,14 @@ public TupleValue() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TupleValue(TupleValue other) : this() { values_ = other.values_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TupleValue Clone() { return new TupleValue(this); } @@ -1069,16 +1413,19 @@ public TupleValue Clone() { = pb::FieldCodec.ForMessage(10, global::Tensorflow.StructuredValue.Parser); private readonly pbc::RepeatedField values_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Values { get { return values_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as TupleValue); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(TupleValue other) { if (ReferenceEquals(other, null)) { return false; @@ -1091,6 +1438,7 @@ public bool Equals(TupleValue other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= values_.GetHashCode(); @@ -1101,19 +1449,37 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else values_.WriteTo(output, _repeated_values_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + values_.WriteTo(ref output, _repeated_values_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += values_.CalculateSize(_repeated_values_codec); @@ -1124,6 +1490,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(TupleValue other) { if (other == null) { return; @@ -1133,7 +1500,11 @@ public void MergeFrom(TupleValue other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1146,31 +1517,59 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + values_.AddEntriesFrom(ref input, _repeated_values_codec); + break; + } + } + } + } + #endif + } /// /// Represents a Python dict keyed by `str`. /// The comment on Unicode from Value.string_value applies analogously. /// - public sealed partial class DictValue : pb::IMessage { + public sealed partial class DictValue : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DictValue()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.StructReflection.Descriptor.MessageTypes[4]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DictValue() { OnConstruction(); } @@ -1178,12 +1577,14 @@ public DictValue() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DictValue(DictValue other) : this() { fields_ = other.fields_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public DictValue Clone() { return new DictValue(this); } @@ -1194,16 +1595,19 @@ public DictValue Clone() { = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Tensorflow.StructuredValue.Parser), 10); private readonly pbc::MapField fields_ = new pbc::MapField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::MapField Fields { get { return fields_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as DictValue); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(DictValue other) { if (ReferenceEquals(other, null)) { return false; @@ -1216,6 +1620,7 @@ public bool Equals(DictValue other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= Fields.GetHashCode(); @@ -1226,19 +1631,37 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else fields_.WriteTo(output, _map_fields_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + fields_.WriteTo(ref output, _map_fields_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += fields_.CalculateSize(_map_fields_codec); @@ -1249,6 +1672,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(DictValue other) { if (other == null) { return; @@ -1258,7 +1682,11 @@ public void MergeFrom(DictValue other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1271,30 +1699,58 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + fields_.AddEntriesFrom(ref input, _map_fields_codec); + break; + } + } + } + } + #endif + } /// /// Represents a (key, value) pair. /// - public sealed partial class PairValue : pb::IMessage { + public sealed partial class PairValue : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PairValue()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.StructReflection.Descriptor.MessageTypes[5]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public PairValue() { OnConstruction(); } @@ -1302,6 +1758,7 @@ public PairValue() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public PairValue(PairValue other) : this() { key_ = other.key_; value_ = other.value_ != null ? other.value_.Clone() : null; @@ -1309,6 +1766,7 @@ public PairValue(PairValue other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public PairValue Clone() { return new PairValue(this); } @@ -1317,6 +1775,7 @@ public PairValue Clone() { public const int KeyFieldNumber = 1; private string key_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Key { get { return key_; } set { @@ -1328,6 +1787,7 @@ public string Key { public const int ValueFieldNumber = 2; private global::Tensorflow.StructuredValue value_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.StructuredValue Value { get { return value_; } set { @@ -1336,11 +1796,13 @@ public string Key { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as PairValue); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(PairValue other) { if (ReferenceEquals(other, null)) { return false; @@ -1354,6 +1816,7 @@ public bool Equals(PairValue other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Key.Length != 0) hash ^= Key.GetHashCode(); @@ -1365,12 +1828,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Key.Length != 0) { output.WriteRawTag(10); output.WriteString(Key); @@ -1382,9 +1850,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Key.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Key); + } + if (value_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Value); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Key.Length != 0) { @@ -1400,6 +1888,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(PairValue other) { if (other == null) { return; @@ -1417,7 +1906,11 @@ public void MergeFrom(PairValue other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1437,30 +1930,65 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Key = input.ReadString(); + break; + } + case 18: { + if (value_ == null) { + Value = new global::Tensorflow.StructuredValue(); + } + input.ReadMessage(Value); + break; + } + } + } } + #endif } /// /// Represents Python's namedtuple. /// - public sealed partial class NamedTupleValue : pb::IMessage { + public sealed partial class NamedTupleValue : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NamedTupleValue()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.StructReflection.Descriptor.MessageTypes[6]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NamedTupleValue() { OnConstruction(); } @@ -1468,6 +1996,7 @@ public NamedTupleValue() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NamedTupleValue(NamedTupleValue other) : this() { name_ = other.name_; values_ = other.values_.Clone(); @@ -1475,6 +2004,7 @@ public NamedTupleValue(NamedTupleValue other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public NamedTupleValue Clone() { return new NamedTupleValue(this); } @@ -1483,6 +2013,7 @@ public NamedTupleValue Clone() { public const int NameFieldNumber = 1; private string name_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -1496,16 +2027,19 @@ public string Name { = pb::FieldCodec.ForMessage(18, global::Tensorflow.PairValue.Parser); private readonly pbc::RepeatedField values_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Values { get { return values_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as NamedTupleValue); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(NamedTupleValue other) { if (ReferenceEquals(other, null)) { return false; @@ -1519,6 +2053,7 @@ public bool Equals(NamedTupleValue other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -1530,12 +2065,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -1544,9 +2084,26 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + values_.WriteTo(ref output, _repeated_values_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -1560,6 +2117,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(NamedTupleValue other) { if (other == null) { return; @@ -1572,7 +2130,11 @@ public void MergeFrom(NamedTupleValue other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1589,30 +2151,62 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + values_.AddEntriesFrom(ref input, _repeated_values_codec); + break; + } + } + } } + #endif } /// /// A protobuf to represent tf.TensorSpec. /// - public sealed partial class TensorSpecProto : pb::IMessage { + public sealed partial class TensorSpecProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TensorSpecProto()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.StructReflection.Descriptor.MessageTypes[7]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TensorSpecProto() { OnConstruction(); } @@ -1620,6 +2214,7 @@ public TensorSpecProto() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TensorSpecProto(TensorSpecProto other) : this() { name_ = other.name_; shape_ = other.shape_ != null ? other.shape_.Clone() : null; @@ -1628,6 +2223,7 @@ public TensorSpecProto(TensorSpecProto other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TensorSpecProto Clone() { return new TensorSpecProto(this); } @@ -1636,6 +2232,7 @@ public TensorSpecProto Clone() { public const int NameFieldNumber = 1; private string name_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -1647,6 +2244,7 @@ public string Name { public const int ShapeFieldNumber = 2; private global::Tensorflow.TensorShapeProto shape_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorShapeProto Shape { get { return shape_; } set { @@ -1658,6 +2256,7 @@ public string Name { public const int DtypeFieldNumber = 3; private global::Tensorflow.DataType dtype_ = global::Tensorflow.DataType.DtInvalid; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.DataType Dtype { get { return dtype_; } set { @@ -1666,11 +2265,13 @@ public string Name { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as TensorSpecProto); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(TensorSpecProto other) { if (ReferenceEquals(other, null)) { return false; @@ -1685,6 +2286,7 @@ public bool Equals(TensorSpecProto other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -1697,12 +2299,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -1718,9 +2325,33 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (shape_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Shape); + } + if (Dtype != global::Tensorflow.DataType.DtInvalid) { + output.WriteRawTag(24); + output.WriteEnum((int) Dtype); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -1739,6 +2370,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(TensorSpecProto other) { if (other == null) { return; @@ -1759,7 +2391,11 @@ public void MergeFrom(TensorSpecProto other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1783,30 +2419,69 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + if (shape_ == null) { + Shape = new global::Tensorflow.TensorShapeProto(); + } + input.ReadMessage(Shape); + break; + } + case 24: { + Dtype = (global::Tensorflow.DataType) input.ReadEnum(); + break; + } + } + } } + #endif } /// /// A protobuf to represent tf.BoundedTensorSpec. /// - public sealed partial class BoundedTensorSpecProto : pb::IMessage { + public sealed partial class BoundedTensorSpecProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BoundedTensorSpecProto()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.StructReflection.Descriptor.MessageTypes[8]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public BoundedTensorSpecProto() { OnConstruction(); } @@ -1814,6 +2489,7 @@ public BoundedTensorSpecProto() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public BoundedTensorSpecProto(BoundedTensorSpecProto other) : this() { name_ = other.name_; shape_ = other.shape_ != null ? other.shape_.Clone() : null; @@ -1824,6 +2500,7 @@ public BoundedTensorSpecProto(BoundedTensorSpecProto other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public BoundedTensorSpecProto Clone() { return new BoundedTensorSpecProto(this); } @@ -1832,6 +2509,7 @@ public BoundedTensorSpecProto Clone() { public const int NameFieldNumber = 1; private string name_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -1843,6 +2521,7 @@ public string Name { public const int ShapeFieldNumber = 2; private global::Tensorflow.TensorShapeProto shape_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorShapeProto Shape { get { return shape_; } set { @@ -1854,6 +2533,7 @@ public string Name { public const int DtypeFieldNumber = 3; private global::Tensorflow.DataType dtype_ = global::Tensorflow.DataType.DtInvalid; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.DataType Dtype { get { return dtype_; } set { @@ -1865,6 +2545,7 @@ public string Name { public const int MinimumFieldNumber = 4; private global::Tensorflow.TensorProto minimum_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorProto Minimum { get { return minimum_; } set { @@ -1876,6 +2557,7 @@ public string Name { public const int MaximumFieldNumber = 5; private global::Tensorflow.TensorProto maximum_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorProto Maximum { get { return maximum_; } set { @@ -1884,11 +2566,13 @@ public string Name { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as BoundedTensorSpecProto); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(BoundedTensorSpecProto other) { if (ReferenceEquals(other, null)) { return false; @@ -1905,6 +2589,7 @@ public bool Equals(BoundedTensorSpecProto other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -1919,12 +2604,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -1948,9 +2638,41 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (shape_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Shape); + } + if (Dtype != global::Tensorflow.DataType.DtInvalid) { + output.WriteRawTag(24); + output.WriteEnum((int) Dtype); + } + if (minimum_ != null) { + output.WriteRawTag(34); + output.WriteMessage(Minimum); + } + if (maximum_ != null) { + output.WriteRawTag(42); + output.WriteMessage(Maximum); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -1975,6 +2697,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(BoundedTensorSpecProto other) { if (other == null) { return; @@ -2007,7 +2730,11 @@ public void MergeFrom(BoundedTensorSpecProto other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -2045,30 +2772,83 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + if (shape_ == null) { + Shape = new global::Tensorflow.TensorShapeProto(); + } + input.ReadMessage(Shape); + break; + } + case 24: { + Dtype = (global::Tensorflow.DataType) input.ReadEnum(); + break; + } + case 34: { + if (minimum_ == null) { + Minimum = new global::Tensorflow.TensorProto(); + } + input.ReadMessage(Minimum); + break; + } + case 42: { + if (maximum_ == null) { + Maximum = new global::Tensorflow.TensorProto(); + } + input.ReadMessage(Maximum); + break; + } + } + } } + #endif } /// /// Represents a tf.TypeSpec /// - public sealed partial class TypeSpecProto : pb::IMessage { + public sealed partial class TypeSpecProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TypeSpecProto()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.StructReflection.Descriptor.MessageTypes[9]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TypeSpecProto() { OnConstruction(); } @@ -2076,14 +2856,17 @@ public TypeSpecProto() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TypeSpecProto(TypeSpecProto other) : this() { typeSpecClass_ = other.typeSpecClass_; typeState_ = other.typeState_ != null ? other.typeState_.Clone() : null; typeSpecClassName_ = other.typeSpecClassName_; + numFlatComponents_ = other.numFlatComponents_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TypeSpecProto Clone() { return new TypeSpecProto(this); } @@ -2092,6 +2875,7 @@ public TypeSpecProto Clone() { public const int TypeSpecClassFieldNumber = 1; private global::Tensorflow.TypeSpecProto.Types.TypeSpecClass typeSpecClass_ = global::Tensorflow.TypeSpecProto.Types.TypeSpecClass.Unknown; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TypeSpecProto.Types.TypeSpecClass TypeSpecClass { get { return typeSpecClass_; } set { @@ -2106,6 +2890,7 @@ public TypeSpecProto Clone() { /// The value returned by TypeSpec._serialize(). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.StructuredValue TypeState { get { return typeState_; } set { @@ -2121,12 +2906,13 @@ public TypeSpecProto Clone() { /// * If type_spec_class == REGISTERED_TYPE_SPEC, the TypeSpec class is /// the one registered under this name. For types registered outside /// core TensorFlow by an add-on library, that library must be loaded - /// before this value can be deserialized by StructureCoder. + /// before this value can be deserialized by nested_structure_coder. /// * If type_spec_class specifies a particular TypeSpec class, this field is /// redundant with the type_spec_class enum, and is only used for error /// reporting in older binaries that do not know the tupe_spec_class enum. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string TypeSpecClassName { get { return typeSpecClassName_; } set { @@ -2134,12 +2920,29 @@ public string TypeSpecClassName { } } + /// Field number for the "num_flat_components" field. + public const int NumFlatComponentsFieldNumber = 4; + private int numFlatComponents_; + /// + /// The number of flat tensor components required by this TypeSpec. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int NumFlatComponents { + get { return numFlatComponents_; } + set { + numFlatComponents_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as TypeSpecProto); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(TypeSpecProto other) { if (ReferenceEquals(other, null)) { return false; @@ -2150,15 +2953,18 @@ public bool Equals(TypeSpecProto other) { if (TypeSpecClass != other.TypeSpecClass) return false; if (!object.Equals(TypeState, other.TypeState)) return false; if (TypeSpecClassName != other.TypeSpecClassName) return false; + if (NumFlatComponents != other.NumFlatComponents) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (TypeSpecClass != global::Tensorflow.TypeSpecProto.Types.TypeSpecClass.Unknown) hash ^= TypeSpecClass.GetHashCode(); if (typeState_ != null) hash ^= TypeState.GetHashCode(); if (TypeSpecClassName.Length != 0) hash ^= TypeSpecClassName.GetHashCode(); + if (NumFlatComponents != 0) hash ^= NumFlatComponents.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -2166,12 +2972,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (TypeSpecClass != global::Tensorflow.TypeSpecProto.Types.TypeSpecClass.Unknown) { output.WriteRawTag(8); output.WriteEnum((int) TypeSpecClass); @@ -2184,12 +2995,44 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(26); output.WriteString(TypeSpecClassName); } + if (NumFlatComponents != 0) { + output.WriteRawTag(32); + output.WriteInt32(NumFlatComponents); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (TypeSpecClass != global::Tensorflow.TypeSpecProto.Types.TypeSpecClass.Unknown) { + output.WriteRawTag(8); + output.WriteEnum((int) TypeSpecClass); + } + if (typeState_ != null) { + output.WriteRawTag(18); + output.WriteMessage(TypeState); + } + if (TypeSpecClassName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(TypeSpecClassName); + } + if (NumFlatComponents != 0) { + output.WriteRawTag(32); + output.WriteInt32(NumFlatComponents); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (TypeSpecClass != global::Tensorflow.TypeSpecProto.Types.TypeSpecClass.Unknown) { @@ -2201,6 +3044,9 @@ public int CalculateSize() { if (TypeSpecClassName.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(TypeSpecClassName); } + if (NumFlatComponents != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(NumFlatComponents); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -2208,6 +3054,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(TypeSpecProto other) { if (other == null) { return; @@ -2224,11 +3071,18 @@ public void MergeFrom(TypeSpecProto other) { if (other.TypeSpecClassName.Length != 0) { TypeSpecClassName = other.TypeSpecClassName; } + if (other.NumFlatComponents != 0) { + NumFlatComponents = other.NumFlatComponents; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -2250,13 +3104,53 @@ public void MergeFrom(pb::CodedInputStream input) { TypeSpecClassName = input.ReadString(); break; } + case 32: { + NumFlatComponents = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + TypeSpecClass = (global::Tensorflow.TypeSpecProto.Types.TypeSpecClass) input.ReadEnum(); + break; + } + case 18: { + if (typeState_ == null) { + TypeState = new global::Tensorflow.StructuredValue(); + } + input.ReadMessage(TypeState); + break; + } + case 26: { + TypeSpecClassName = input.ReadString(); + break; + } + case 32: { + NumFlatComponents = input.ReadInt32(); + break; + } } } } + #endif #region Nested types /// Container for nested types declared in the TypeSpecProto message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { public enum TypeSpecClass { [pbr::OriginalName("UNKNOWN")] Unknown = 0, diff --git a/src/TensorFlowNET.Core/Protobuf/Summary.cs b/src/TensorFlowNET.Core/Protobuf/Summary.cs index 44ba5cdbc..8f17e8dff 100644 --- a/src/TensorFlowNET.Core/Protobuf/Summary.cs +++ b/src/TensorFlowNET.Core/Protobuf/Summary.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/summary.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -25,41 +25,38 @@ static SummaryReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "Cid0ZW5zb3JmbG93L2NvcmUvZnJhbWV3b3JrL3N1bW1hcnkucHJvdG8SCnRl", - "bnNvcmZsb3caJnRlbnNvcmZsb3cvY29yZS9mcmFtZXdvcmsvdGVuc29yLnBy", - "b3RvIicKElN1bW1hcnlEZXNjcmlwdGlvbhIRCgl0eXBlX2hpbnQYASABKAki", - "hwEKDkhpc3RvZ3JhbVByb3RvEgsKA21pbhgBIAEoARILCgNtYXgYAiABKAES", - "CwoDbnVtGAMgASgBEgsKA3N1bRgEIAEoARITCgtzdW1fc3F1YXJlcxgFIAEo", - "ARIYCgxidWNrZXRfbGltaXQYBiADKAFCAhABEhIKBmJ1Y2tldBgHIAMoAUIC", - "EAEi4AEKD1N1bW1hcnlNZXRhZGF0YRI7CgtwbHVnaW5fZGF0YRgBIAEoCzIm", - "LnRlbnNvcmZsb3cuU3VtbWFyeU1ldGFkYXRhLlBsdWdpbkRhdGESFAoMZGlz", - "cGxheV9uYW1lGAIgASgJEhsKE3N1bW1hcnlfZGVzY3JpcHRpb24YAyABKAkS", - "KQoKZGF0YV9jbGFzcxgEIAEoDjIVLnRlbnNvcmZsb3cuRGF0YUNsYXNzGjIK", - "ClBsdWdpbkRhdGESEwoLcGx1Z2luX25hbWUYASABKAkSDwoHY29udGVudBgC", - "IAEoDCLeBAoHU3VtbWFyeRIoCgV2YWx1ZRgBIAMoCzIZLnRlbnNvcmZsb3cu", - "U3VtbWFyeS5WYWx1ZRpYCgVJbWFnZRIOCgZoZWlnaHQYASABKAUSDQoFd2lk", - "dGgYAiABKAUSEgoKY29sb3JzcGFjZRgDIAEoBRIcChRlbmNvZGVkX2ltYWdl", - "X3N0cmluZxgEIAEoDBp9CgVBdWRpbxITCgtzYW1wbGVfcmF0ZRgBIAEoAhIU", - "CgxudW1fY2hhbm5lbHMYAiABKAMSFQoNbGVuZ3RoX2ZyYW1lcxgDIAEoAxIc", - "ChRlbmNvZGVkX2F1ZGlvX3N0cmluZxgEIAEoDBIUCgxjb250ZW50X3R5cGUY", - "BSABKAkazwIKBVZhbHVlEhEKCW5vZGVfbmFtZRgHIAEoCRILCgN0YWcYASAB", - "KAkSLQoIbWV0YWRhdGEYCSABKAsyGy50ZW5zb3JmbG93LlN1bW1hcnlNZXRh", - "ZGF0YRIWCgxzaW1wbGVfdmFsdWUYAiABKAJIABImChxvYnNvbGV0ZV9vbGRf", - "c3R5bGVfaGlzdG9ncmFtGAMgASgMSAASKgoFaW1hZ2UYBCABKAsyGS50ZW5z", - "b3JmbG93LlN1bW1hcnkuSW1hZ2VIABIrCgVoaXN0bxgFIAEoCzIaLnRlbnNv", - "cmZsb3cuSGlzdG9ncmFtUHJvdG9IABIqCgVhdWRpbxgGIAEoCzIZLnRlbnNv", - "cmZsb3cuU3VtbWFyeS5BdWRpb0gAEikKBnRlbnNvchgIIAEoCzIXLnRlbnNv", - "cmZsb3cuVGVuc29yUHJvdG9IAEIHCgV2YWx1ZSpvCglEYXRhQ2xhc3MSFgoS", - "REFUQV9DTEFTU19VTktOT1dOEAASFQoRREFUQV9DTEFTU19TQ0FMQVIQARIV", - "ChFEQVRBX0NMQVNTX1RFTlNPUhACEhwKGERBVEFfQ0xBU1NfQkxPQl9TRVFV", - "RU5DRRADQn4KGG9yZy50ZW5zb3JmbG93LmZyYW1ld29ya0INU3VtbWFyeVBy", - "b3Rvc1ABWk5naXRodWIuY29tL3RlbnNvcmZsb3cvdGVuc29yZmxvdy90ZW5z", - "b3JmbG93L2dvL2NvcmUvZnJhbWV3b3JrL3N1bW1hcnlfZ29fcHJvdG/4AQFi", - "BnByb3RvMw==")); + "bnNvcmZsb3caJ3RlbnNvcmZsb3cvdHNsL3Byb3RvYnVmL2hpc3RvZ3JhbS5w", + "cm90bxomdGVuc29yZmxvdy9jb3JlL2ZyYW1ld29yay90ZW5zb3IucHJvdG8i", + "JwoSU3VtbWFyeURlc2NyaXB0aW9uEhEKCXR5cGVfaGludBgBIAEoCSLgAQoP", + "U3VtbWFyeU1ldGFkYXRhEjsKC3BsdWdpbl9kYXRhGAEgASgLMiYudGVuc29y", + "Zmxvdy5TdW1tYXJ5TWV0YWRhdGEuUGx1Z2luRGF0YRIUCgxkaXNwbGF5X25h", + "bWUYAiABKAkSGwoTc3VtbWFyeV9kZXNjcmlwdGlvbhgDIAEoCRIpCgpkYXRh", + "X2NsYXNzGAQgASgOMhUudGVuc29yZmxvdy5EYXRhQ2xhc3MaMgoKUGx1Z2lu", + "RGF0YRITCgtwbHVnaW5fbmFtZRgBIAEoCRIPCgdjb250ZW50GAIgASgMIt4E", + "CgdTdW1tYXJ5EigKBXZhbHVlGAEgAygLMhkudGVuc29yZmxvdy5TdW1tYXJ5", + "LlZhbHVlGlgKBUltYWdlEg4KBmhlaWdodBgBIAEoBRINCgV3aWR0aBgCIAEo", + "BRISCgpjb2xvcnNwYWNlGAMgASgFEhwKFGVuY29kZWRfaW1hZ2Vfc3RyaW5n", + "GAQgASgMGn0KBUF1ZGlvEhMKC3NhbXBsZV9yYXRlGAEgASgCEhQKDG51bV9j", + "aGFubmVscxgCIAEoAxIVCg1sZW5ndGhfZnJhbWVzGAMgASgDEhwKFGVuY29k", + "ZWRfYXVkaW9fc3RyaW5nGAQgASgMEhQKDGNvbnRlbnRfdHlwZRgFIAEoCRrP", + "AgoFVmFsdWUSEQoJbm9kZV9uYW1lGAcgASgJEgsKA3RhZxgBIAEoCRItCght", + "ZXRhZGF0YRgJIAEoCzIbLnRlbnNvcmZsb3cuU3VtbWFyeU1ldGFkYXRhEhYK", + "DHNpbXBsZV92YWx1ZRgCIAEoAkgAEiYKHG9ic29sZXRlX29sZF9zdHlsZV9o", + "aXN0b2dyYW0YAyABKAxIABIqCgVpbWFnZRgEIAEoCzIZLnRlbnNvcmZsb3cu", + "U3VtbWFyeS5JbWFnZUgAEisKBWhpc3RvGAUgASgLMhoudGVuc29yZmxvdy5I", + "aXN0b2dyYW1Qcm90b0gAEioKBWF1ZGlvGAYgASgLMhkudGVuc29yZmxvdy5T", + "dW1tYXJ5LkF1ZGlvSAASKQoGdGVuc29yGAggASgLMhcudGVuc29yZmxvdy5U", + "ZW5zb3JQcm90b0gAQgcKBXZhbHVlKm8KCURhdGFDbGFzcxIWChJEQVRBX0NM", + "QVNTX1VOS05PV04QABIVChFEQVRBX0NMQVNTX1NDQUxBUhABEhUKEURBVEFf", + "Q0xBU1NfVEVOU09SEAISHAoYREFUQV9DTEFTU19CTE9CX1NFUVVFTkNFEANC", + "fgoYb3JnLnRlbnNvcmZsb3cuZnJhbWV3b3JrQg1TdW1tYXJ5UHJvdG9zUAFa", + "TmdpdGh1Yi5jb20vdGVuc29yZmxvdy90ZW5zb3JmbG93L3RlbnNvcmZsb3cv", + "Z28vY29yZS9mcmFtZXdvcmsvc3VtbWFyeV9nb19wcm90b/gBAVAAYgZwcm90", + "bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Tensorflow.TensorReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::Tensorflow.HistogramReflection.Descriptor, global::Tensorflow.TensorReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tensorflow.DataClass), }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.SummaryDescription), global::Tensorflow.SummaryDescription.Parser, new[]{ "TypeHint" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.HistogramProto), global::Tensorflow.HistogramProto.Parser, new[]{ "Min", "Max", "Num", "Sum", "SumSquares", "BucketLimit", "Bucket" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.SummaryMetadata), global::Tensorflow.SummaryMetadata.Parser, new[]{ "PluginData", "DisplayName", "SummaryDescription", "DataClass" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.SummaryMetadata.Types.PluginData), global::Tensorflow.SummaryMetadata.Types.PluginData.Parser, new[]{ "PluginName", "Content" }, null, null, null, null)}), new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.Summary), global::Tensorflow.Summary.Parser, new[]{ "Value" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.Summary.Types.Image), global::Tensorflow.Summary.Types.Image.Parser, new[]{ "Height", "Width", "Colorspace", "EncodedImageString" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.Summary.Types.Audio), global::Tensorflow.Summary.Types.Audio.Parser, new[]{ "SampleRate", "NumChannels", "LengthFrames", "EncodedAudioString", "ContentType" }, null, null, null, null), @@ -101,23 +98,31 @@ public enum DataClass { /// /// Metadata associated with a series of Summary data /// - public sealed partial class SummaryDescription : pb::IMessage { + public sealed partial class SummaryDescription : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SummaryDescription()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.SummaryReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SummaryDescription() { OnConstruction(); } @@ -125,12 +130,14 @@ public SummaryDescription() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SummaryDescription(SummaryDescription other) : this() { typeHint_ = other.typeHint_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SummaryDescription Clone() { return new SummaryDescription(this); } @@ -143,6 +150,7 @@ public SummaryDescription Clone() { /// Supported values include "scalar", "histogram", "image", "audio" /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string TypeHint { get { return typeHint_; } set { @@ -151,11 +159,13 @@ public string TypeHint { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as SummaryDescription); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(SummaryDescription other) { if (ReferenceEquals(other, null)) { return false; @@ -168,6 +178,7 @@ public bool Equals(SummaryDescription other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (TypeHint.Length != 0) hash ^= TypeHint.GetHashCode(); @@ -178,12 +189,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (TypeHint.Length != 0) { output.WriteRawTag(10); output.WriteString(TypeHint); @@ -191,9 +207,25 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (TypeHint.Length != 0) { + output.WriteRawTag(10); + output.WriteString(TypeHint); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (TypeHint.Length != 0) { @@ -206,6 +238,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(SummaryDescription other) { if (other == null) { return; @@ -217,7 +250,11 @@ public void MergeFrom(SummaryDescription other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -230,301 +267,27 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } - } - - /// - /// Serialization format for histogram module in - /// core/lib/histogram/histogram.h - /// - public sealed partial class HistogramProto : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HistogramProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Tensorflow.SummaryReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HistogramProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HistogramProto(HistogramProto other) : this() { - min_ = other.min_; - max_ = other.max_; - num_ = other.num_; - sum_ = other.sum_; - sumSquares_ = other.sumSquares_; - bucketLimit_ = other.bucketLimit_.Clone(); - bucket_ = other.bucket_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HistogramProto Clone() { - return new HistogramProto(this); - } - - /// Field number for the "min" field. - public const int MinFieldNumber = 1; - private double min_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double Min { - get { return min_; } - set { - min_ = value; - } - } - - /// Field number for the "max" field. - public const int MaxFieldNumber = 2; - private double max_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double Max { - get { return max_; } - set { - max_ = value; - } - } - - /// Field number for the "num" field. - public const int NumFieldNumber = 3; - private double num_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double Num { - get { return num_; } - set { - num_ = value; - } - } - - /// Field number for the "sum" field. - public const int SumFieldNumber = 4; - private double sum_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double Sum { - get { return sum_; } - set { - sum_ = value; - } - } - - /// Field number for the "sum_squares" field. - public const int SumSquaresFieldNumber = 5; - private double sumSquares_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public double SumSquares { - get { return sumSquares_; } - set { - sumSquares_ = value; - } - } - - /// Field number for the "bucket_limit" field. - public const int BucketLimitFieldNumber = 6; - private static readonly pb::FieldCodec _repeated_bucketLimit_codec - = pb::FieldCodec.ForDouble(50); - private readonly pbc::RepeatedField bucketLimit_ = new pbc::RepeatedField(); - /// - /// Parallel arrays encoding the bucket boundaries and the bucket values. - /// bucket(i) is the count for the bucket i. The range for - /// a bucket is: - /// i == 0: -DBL_MAX .. bucket_limit(0) - /// i != 0: bucket_limit(i-1) .. bucket_limit(i) - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField BucketLimit { - get { return bucketLimit_; } - } - - /// Field number for the "bucket" field. - public const int BucketFieldNumber = 7; - private static readonly pb::FieldCodec _repeated_bucket_codec - = pb::FieldCodec.ForDouble(58); - private readonly pbc::RepeatedField bucket_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Bucket { - get { return bucket_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as HistogramProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(HistogramProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Min, other.Min)) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Max, other.Max)) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Num, other.Num)) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(Sum, other.Sum)) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(SumSquares, other.SumSquares)) return false; - if(!bucketLimit_.Equals(other.bucketLimit_)) return false; - if(!bucket_.Equals(other.bucket_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Min != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Min); - if (Max != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Max); - if (Num != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Num); - if (Sum != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Sum); - if (SumSquares != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(SumSquares); - hash ^= bucketLimit_.GetHashCode(); - hash ^= bucket_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Min != 0D) { - output.WriteRawTag(9); - output.WriteDouble(Min); - } - if (Max != 0D) { - output.WriteRawTag(17); - output.WriteDouble(Max); - } - if (Num != 0D) { - output.WriteRawTag(25); - output.WriteDouble(Num); - } - if (Sum != 0D) { - output.WriteRawTag(33); - output.WriteDouble(Sum); - } - if (SumSquares != 0D) { - output.WriteRawTag(41); - output.WriteDouble(SumSquares); - } - bucketLimit_.WriteTo(output, _repeated_bucketLimit_codec); - bucket_.WriteTo(output, _repeated_bucket_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Min != 0D) { - size += 1 + 8; - } - if (Max != 0D) { - size += 1 + 8; - } - if (Num != 0D) { - size += 1 + 8; - } - if (Sum != 0D) { - size += 1 + 8; - } - if (SumSquares != 0D) { - size += 1 + 8; - } - size += bucketLimit_.CalculateSize(_repeated_bucketLimit_codec); - size += bucket_.CalculateSize(_repeated_bucket_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(HistogramProto other) { - if (other == null) { - return; - } - if (other.Min != 0D) { - Min = other.Min; - } - if (other.Max != 0D) { - Max = other.Max; - } - if (other.Num != 0D) { - Num = other.Num; - } - if (other.Sum != 0D) { - Sum = other.Sum; - } - if (other.SumSquares != 0D) { - SumSquares = other.SumSquares; - } - bucketLimit_.Add(other.bucketLimit_); - bucket_.Add(other.bucket_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 9: { - Min = input.ReadDouble(); - break; - } - case 17: { - Max = input.ReadDouble(); - break; - } - case 25: { - Num = input.ReadDouble(); - break; - } - case 33: { - Sum = input.ReadDouble(); + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; - } - case 41: { - SumSquares = input.ReadDouble(); - break; - } - case 50: - case 49: { - bucketLimit_.AddEntriesFrom(input, _repeated_bucketLimit_codec); - break; - } - case 58: - case 57: { - bucket_.AddEntriesFrom(input, _repeated_bucket_codec); + case 10: { + TypeHint = input.ReadString(); break; } } } } + #endif } @@ -532,23 +295,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// A SummaryMetadata encapsulates information on which plugins are able to make /// use of a certain summary value. /// - public sealed partial class SummaryMetadata : pb::IMessage { + public sealed partial class SummaryMetadata : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SummaryMetadata()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Tensorflow.SummaryReflection.Descriptor.MessageTypes[2]; } + get { return global::Tensorflow.SummaryReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SummaryMetadata() { OnConstruction(); } @@ -556,6 +327,7 @@ public SummaryMetadata() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SummaryMetadata(SummaryMetadata other) : this() { pluginData_ = other.pluginData_ != null ? other.pluginData_.Clone() : null; displayName_ = other.displayName_; @@ -565,6 +337,7 @@ public SummaryMetadata(SummaryMetadata other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SummaryMetadata Clone() { return new SummaryMetadata(this); } @@ -576,6 +349,7 @@ public SummaryMetadata Clone() { /// Data that associates a summary with a certain plugin. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.SummaryMetadata.Types.PluginData PluginData { get { return pluginData_; } set { @@ -590,6 +364,7 @@ public SummaryMetadata Clone() { /// Display name for viewing in TensorBoard. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string DisplayName { get { return displayName_; } set { @@ -604,6 +379,7 @@ public string DisplayName { /// Longform readable description of the summary sequence. Markdown supported. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string SummaryDescription { get { return summaryDescription_; } set { @@ -621,6 +397,7 @@ public string SummaryDescription { /// values. See `DataClass` docs for details. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.DataClass DataClass { get { return dataClass_; } set { @@ -629,11 +406,13 @@ public string SummaryDescription { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as SummaryMetadata); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(SummaryMetadata other) { if (ReferenceEquals(other, null)) { return false; @@ -649,6 +428,7 @@ public bool Equals(SummaryMetadata other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (pluginData_ != null) hash ^= PluginData.GetHashCode(); @@ -662,12 +442,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (pluginData_ != null) { output.WriteRawTag(10); output.WriteMessage(PluginData); @@ -687,9 +472,37 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (pluginData_ != null) { + output.WriteRawTag(10); + output.WriteMessage(PluginData); + } + if (DisplayName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(DisplayName); + } + if (SummaryDescription.Length != 0) { + output.WriteRawTag(26); + output.WriteString(SummaryDescription); + } + if (DataClass != global::Tensorflow.DataClass.Unknown) { + output.WriteRawTag(32); + output.WriteEnum((int) DataClass); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (pluginData_ != null) { @@ -711,6 +524,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(SummaryMetadata other) { if (other == null) { return; @@ -734,7 +548,11 @@ public void MergeFrom(SummaryMetadata other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -762,29 +580,73 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (pluginData_ == null) { + PluginData = new global::Tensorflow.SummaryMetadata.Types.PluginData(); + } + input.ReadMessage(PluginData); + break; + } + case 18: { + DisplayName = input.ReadString(); + break; + } + case 26: { + SummaryDescription = input.ReadString(); + break; + } + case 32: { + DataClass = (global::Tensorflow.DataClass) input.ReadEnum(); + break; + } + } + } } + #endif #region Nested types /// Container for nested types declared in the SummaryMetadata message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { - public sealed partial class PluginData : pb::IMessage { + public sealed partial class PluginData : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PluginData()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.SummaryMetadata.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public PluginData() { OnConstruction(); } @@ -792,6 +654,7 @@ public PluginData() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public PluginData(PluginData other) : this() { pluginName_ = other.pluginName_; content_ = other.content_; @@ -799,6 +662,7 @@ public PluginData(PluginData other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public PluginData Clone() { return new PluginData(this); } @@ -810,6 +674,7 @@ public PluginData Clone() { /// The name of the plugin this data pertains to. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string PluginName { get { return pluginName_; } set { @@ -825,6 +690,7 @@ public string PluginName { /// a binary serialized protocol buffer. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pb::ByteString Content { get { return content_; } set { @@ -833,11 +699,13 @@ public string PluginName { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as PluginData); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(PluginData other) { if (ReferenceEquals(other, null)) { return false; @@ -851,6 +719,7 @@ public bool Equals(PluginData other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (PluginName.Length != 0) hash ^= PluginName.GetHashCode(); @@ -862,12 +731,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (PluginName.Length != 0) { output.WriteRawTag(10); output.WriteString(PluginName); @@ -879,9 +753,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (PluginName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(PluginName); + } + if (Content.Length != 0) { + output.WriteRawTag(18); + output.WriteBytes(Content); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (PluginName.Length != 0) { @@ -897,6 +791,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(PluginData other) { if (other == null) { return; @@ -911,7 +806,11 @@ public void MergeFrom(PluginData other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -928,7 +827,31 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + PluginName = input.ReadString(); + break; + } + case 18: { + Content = input.ReadBytes(); + break; + } + } + } } + #endif } @@ -945,23 +868,31 @@ public void MergeFrom(pb::CodedInputStream input) { /// the "summary_interval_secs" attribute of the training operation. /// Summaries are also produced at the end of an evaluation. /// - public sealed partial class Summary : pb::IMessage { + public sealed partial class Summary : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Summary()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Tensorflow.SummaryReflection.Descriptor.MessageTypes[3]; } + get { return global::Tensorflow.SummaryReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Summary() { OnConstruction(); } @@ -969,12 +900,14 @@ public Summary() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Summary(Summary other) : this() { value_ = other.value_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Summary Clone() { return new Summary(this); } @@ -988,16 +921,19 @@ public Summary Clone() { /// Set of values for the summary. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Value { get { return value_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as Summary); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(Summary other) { if (ReferenceEquals(other, null)) { return false; @@ -1010,6 +946,7 @@ public bool Equals(Summary other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= value_.GetHashCode(); @@ -1020,19 +957,37 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else value_.WriteTo(output, _repeated_value_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + value_.WriteTo(ref output, _repeated_value_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += value_.CalculateSize(_repeated_value_codec); @@ -1043,6 +998,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(Summary other) { if (other == null) { return; @@ -1052,7 +1008,11 @@ public void MergeFrom(Summary other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1065,29 +1025,58 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + value_.AddEntriesFrom(ref input, _repeated_value_codec); + break; + } + } + } } + #endif #region Nested types /// Container for nested types declared in the Summary message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { - public sealed partial class Image : pb::IMessage { + public sealed partial class Image : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Image()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.Summary.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Image() { OnConstruction(); } @@ -1095,6 +1084,7 @@ public Image() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Image(Image other) : this() { height_ = other.height_; width_ = other.width_; @@ -1104,6 +1094,7 @@ public Image(Image other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Image Clone() { return new Image(this); } @@ -1115,6 +1106,7 @@ public Image Clone() { /// Dimensions of the image. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int Height { get { return height_; } set { @@ -1126,6 +1118,7 @@ public int Height { public const int WidthFieldNumber = 2; private int width_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int Width { get { return width_; } set { @@ -1146,6 +1139,7 @@ public int Width { /// 6 - BGRA /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int Colorspace { get { return colorspace_; } set { @@ -1161,6 +1155,7 @@ public int Colorspace { /// image_codec::CoderUtil can be stored here. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pb::ByteString EncodedImageString { get { return encodedImageString_; } set { @@ -1169,11 +1164,13 @@ public int Colorspace { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as Image); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(Image other) { if (ReferenceEquals(other, null)) { return false; @@ -1189,6 +1186,7 @@ public bool Equals(Image other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Height != 0) hash ^= Height.GetHashCode(); @@ -1202,12 +1200,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Height != 0) { output.WriteRawTag(8); output.WriteInt32(Height); @@ -1227,9 +1230,37 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Height != 0) { + output.WriteRawTag(8); + output.WriteInt32(Height); + } + if (Width != 0) { + output.WriteRawTag(16); + output.WriteInt32(Width); + } + if (Colorspace != 0) { + output.WriteRawTag(24); + output.WriteInt32(Colorspace); + } + if (EncodedImageString.Length != 0) { + output.WriteRawTag(34); + output.WriteBytes(EncodedImageString); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Height != 0) { @@ -1251,6 +1282,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(Image other) { if (other == null) { return; @@ -1271,7 +1303,11 @@ public void MergeFrom(Image other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1296,27 +1332,67 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Height = input.ReadInt32(); + break; + } + case 16: { + Width = input.ReadInt32(); + break; + } + case 24: { + Colorspace = input.ReadInt32(); + break; + } + case 34: { + EncodedImageString = input.ReadBytes(); + break; + } + } + } + } + #endif + } - public sealed partial class Audio : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public float SampleRate { get { return sampleRate_; } set { @@ -1359,6 +1438,7 @@ public float SampleRate { /// Number of channels of audio. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long NumChannels { get { return numChannels_; } set { @@ -1373,6 +1453,7 @@ public long NumChannels { /// Length of the audio in frames (samples per channel). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long LengthFrames { get { return lengthFrames_; } set { @@ -1388,6 +1469,7 @@ public long LengthFrames { /// "audio/wav"). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pb::ByteString EncodedAudioString { get { return encodedAudioString_; } set { @@ -1399,6 +1481,7 @@ public long LengthFrames { public const int ContentTypeFieldNumber = 5; private string contentType_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string ContentType { get { return contentType_; } set { @@ -1407,11 +1490,13 @@ public string ContentType { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as Audio); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(Audio other) { if (ReferenceEquals(other, null)) { return false; @@ -1428,6 +1513,7 @@ public bool Equals(Audio other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (SampleRate != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(SampleRate); @@ -1442,12 +1528,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (SampleRate != 0F) { output.WriteRawTag(13); output.WriteFloat(SampleRate); @@ -1471,9 +1562,41 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (SampleRate != 0F) { + output.WriteRawTag(13); + output.WriteFloat(SampleRate); + } + if (NumChannels != 0L) { + output.WriteRawTag(16); + output.WriteInt64(NumChannels); + } + if (LengthFrames != 0L) { + output.WriteRawTag(24); + output.WriteInt64(LengthFrames); + } + if (EncodedAudioString.Length != 0) { + output.WriteRawTag(34); + output.WriteBytes(EncodedAudioString); + } + if (ContentType.Length != 0) { + output.WriteRawTag(42); + output.WriteString(ContentType); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (SampleRate != 0F) { @@ -1498,6 +1621,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(Audio other) { if (other == null) { return; @@ -1521,7 +1645,11 @@ public void MergeFrom(Audio other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1550,27 +1678,71 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 13: { + SampleRate = input.ReadFloat(); + break; + } + case 16: { + NumChannels = input.ReadInt64(); + break; + } + case 24: { + LengthFrames = input.ReadInt64(); + break; + } + case 34: { + EncodedAudioString = input.ReadBytes(); + break; + } + case 42: { + ContentType = input.ReadString(); + break; + } + } + } } + #endif } - public sealed partial class Value : pb::IMessage { + public sealed partial class Value : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Value()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.Summary.Descriptor.NestedTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Value() { OnConstruction(); } @@ -1578,6 +1750,7 @@ public Value() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Value(Value other) : this() { nodeName_ = other.nodeName_; tag_ = other.tag_; @@ -1607,6 +1780,7 @@ public Value(Value other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Value Clone() { return new Value(this); } @@ -1618,6 +1792,7 @@ public Value Clone() { /// This field is deprecated and will not be set. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string NodeName { get { return nodeName_; } set { @@ -1634,6 +1809,7 @@ public string NodeName { /// hierarchy). For example: foo/bar/0 /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Tag { get { return tag_; } set { @@ -1652,6 +1828,7 @@ public string Tag { /// tags are associated with which plugins. This saves space. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.SummaryMetadata Metadata { get { return metadata_; } set { @@ -1662,6 +1839,7 @@ public string Tag { /// Field number for the "simple_value" field. public const int SimpleValueFieldNumber = 2; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public float SimpleValue { get { return valueCase_ == ValueOneofCase.SimpleValue ? (float) value_ : 0F; } set { @@ -1673,6 +1851,7 @@ public float SimpleValue { /// Field number for the "obsolete_old_style_histogram" field. public const int ObsoleteOldStyleHistogramFieldNumber = 3; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pb::ByteString ObsoleteOldStyleHistogram { get { return valueCase_ == ValueOneofCase.ObsoleteOldStyleHistogram ? (pb::ByteString) value_ : pb::ByteString.Empty; } set { @@ -1684,6 +1863,7 @@ public float SimpleValue { /// Field number for the "image" field. public const int ImageFieldNumber = 4; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.Summary.Types.Image Image { get { return valueCase_ == ValueOneofCase.Image ? (global::Tensorflow.Summary.Types.Image) value_ : null; } set { @@ -1695,6 +1875,7 @@ public float SimpleValue { /// Field number for the "histo" field. public const int HistoFieldNumber = 5; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.HistogramProto Histo { get { return valueCase_ == ValueOneofCase.Histo ? (global::Tensorflow.HistogramProto) value_ : null; } set { @@ -1706,6 +1887,7 @@ public float SimpleValue { /// Field number for the "audio" field. public const int AudioFieldNumber = 6; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.Summary.Types.Audio Audio { get { return valueCase_ == ValueOneofCase.Audio ? (global::Tensorflow.Summary.Types.Audio) value_ : null; } set { @@ -1717,6 +1899,7 @@ public float SimpleValue { /// Field number for the "tensor" field. public const int TensorFieldNumber = 8; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorProto Tensor { get { return valueCase_ == ValueOneofCase.Tensor ? (global::Tensorflow.TensorProto) value_ : null; } set { @@ -1738,22 +1921,26 @@ public enum ValueOneofCase { } private ValueOneofCase valueCase_ = ValueOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ValueOneofCase ValueCase { get { return valueCase_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void ClearValue() { valueCase_ = ValueOneofCase.None; value_ = null; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as Value); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(Value other) { if (ReferenceEquals(other, null)) { return false; @@ -1775,6 +1962,7 @@ public bool Equals(Value other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (NodeName.Length != 0) hash ^= NodeName.GetHashCode(); @@ -1794,12 +1982,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Tag.Length != 0) { output.WriteRawTag(10); output.WriteString(Tag); @@ -1839,9 +2032,57 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Tag.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Tag); + } + if (valueCase_ == ValueOneofCase.SimpleValue) { + output.WriteRawTag(21); + output.WriteFloat(SimpleValue); + } + if (valueCase_ == ValueOneofCase.ObsoleteOldStyleHistogram) { + output.WriteRawTag(26); + output.WriteBytes(ObsoleteOldStyleHistogram); + } + if (valueCase_ == ValueOneofCase.Image) { + output.WriteRawTag(34); + output.WriteMessage(Image); + } + if (valueCase_ == ValueOneofCase.Histo) { + output.WriteRawTag(42); + output.WriteMessage(Histo); + } + if (valueCase_ == ValueOneofCase.Audio) { + output.WriteRawTag(50); + output.WriteMessage(Audio); + } + if (NodeName.Length != 0) { + output.WriteRawTag(58); + output.WriteString(NodeName); + } + if (valueCase_ == ValueOneofCase.Tensor) { + output.WriteRawTag(66); + output.WriteMessage(Tensor); + } + if (metadata_ != null) { + output.WriteRawTag(74); + output.WriteMessage(Metadata); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (NodeName.Length != 0) { @@ -1878,6 +2119,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(Value other) { if (other == null) { return; @@ -1931,7 +2173,11 @@ public void MergeFrom(Value other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -1999,7 +2245,82 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Tag = input.ReadString(); + break; + } + case 21: { + SimpleValue = input.ReadFloat(); + break; + } + case 26: { + ObsoleteOldStyleHistogram = input.ReadBytes(); + break; + } + case 34: { + global::Tensorflow.Summary.Types.Image subBuilder = new global::Tensorflow.Summary.Types.Image(); + if (valueCase_ == ValueOneofCase.Image) { + subBuilder.MergeFrom(Image); + } + input.ReadMessage(subBuilder); + Image = subBuilder; + break; + } + case 42: { + global::Tensorflow.HistogramProto subBuilder = new global::Tensorflow.HistogramProto(); + if (valueCase_ == ValueOneofCase.Histo) { + subBuilder.MergeFrom(Histo); + } + input.ReadMessage(subBuilder); + Histo = subBuilder; + break; + } + case 50: { + global::Tensorflow.Summary.Types.Audio subBuilder = new global::Tensorflow.Summary.Types.Audio(); + if (valueCase_ == ValueOneofCase.Audio) { + subBuilder.MergeFrom(Audio); + } + input.ReadMessage(subBuilder); + Audio = subBuilder; + break; + } + case 58: { + NodeName = input.ReadString(); + break; + } + case 66: { + global::Tensorflow.TensorProto subBuilder = new global::Tensorflow.TensorProto(); + if (valueCase_ == ValueOneofCase.Tensor) { + subBuilder.MergeFrom(Tensor); + } + input.ReadMessage(subBuilder); + Tensor = subBuilder; + break; + } + case 74: { + if (metadata_ == null) { + Metadata = new global::Tensorflow.SummaryMetadata(); + } + input.ReadMessage(Metadata); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/Tensor.cs b/src/TensorFlowNET.Core/Protobuf/Tensor.cs index 1ab871331..2ec07ac40 100644 --- a/src/TensorFlowNET.Core/Protobuf/Tensor.cs +++ b/src/TensorFlowNET.Core/Protobuf/Tensor.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/tensor.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -60,23 +60,31 @@ static TensorReflection() { /// /// Protocol buffer representing a tensor. /// - public sealed partial class TensorProto : pb::IMessage { + public sealed partial class TensorProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TensorProto()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.TensorReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TensorProto() { OnConstruction(); } @@ -84,6 +92,7 @@ public TensorProto() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TensorProto(TensorProto other) : this() { dtype_ = other.dtype_; tensorShape_ = other.tensorShape_ != null ? other.tensorShape_.Clone() : null; @@ -106,6 +115,7 @@ public TensorProto(TensorProto other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TensorProto Clone() { return new TensorProto(this); } @@ -114,6 +124,7 @@ public TensorProto Clone() { public const int DtypeFieldNumber = 1; private global::Tensorflow.DataType dtype_ = global::Tensorflow.DataType.DtInvalid; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.DataType Dtype { get { return dtype_; } set { @@ -128,6 +139,7 @@ public TensorProto Clone() { /// Shape of the tensor. TODO(touts): sort out the 0-rank issues. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorShapeProto TensorShape { get { return tensorShape_; } set { @@ -146,6 +158,7 @@ public TensorProto Clone() { /// to represent a constant Tensor with a single value. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int VersionNumber { get { return versionNumber_; } set { @@ -164,6 +177,7 @@ public int VersionNumber { /// many repeated small items. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pb::ByteString TensorContent { get { return tensorContent_; } set { @@ -181,6 +195,7 @@ public int VersionNumber { /// have some pointless zero padding for each value here. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField HalfVal { get { return halfVal_; } } @@ -194,6 +209,7 @@ public int VersionNumber { /// DT_FLOAT. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField FloatVal { get { return floatVal_; } } @@ -207,6 +223,7 @@ public int VersionNumber { /// DT_DOUBLE. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField DoubleVal { get { return doubleVal_; } } @@ -220,6 +237,7 @@ public int VersionNumber { /// DT_INT32, DT_INT16, DT_UINT16, DT_INT8, DT_UINT8. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField IntVal { get { return intVal_; } } @@ -233,6 +251,7 @@ public int VersionNumber { /// DT_STRING /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField StringVal { get { return stringVal_; } } @@ -247,6 +266,7 @@ public int VersionNumber { /// and imaginary parts of i-th single precision complex. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField ScomplexVal { get { return scomplexVal_; } } @@ -260,6 +280,7 @@ public int VersionNumber { /// DT_INT64 /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Int64Val { get { return int64Val_; } } @@ -273,6 +294,7 @@ public int VersionNumber { /// DT_BOOL /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField BoolVal { get { return boolVal_; } } @@ -287,6 +309,7 @@ public int VersionNumber { /// and imaginary parts of i-th double precision complex. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField DcomplexVal { get { return dcomplexVal_; } } @@ -300,6 +323,7 @@ public int VersionNumber { /// DT_RESOURCE /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField ResourceHandleVal { get { return resourceHandleVal_; } } @@ -313,6 +337,7 @@ public int VersionNumber { /// DT_VARIANT /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField VariantVal { get { return variantVal_; } } @@ -326,6 +351,7 @@ public int VersionNumber { /// DT_UINT32 /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Uint32Val { get { return uint32Val_; } } @@ -339,16 +365,19 @@ public int VersionNumber { /// DT_UINT64 /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Uint64Val { get { return uint64Val_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as TensorProto); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(TensorProto other) { if (ReferenceEquals(other, null)) { return false; @@ -377,6 +406,7 @@ public bool Equals(TensorProto other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Dtype != global::Tensorflow.DataType.DtInvalid) hash ^= Dtype.GetHashCode(); @@ -403,12 +433,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Dtype != global::Tensorflow.DataType.DtInvalid) { output.WriteRawTag(8); output.WriteEnum((int) Dtype); @@ -441,9 +476,50 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Dtype != global::Tensorflow.DataType.DtInvalid) { + output.WriteRawTag(8); + output.WriteEnum((int) Dtype); + } + if (tensorShape_ != null) { + output.WriteRawTag(18); + output.WriteMessage(TensorShape); + } + if (VersionNumber != 0) { + output.WriteRawTag(24); + output.WriteInt32(VersionNumber); + } + if (TensorContent.Length != 0) { + output.WriteRawTag(34); + output.WriteBytes(TensorContent); + } + floatVal_.WriteTo(ref output, _repeated_floatVal_codec); + doubleVal_.WriteTo(ref output, _repeated_doubleVal_codec); + intVal_.WriteTo(ref output, _repeated_intVal_codec); + stringVal_.WriteTo(ref output, _repeated_stringVal_codec); + scomplexVal_.WriteTo(ref output, _repeated_scomplexVal_codec); + int64Val_.WriteTo(ref output, _repeated_int64Val_codec); + boolVal_.WriteTo(ref output, _repeated_boolVal_codec); + dcomplexVal_.WriteTo(ref output, _repeated_dcomplexVal_codec); + halfVal_.WriteTo(ref output, _repeated_halfVal_codec); + resourceHandleVal_.WriteTo(ref output, _repeated_resourceHandleVal_codec); + variantVal_.WriteTo(ref output, _repeated_variantVal_codec); + uint32Val_.WriteTo(ref output, _repeated_uint32Val_codec); + uint64Val_.WriteTo(ref output, _repeated_uint64Val_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Dtype != global::Tensorflow.DataType.DtInvalid) { @@ -478,6 +554,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(TensorProto other) { if (other == null) { return; @@ -514,7 +591,11 @@ public void MergeFrom(TensorProto other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -604,30 +685,135 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Dtype = (global::Tensorflow.DataType) input.ReadEnum(); + break; + } + case 18: { + if (tensorShape_ == null) { + TensorShape = new global::Tensorflow.TensorShapeProto(); + } + input.ReadMessage(TensorShape); + break; + } + case 24: { + VersionNumber = input.ReadInt32(); + break; + } + case 34: { + TensorContent = input.ReadBytes(); + break; + } + case 42: + case 45: { + floatVal_.AddEntriesFrom(ref input, _repeated_floatVal_codec); + break; + } + case 50: + case 49: { + doubleVal_.AddEntriesFrom(ref input, _repeated_doubleVal_codec); + break; + } + case 58: + case 56: { + intVal_.AddEntriesFrom(ref input, _repeated_intVal_codec); + break; + } + case 66: { + stringVal_.AddEntriesFrom(ref input, _repeated_stringVal_codec); + break; + } + case 74: + case 77: { + scomplexVal_.AddEntriesFrom(ref input, _repeated_scomplexVal_codec); + break; + } + case 82: + case 80: { + int64Val_.AddEntriesFrom(ref input, _repeated_int64Val_codec); + break; + } + case 90: + case 88: { + boolVal_.AddEntriesFrom(ref input, _repeated_boolVal_codec); + break; + } + case 98: + case 97: { + dcomplexVal_.AddEntriesFrom(ref input, _repeated_dcomplexVal_codec); + break; + } + case 106: + case 104: { + halfVal_.AddEntriesFrom(ref input, _repeated_halfVal_codec); + break; + } + case 114: { + resourceHandleVal_.AddEntriesFrom(ref input, _repeated_resourceHandleVal_codec); + break; + } + case 122: { + variantVal_.AddEntriesFrom(ref input, _repeated_variantVal_codec); + break; + } + case 130: + case 128: { + uint32Val_.AddEntriesFrom(ref input, _repeated_uint32Val_codec); + break; + } + case 138: + case 136: { + uint64Val_.AddEntriesFrom(ref input, _repeated_uint64Val_codec); + break; + } + } + } + } + #endif + } /// /// Protocol buffer representing the serialization format of DT_VARIANT tensors. /// - public sealed partial class VariantTensorDataProto : pb::IMessage { + public sealed partial class VariantTensorDataProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new VariantTensorDataProto()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.TensorReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public VariantTensorDataProto() { OnConstruction(); } @@ -635,6 +821,7 @@ public VariantTensorDataProto() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public VariantTensorDataProto(VariantTensorDataProto other) : this() { typeName_ = other.typeName_; metadata_ = other.metadata_; @@ -643,6 +830,7 @@ public VariantTensorDataProto(VariantTensorDataProto other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public VariantTensorDataProto Clone() { return new VariantTensorDataProto(this); } @@ -654,6 +842,7 @@ public VariantTensorDataProto Clone() { /// Name of the type of objects being serialized. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string TypeName { get { return typeName_; } set { @@ -668,6 +857,7 @@ public string TypeName { /// Portions of the object that are not Tensors. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pb::ByteString Metadata { get { return metadata_; } set { @@ -684,16 +874,19 @@ public string TypeName { /// Tensors contained within objects being serialized. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Tensors { get { return tensors_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as VariantTensorDataProto); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(VariantTensorDataProto other) { if (ReferenceEquals(other, null)) { return false; @@ -708,6 +901,7 @@ public bool Equals(VariantTensorDataProto other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (TypeName.Length != 0) hash ^= TypeName.GetHashCode(); @@ -720,12 +914,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (TypeName.Length != 0) { output.WriteRawTag(10); output.WriteString(TypeName); @@ -738,9 +937,30 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (TypeName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(TypeName); + } + if (Metadata.Length != 0) { + output.WriteRawTag(18); + output.WriteBytes(Metadata); + } + tensors_.WriteTo(ref output, _repeated_tensors_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (TypeName.Length != 0) { @@ -757,6 +977,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(VariantTensorDataProto other) { if (other == null) { return; @@ -772,7 +993,11 @@ public void MergeFrom(VariantTensorDataProto other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -793,7 +1018,35 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + TypeName = input.ReadString(); + break; + } + case 18: { + Metadata = input.ReadBytes(); + break; + } + case 26: { + tensors_.AddEntriesFrom(ref input, _repeated_tensors_codec); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/TensorDescription.cs b/src/TensorFlowNET.Core/Protobuf/TensorDescription.cs index 0af197687..81b170abe 100644 --- a/src/TensorFlowNET.Core/Protobuf/TensorDescription.cs +++ b/src/TensorFlowNET.Core/Protobuf/TensorDescription.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/tensor_description.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -46,23 +46,31 @@ static TensorDescriptionReflection() { } #region Messages - public sealed partial class TensorDescription : pb::IMessage { + public sealed partial class TensorDescription : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TensorDescription()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.TensorDescriptionReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TensorDescription() { OnConstruction(); } @@ -70,6 +78,7 @@ public TensorDescription() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TensorDescription(TensorDescription other) : this() { dtype_ = other.dtype_; shape_ = other.shape_ != null ? other.shape_.Clone() : null; @@ -78,6 +87,7 @@ public TensorDescription(TensorDescription other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TensorDescription Clone() { return new TensorDescription(this); } @@ -89,6 +99,7 @@ public TensorDescription Clone() { /// Data type of tensor elements /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.DataType Dtype { get { return dtype_; } set { @@ -103,6 +114,7 @@ public TensorDescription Clone() { /// Shape of the tensor. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.TensorShapeProto Shape { get { return shape_; } set { @@ -117,6 +129,7 @@ public TensorDescription Clone() { /// Information about the size and allocator used for the data /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.AllocationDescription AllocationDescription { get { return allocationDescription_; } set { @@ -125,11 +138,13 @@ public TensorDescription Clone() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as TensorDescription); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(TensorDescription other) { if (ReferenceEquals(other, null)) { return false; @@ -144,6 +159,7 @@ public bool Equals(TensorDescription other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Dtype != global::Tensorflow.DataType.DtInvalid) hash ^= Dtype.GetHashCode(); @@ -156,12 +172,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Dtype != global::Tensorflow.DataType.DtInvalid) { output.WriteRawTag(8); output.WriteEnum((int) Dtype); @@ -177,9 +198,33 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Dtype != global::Tensorflow.DataType.DtInvalid) { + output.WriteRawTag(8); + output.WriteEnum((int) Dtype); + } + if (shape_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Shape); + } + if (allocationDescription_ != null) { + output.WriteRawTag(34); + output.WriteMessage(AllocationDescription); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Dtype != global::Tensorflow.DataType.DtInvalid) { @@ -198,6 +243,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(TensorDescription other) { if (other == null) { return; @@ -221,7 +267,11 @@ public void MergeFrom(TensorDescription other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -248,7 +298,41 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Dtype = (global::Tensorflow.DataType) input.ReadEnum(); + break; + } + case 18: { + if (shape_ == null) { + Shape = new global::Tensorflow.TensorShapeProto(); + } + input.ReadMessage(Shape); + break; + } + case 34: { + if (allocationDescription_ == null) { + AllocationDescription = new global::Tensorflow.AllocationDescription(); + } + input.ReadMessage(AllocationDescription); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/TensorShape.cs b/src/TensorFlowNET.Core/Protobuf/TensorShape.cs index dec408f5d..e22ed820b 100644 --- a/src/TensorFlowNET.Core/Protobuf/TensorShape.cs +++ b/src/TensorFlowNET.Core/Protobuf/TensorShape.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/tensor_shape.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -45,23 +45,31 @@ static TensorShapeReflection() { /// /// Dimensions of a tensor. /// - public sealed partial class TensorShapeProto : pb::IMessage { + public sealed partial class TensorShapeProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TensorShapeProto()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.TensorShapeReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TensorShapeProto() { OnConstruction(); } @@ -69,6 +77,7 @@ public TensorShapeProto() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TensorShapeProto(TensorShapeProto other) : this() { dim_ = other.dim_.Clone(); unknownRank_ = other.unknownRank_; @@ -76,6 +85,7 @@ public TensorShapeProto(TensorShapeProto other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TensorShapeProto Clone() { return new TensorShapeProto(this); } @@ -101,6 +111,7 @@ public TensorShapeProto Clone() { /// If "dim.size()" > 0, "unknown_rank" must be false. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Dim { get { return dim_; } } @@ -114,6 +125,7 @@ public TensorShapeProto Clone() { /// If true, "dim.size()" must be 0. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool UnknownRank { get { return unknownRank_; } set { @@ -122,11 +134,13 @@ public bool UnknownRank { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as TensorShapeProto); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(TensorShapeProto other) { if (ReferenceEquals(other, null)) { return false; @@ -140,6 +154,7 @@ public bool Equals(TensorShapeProto other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= dim_.GetHashCode(); @@ -151,12 +166,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else dim_.WriteTo(output, _repeated_dim_codec); if (UnknownRank != false) { output.WriteRawTag(24); @@ -165,9 +185,26 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + dim_.WriteTo(ref output, _repeated_dim_codec); + if (UnknownRank != false) { + output.WriteRawTag(24); + output.WriteBool(UnknownRank); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += dim_.CalculateSize(_repeated_dim_codec); @@ -181,6 +218,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(TensorShapeProto other) { if (other == null) { return; @@ -193,7 +231,11 @@ public void MergeFrom(TensorShapeProto other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -210,32 +252,65 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 18: { + dim_.AddEntriesFrom(ref input, _repeated_dim_codec); + break; + } + case 24: { + UnknownRank = input.ReadBool(); + break; + } + } + } + } + #endif + #region Nested types /// Container for nested types declared in the TensorShapeProto message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { /// /// One dimension of the tensor. /// - public sealed partial class Dim : pb::IMessage { + public sealed partial class Dim : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Dim()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.TensorShapeProto.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Dim() { OnConstruction(); } @@ -243,6 +318,7 @@ public Dim() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Dim(Dim other) : this() { size_ = other.size_; name_ = other.name_; @@ -250,6 +326,7 @@ public Dim(Dim other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Dim Clone() { return new Dim(this); } @@ -265,6 +342,7 @@ public Dim Clone() { /// a TensorShapeProto containing a dim value of -1. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long Size { get { return size_; } set { @@ -279,6 +357,7 @@ public long Size { /// Optional name of the tensor dimension. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -287,11 +366,13 @@ public string Name { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as Dim); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(Dim other) { if (ReferenceEquals(other, null)) { return false; @@ -305,6 +386,7 @@ public bool Equals(Dim other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Size != 0L) hash ^= Size.GetHashCode(); @@ -316,12 +398,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Size != 0L) { output.WriteRawTag(8); output.WriteInt64(Size); @@ -333,9 +420,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Size != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Size); + } + if (Name.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Name); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Size != 0L) { @@ -351,6 +458,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(Dim other) { if (other == null) { return; @@ -365,7 +473,11 @@ public void MergeFrom(Dim other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -382,7 +494,31 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Size = input.ReadInt64(); + break; + } + case 18: { + Name = input.ReadString(); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/TensorSlice.cs b/src/TensorFlowNET.Core/Protobuf/TensorSlice.cs index fe505f715..cf1c44d35 100644 --- a/src/TensorFlowNET.Core/Protobuf/TensorSlice.cs +++ b/src/TensorFlowNET.Core/Protobuf/TensorSlice.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/tensor_slice.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -45,23 +45,31 @@ static TensorSliceReflection() { /// /// Can only be interpreted if you know the corresponding TensorShape. /// - public sealed partial class TensorSliceProto : pb::IMessage { + public sealed partial class TensorSliceProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TensorSliceProto()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.TensorSliceReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TensorSliceProto() { OnConstruction(); } @@ -69,12 +77,14 @@ public TensorSliceProto() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TensorSliceProto(TensorSliceProto other) : this() { extent_ = other.extent_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TensorSliceProto Clone() { return new TensorSliceProto(this); } @@ -92,16 +102,19 @@ public TensorSliceProto Clone() { /// dimensions in the TensorShape. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Extent { get { return extent_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as TensorSliceProto); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(TensorSliceProto other) { if (ReferenceEquals(other, null)) { return false; @@ -114,6 +127,7 @@ public bool Equals(TensorSliceProto other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= extent_.GetHashCode(); @@ -124,19 +138,37 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else extent_.WriteTo(output, _repeated_extent_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + extent_.WriteTo(ref output, _repeated_extent_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += extent_.CalculateSize(_repeated_extent_codec); @@ -147,6 +179,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(TensorSliceProto other) { if (other == null) { return; @@ -156,7 +189,11 @@ public void MergeFrom(TensorSliceProto other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -169,32 +206,61 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + extent_.AddEntriesFrom(ref input, _repeated_extent_codec); + break; + } + } + } + } + #endif + #region Nested types /// Container for nested types declared in the TensorSliceProto message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { /// /// Extent of the slice in one dimension. /// - public sealed partial class Extent : pb::IMessage { + public sealed partial class Extent : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Extent()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.TensorSliceProto.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Extent() { OnConstruction(); } @@ -202,6 +268,7 @@ public Extent() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Extent(Extent other) : this() { start_ = other.start_; switch (other.HasLengthCase) { @@ -214,6 +281,7 @@ public Extent(Extent other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public Extent Clone() { return new Extent(this); } @@ -225,6 +293,7 @@ public Extent Clone() { /// Start index of the slice, starting at 0. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long Start { get { return start_; } set { @@ -235,6 +304,7 @@ public long Start { /// Field number for the "length" field. public const int LengthFieldNumber = 2; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long Length { get { return hasLengthCase_ == HasLengthOneofCase.Length ? (long) hasLength_ : 0L; } set { @@ -251,22 +321,26 @@ public enum HasLengthOneofCase { } private HasLengthOneofCase hasLengthCase_ = HasLengthOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public HasLengthOneofCase HasLengthCase { get { return hasLengthCase_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void ClearHasLength() { hasLengthCase_ = HasLengthOneofCase.None; hasLength_ = null; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as Extent); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(Extent other) { if (ReferenceEquals(other, null)) { return false; @@ -281,6 +355,7 @@ public bool Equals(Extent other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Start != 0L) hash ^= Start.GetHashCode(); @@ -293,12 +368,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Start != 0L) { output.WriteRawTag(8); output.WriteInt64(Start); @@ -310,9 +390,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Start != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Start); + } + if (hasLengthCase_ == HasLengthOneofCase.Length) { + output.WriteRawTag(16); + output.WriteInt64(Length); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Start != 0L) { @@ -328,6 +428,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(Extent other) { if (other == null) { return; @@ -345,7 +446,11 @@ public void MergeFrom(Extent other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -362,7 +467,31 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Start = input.ReadInt64(); + break; + } + case 16: { + Length = input.ReadInt64(); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/TrackableObjectGraph.cs b/src/TensorFlowNET.Core/Protobuf/TrackableObjectGraph.cs index fb197eca2..89bc07521 100644 --- a/src/TensorFlowNET.Core/Protobuf/TrackableObjectGraph.cs +++ b/src/TensorFlowNET.Core/Protobuf/TrackableObjectGraph.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/protobuf/trackable_object_graph.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -25,53 +25,66 @@ static TrackableObjectGraphReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CjV0ZW5zb3JmbG93L2NvcmUvcHJvdG9idWYvdHJhY2thYmxlX29iamVjdF9n", - "cmFwaC5wcm90bxIKdGVuc29yZmxvdyKDBQoUVHJhY2thYmxlT2JqZWN0R3Jh", - "cGgSPwoFbm9kZXMYASADKAsyMC50ZW5zb3JmbG93LlRyYWNrYWJsZU9iamVj", - "dEdyYXBoLlRyYWNrYWJsZU9iamVjdBqpBAoPVHJhY2thYmxlT2JqZWN0ElIK", - "CGNoaWxkcmVuGAEgAygLMkAudGVuc29yZmxvdy5UcmFja2FibGVPYmplY3RH", - "cmFwaC5UcmFja2FibGVPYmplY3QuT2JqZWN0UmVmZXJlbmNlElUKCmF0dHJp", - "YnV0ZXMYAiADKAsyQS50ZW5zb3JmbG93LlRyYWNrYWJsZU9iamVjdEdyYXBo", - "LlRyYWNrYWJsZU9iamVjdC5TZXJpYWxpemVkVGVuc29yEl4KDnNsb3RfdmFy", - "aWFibGVzGAMgAygLMkYudGVuc29yZmxvdy5UcmFja2FibGVPYmplY3RHcmFw", - "aC5UcmFja2FibGVPYmplY3QuU2xvdFZhcmlhYmxlUmVmZXJlbmNlGjYKD09i", - "amVjdFJlZmVyZW5jZRIPCgdub2RlX2lkGAEgASgFEhIKCmxvY2FsX25hbWUY", - "AiABKAkaZQoQU2VyaWFsaXplZFRlbnNvchIMCgRuYW1lGAEgASgJEhEKCWZ1", - "bGxfbmFtZRgCIAEoCRIWCg5jaGVja3BvaW50X2tleRgDIAEoCRIYChBvcHRp", - "b25hbF9yZXN0b3JlGAQgASgIGmwKFVNsb3RWYXJpYWJsZVJlZmVyZW5jZRIh", - "ChlvcmlnaW5hbF92YXJpYWJsZV9ub2RlX2lkGAEgASgFEhEKCXNsb3RfbmFt", - "ZRgCIAEoCRIdChVzbG90X3ZhcmlhYmxlX25vZGVfaWQYAyABKAVCWlpVZ2l0", - "aHViLmNvbS90ZW5zb3JmbG93L3RlbnNvcmZsb3cvdGVuc29yZmxvdy9nby9j", - "b3JlL3Byb3RvYnVmL2Zvcl9jb3JlX3Byb3Rvc19nb19wcm90b/gBAWIGcHJv", - "dG8z")); + "cmFwaC5wcm90bxIKdGVuc29yZmxvdxoeZ29vZ2xlL3Byb3RvYnVmL3dyYXBw", + "ZXJzLnByb3RvIvMFChRUcmFja2FibGVPYmplY3RHcmFwaBI/CgVub2RlcxgB", + "IAMoCzIwLnRlbnNvcmZsb3cuVHJhY2thYmxlT2JqZWN0R3JhcGguVHJhY2th", + "YmxlT2JqZWN0GpkFCg9UcmFja2FibGVPYmplY3QSUgoIY2hpbGRyZW4YASAD", + "KAsyQC50ZW5zb3JmbG93LlRyYWNrYWJsZU9iamVjdEdyYXBoLlRyYWNrYWJs", + "ZU9iamVjdC5PYmplY3RSZWZlcmVuY2USVQoKYXR0cmlidXRlcxgCIAMoCzJB", + "LnRlbnNvcmZsb3cuVHJhY2thYmxlT2JqZWN0R3JhcGguVHJhY2thYmxlT2Jq", + "ZWN0LlNlcmlhbGl6ZWRUZW5zb3ISXgoOc2xvdF92YXJpYWJsZXMYAyADKAsy", + "Ri50ZW5zb3JmbG93LlRyYWNrYWJsZU9iamVjdEdyYXBoLlRyYWNrYWJsZU9i", + "amVjdC5TbG90VmFyaWFibGVSZWZlcmVuY2USNQoQcmVnaXN0ZXJlZF9zYXZl", + "chgEIAEoCzIbLnRlbnNvcmZsb3cuUmVnaXN0ZXJlZFNhdmVyEjkKFWhhc19j", + "aGVja3BvaW50X3ZhbHVlcxgFIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5Cb29s", + "VmFsdWUaNgoPT2JqZWN0UmVmZXJlbmNlEg8KB25vZGVfaWQYASABKAUSEgoK", + "bG9jYWxfbmFtZRgCIAEoCRpjChBTZXJpYWxpemVkVGVuc29yEgwKBG5hbWUY", + "ASABKAkSEQoJZnVsbF9uYW1lGAIgASgJEhYKDmNoZWNrcG9pbnRfa2V5GAMg", + "ASgJSgQIBBAFUhBvcHRpb25hbF9yZXN0b3JlGmwKFVNsb3RWYXJpYWJsZVJl", + "ZmVyZW5jZRIhChlvcmlnaW5hbF92YXJpYWJsZV9ub2RlX2lkGAEgASgFEhEK", + "CXNsb3RfbmFtZRgCIAEoCRIdChVzbG90X3ZhcmlhYmxlX25vZGVfaWQYAyAB", + "KAUiNAoPUmVnaXN0ZXJlZFNhdmVyEgwKBG5hbWUYASABKAkSEwoLb2JqZWN0", + "X25hbWUYAiABKAlCWlpVZ2l0aHViLmNvbS90ZW5zb3JmbG93L3RlbnNvcmZs", + "b3cvdGVuc29yZmxvdy9nby9jb3JlL3Byb3RvYnVmL2Zvcl9jb3JlX3Byb3Rv", + "c19nb19wcm90b/gBAWIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, + new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.TrackableObjectGraph), global::Tensorflow.TrackableObjectGraph.Parser, new[]{ "Nodes" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.TrackableObjectGraph.Types.TrackableObject), global::Tensorflow.TrackableObjectGraph.Types.TrackableObject.Parser, new[]{ "Children", "Attributes", "SlotVariables" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.TrackableObjectGraph.Types.TrackableObject.Types.ObjectReference), global::Tensorflow.TrackableObjectGraph.Types.TrackableObject.Types.ObjectReference.Parser, new[]{ "NodeId", "LocalName" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.TrackableObjectGraph.Types.TrackableObject.Types.SerializedTensor), global::Tensorflow.TrackableObjectGraph.Types.TrackableObject.Types.SerializedTensor.Parser, new[]{ "Name", "FullName", "CheckpointKey", "OptionalRestore" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.TrackableObjectGraph.Types.TrackableObject.Types.SlotVariableReference), global::Tensorflow.TrackableObjectGraph.Types.TrackableObject.Types.SlotVariableReference.Parser, new[]{ "OriginalVariableNodeId", "SlotName", "SlotVariableNodeId" }, null, null, null, null)})}) + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.TrackableObjectGraph), global::Tensorflow.TrackableObjectGraph.Parser, new[]{ "Nodes" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.TrackableObjectGraph.Types.TrackableObject), global::Tensorflow.TrackableObjectGraph.Types.TrackableObject.Parser, new[]{ "Children", "Attributes", "SlotVariables", "RegisteredSaver", "HasCheckpointValues" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.TrackableObjectGraph.Types.TrackableObject.Types.ObjectReference), global::Tensorflow.TrackableObjectGraph.Types.TrackableObject.Types.ObjectReference.Parser, new[]{ "NodeId", "LocalName" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.TrackableObjectGraph.Types.TrackableObject.Types.SerializedTensor), global::Tensorflow.TrackableObjectGraph.Types.TrackableObject.Types.SerializedTensor.Parser, new[]{ "Name", "FullName", "CheckpointKey" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.TrackableObjectGraph.Types.TrackableObject.Types.SlotVariableReference), global::Tensorflow.TrackableObjectGraph.Types.TrackableObject.Types.SlotVariableReference.Parser, new[]{ "OriginalVariableNodeId", "SlotName", "SlotVariableNodeId" }, null, null, null, null)})}), + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.RegisteredSaver), global::Tensorflow.RegisteredSaver.Parser, new[]{ "Name", "ObjectName" }, null, null, null, null) })); } #endregion } #region Messages - public sealed partial class TrackableObjectGraph : pb::IMessage { + public sealed partial class TrackableObjectGraph : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TrackableObjectGraph()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.TrackableObjectGraphReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TrackableObjectGraph() { OnConstruction(); } @@ -79,12 +92,14 @@ public TrackableObjectGraph() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TrackableObjectGraph(TrackableObjectGraph other) : this() { nodes_ = other.nodes_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TrackableObjectGraph Clone() { return new TrackableObjectGraph(this); } @@ -95,16 +110,19 @@ public TrackableObjectGraph Clone() { = pb::FieldCodec.ForMessage(10, global::Tensorflow.TrackableObjectGraph.Types.TrackableObject.Parser); private readonly pbc::RepeatedField nodes_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Nodes { get { return nodes_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as TrackableObjectGraph); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(TrackableObjectGraph other) { if (ReferenceEquals(other, null)) { return false; @@ -117,6 +135,7 @@ public bool Equals(TrackableObjectGraph other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= nodes_.GetHashCode(); @@ -127,19 +146,37 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else nodes_.WriteTo(output, _repeated_nodes_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + nodes_.WriteTo(ref output, _repeated_nodes_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += nodes_.CalculateSize(_repeated_nodes_codec); @@ -150,6 +187,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(TrackableObjectGraph other) { if (other == null) { return; @@ -159,7 +197,11 @@ public void MergeFrom(TrackableObjectGraph other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -172,60 +214,77 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + nodes_.AddEntriesFrom(ref input, _repeated_nodes_codec); + break; + } + } + } + } + #endif + #region Nested types /// Container for nested types declared in the TrackableObjectGraph message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { - public sealed partial class TrackableObject : pb::IMessage { + public sealed partial class TrackableObject : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TrackableObject()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.TrackableObjectGraph.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TrackableObject() { OnConstruction(); } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TrackableObject(pbc::RepeatedField slot) { - OnConstruction(); - slotVariables_ = slot; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TrackableObject(pbc::RepeatedField slot, - pbc::RepeatedField children - ) - { - OnConstruction(); - slotVariables_ = slot; - children_ = children; - } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TrackableObject(TrackableObject other) : this() { children_ = other.children_.Clone(); attributes_ = other.attributes_.Clone(); slotVariables_ = other.slotVariables_.Clone(); + registeredSaver_ = other.registeredSaver_ != null ? other.registeredSaver_.Clone() : null; + HasCheckpointValues = other.HasCheckpointValues; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public TrackableObject Clone() { return new TrackableObject(this); } @@ -239,6 +298,7 @@ public TrackableObject Clone() { /// Objects which this object depends on. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Children { get { return children_; } } @@ -252,6 +312,7 @@ public TrackableObject Clone() { /// Serialized data specific to this object. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField Attributes { get { return attributes_; } } @@ -265,16 +326,55 @@ public TrackableObject Clone() { /// Slot variables owned by this object. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField SlotVariables { get { return slotVariables_; } } + /// Field number for the "registered_saver" field. + public const int RegisteredSaverFieldNumber = 4; + private global::Tensorflow.RegisteredSaver registeredSaver_; + /// + /// The registered saver used to save this object. If this saver is not + /// present when loading the checkpoint, then loading will fail. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.RegisteredSaver RegisteredSaver { + get { return registeredSaver_; } + set { + registeredSaver_ = value; + } + } + + /// Field number for the "has_checkpoint_values" field. + public const int HasCheckpointValuesFieldNumber = 5; + private static readonly pb::FieldCodec _single_hasCheckpointValues_codec = pb::FieldCodec.ForStructWrapper(42); + private bool? hasCheckpointValues_; + /// + /// Whether this object has checkpoint values or descendants with checkpoint + /// values. This is computed at save time to avoid traversing the entire + /// object graph proto when restoring (which also has to traverse the live + /// object graph). + /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool? HasCheckpointValues { + get { return hasCheckpointValues_; } + set { + hasCheckpointValues_ = value; + } + } + + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as TrackableObject); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(TrackableObject other) { if (ReferenceEquals(other, null)) { return false; @@ -285,15 +385,20 @@ public bool Equals(TrackableObject other) { if(!children_.Equals(other.children_)) return false; if(!attributes_.Equals(other.attributes_)) return false; if(!slotVariables_.Equals(other.slotVariables_)) return false; + if (!object.Equals(RegisteredSaver, other.RegisteredSaver)) return false; + if (HasCheckpointValues != other.HasCheckpointValues) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; hash ^= children_.GetHashCode(); hash ^= attributes_.GetHashCode(); hash ^= slotVariables_.GetHashCode(); + if (registeredSaver_ != null) hash ^= RegisteredSaver.GetHashCode(); + if (hasCheckpointValues_ != null) hash ^= HasCheckpointValues.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -301,26 +406,66 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else children_.WriteTo(output, _repeated_children_codec); attributes_.WriteTo(output, _repeated_attributes_codec); slotVariables_.WriteTo(output, _repeated_slotVariables_codec); + if (registeredSaver_ != null) { + output.WriteRawTag(34); + output.WriteMessage(RegisteredSaver); + } + if (hasCheckpointValues_ != null) { + _single_hasCheckpointValues_codec.WriteTagAndValue(output, HasCheckpointValues); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + children_.WriteTo(ref output, _repeated_children_codec); + attributes_.WriteTo(ref output, _repeated_attributes_codec); + slotVariables_.WriteTo(ref output, _repeated_slotVariables_codec); + if (registeredSaver_ != null) { + output.WriteRawTag(34); + output.WriteMessage(RegisteredSaver); + } + if (hasCheckpointValues_ != null) { + _single_hasCheckpointValues_codec.WriteTagAndValue(ref output, HasCheckpointValues); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; size += children_.CalculateSize(_repeated_children_codec); size += attributes_.CalculateSize(_repeated_attributes_codec); size += slotVariables_.CalculateSize(_repeated_slotVariables_codec); + if (registeredSaver_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegisteredSaver); + } + if (hasCheckpointValues_ != null) { + size += _single_hasCheckpointValues_codec.CalculateSizeWithTag(HasCheckpointValues); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -328,6 +473,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(TrackableObject other) { if (other == null) { return; @@ -335,11 +481,26 @@ public void MergeFrom(TrackableObject other) { children_.Add(other.children_); attributes_.Add(other.attributes_); slotVariables_.Add(other.slotVariables_); + if (other.registeredSaver_ != null) { + if (registeredSaver_ == null) { + RegisteredSaver = new global::Tensorflow.RegisteredSaver(); + } + RegisteredSaver.MergeFrom(other.RegisteredSaver); + } + if (other.hasCheckpointValues_ != null) { + if (hasCheckpointValues_ == null || other.HasCheckpointValues != false) { + HasCheckpointValues = other.HasCheckpointValues; + } + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -358,31 +519,96 @@ public void MergeFrom(pb::CodedInputStream input) { slotVariables_.AddEntriesFrom(input, _repeated_slotVariables_codec); break; } + case 34: { + if (registeredSaver_ == null) { + RegisteredSaver = new global::Tensorflow.RegisteredSaver(); + } + input.ReadMessage(RegisteredSaver); + break; + } + case 42: { + bool? value = _single_hasCheckpointValues_codec.Read(input); + if (hasCheckpointValues_ == null || value != false) { + HasCheckpointValues = value; + } + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + children_.AddEntriesFrom(ref input, _repeated_children_codec); + break; + } + case 18: { + attributes_.AddEntriesFrom(ref input, _repeated_attributes_codec); + break; + } + case 26: { + slotVariables_.AddEntriesFrom(ref input, _repeated_slotVariables_codec); + break; + } + case 34: { + if (registeredSaver_ == null) { + RegisteredSaver = new global::Tensorflow.RegisteredSaver(); + } + input.ReadMessage(RegisteredSaver); + break; + } + case 42: { + bool? value = _single_hasCheckpointValues_codec.Read(ref input); + if (hasCheckpointValues_ == null || value != false) { + HasCheckpointValues = value; + } + break; + } } } } + #endif #region Nested types /// Container for nested types declared in the TrackableObject message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { - public sealed partial class ObjectReference : pb::IMessage { + public sealed partial class ObjectReference : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ObjectReference()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.TrackableObjectGraph.Types.TrackableObject.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ObjectReference() { OnConstruction(); } @@ -390,6 +616,7 @@ public ObjectReference() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ObjectReference(ObjectReference other) : this() { nodeId_ = other.nodeId_; localName_ = other.localName_; @@ -397,6 +624,7 @@ public ObjectReference(ObjectReference other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ObjectReference Clone() { return new ObjectReference(this); } @@ -409,6 +637,7 @@ public ObjectReference Clone() { /// being referenced. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int NodeId { get { return nodeId_; } set { @@ -423,6 +652,7 @@ public int NodeId { /// A user-provided name for the edge. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string LocalName { get { return localName_; } set { @@ -431,11 +661,13 @@ public string LocalName { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as ObjectReference); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(ObjectReference other) { if (ReferenceEquals(other, null)) { return false; @@ -449,6 +681,7 @@ public bool Equals(ObjectReference other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (NodeId != 0) hash ^= NodeId.GetHashCode(); @@ -460,12 +693,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (NodeId != 0) { output.WriteRawTag(8); output.WriteInt32(NodeId); @@ -477,9 +715,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (NodeId != 0) { + output.WriteRawTag(8); + output.WriteInt32(NodeId); + } + if (LocalName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(LocalName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (NodeId != 0) { @@ -495,6 +753,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(ObjectReference other) { if (other == null) { return; @@ -509,7 +768,11 @@ public void MergeFrom(ObjectReference other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -526,27 +789,59 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + NodeId = input.ReadInt32(); + break; + } + case 18: { + LocalName = input.ReadString(); + break; + } + } + } } + #endif } - public sealed partial class SerializedTensor : pb::IMessage { + public sealed partial class SerializedTensor : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SerializedTensor()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.TrackableObjectGraph.Types.TrackableObject.Descriptor.NestedTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SerializedTensor() { OnConstruction(); } @@ -554,15 +849,16 @@ public SerializedTensor() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SerializedTensor(SerializedTensor other) : this() { name_ = other.name_; fullName_ = other.fullName_; checkpointKey_ = other.checkpointKey_; - optionalRestore_ = other.optionalRestore_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SerializedTensor Clone() { return new SerializedTensor(this); } @@ -576,6 +872,7 @@ public SerializedTensor Clone() { /// be restored on object creation as an optimization. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string Name { get { return name_; } set { @@ -593,6 +890,7 @@ public string Name { /// assigned by tf.train.Saver. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string FullName { get { return fullName_; } set { @@ -607,6 +905,7 @@ public string FullName { /// The generated name of the Tensor in the checkpoint. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string CheckpointKey { get { return checkpointKey_; } set { @@ -614,28 +913,14 @@ public string CheckpointKey { } } - /// Field number for the "optional_restore" field. - public const int OptionalRestoreFieldNumber = 4; - private bool optionalRestore_; - /// - /// Whether checkpoints should be considered as matching even without this - /// value restored. Used for non-critical values which don't affect the - /// TensorFlow graph, such as layer configurations. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool OptionalRestore { - get { return optionalRestore_; } - set { - optionalRestore_ = value; - } - } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as SerializedTensor); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(SerializedTensor other) { if (ReferenceEquals(other, null)) { return false; @@ -646,17 +931,16 @@ public bool Equals(SerializedTensor other) { if (Name != other.Name) return false; if (FullName != other.FullName) return false; if (CheckpointKey != other.CheckpointKey) return false; - if (OptionalRestore != other.OptionalRestore) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); if (FullName.Length != 0) hash ^= FullName.GetHashCode(); if (CheckpointKey.Length != 0) hash ^= CheckpointKey.GetHashCode(); - if (OptionalRestore != false) hash ^= OptionalRestore.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -664,12 +948,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); @@ -682,16 +971,36 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(26); output.WriteString(CheckpointKey); } - if (OptionalRestore != false) { - output.WriteRawTag(32); - output.WriteBool(OptionalRestore); - } if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (FullName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(FullName); + } + if (CheckpointKey.Length != 0) { + output.WriteRawTag(26); + output.WriteString(CheckpointKey); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -703,9 +1012,6 @@ public int CalculateSize() { if (CheckpointKey.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(CheckpointKey); } - if (OptionalRestore != false) { - size += 1 + 1; - } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -713,6 +1019,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(SerializedTensor other) { if (other == null) { return; @@ -726,14 +1033,15 @@ public void MergeFrom(SerializedTensor other) { if (other.CheckpointKey.Length != 0) { CheckpointKey = other.CheckpointKey; } - if (other.OptionalRestore != false) { - OptionalRestore = other.OptionalRestore; - } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -752,33 +1060,65 @@ public void MergeFrom(pb::CodedInputStream input) { CheckpointKey = input.ReadString(); break; } - case 32: { - OptionalRestore = input.ReadBool(); + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + FullName = input.ReadString(); + break; + } + case 26: { + CheckpointKey = input.ReadString(); break; } } } } + #endif } - public sealed partial class SlotVariableReference : pb::IMessage { + public sealed partial class SlotVariableReference : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SlotVariableReference()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.TrackableObjectGraph.Types.TrackableObject.Descriptor.NestedTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SlotVariableReference() { OnConstruction(); } @@ -786,6 +1126,7 @@ public SlotVariableReference() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SlotVariableReference(SlotVariableReference other) : this() { originalVariableNodeId_ = other.originalVariableNodeId_; slotName_ = other.slotName_; @@ -794,6 +1135,7 @@ public SlotVariableReference(SlotVariableReference other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SlotVariableReference Clone() { return new SlotVariableReference(this); } @@ -806,6 +1148,7 @@ public SlotVariableReference Clone() { /// variable object this slot was created for. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int OriginalVariableNodeId { get { return originalVariableNodeId_; } set { @@ -820,6 +1163,7 @@ public int OriginalVariableNodeId { /// The name of the slot (e.g. "m"/"v"). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string SlotName { get { return slotName_; } set { @@ -835,6 +1179,7 @@ public string SlotName { /// `Object` with the value of the slot variable. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int SlotVariableNodeId { get { return slotVariableNodeId_; } set { @@ -843,11 +1188,13 @@ public int SlotVariableNodeId { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as SlotVariableReference); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(SlotVariableReference other) { if (ReferenceEquals(other, null)) { return false; @@ -862,6 +1209,7 @@ public bool Equals(SlotVariableReference other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (OriginalVariableNodeId != 0) hash ^= OriginalVariableNodeId.GetHashCode(); @@ -874,12 +1222,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (OriginalVariableNodeId != 0) { output.WriteRawTag(8); output.WriteInt32(OriginalVariableNodeId); @@ -895,9 +1248,33 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (OriginalVariableNodeId != 0) { + output.WriteRawTag(8); + output.WriteInt32(OriginalVariableNodeId); + } + if (SlotName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(SlotName); + } + if (SlotVariableNodeId != 0) { + output.WriteRawTag(24); + output.WriteInt32(SlotVariableNodeId); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (OriginalVariableNodeId != 0) { @@ -916,6 +1293,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(SlotVariableReference other) { if (other == null) { return; @@ -933,7 +1311,11 @@ public void MergeFrom(SlotVariableReference other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -954,7 +1336,35 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + OriginalVariableNodeId = input.ReadInt32(); + break; + } + case 18: { + SlotName = input.ReadString(); + break; + } + case 24: { + SlotVariableNodeId = input.ReadInt32(); + break; + } + } + } } + #endif } @@ -968,6 +1378,238 @@ public void MergeFrom(pb::CodedInputStream input) { } + public sealed partial class RegisteredSaver : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegisteredSaver()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.TrackableObjectGraphReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public RegisteredSaver() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public RegisteredSaver(RegisteredSaver other) : this() { + name_ = other.name_; + objectName_ = other.objectName_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public RegisteredSaver Clone() { + return new RegisteredSaver(this); + } + + /// Field number for the "name" field. + public const int NameFieldNumber = 1; + private string name_ = ""; + /// + /// The name of the registered saver/restore function. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "object_name" field. + public const int ObjectNameFieldNumber = 2; + private string objectName_ = ""; + /// + /// Unique auto-generated name of the object. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string ObjectName { + get { return objectName_; } + set { + objectName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as RegisteredSaver); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(RegisteredSaver other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + if (ObjectName != other.ObjectName) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (ObjectName.Length != 0) hash ^= ObjectName.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (ObjectName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ObjectName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (ObjectName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ObjectName); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (ObjectName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ObjectName); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(RegisteredSaver other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + if (other.ObjectName.Length != 0) { + ObjectName = other.ObjectName; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + ObjectName = input.ReadString(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + ObjectName = input.ReadString(); + break; + } + } + } + } + #endif + + } + #endregion } diff --git a/src/TensorFlowNET.Core/Protobuf/Types.cs b/src/TensorFlowNET.Core/Protobuf/Types.cs index 6483cddf9..a2d3bac5d 100644 --- a/src/TensorFlowNET.Core/Protobuf/Types.cs +++ b/src/TensorFlowNET.Core/Protobuf/Types.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/types.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -25,31 +25,34 @@ static TypesReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CiV0ZW5zb3JmbG93L2NvcmUvZnJhbWV3b3JrL3R5cGVzLnByb3RvEgp0ZW5z", - "b3JmbG93KqoGCghEYXRhVHlwZRIOCgpEVF9JTlZBTElEEAASDAoIRFRfRkxP", - "QVQQARINCglEVF9ET1VCTEUQAhIMCghEVF9JTlQzMhADEgwKCERUX1VJTlQ4", - "EAQSDAoIRFRfSU5UMTYQBRILCgdEVF9JTlQ4EAYSDQoJRFRfU1RSSU5HEAcS", - "EAoMRFRfQ09NUExFWDY0EAgSDAoIRFRfSU5UNjQQCRILCgdEVF9CT09MEAoS", - "DAoIRFRfUUlOVDgQCxINCglEVF9RVUlOVDgQDBINCglEVF9RSU5UMzIQDRIP", - "CgtEVF9CRkxPQVQxNhAOEg0KCURUX1FJTlQxNhAPEg4KCkRUX1FVSU5UMTYQ", - "EBINCglEVF9VSU5UMTYQERIRCg1EVF9DT01QTEVYMTI4EBISCwoHRFRfSEFM", - "RhATEg8KC0RUX1JFU09VUkNFEBQSDgoKRFRfVkFSSUFOVBAVEg0KCURUX1VJ", - "TlQzMhAWEg0KCURUX1VJTlQ2NBAXEhAKDERUX0ZMT0FUX1JFRhBlEhEKDURU", - "X0RPVUJMRV9SRUYQZhIQCgxEVF9JTlQzMl9SRUYQZxIQCgxEVF9VSU5UOF9S", - "RUYQaBIQCgxEVF9JTlQxNl9SRUYQaRIPCgtEVF9JTlQ4X1JFRhBqEhEKDURU", - "X1NUUklOR19SRUYQaxIUChBEVF9DT01QTEVYNjRfUkVGEGwSEAoMRFRfSU5U", - "NjRfUkVGEG0SDwoLRFRfQk9PTF9SRUYQbhIQCgxEVF9RSU5UOF9SRUYQbxIR", - "Cg1EVF9RVUlOVDhfUkVGEHASEQoNRFRfUUlOVDMyX1JFRhBxEhMKD0RUX0JG", - "TE9BVDE2X1JFRhByEhEKDURUX1FJTlQxNl9SRUYQcxISCg5EVF9RVUlOVDE2", - "X1JFRhB0EhEKDURUX1VJTlQxNl9SRUYQdRIVChFEVF9DT01QTEVYMTI4X1JF", - "RhB2Eg8KC0RUX0hBTEZfUkVGEHcSEwoPRFRfUkVTT1VSQ0VfUkVGEHgSEgoO", - "RFRfVkFSSUFOVF9SRUYQeRIRCg1EVF9VSU5UMzJfUkVGEHoSEQoNRFRfVUlO", - "VDY0X1JFRhB7QnoKGG9yZy50ZW5zb3JmbG93LmZyYW1ld29ya0ILVHlwZXNQ", - "cm90b3NQAVpMZ2l0aHViLmNvbS90ZW5zb3JmbG93L3RlbnNvcmZsb3cvdGVu", - "c29yZmxvdy9nby9jb3JlL2ZyYW1ld29yay90eXBlc19nb19wcm90b/gBAWIG", - "cHJvdG8z")); + "b3JmbG93IjkKD1NlcmlhbGl6ZWREVHlwZRImCghkYXRhdHlwZRgBIAEoDjIU", + "LnRlbnNvcmZsb3cuRGF0YVR5cGUqqgYKCERhdGFUeXBlEg4KCkRUX0lOVkFM", + "SUQQABIMCghEVF9GTE9BVBABEg0KCURUX0RPVUJMRRACEgwKCERUX0lOVDMy", + "EAMSDAoIRFRfVUlOVDgQBBIMCghEVF9JTlQxNhAFEgsKB0RUX0lOVDgQBhIN", + "CglEVF9TVFJJTkcQBxIQCgxEVF9DT01QTEVYNjQQCBIMCghEVF9JTlQ2NBAJ", + "EgsKB0RUX0JPT0wQChIMCghEVF9RSU5UOBALEg0KCURUX1FVSU5UOBAMEg0K", + "CURUX1FJTlQzMhANEg8KC0RUX0JGTE9BVDE2EA4SDQoJRFRfUUlOVDE2EA8S", + "DgoKRFRfUVVJTlQxNhAQEg0KCURUX1VJTlQxNhAREhEKDURUX0NPTVBMRVgx", + "MjgQEhILCgdEVF9IQUxGEBMSDwoLRFRfUkVTT1VSQ0UQFBIOCgpEVF9WQVJJ", + "QU5UEBUSDQoJRFRfVUlOVDMyEBYSDQoJRFRfVUlOVDY0EBcSEAoMRFRfRkxP", + "QVRfUkVGEGUSEQoNRFRfRE9VQkxFX1JFRhBmEhAKDERUX0lOVDMyX1JFRhBn", + "EhAKDERUX1VJTlQ4X1JFRhBoEhAKDERUX0lOVDE2X1JFRhBpEg8KC0RUX0lO", + "VDhfUkVGEGoSEQoNRFRfU1RSSU5HX1JFRhBrEhQKEERUX0NPTVBMRVg2NF9S", + "RUYQbBIQCgxEVF9JTlQ2NF9SRUYQbRIPCgtEVF9CT09MX1JFRhBuEhAKDERU", + "X1FJTlQ4X1JFRhBvEhEKDURUX1FVSU5UOF9SRUYQcBIRCg1EVF9RSU5UMzJf", + "UkVGEHESEwoPRFRfQkZMT0FUMTZfUkVGEHISEQoNRFRfUUlOVDE2X1JFRhBz", + "EhIKDkRUX1FVSU5UMTZfUkVGEHQSEQoNRFRfVUlOVDE2X1JFRhB1EhUKEURU", + "X0NPTVBMRVgxMjhfUkVGEHYSDwoLRFRfSEFMRl9SRUYQdxITCg9EVF9SRVNP", + "VVJDRV9SRUYQeBISCg5EVF9WQVJJQU5UX1JFRhB5EhEKDURUX1VJTlQzMl9S", + "RUYQehIRCg1EVF9VSU5UNjRfUkVGEHtCegoYb3JnLnRlbnNvcmZsb3cuZnJh", + "bWV3b3JrQgtUeXBlc1Byb3Rvc1ABWkxnaXRodWIuY29tL3RlbnNvcmZsb3cv", + "dGVuc29yZmxvdy90ZW5zb3JmbG93L2dvL2NvcmUvZnJhbWV3b3JrL3R5cGVz", + "X2dvX3Byb3Rv+AEBYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tensorflow.DataType), }, null, null)); + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tensorflow.DataType), }, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tensorflow.SerializedDType), global::Tensorflow.SerializedDType.Parser, new[]{ "Datatype" }, null, null, null, null) + })); } #endregion @@ -150,6 +153,201 @@ public enum DataType { #endregion + #region Messages + /// + /// Represents a serialized tf.dtypes.Dtype + /// + public sealed partial class SerializedDType : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SerializedDType()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tensorflow.TypesReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public SerializedDType() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public SerializedDType(SerializedDType other) : this() { + datatype_ = other.datatype_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public SerializedDType Clone() { + return new SerializedDType(this); + } + + /// Field number for the "datatype" field. + public const int DatatypeFieldNumber = 1; + private global::Tensorflow.DataType datatype_ = global::Tensorflow.DataType.DtInvalid; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Tensorflow.DataType Datatype { + get { return datatype_; } + set { + datatype_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as SerializedDType); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(SerializedDType other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Datatype != other.Datatype) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Datatype != global::Tensorflow.DataType.DtInvalid) hash ^= Datatype.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Datatype != global::Tensorflow.DataType.DtInvalid) { + output.WriteRawTag(8); + output.WriteEnum((int) Datatype); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Datatype != global::Tensorflow.DataType.DtInvalid) { + output.WriteRawTag(8); + output.WriteEnum((int) Datatype); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Datatype != global::Tensorflow.DataType.DtInvalid) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Datatype); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(SerializedDType other) { + if (other == null) { + return; + } + if (other.Datatype != global::Tensorflow.DataType.DtInvalid) { + Datatype = other.Datatype; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Datatype = (global::Tensorflow.DataType) input.ReadEnum(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Datatype = (global::Tensorflow.DataType) input.ReadEnum(); + break; + } + } + } + } + #endif + + } + + #endregion + } #endregion Designer generated code diff --git a/src/TensorFlowNET.Core/Protobuf/Variable.cs b/src/TensorFlowNET.Core/Protobuf/Variable.cs index 145c3625c..1bb8f0120 100644 --- a/src/TensorFlowNET.Core/Protobuf/Variable.cs +++ b/src/TensorFlowNET.Core/Protobuf/Variable.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/variable.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -117,23 +117,31 @@ public enum VariableAggregation { /// /// Protocol buffer representing a Variable. /// - public sealed partial class VariableDef : pb::IMessage { + public sealed partial class VariableDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new VariableDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.VariableReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public VariableDef() { OnConstruction(); } @@ -141,6 +149,7 @@ public VariableDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public VariableDef(VariableDef other) : this() { variableName_ = other.variableName_; initialValueName_ = other.initialValueName_; @@ -155,6 +164,7 @@ public VariableDef(VariableDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public VariableDef Clone() { return new VariableDef(this); } @@ -166,6 +176,7 @@ public VariableDef Clone() { /// Name of the variable tensor. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string VariableName { get { return variableName_; } set { @@ -180,6 +191,7 @@ public string VariableName { /// Name of the tensor holding the variable's initial value. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string InitialValueName { get { return initialValueName_; } set { @@ -194,6 +206,7 @@ public string InitialValueName { /// Name of the initializer op. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string InitializerName { get { return initializerName_; } set { @@ -208,6 +221,7 @@ public string InitializerName { /// Name of the snapshot tensor. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string SnapshotName { get { return snapshotName_; } set { @@ -222,6 +236,7 @@ public string SnapshotName { /// Support for saving variables as slices of a larger variable. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.SaveSliceInfoDef SaveSliceInfoDef { get { return saveSliceInfoDef_; } set { @@ -236,6 +251,7 @@ public string SnapshotName { /// Whether to represent this as a ResourceVariable. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool IsResource { get { return isResource_; } set { @@ -250,6 +266,7 @@ public bool IsResource { /// Whether this variable should be trained. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Trainable { get { return trainable_; } set { @@ -264,6 +281,7 @@ public bool Trainable { /// Indicates when a distributed variable will be synced. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.VariableSynchronization Synchronization { get { return synchronization_; } set { @@ -278,6 +296,7 @@ public bool Trainable { /// Indicates how a distributed variable will be aggregated. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.VariableAggregation Aggregation { get { return aggregation_; } set { @@ -286,11 +305,13 @@ public bool Trainable { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as VariableDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(VariableDef other) { if (ReferenceEquals(other, null)) { return false; @@ -311,6 +332,7 @@ public bool Equals(VariableDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (VariableName.Length != 0) hash ^= VariableName.GetHashCode(); @@ -329,12 +351,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (VariableName.Length != 0) { output.WriteRawTag(10); output.WriteString(VariableName); @@ -374,9 +401,57 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (VariableName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(VariableName); + } + if (InitializerName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(InitializerName); + } + if (SnapshotName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(SnapshotName); + } + if (saveSliceInfoDef_ != null) { + output.WriteRawTag(34); + output.WriteMessage(SaveSliceInfoDef); + } + if (IsResource != false) { + output.WriteRawTag(40); + output.WriteBool(IsResource); + } + if (InitialValueName.Length != 0) { + output.WriteRawTag(50); + output.WriteString(InitialValueName); + } + if (Trainable != false) { + output.WriteRawTag(56); + output.WriteBool(Trainable); + } + if (Synchronization != global::Tensorflow.VariableSynchronization.Auto) { + output.WriteRawTag(64); + output.WriteEnum((int) Synchronization); + } + if (Aggregation != global::Tensorflow.VariableAggregation.None) { + output.WriteRawTag(72); + output.WriteEnum((int) Aggregation); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (VariableName.Length != 0) { @@ -413,6 +488,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(VariableDef other) { if (other == null) { return; @@ -451,7 +527,11 @@ public void MergeFrom(VariableDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -499,27 +579,90 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + VariableName = input.ReadString(); + break; + } + case 18: { + InitializerName = input.ReadString(); + break; + } + case 26: { + SnapshotName = input.ReadString(); + break; + } + case 34: { + if (saveSliceInfoDef_ == null) { + SaveSliceInfoDef = new global::Tensorflow.SaveSliceInfoDef(); + } + input.ReadMessage(SaveSliceInfoDef); + break; + } + case 40: { + IsResource = input.ReadBool(); + break; + } + case 50: { + InitialValueName = input.ReadString(); + break; + } + case 56: { + Trainable = input.ReadBool(); + break; + } + case 64: { + Synchronization = (global::Tensorflow.VariableSynchronization) input.ReadEnum(); + break; + } + case 72: { + Aggregation = (global::Tensorflow.VariableAggregation) input.ReadEnum(); + break; + } + } + } + } + #endif + } - public sealed partial class SaveSliceInfoDef : pb::IMessage { + public sealed partial class SaveSliceInfoDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SaveSliceInfoDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.VariableReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SaveSliceInfoDef() { OnConstruction(); } @@ -527,6 +670,7 @@ public SaveSliceInfoDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SaveSliceInfoDef(SaveSliceInfoDef other) : this() { fullName_ = other.fullName_; fullShape_ = other.fullShape_.Clone(); @@ -536,6 +680,7 @@ public SaveSliceInfoDef(SaveSliceInfoDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public SaveSliceInfoDef Clone() { return new SaveSliceInfoDef(this); } @@ -547,6 +692,7 @@ public SaveSliceInfoDef Clone() { /// Name of the full variable of which this is a slice. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string FullName { get { return fullName_; } set { @@ -563,6 +709,7 @@ public string FullName { /// Shape of the full variable. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField FullShape { get { return fullShape_; } } @@ -576,6 +723,7 @@ public string FullName { /// Offset of this variable into the full variable. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField VarOffset { get { return varOffset_; } } @@ -589,16 +737,19 @@ public string FullName { /// Shape of this variable. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField VarShape { get { return varShape_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as SaveSliceInfoDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(SaveSliceInfoDef other) { if (ReferenceEquals(other, null)) { return false; @@ -614,6 +765,7 @@ public bool Equals(SaveSliceInfoDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (FullName.Length != 0) hash ^= FullName.GetHashCode(); @@ -627,12 +779,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (FullName.Length != 0) { output.WriteRawTag(10); output.WriteString(FullName); @@ -643,9 +800,28 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (FullName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(FullName); + } + fullShape_.WriteTo(ref output, _repeated_fullShape_codec); + varOffset_.WriteTo(ref output, _repeated_varOffset_codec); + varShape_.WriteTo(ref output, _repeated_varShape_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } } + #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (FullName.Length != 0) { @@ -661,6 +837,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(SaveSliceInfoDef other) { if (other == null) { return; @@ -675,7 +852,11 @@ public void MergeFrom(SaveSliceInfoDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -703,7 +884,42 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + FullName = input.ReadString(); + break; + } + case 18: + case 16: { + fullShape_.AddEntriesFrom(ref input, _repeated_fullShape_codec); + break; + } + case 26: + case 24: { + varOffset_.AddEntriesFrom(ref input, _repeated_varOffset_codec); + break; + } + case 34: + case 32: { + varShape_.AddEntriesFrom(ref input, _repeated_varShape_codec); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/VerifierConfig.cs b/src/TensorFlowNET.Core/Protobuf/VerifierConfig.cs index d0f2e2fbb..904196b1f 100644 --- a/src/TensorFlowNET.Core/Protobuf/VerifierConfig.cs +++ b/src/TensorFlowNET.Core/Protobuf/VerifierConfig.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/protobuf/verifier_config.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -46,23 +46,31 @@ static VerifierConfigReflection() { /// /// The config for graph verifiers. /// - public sealed partial class VerifierConfig : pb::IMessage { + public sealed partial class VerifierConfig : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new VerifierConfig()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.VerifierConfigReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public VerifierConfig() { OnConstruction(); } @@ -70,6 +78,7 @@ public VerifierConfig() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public VerifierConfig(VerifierConfig other) : this() { verificationTimeoutInMs_ = other.verificationTimeoutInMs_; structureVerifier_ = other.structureVerifier_; @@ -77,6 +86,7 @@ public VerifierConfig(VerifierConfig other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public VerifierConfig Clone() { return new VerifierConfig(this); } @@ -89,6 +99,7 @@ public VerifierConfig Clone() { /// verifiers must complete execution within this time. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public long VerificationTimeoutInMs { get { return verificationTimeoutInMs_; } set { @@ -103,6 +114,7 @@ public long VerificationTimeoutInMs { /// Perform structural validation on a tensorflow graph. Default is OFF. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Tensorflow.VerifierConfig.Types.Toggle StructureVerifier { get { return structureVerifier_; } set { @@ -111,11 +123,13 @@ public long VerificationTimeoutInMs { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as VerifierConfig); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(VerifierConfig other) { if (ReferenceEquals(other, null)) { return false; @@ -129,6 +143,7 @@ public bool Equals(VerifierConfig other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (VerificationTimeoutInMs != 0L) hash ^= VerificationTimeoutInMs.GetHashCode(); @@ -140,12 +155,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (VerificationTimeoutInMs != 0L) { output.WriteRawTag(8); output.WriteInt64(VerificationTimeoutInMs); @@ -157,9 +177,29 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (VerificationTimeoutInMs != 0L) { + output.WriteRawTag(8); + output.WriteInt64(VerificationTimeoutInMs); + } + if (StructureVerifier != global::Tensorflow.VerifierConfig.Types.Toggle.Default) { + output.WriteRawTag(16); + output.WriteEnum((int) StructureVerifier); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (VerificationTimeoutInMs != 0L) { @@ -175,6 +215,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(VerifierConfig other) { if (other == null) { return; @@ -189,7 +230,11 @@ public void MergeFrom(VerifierConfig other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -206,11 +251,36 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + VerificationTimeoutInMs = input.ReadInt64(); + break; + } + case 16: { + StructureVerifier = (global::Tensorflow.VerifierConfig.Types.Toggle) input.ReadEnum(); + break; + } + } + } } + #endif #region Nested types /// Container for nested types declared in the VerifierConfig message type. [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static partial class Types { public enum Toggle { [pbr::OriginalName("DEFAULT")] Default = 0, diff --git a/src/TensorFlowNET.Core/Protobuf/Versions.cs b/src/TensorFlowNET.Core/Protobuf/Versions.cs index 3cd007655..d3e9fc512 100644 --- a/src/TensorFlowNET.Core/Protobuf/Versions.cs +++ b/src/TensorFlowNET.Core/Protobuf/Versions.cs @@ -2,7 +2,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: tensorflow/core/framework/versions.proto // -#pragma warning disable 1591, 0612, 3021 +#pragma warning disable 1591, 0612, 3021, 8981 #region Designer generated code using pb = global::Google.Protobuf; @@ -54,23 +54,31 @@ static VersionsReflection() { /// consumer >= min_consumer /// consumer not in bad_consumers /// - public sealed partial class VersionDef : pb::IMessage { + public sealed partial class VersionDef : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new VersionDef()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::Tensorflow.VersionsReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public VersionDef() { OnConstruction(); } @@ -78,6 +86,7 @@ public VersionDef() { partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public VersionDef(VersionDef other) : this() { producer_ = other.producer_; minConsumer_ = other.minConsumer_; @@ -86,6 +95,7 @@ public VersionDef(VersionDef other) : this() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public VersionDef Clone() { return new VersionDef(this); } @@ -97,6 +107,7 @@ public VersionDef Clone() { /// The version of the code that produced this data. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int Producer { get { return producer_; } set { @@ -111,6 +122,7 @@ public int Producer { /// Any consumer below this version is not allowed to consume this data. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int MinConsumer { get { return minConsumer_; } set { @@ -127,16 +139,19 @@ public int MinConsumer { /// Specific consumer versions which are disallowed (e.g. due to bugs). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public pbc::RepeatedField BadConsumers { get { return badConsumers_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as VersionDef); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(VersionDef other) { if (ReferenceEquals(other, null)) { return false; @@ -151,6 +166,7 @@ public bool Equals(VersionDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (Producer != 0) hash ^= Producer.GetHashCode(); @@ -163,12 +179,17 @@ public override int GetHashCode() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else if (Producer != 0) { output.WriteRawTag(8); output.WriteInt32(Producer); @@ -181,9 +202,30 @@ public void WriteTo(pb::CodedOutputStream output) { if (_unknownFields != null) { _unknownFields.WriteTo(output); } + #endif } + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Producer != 0) { + output.WriteRawTag(8); + output.WriteInt32(Producer); + } + if (MinConsumer != 0) { + output.WriteRawTag(16); + output.WriteInt32(MinConsumer); + } + badConsumers_.WriteTo(ref output, _repeated_badConsumers_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (Producer != 0) { @@ -200,6 +242,7 @@ public int CalculateSize() { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(VersionDef other) { if (other == null) { return; @@ -215,7 +258,11 @@ public void MergeFrom(VersionDef other) { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { @@ -237,7 +284,36 @@ public void MergeFrom(pb::CodedInputStream input) { } } } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Producer = input.ReadInt32(); + break; + } + case 16: { + MinConsumer = input.ReadInt32(); + break; + } + case 26: + case 24: { + badConsumers_.AddEntriesFrom(ref input, _repeated_badConsumers_codec); + break; + } + } + } } + #endif } diff --git a/src/TensorFlowNET.Core/Protobuf/Xla.cs b/src/TensorFlowNET.Core/Protobuf/Xla.cs new file mode 100644 index 000000000..24f46594c --- /dev/null +++ b/src/TensorFlowNET.Core/Protobuf/Xla.cs @@ -0,0 +1,12788 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tensorflow/compiler/xla/xla.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Xla { + + /// Holder for reflection information generated from tensorflow/compiler/xla/xla.proto + public static partial class XlaReflection { + + #region Descriptor + /// File descriptor for tensorflow/compiler/xla/xla.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static XlaReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiF0ZW5zb3JmbG93L2NvbXBpbGVyL3hsYS94bGEucHJvdG8SA3hsYRopdGVu", + "c29yZmxvdy9jb21waWxlci94bGEvc2VydmljZS9obG8ucHJvdG8aJnRlbnNv", + "cmZsb3cvY29tcGlsZXIveGxhL3hsYV9kYXRhLnByb3RvIscdCgxEZWJ1Z09w", + "dGlvbnMSHwoXeGxhX2hsb19ncmFwaF9hZGRyZXNzZXMYAiABKAgSFwoPeGxh", + "X2hsb19wcm9maWxlGAkgASgIEh4KFnhsYV9kaXNhYmxlX2hsb19wYXNzZXMY", + "HiADKAkSIgoaeGxhX2VuYWJsZV9obG9fcGFzc2VzX29ubHkYfCADKAkSIgoa", + "eGxhX2Rpc2FibGVfYWxsX2hsb19wYXNzZXMYaCABKAgSJgoeeGxhX2JhY2tl", + "bmRfb3B0aW1pemF0aW9uX2xldmVsGB8gASgFEiIKGnhsYV9lbWJlZF9pcl9p", + "bl9leGVjdXRhYmxlGCEgASgIEiwKJHhsYV9lbGltaW5hdGVfaGxvX2ltcGxp", + "Y2l0X2Jyb2FkY2FzdBgjIAEoCBIiChp4bGFfY3B1X211bHRpX3RocmVhZF9l", + "aWdlbhg8IAEoCBIdChV4bGFfZ3B1X2N1ZGFfZGF0YV9kaXIYPSABKAkSEwoL", + "eGxhX2dwdV9mdHoYPiABKAgSLAokeGxhX2xsdm1fZW5hYmxlX2FsaWFzX3Nj", + "b3BlX21ldGFkYXRhGEYgASgIEigKIHhsYV9sbHZtX2VuYWJsZV9ub2FsaWFz", + "X21ldGFkYXRhGEcgASgIEi8KJ3hsYV9sbHZtX2VuYWJsZV9pbnZhcmlhbnRf", + "bG9hZF9tZXRhZGF0YRhIIAEoCBIpCiF4bGFfbGx2bV9kaXNhYmxlX2V4cGVu", + "c2l2ZV9wYXNzZXMYSSABKAgSIwobeGxhX3Rlc3RfYWxsX291dHB1dF9sYXlv", + "dXRzGFogASgIEiIKGnhsYV90ZXN0X2FsbF9pbnB1dF9sYXlvdXRzGFsgASgI", + "EiQKHHhsYV9obG9fZ3JhcGhfc2hhcmRpbmdfY29sb3IYXCABKAgSGwoTeGxh", + "X2NwdV91c2VfbWtsX2RubhhhIAEoCBIgChd4bGFfY3B1X3VzZV94bGFfcnVu", + "dGltZRixASABKAgSKAogeGxhX2dwdV9tYXhfa2VybmVsX3Vucm9sbF9mYWN0", + "b3IYYiABKAUSIAoYeGxhX2NwdV9lbmFibGVfZmFzdF9tYXRoGGMgASgIEiQK", + "HHhsYV9jcHVfZmFzdF9tYXRoX2hvbm9yX25hbnMYeCABKAgSJAoceGxhX2Nw", + "dV9mYXN0X21hdGhfaG9ub3JfaW5mcxh5IAEoCBIoCiB4bGFfY3B1X2Zhc3Rf", + "bWF0aF9ob25vcl9kaXZpc2lvbhh+IAEoCBIqCiF4bGFfY3B1X2Zhc3RfbWF0", + "aF9ob25vcl9mdW5jdGlvbnMYgQEgASgIEiQKG3hsYV9jcHVfZW5hYmxlX2Zh", + "c3RfbWluX21heBiMASABKAgSIwobeGxhX2dwdV9lbmFibGVfZmFzdF9taW5f", + "bWF4GGQgASgIEiIKGnhsYV9hbGxvd19leGNlc3NfcHJlY2lzaW9uGHogASgI", + "Ei4KJnhsYV9ncHVfY3Jhc2hfb25fdmVyaWZpY2F0aW9uX2ZhaWx1cmVzGGUg", + "ASgIEh4KFnhsYV9ncHVfYXV0b3R1bmVfbGV2ZWwYeyABKAUSLAokeGxhX2Zv", + "cmNlX2hvc3RfcGxhdGZvcm1fZGV2aWNlX2NvdW50GGYgASgFEiwKJHhsYV9n", + "cHVfZGlzYWJsZV9ncHVhc21fb3B0aW1pemF0aW9ucxhnIAEoCBI8ChR4bGFf", + "Z3B1X3NoYXBlX2NoZWNrcxiqASABKA4yHS54bGEuRGVidWdPcHRpb25zLlNo", + "YXBlQ2hlY2tzEiUKHHhsYV9jcHVfZW5hYmxlX21saXJfbG93ZXJpbmcYqwEg", + "ASgIEiUKHHhsYV9ncHVfZW5hYmxlX21saXJfbG93ZXJpbmcYrQEgASgIEicK", + "H3hsYV9obG9fZXZhbHVhdG9yX3VzZV9mYXN0X3BhdGgYaiABKAgSKgoieGxh", + "X2FsbG93X3NjYWxhcl9pbmRleF9keW5hbWljX29wcxhrIAEoCBJGChh4bGFf", + "c3RlcF9tYXJrZXJfbG9jYXRpb24YbCABKA4yJC54bGEuRGVidWdPcHRpb25z", + "LlN0ZXBNYXJrZXJMb2NhdGlvbhITCgt4bGFfZHVtcF90bxhtIAEoCRIeChZ4", + "bGFfZHVtcF9obG9fbW9kdWxlX3JlGG4gASgJEhwKFHhsYV9kdW1wX2hsb19w", + "YXNzX3JlGG8gASgJEhwKFHhsYV9kdW1wX2hsb19hc190ZXh0GHAgASgIEh0K", + "FXhsYV9kdW1wX2hsb19hc19wcm90bxhxIAEoCBIbChN4bGFfZHVtcF9obG9f", + "YXNfZG90GHIgASgIEhsKE3hsYV9kdW1wX2hsb19hc191cmwYcyABKAgSHAoU", + "eGxhX2R1bXBfaGxvX2FzX2h0bWwYdCABKAgSJgodeGxhX2R1bXBfZnVzaW9u", + "X3Zpc3VhbGl6YXRpb24YlQEgASgIEh4KFnhsYV9kdW1wX2hsb19zbmFwc2hv", + "dHMYdiABKAgSIwoaeGxhX2R1bXBfaW5jbHVkZV90aW1lc3RhbXAYgwEgASgI", + "EiEKGHhsYV9kdW1wX21heF9obG9fbW9kdWxlcxiEASABKAUSIQoYeGxhX2R1", + "bXBfbW9kdWxlX21ldGFkYXRhGJABIAEoCBIhChh4bGFfZHVtcF9jb21wcmVz", + "c19wcm90b3MYlwEgASgIEiIKGXhsYV9kdW1wX2hsb19hc19sb25nX3RleHQY", + "pAEgASgIEh8KF3hsYV9ncHVfZm9yY2VfY29udl9uY2h3GH0gASgIEiAKF3hs", + "YV9ncHVfZm9yY2VfY29udl9uaHdjGJIBIAEoCBIYChB4bGFfZ3B1X3B0eF9m", + "aWxlGH8gAygJEhwKE3hsYV9ncHVfZHVtcF9sbHZtaXIYmwEgASgIEigKH3hs", + "YV9ncHVfYWxnb3JpdGhtX2RlbnlsaXN0X3BhdGgYgAEgASgJEhsKEnhsYV90", + "cHVfZGV0ZWN0X25hbhiHASABKAgSGwoSeGxhX3RwdV9kZXRlY3RfaW5mGIgB", + "IAEoCBIlChx4bGFfY3B1X2VuYWJsZV94cHJvZl90cmFjZW1lGIkBIAEoCBI9", + "CjR4bGFfZ3B1X3Vuc2FmZV9mYWxsYmFja190b19kcml2ZXJfb25fcHR4YXNf", + "bm90X2ZvdW5kGIoBIAEoCBIgChd4bGFfZ3B1X2FzbV9leHRyYV9mbGFncxiN", + "ASABKAkSLwomeGxhX211bHRpaGVhcF9zaXplX2NvbnN0cmFpbnRfcGVyX2hl", + "YXAYjgEgASgFEikKIHhsYV9kZXRhaWxlZF9sb2dnaW5nX2FuZF9kdW1waW5n", + "GI8BIAEoCBIuCiV4bGFfZ3B1X2ZvcmNlX2NvbXBpbGF0aW9uX3BhcmFsbGVs", + "aXNtGJMBIAEoBRIiChl4bGFfZ3B1X2RldGVybWluaXN0aWNfb3BzGJQBIAEo", + "CBIdChR4bGFfZ3B1X2xsdm1faXJfZmlsZRiWASADKAkSKAofeGxhX2dwdV9l", + "bmFibGVfYXN5bmNfYWxsX3JlZHVjZRiYASABKAgSMwoqeGxhX2dwdV9hbGxf", + "cmVkdWNlX2NvbWJpbmVfdGhyZXNob2xkX2J5dGVzGJ0BIAEoAxImCh14bGFf", + "Z3B1X2FsbF9yZWR1Y2VfY29udGlndW91cxieASABKAgSPAozeGxhX2dwdV9h", + "bGxfcmVkdWNlX2JsdWVjb25uZWN0X251bV9kZXZpY2VzX3Blcl9ob3N0GJ8B", + "IAEoBRImCh14bGFfZ3B1X2VuYWJsZV9jdWRubl9mcm9udGVuZBigASABKAgS", + "IgoZeGxhX2R1bXBfZGlzYWJsZV9tZXRhZGF0YRiZASABKAgSIQoYeGxhX2R1", + "bXBfaGxvX3BpcGVsaW5lX3JlGJoBIAEoCRItCiR4bGFfZ3B1X3N0cmljdF9j", + "b252X2FsZ29yaXRobV9waWNrZXIYnAEgASgIEi4KJXhsYV9ncHVfZW5hYmxl", + "X3hsYV9ydW50aW1lX2V4ZWN1dGFibGUYqQEgASgIEjEKKHhsYV9ncHVfbmNj", + "bF90ZXJtaW5hdGlvbl90aW1lb3V0X3NlY29uZHMYowEgASgDEigKH3hsYV9n", + "cHVfZW5hYmxlX3NoYXJlZF9jb25zdGFudHMYpQEgASgIEiAKF3hsYV9ncHVf", + "ZW5hYmxlX2N1Ymxhc2x0GKYBIAEoCBIuCiV4bGFfZ3B1X3JlZHpvbmVfc2Ny", + "YXRjaF9tYXhfbWVnYWJ5dGVzGKcBIAEoAxIsCiN4bGFfZ3B1X3NpbXBsaWZ5", + "X2FsbF9mcF9jb252ZXJzaW9ucxioASABKAgSIgoZeGxhX2dwdV9ub3JtYWxp", + "emVfbGF5b3V0cxisASABKAgSGAoPeGxhX2NwdV91c2VfYWNsGK4BIAEoCBIl", + "Chx4bGFfY3B1X3N0cmljdF9kb3RfY29udl9tYXRoGK8BIAEoCBJRChl4bGFf", + "YmFja2VuZF9leHRyYV9vcHRpb25zGPQDIAMoCzItLnhsYS5EZWJ1Z09wdGlv", + "bnMuWGxhQmFja2VuZEV4dHJhT3B0aW9uc0VudHJ5Gj0KG1hsYUJhY2tlbmRF", + "eHRyYU9wdGlvbnNFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6", + "AjgBIjgKC1NoYXBlQ2hlY2tzEgoKBklHTk9SRRAAEgsKB1JVTlRJTUUQARIQ", + "CgxDT01QSUxFX1RJTUUQAiKRAQoSU3RlcE1hcmtlckxvY2F0aW9uEhYKElNU", + "RVBfTUFSS19BVF9FTlRSWRAAEiUKIVNURVBfTUFSS19BVF9UT1BfTEVWRUxf", + "V0hJTEVfTE9PUBABEigKJFNURVBfTUFSS19BVF9TRUNPTkRfTEVWRUxfV0hJ", + "TEVfTE9PUBADEhIKDlNURVBfTUFSS19OT05FEAJKBAg/EEBKBgiGARCHAUoE", + "CFAQUUoECF0QXkoECF4QX0oGCIIBEIMBSgYIoQEQogFKBgiiARCjAUoECAUQ", + "BkoECHUQdkoGCIUBEIYBSgYIiwEQjAFKBgiwARCxAUoGCLIBELMBIqsEChBF", + "eGVjdXRpb25PcHRpb25zEjEKGHNoYXBlX3dpdGhfb3V0cHV0X2xheW91dBgC", + "IAEoCzIPLnhsYS5TaGFwZVByb3RvEgwKBHNlZWQYAyABKAQSKAoNZGVidWdf", + "b3B0aW9ucxgEIAEoCzIRLnhsYS5EZWJ1Z09wdGlvbnMSKQoOZGV2aWNlX2hh", + "bmRsZXMYBSADKAsyES54bGEuRGV2aWNlSGFuZGxlEhQKDG51bV9yZXBsaWNh", + "cxgGIAEoBRI1ChFkZXZpY2VfYXNzaWdubWVudBgHIAEoCzIaLnhsYS5EZXZp", + "Y2VBc3NpZ25tZW50UHJvdG8SIAoYYWxpYXNfcGFzc3Rocm91Z2hfcGFyYW1z", + "GAggASgIEhYKDm51bV9wYXJ0aXRpb25zGAkgASgFEhEKCWxhdW5jaF9pZBgK", + "IAEoBRIdChV1c2Vfc3BtZF9wYXJ0aXRpb25pbmcYCyABKAgSIgoadXNlX2F1", + "dG9fc3BtZF9wYXJ0aXRpb25pbmcYDyABKAgSKQohYXV0b19zcG1kX3BhcnRp", + "dGlvbmluZ19tZXNoX3NoYXBlGBAgAygDEicKH2F1dG9fc3BtZF9wYXJ0aXRp", + "b25pbmdfbWVzaF9pZHMYESADKAMSFwoPZGVkdXBsaWNhdGVfaGxvGAwgASgI", + "EjEKKWFsbG93X3NwbWRfc2hhcmRpbmdfcHJvcGFnYXRpb25fdG9fb3V0cHV0", + "GA4gASgISgQIDRAOIi8KF0dldERldmljZUhhbmRsZXNSZXF1ZXN0EhQKDGRl", + "dmljZV9jb3VudBgBIAEoAyJFChhHZXREZXZpY2VIYW5kbGVzUmVzcG9uc2US", + "KQoOZGV2aWNlX2hhbmRsZXMYASADKAsyES54bGEuRGV2aWNlSGFuZGxlImoK", + "F1RyYW5zZmVyVG9DbGllbnRSZXF1ZXN0EiMKBGRhdGEYASABKAsyFS54bGEu", + "R2xvYmFsRGF0YUhhbmRsZRIqChFzaGFwZV93aXRoX2xheW91dBgCIAEoCzIP", + "LnhsYS5TaGFwZVByb3RvIj4KGFRyYW5zZmVyVG9DbGllbnRSZXNwb25zZRIi", + "CgdsaXRlcmFsGAEgASgLMhEueGxhLkxpdGVyYWxQcm90byJnChdUcmFuc2Zl", + "clRvU2VydmVyUmVxdWVzdBIiCgdsaXRlcmFsGAEgASgLMhEueGxhLkxpdGVy", + "YWxQcm90bxIoCg1kZXZpY2VfaGFuZGxlGAIgASgLMhEueGxhLkRldmljZUhh", + "bmRsZSI/ChhUcmFuc2ZlclRvU2VydmVyUmVzcG9uc2USIwoEZGF0YRgBIAEo", + "CzIVLnhsYS5HbG9iYWxEYXRhSGFuZGxlInsKF1RyYW5zZmVyVG9JbmZlZWRS", + "ZXF1ZXN0EiIKB2xpdGVyYWwYASABKAsyES54bGEuTGl0ZXJhbFByb3RvEhIK", + "CnJlcGxpY2FfaWQYAiABKAMSKAoNZGV2aWNlX2hhbmRsZRgDIAEoCzIRLnhs", + "YS5EZXZpY2VIYW5kbGUiGgoYVHJhbnNmZXJUb0luZmVlZFJlc3BvbnNlIoYB", + "ChpUcmFuc2ZlckZyb21PdXRmZWVkUmVxdWVzdBIqChFzaGFwZV93aXRoX2xh", + "eW91dBgBIAEoCzIPLnhsYS5TaGFwZVByb3RvEhIKCnJlcGxpY2FfaWQYAiAB", + "KAMSKAoNZGV2aWNlX2hhbmRsZRgDIAEoCzIRLnhsYS5EZXZpY2VIYW5kbGUi", + "QQobVHJhbnNmZXJGcm9tT3V0ZmVlZFJlc3BvbnNlEiIKB2xpdGVyYWwYASAB", + "KAsyES54bGEuTGl0ZXJhbFByb3RvIj4KElJlc2V0RGV2aWNlUmVxdWVzdBIo", + "Cg1kZXZpY2VfaGFuZGxlGAEgASgLMhEueGxhLkRldmljZUhhbmRsZSIVChNS", + "ZXNldERldmljZVJlc3BvbnNlInIKHENvbXB1dGF0aW9uR3JhcGhTdGF0c1Jl", + "cXVlc3QSKAoLY29tcHV0YXRpb24YASABKAsyEy54bGEuSGxvTW9kdWxlUHJv", + "dG8SKAoNZGVidWdfb3B0aW9ucxgCIAEoCzIRLnhsYS5EZWJ1Z09wdGlvbnMi", + "QAoYQ29tcHV0YXRpb25TdGF0c1Jlc3BvbnNlEiQKBXN0YXRzGAEgASgLMhUu", + "eGxhLkNvbXB1dGF0aW9uU3RhdHMiUgoaQ3JlYXRlQ2hhbm5lbEhhbmRsZVJl", + "cXVlc3QSNAoMY2hhbm5lbF90eXBlGAEgASgOMh4ueGxhLkNoYW5uZWxIYW5k", + "bGUuQ2hhbm5lbFR5cGUiQgobQ3JlYXRlQ2hhbm5lbEhhbmRsZVJlc3BvbnNl", + "EiMKB2NoYW5uZWwYASABKAsyEi54bGEuQ2hhbm5lbEhhbmRsZSI4ChFVbnJl", + "Z2lzdGVyUmVxdWVzdBIjCgRkYXRhGAEgAygLMhUueGxhLkdsb2JhbERhdGFI", + "YW5kbGUiFAoSVW5yZWdpc3RlclJlc3BvbnNlIp4BCg5Db21waWxlUmVxdWVz", + "dBIoCgtjb21wdXRhdGlvbhgBIAEoCzITLnhsYS5IbG9Nb2R1bGVQcm90bxIw", + "ChFleGVjdXRpb25fb3B0aW9ucxgCIAEoCzIVLnhsYS5FeGVjdXRpb25PcHRp", + "b25zEjAKF2lucHV0X3NoYXBlX3dpdGhfbGF5b3V0GAMgAygLMg8ueGxhLlNo", + "YXBlUHJvdG8iNwoPQ29tcGlsZVJlc3BvbnNlEiQKBmhhbmRsZRgBIAEoCzIU", + "LnhsYS5FeGVjdXRpb25IYW5kbGUiYAoORXhlY3V0ZVJlcXVlc3QSJAoGaGFu", + "ZGxlGAEgASgLMhQueGxhLkV4ZWN1dGlvbkhhbmRsZRIoCglhcmd1bWVudHMY", + "AiADKAsyFS54bGEuR2xvYmFsRGF0YUhhbmRsZSKbAQoTRXhlY3V0ZUdyYXBo", + "UmVxdWVzdBIoCgtjb21wdXRhdGlvbhgBIAEoCzITLnhsYS5IbG9Nb2R1bGVQ", + "cm90bxIoCglhcmd1bWVudHMYAiADKAsyFS54bGEuR2xvYmFsRGF0YUhhbmRs", + "ZRIwChFleGVjdXRpb25fb3B0aW9ucxgDIAEoCzIVLnhsYS5FeGVjdXRpb25P", + "cHRpb25zIkkKG0V4ZWN1dGVHcmFwaFBhcmFsbGVsUmVxdWVzdBIqCghyZXF1", + "ZXN0cxgBIAMoCzIYLnhsYS5FeGVjdXRlR3JhcGhSZXF1ZXN0ImAKD0V4ZWN1", + "dGVSZXNwb25zZRIlCgZvdXRwdXQYASABKAsyFS54bGEuR2xvYmFsRGF0YUhh", + "bmRsZRImCgdwcm9maWxlGAIgASgLMhUueGxhLkV4ZWN1dGlvblByb2ZpbGUi", + "QgoXRXhlY3V0ZVBhcmFsbGVsUmVzcG9uc2USJwoJcmVzcG9uc2VzGAEgAygL", + "MhQueGxhLkV4ZWN1dGVSZXNwb25zZSJCChdXYWl0Rm9yRXhlY3V0aW9uUmVx", + "dWVzdBInCglleGVjdXRpb24YASABKAsyFC54bGEuRXhlY3V0aW9uSGFuZGxl", + "ImkKGFdhaXRGb3JFeGVjdXRpb25SZXNwb25zZRIlCgZvdXRwdXQYASABKAsy", + "FS54bGEuR2xvYmFsRGF0YUhhbmRsZRImCgdwcm9maWxlGAIgASgLMhUueGxh", + "LkV4ZWN1dGlvblByb2ZpbGUicAobQ29tcHV0ZUNvbnN0YW50R3JhcGhSZXF1", + "ZXN0EigKC2NvbXB1dGF0aW9uGAEgASgLMhMueGxhLkhsb01vZHVsZVByb3Rv", + "EicKDW91dHB1dF9sYXlvdXQYAiABKAsyEC54bGEuTGF5b3V0UHJvdG8iPQoX", + "Q29tcHV0ZUNvbnN0YW50UmVzcG9uc2USIgoHbGl0ZXJhbBgBIAEoCzIRLnhs", + "YS5MaXRlcmFsUHJvdG8iRgoXRGVjb25zdHJ1Y3RUdXBsZVJlcXVlc3QSKwoM", + "dHVwbGVfaGFuZGxlGAIgASgLMhUueGxhLkdsb2JhbERhdGFIYW5kbGUiSgoY", + "RGVjb25zdHJ1Y3RUdXBsZVJlc3BvbnNlEi4KD2VsZW1lbnRfaGFuZGxlcxgB", + "IAMoCzIVLnhsYS5HbG9iYWxEYXRhSGFuZGxlIpsBCg9Mb2FkRGF0YVJlcXVl", + "c3QSHAoUY29sdW1uaW9fdGFibGV0X3BhdGgYASABKAkSFgoOY29sdW1uaW9f", + "ZmllbGQYAiABKAkSJgoNZWxlbWVudF9zaGFwZRgDIAEoCzIPLnhsYS5TaGFw", + "ZVByb3RvEg4KBm9mZnNldBgEIAEoAxINCgVsaW1pdBgFIAEoAxILCgN6aXAY", + "BiABKAgingEKEExvYWREYXRhUmVzcG9uc2USIwoEZGF0YRgBIAEoCzIVLnhs", + "YS5HbG9iYWxEYXRhSGFuZGxlEiMKCmRhdGFfc2hhcGUYAiABKAsyDy54bGEu", + "U2hhcGVQcm90bxIWCg5hdmFpbGFibGVfcm93cxgDIAEoAxITCgtyb3dzX2xv", + "YWRlZBgEIAEoAxITCgtuYW5vc2Vjb25kcxgFIAEoAyI2Cg9HZXRTaGFwZVJl", + "cXVlc3QSIwoEZGF0YRgBIAEoCzIVLnhsYS5HbG9iYWxEYXRhSGFuZGxlIjIK", + "EEdldFNoYXBlUmVzcG9uc2USHgoFc2hhcGUYASABKAsyDy54bGEuU2hhcGVQ", + "cm90byI0Cg1VbnBhY2tSZXF1ZXN0EiMKBGRhdGEYASABKAsyFS54bGEuR2xv", + "YmFsRGF0YUhhbmRsZSI6Cg5VbnBhY2tSZXNwb25zZRIoCgl0aWVkX2RhdGEY", + "ASADKAsyFS54bGEuR2xvYmFsRGF0YUhhbmRsZWIGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Xla.HloReflection.Descriptor, global::Xla.XlaDataReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.DebugOptions), global::Xla.DebugOptions.Parser, new[]{ "XlaHloGraphAddresses", "XlaHloProfile", "XlaDisableHloPasses", "XlaEnableHloPassesOnly", "XlaDisableAllHloPasses", "XlaBackendOptimizationLevel", "XlaEmbedIrInExecutable", "XlaEliminateHloImplicitBroadcast", "XlaCpuMultiThreadEigen", "XlaGpuCudaDataDir", "XlaGpuFtz", "XlaLlvmEnableAliasScopeMetadata", "XlaLlvmEnableNoaliasMetadata", "XlaLlvmEnableInvariantLoadMetadata", "XlaLlvmDisableExpensivePasses", "XlaTestAllOutputLayouts", "XlaTestAllInputLayouts", "XlaHloGraphShardingColor", "XlaCpuUseMklDnn", "XlaCpuUseXlaRuntime", "XlaGpuMaxKernelUnrollFactor", "XlaCpuEnableFastMath", "XlaCpuFastMathHonorNans", "XlaCpuFastMathHonorInfs", "XlaCpuFastMathHonorDivision", "XlaCpuFastMathHonorFunctions", "XlaCpuEnableFastMinMax", "XlaGpuEnableFastMinMax", "XlaAllowExcessPrecision", "XlaGpuCrashOnVerificationFailures", "XlaGpuAutotuneLevel", "XlaForceHostPlatformDeviceCount", "XlaGpuDisableGpuasmOptimizations", "XlaGpuShapeChecks", "XlaCpuEnableMlirLowering", "XlaGpuEnableMlirLowering", "XlaHloEvaluatorUseFastPath", "XlaAllowScalarIndexDynamicOps", "XlaStepMarkerLocation", "XlaDumpTo", "XlaDumpHloModuleRe", "XlaDumpHloPassRe", "XlaDumpHloAsText", "XlaDumpHloAsProto", "XlaDumpHloAsDot", "XlaDumpHloAsUrl", "XlaDumpHloAsHtml", "XlaDumpFusionVisualization", "XlaDumpHloSnapshots", "XlaDumpIncludeTimestamp", "XlaDumpMaxHloModules", "XlaDumpModuleMetadata", "XlaDumpCompressProtos", "XlaDumpHloAsLongText", "XlaGpuForceConvNchw", "XlaGpuForceConvNhwc", "XlaGpuPtxFile", "XlaGpuDumpLlvmir", "XlaGpuAlgorithmDenylistPath", "XlaTpuDetectNan", "XlaTpuDetectInf", "XlaCpuEnableXprofTraceme", "XlaGpuUnsafeFallbackToDriverOnPtxasNotFound", "XlaGpuAsmExtraFlags", "XlaMultiheapSizeConstraintPerHeap", "XlaDetailedLoggingAndDumping", "XlaGpuForceCompilationParallelism", "XlaGpuDeterministicOps", "XlaGpuLlvmIrFile", "XlaGpuEnableAsyncAllReduce", "XlaGpuAllReduceCombineThresholdBytes", "XlaGpuAllReduceContiguous", "XlaGpuAllReduceBlueconnectNumDevicesPerHost", "XlaGpuEnableCudnnFrontend", "XlaDumpDisableMetadata", "XlaDumpHloPipelineRe", "XlaGpuStrictConvAlgorithmPicker", "XlaGpuEnableXlaRuntimeExecutable", "XlaGpuNcclTerminationTimeoutSeconds", "XlaGpuEnableSharedConstants", "XlaGpuEnableCublaslt", "XlaGpuRedzoneScratchMaxMegabytes", "XlaGpuSimplifyAllFpConversions", "XlaGpuNormalizeLayouts", "XlaCpuUseAcl", "XlaCpuStrictDotConvMath", "XlaBackendExtraOptions" }, null, new[]{ typeof(global::Xla.DebugOptions.Types.ShapeChecks), typeof(global::Xla.DebugOptions.Types.StepMarkerLocation) }, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ExecutionOptions), global::Xla.ExecutionOptions.Parser, new[]{ "ShapeWithOutputLayout", "Seed", "DebugOptions", "DeviceHandles", "NumReplicas", "DeviceAssignment", "AliasPassthroughParams", "NumPartitions", "LaunchId", "UseSpmdPartitioning", "UseAutoSpmdPartitioning", "AutoSpmdPartitioningMeshShape", "AutoSpmdPartitioningMeshIds", "DeduplicateHlo", "AllowSpmdShardingPropagationToOutput" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.GetDeviceHandlesRequest), global::Xla.GetDeviceHandlesRequest.Parser, new[]{ "DeviceCount" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.GetDeviceHandlesResponse), global::Xla.GetDeviceHandlesResponse.Parser, new[]{ "DeviceHandles" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.TransferToClientRequest), global::Xla.TransferToClientRequest.Parser, new[]{ "Data", "ShapeWithLayout" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.TransferToClientResponse), global::Xla.TransferToClientResponse.Parser, new[]{ "Literal" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.TransferToServerRequest), global::Xla.TransferToServerRequest.Parser, new[]{ "Literal", "DeviceHandle" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.TransferToServerResponse), global::Xla.TransferToServerResponse.Parser, new[]{ "Data" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.TransferToInfeedRequest), global::Xla.TransferToInfeedRequest.Parser, new[]{ "Literal", "ReplicaId", "DeviceHandle" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.TransferToInfeedResponse), global::Xla.TransferToInfeedResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.TransferFromOutfeedRequest), global::Xla.TransferFromOutfeedRequest.Parser, new[]{ "ShapeWithLayout", "ReplicaId", "DeviceHandle" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.TransferFromOutfeedResponse), global::Xla.TransferFromOutfeedResponse.Parser, new[]{ "Literal" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ResetDeviceRequest), global::Xla.ResetDeviceRequest.Parser, new[]{ "DeviceHandle" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ResetDeviceResponse), global::Xla.ResetDeviceResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ComputationGraphStatsRequest), global::Xla.ComputationGraphStatsRequest.Parser, new[]{ "Computation", "DebugOptions" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ComputationStatsResponse), global::Xla.ComputationStatsResponse.Parser, new[]{ "Stats" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.CreateChannelHandleRequest), global::Xla.CreateChannelHandleRequest.Parser, new[]{ "ChannelType" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.CreateChannelHandleResponse), global::Xla.CreateChannelHandleResponse.Parser, new[]{ "Channel" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.UnregisterRequest), global::Xla.UnregisterRequest.Parser, new[]{ "Data" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.UnregisterResponse), global::Xla.UnregisterResponse.Parser, null, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.CompileRequest), global::Xla.CompileRequest.Parser, new[]{ "Computation", "ExecutionOptions", "InputShapeWithLayout" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.CompileResponse), global::Xla.CompileResponse.Parser, new[]{ "Handle" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ExecuteRequest), global::Xla.ExecuteRequest.Parser, new[]{ "Handle", "Arguments" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ExecuteGraphRequest), global::Xla.ExecuteGraphRequest.Parser, new[]{ "Computation", "Arguments", "ExecutionOptions" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ExecuteGraphParallelRequest), global::Xla.ExecuteGraphParallelRequest.Parser, new[]{ "Requests" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ExecuteResponse), global::Xla.ExecuteResponse.Parser, new[]{ "Output", "Profile" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ExecuteParallelResponse), global::Xla.ExecuteParallelResponse.Parser, new[]{ "Responses" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.WaitForExecutionRequest), global::Xla.WaitForExecutionRequest.Parser, new[]{ "Execution" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.WaitForExecutionResponse), global::Xla.WaitForExecutionResponse.Parser, new[]{ "Output", "Profile" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ComputeConstantGraphRequest), global::Xla.ComputeConstantGraphRequest.Parser, new[]{ "Computation", "OutputLayout" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ComputeConstantResponse), global::Xla.ComputeConstantResponse.Parser, new[]{ "Literal" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.DeconstructTupleRequest), global::Xla.DeconstructTupleRequest.Parser, new[]{ "TupleHandle" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.DeconstructTupleResponse), global::Xla.DeconstructTupleResponse.Parser, new[]{ "ElementHandles" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.LoadDataRequest), global::Xla.LoadDataRequest.Parser, new[]{ "ColumnioTabletPath", "ColumnioField", "ElementShape", "Offset", "Limit", "Zip" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.LoadDataResponse), global::Xla.LoadDataResponse.Parser, new[]{ "Data", "DataShape", "AvailableRows", "RowsLoaded", "Nanoseconds" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.GetShapeRequest), global::Xla.GetShapeRequest.Parser, new[]{ "Data" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.GetShapeResponse), global::Xla.GetShapeResponse.Parser, new[]{ "Shape" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.UnpackRequest), global::Xla.UnpackRequest.Parser, new[]{ "Data" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.UnpackResponse), global::Xla.UnpackResponse.Parser, new[]{ "TiedData" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + /// + /// Debugging options for XLA. These options may change at any time - there are + /// no guarantees about backward or forward compatibility for these fields. + /// + public sealed partial class DebugOptions : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DebugOptions()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DebugOptions() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DebugOptions(DebugOptions other) : this() { + xlaHloGraphAddresses_ = other.xlaHloGraphAddresses_; + xlaHloProfile_ = other.xlaHloProfile_; + xlaDisableHloPasses_ = other.xlaDisableHloPasses_.Clone(); + xlaEnableHloPassesOnly_ = other.xlaEnableHloPassesOnly_.Clone(); + xlaDisableAllHloPasses_ = other.xlaDisableAllHloPasses_; + xlaBackendOptimizationLevel_ = other.xlaBackendOptimizationLevel_; + xlaEmbedIrInExecutable_ = other.xlaEmbedIrInExecutable_; + xlaEliminateHloImplicitBroadcast_ = other.xlaEliminateHloImplicitBroadcast_; + xlaCpuMultiThreadEigen_ = other.xlaCpuMultiThreadEigen_; + xlaGpuCudaDataDir_ = other.xlaGpuCudaDataDir_; + xlaGpuFtz_ = other.xlaGpuFtz_; + xlaLlvmEnableAliasScopeMetadata_ = other.xlaLlvmEnableAliasScopeMetadata_; + xlaLlvmEnableNoaliasMetadata_ = other.xlaLlvmEnableNoaliasMetadata_; + xlaLlvmEnableInvariantLoadMetadata_ = other.xlaLlvmEnableInvariantLoadMetadata_; + xlaLlvmDisableExpensivePasses_ = other.xlaLlvmDisableExpensivePasses_; + xlaTestAllOutputLayouts_ = other.xlaTestAllOutputLayouts_; + xlaTestAllInputLayouts_ = other.xlaTestAllInputLayouts_; + xlaHloGraphShardingColor_ = other.xlaHloGraphShardingColor_; + xlaCpuUseMklDnn_ = other.xlaCpuUseMklDnn_; + xlaCpuUseXlaRuntime_ = other.xlaCpuUseXlaRuntime_; + xlaGpuMaxKernelUnrollFactor_ = other.xlaGpuMaxKernelUnrollFactor_; + xlaCpuEnableFastMath_ = other.xlaCpuEnableFastMath_; + xlaCpuFastMathHonorNans_ = other.xlaCpuFastMathHonorNans_; + xlaCpuFastMathHonorInfs_ = other.xlaCpuFastMathHonorInfs_; + xlaCpuFastMathHonorDivision_ = other.xlaCpuFastMathHonorDivision_; + xlaCpuFastMathHonorFunctions_ = other.xlaCpuFastMathHonorFunctions_; + xlaCpuEnableFastMinMax_ = other.xlaCpuEnableFastMinMax_; + xlaGpuEnableFastMinMax_ = other.xlaGpuEnableFastMinMax_; + xlaAllowExcessPrecision_ = other.xlaAllowExcessPrecision_; + xlaGpuCrashOnVerificationFailures_ = other.xlaGpuCrashOnVerificationFailures_; + xlaGpuAutotuneLevel_ = other.xlaGpuAutotuneLevel_; + xlaForceHostPlatformDeviceCount_ = other.xlaForceHostPlatformDeviceCount_; + xlaGpuDisableGpuasmOptimizations_ = other.xlaGpuDisableGpuasmOptimizations_; + xlaGpuShapeChecks_ = other.xlaGpuShapeChecks_; + xlaCpuEnableMlirLowering_ = other.xlaCpuEnableMlirLowering_; + xlaGpuEnableMlirLowering_ = other.xlaGpuEnableMlirLowering_; + xlaHloEvaluatorUseFastPath_ = other.xlaHloEvaluatorUseFastPath_; + xlaAllowScalarIndexDynamicOps_ = other.xlaAllowScalarIndexDynamicOps_; + xlaStepMarkerLocation_ = other.xlaStepMarkerLocation_; + xlaDumpTo_ = other.xlaDumpTo_; + xlaDumpHloModuleRe_ = other.xlaDumpHloModuleRe_; + xlaDumpHloPassRe_ = other.xlaDumpHloPassRe_; + xlaDumpHloAsText_ = other.xlaDumpHloAsText_; + xlaDumpHloAsProto_ = other.xlaDumpHloAsProto_; + xlaDumpHloAsDot_ = other.xlaDumpHloAsDot_; + xlaDumpHloAsUrl_ = other.xlaDumpHloAsUrl_; + xlaDumpHloAsHtml_ = other.xlaDumpHloAsHtml_; + xlaDumpFusionVisualization_ = other.xlaDumpFusionVisualization_; + xlaDumpHloSnapshots_ = other.xlaDumpHloSnapshots_; + xlaDumpIncludeTimestamp_ = other.xlaDumpIncludeTimestamp_; + xlaDumpMaxHloModules_ = other.xlaDumpMaxHloModules_; + xlaDumpModuleMetadata_ = other.xlaDumpModuleMetadata_; + xlaDumpCompressProtos_ = other.xlaDumpCompressProtos_; + xlaDumpHloAsLongText_ = other.xlaDumpHloAsLongText_; + xlaGpuForceConvNchw_ = other.xlaGpuForceConvNchw_; + xlaGpuForceConvNhwc_ = other.xlaGpuForceConvNhwc_; + xlaGpuPtxFile_ = other.xlaGpuPtxFile_.Clone(); + xlaGpuDumpLlvmir_ = other.xlaGpuDumpLlvmir_; + xlaGpuAlgorithmDenylistPath_ = other.xlaGpuAlgorithmDenylistPath_; + xlaTpuDetectNan_ = other.xlaTpuDetectNan_; + xlaTpuDetectInf_ = other.xlaTpuDetectInf_; + xlaCpuEnableXprofTraceme_ = other.xlaCpuEnableXprofTraceme_; + xlaGpuUnsafeFallbackToDriverOnPtxasNotFound_ = other.xlaGpuUnsafeFallbackToDriverOnPtxasNotFound_; + xlaGpuAsmExtraFlags_ = other.xlaGpuAsmExtraFlags_; + xlaMultiheapSizeConstraintPerHeap_ = other.xlaMultiheapSizeConstraintPerHeap_; + xlaDetailedLoggingAndDumping_ = other.xlaDetailedLoggingAndDumping_; + xlaGpuForceCompilationParallelism_ = other.xlaGpuForceCompilationParallelism_; + xlaGpuDeterministicOps_ = other.xlaGpuDeterministicOps_; + xlaGpuLlvmIrFile_ = other.xlaGpuLlvmIrFile_.Clone(); + xlaGpuEnableAsyncAllReduce_ = other.xlaGpuEnableAsyncAllReduce_; + xlaGpuAllReduceCombineThresholdBytes_ = other.xlaGpuAllReduceCombineThresholdBytes_; + xlaGpuAllReduceContiguous_ = other.xlaGpuAllReduceContiguous_; + xlaGpuAllReduceBlueconnectNumDevicesPerHost_ = other.xlaGpuAllReduceBlueconnectNumDevicesPerHost_; + xlaGpuEnableCudnnFrontend_ = other.xlaGpuEnableCudnnFrontend_; + xlaDumpDisableMetadata_ = other.xlaDumpDisableMetadata_; + xlaDumpHloPipelineRe_ = other.xlaDumpHloPipelineRe_; + xlaGpuStrictConvAlgorithmPicker_ = other.xlaGpuStrictConvAlgorithmPicker_; + xlaGpuEnableXlaRuntimeExecutable_ = other.xlaGpuEnableXlaRuntimeExecutable_; + xlaGpuNcclTerminationTimeoutSeconds_ = other.xlaGpuNcclTerminationTimeoutSeconds_; + xlaGpuEnableSharedConstants_ = other.xlaGpuEnableSharedConstants_; + xlaGpuEnableCublaslt_ = other.xlaGpuEnableCublaslt_; + xlaGpuRedzoneScratchMaxMegabytes_ = other.xlaGpuRedzoneScratchMaxMegabytes_; + xlaGpuSimplifyAllFpConversions_ = other.xlaGpuSimplifyAllFpConversions_; + xlaGpuNormalizeLayouts_ = other.xlaGpuNormalizeLayouts_; + xlaCpuUseAcl_ = other.xlaCpuUseAcl_; + xlaCpuStrictDotConvMath_ = other.xlaCpuStrictDotConvMath_; + xlaBackendExtraOptions_ = other.xlaBackendExtraOptions_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DebugOptions Clone() { + return new DebugOptions(this); + } + + /// Field number for the "xla_hlo_graph_addresses" field. + public const int XlaHloGraphAddressesFieldNumber = 2; + private bool xlaHloGraphAddresses_; + /// + /// Show addresses of HLO ops in graph dump. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaHloGraphAddresses { + get { return xlaHloGraphAddresses_; } + set { + xlaHloGraphAddresses_ = value; + } + } + + /// Field number for the "xla_hlo_profile" field. + public const int XlaHloProfileFieldNumber = 9; + private bool xlaHloProfile_; + /// + /// Instrument the computation to collect per-HLO cycle counts. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaHloProfile { + get { return xlaHloProfile_; } + set { + xlaHloProfile_ = value; + } + } + + /// Field number for the "xla_disable_hlo_passes" field. + public const int XlaDisableHloPassesFieldNumber = 30; + private static readonly pb::FieldCodec _repeated_xlaDisableHloPasses_codec + = pb::FieldCodec.ForString(242); + private readonly pbc::RepeatedField xlaDisableHloPasses_ = new pbc::RepeatedField(); + /// + /// List of HLO passes to disable/enable. These names must exactly match the + /// pass names as specified by the HloPassInterface::name() method. + /// + /// At least one of xla_disable_hlo_passes and xla_enable_hlo_passes_only must + /// be empty. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField XlaDisableHloPasses { + get { return xlaDisableHloPasses_; } + } + + /// Field number for the "xla_enable_hlo_passes_only" field. + public const int XlaEnableHloPassesOnlyFieldNumber = 124; + private static readonly pb::FieldCodec _repeated_xlaEnableHloPassesOnly_codec + = pb::FieldCodec.ForString(994); + private readonly pbc::RepeatedField xlaEnableHloPassesOnly_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField XlaEnableHloPassesOnly { + get { return xlaEnableHloPassesOnly_; } + } + + /// Field number for the "xla_disable_all_hlo_passes" field. + public const int XlaDisableAllHloPassesFieldNumber = 104; + private bool xlaDisableAllHloPasses_; + /// + /// Disables all HLO passes. Notes that some passes are necessary for + /// correctness and the invariants that must be satisfied by "fully optimized" + /// HLO are different for different devices and may change over time. The only + /// "guarantee", such as it is, is that if you compile XLA and dump the + /// optimized HLO for some graph, you should be able to run it again on the + /// same device with the same build of XLA. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaDisableAllHloPasses { + get { return xlaDisableAllHloPasses_; } + set { + xlaDisableAllHloPasses_ = value; + } + } + + /// Field number for the "xla_backend_optimization_level" field. + public const int XlaBackendOptimizationLevelFieldNumber = 31; + private int xlaBackendOptimizationLevel_; + /// + /// Numerical optimization level for the XLA compiler backend; the specific + /// interpretation of this value is left to the backends. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int XlaBackendOptimizationLevel { + get { return xlaBackendOptimizationLevel_; } + set { + xlaBackendOptimizationLevel_ = value; + } + } + + /// Field number for the "xla_embed_ir_in_executable" field. + public const int XlaEmbedIrInExecutableFieldNumber = 33; + private bool xlaEmbedIrInExecutable_; + /// + /// Embed the compiler IR as a string in the executable. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaEmbedIrInExecutable { + get { return xlaEmbedIrInExecutable_; } + set { + xlaEmbedIrInExecutable_ = value; + } + } + + /// Field number for the "xla_eliminate_hlo_implicit_broadcast" field. + public const int XlaEliminateHloImplicitBroadcastFieldNumber = 35; + private bool xlaEliminateHloImplicitBroadcast_; + /// + /// Eliminate implicit broadcasts when lowering user computations to HLO + /// instructions; use explicit broadcast instead. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaEliminateHloImplicitBroadcast { + get { return xlaEliminateHloImplicitBroadcast_; } + set { + xlaEliminateHloImplicitBroadcast_ = value; + } + } + + /// Field number for the "xla_cpu_multi_thread_eigen" field. + public const int XlaCpuMultiThreadEigenFieldNumber = 60; + private bool xlaCpuMultiThreadEigen_; + /// + /// When generating calls to Eigen in the CPU backend, use multi-threaded Eigen + /// mode. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaCpuMultiThreadEigen { + get { return xlaCpuMultiThreadEigen_; } + set { + xlaCpuMultiThreadEigen_ = value; + } + } + + /// Field number for the "xla_gpu_cuda_data_dir" field. + public const int XlaGpuCudaDataDirFieldNumber = 61; + private string xlaGpuCudaDataDir_ = ""; + /// + /// Path to directory with cuda/ptx tools and libraries. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string XlaGpuCudaDataDir { + get { return xlaGpuCudaDataDir_; } + set { + xlaGpuCudaDataDir_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "xla_gpu_ftz" field. + public const int XlaGpuFtzFieldNumber = 62; + private bool xlaGpuFtz_; + /// + /// Enable flush-to-zero semantics in the GPU backend. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaGpuFtz { + get { return xlaGpuFtz_; } + set { + xlaGpuFtz_ = value; + } + } + + /// Field number for the "xla_llvm_enable_alias_scope_metadata" field. + public const int XlaLlvmEnableAliasScopeMetadataFieldNumber = 70; + private bool xlaLlvmEnableAliasScopeMetadata_; + /// + /// If true, in LLVM-based backends, emit !alias.scope metadata in + /// generated IR. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaLlvmEnableAliasScopeMetadata { + get { return xlaLlvmEnableAliasScopeMetadata_; } + set { + xlaLlvmEnableAliasScopeMetadata_ = value; + } + } + + /// Field number for the "xla_llvm_enable_noalias_metadata" field. + public const int XlaLlvmEnableNoaliasMetadataFieldNumber = 71; + private bool xlaLlvmEnableNoaliasMetadata_; + /// + /// If true, in LLVM-based backends, emit !noalias metadata in the + /// generated IR. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaLlvmEnableNoaliasMetadata { + get { return xlaLlvmEnableNoaliasMetadata_; } + set { + xlaLlvmEnableNoaliasMetadata_ = value; + } + } + + /// Field number for the "xla_llvm_enable_invariant_load_metadata" field. + public const int XlaLlvmEnableInvariantLoadMetadataFieldNumber = 72; + private bool xlaLlvmEnableInvariantLoadMetadata_; + /// + /// If true, in LLVM-based backends, emit !invariant.load metadata in + /// the generated IR. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaLlvmEnableInvariantLoadMetadata { + get { return xlaLlvmEnableInvariantLoadMetadata_; } + set { + xlaLlvmEnableInvariantLoadMetadata_ = value; + } + } + + /// Field number for the "xla_llvm_disable_expensive_passes" field. + public const int XlaLlvmDisableExpensivePassesFieldNumber = 73; + private bool xlaLlvmDisableExpensivePasses_; + /// + /// If true, a set of expensive LLVM optimization passes will not be run. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaLlvmDisableExpensivePasses { + get { return xlaLlvmDisableExpensivePasses_; } + set { + xlaLlvmDisableExpensivePasses_ = value; + } + } + + /// Field number for the "xla_test_all_output_layouts" field. + public const int XlaTestAllOutputLayoutsFieldNumber = 90; + private bool xlaTestAllOutputLayouts_; + /// + /// This is used by ClientLibraryTestBase::ComputeAndCompare*. If true, the + /// computation will run n! times with all permunations of layouts for the + /// output shape in rank n. For example, with a 3D shape, all permutations of + /// the set {0, 1, 2} are tried. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaTestAllOutputLayouts { + get { return xlaTestAllOutputLayouts_; } + set { + xlaTestAllOutputLayouts_ = value; + } + } + + /// Field number for the "xla_test_all_input_layouts" field. + public const int XlaTestAllInputLayoutsFieldNumber = 91; + private bool xlaTestAllInputLayouts_; + /// + /// This is used by ClientLibraryTestBase::ComputeAndCompare*. If true, the + /// computation will run for all permunations of layouts of all input + /// arguments. For example, with 2 input arguments in 2D and 4D shapes, the + /// computation will run 2! * 4! times. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaTestAllInputLayouts { + get { return xlaTestAllInputLayouts_; } + set { + xlaTestAllInputLayouts_ = value; + } + } + + /// Field number for the "xla_hlo_graph_sharding_color" field. + public const int XlaHloGraphShardingColorFieldNumber = 92; + private bool xlaHloGraphShardingColor_; + /// + /// Assign colors based on sharding information when generating the Graphviz + /// HLO graph. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaHloGraphShardingColor { + get { return xlaHloGraphShardingColor_; } + set { + xlaHloGraphShardingColor_ = value; + } + } + + /// Field number for the "xla_cpu_use_mkl_dnn" field. + public const int XlaCpuUseMklDnnFieldNumber = 97; + private bool xlaCpuUseMklDnn_; + /// + /// Generate calls to MKL-DNN in the CPU backend. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaCpuUseMklDnn { + get { return xlaCpuUseMklDnn_; } + set { + xlaCpuUseMklDnn_ = value; + } + } + + /// Field number for the "xla_cpu_use_xla_runtime" field. + public const int XlaCpuUseXlaRuntimeFieldNumber = 177; + private bool xlaCpuUseXlaRuntime_; + /// + /// Enable XLA Runtime in the CPU backend. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaCpuUseXlaRuntime { + get { return xlaCpuUseXlaRuntime_; } + set { + xlaCpuUseXlaRuntime_ = value; + } + } + + /// Field number for the "xla_gpu_max_kernel_unroll_factor" field. + public const int XlaGpuMaxKernelUnrollFactorFieldNumber = 98; + private int xlaGpuMaxKernelUnrollFactor_; + /// + /// Maximum kernel unroll factor for the GPU backend. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int XlaGpuMaxKernelUnrollFactor { + get { return xlaGpuMaxKernelUnrollFactor_; } + set { + xlaGpuMaxKernelUnrollFactor_ = value; + } + } + + /// Field number for the "xla_cpu_enable_fast_math" field. + public const int XlaCpuEnableFastMathFieldNumber = 99; + private bool xlaCpuEnableFastMath_; + /// + /// When true, "unsafe" mathematical optimizations are enabled. These + /// transformations include but are not limited to: + /// + /// - Reducing the precision of operations (e.g. using an approximate sin + /// function, or transforming x/y into x * (1/y)). + /// - Assuming that operations never produce or consume NaN or +/- Inf (this + /// behavior can be adjusted using xla_cpu_fast_math_allow_{nans|infs}). + /// - Assuming that +0 and -0 are indistinguishable. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaCpuEnableFastMath { + get { return xlaCpuEnableFastMath_; } + set { + xlaCpuEnableFastMath_ = value; + } + } + + /// Field number for the "xla_cpu_fast_math_honor_nans" field. + public const int XlaCpuFastMathHonorNansFieldNumber = 120; + private bool xlaCpuFastMathHonorNans_; + /// + /// When xla_cpu_enable_fast_math is true then this controls whether we allow + /// operations to produce NaNs. Ignored when xla_cpu_enable_fast_math is + /// false. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaCpuFastMathHonorNans { + get { return xlaCpuFastMathHonorNans_; } + set { + xlaCpuFastMathHonorNans_ = value; + } + } + + /// Field number for the "xla_cpu_fast_math_honor_infs" field. + public const int XlaCpuFastMathHonorInfsFieldNumber = 121; + private bool xlaCpuFastMathHonorInfs_; + /// + /// When xla_cpu_enable_fast_math is true then this controls whether we allow + /// operations to produce infinites. Ignored when xla_cpu_enable_fast_math is + /// false. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaCpuFastMathHonorInfs { + get { return xlaCpuFastMathHonorInfs_; } + set { + xlaCpuFastMathHonorInfs_ = value; + } + } + + /// Field number for the "xla_cpu_fast_math_honor_division" field. + public const int XlaCpuFastMathHonorDivisionFieldNumber = 126; + private bool xlaCpuFastMathHonorDivision_; + /// + /// When xla_cpu_enable_fast_math is true then this controls whether we forbid + /// to use the reciprocal of an argument instead of division. Ignored when + /// xla_cpu_enable_fast_math is false. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaCpuFastMathHonorDivision { + get { return xlaCpuFastMathHonorDivision_; } + set { + xlaCpuFastMathHonorDivision_ = value; + } + } + + /// Field number for the "xla_cpu_fast_math_honor_functions" field. + public const int XlaCpuFastMathHonorFunctionsFieldNumber = 129; + private bool xlaCpuFastMathHonorFunctions_; + /// + /// When xla_cpu_enable_fast_math is true then this controls whether we forbid + /// to approximate calculations for functions. Ignored when + /// xla_cpu_enable_fast_math is false. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaCpuFastMathHonorFunctions { + get { return xlaCpuFastMathHonorFunctions_; } + set { + xlaCpuFastMathHonorFunctions_ = value; + } + } + + /// Field number for the "xla_cpu_enable_fast_min_max" field. + public const int XlaCpuEnableFastMinMaxFieldNumber = 140; + private bool xlaCpuEnableFastMinMax_; + /// + /// When false we lower the Minimum and Maximum hlos in the CPU backend such + /// that Min(NotNaN, NaN) = Min(NaN, NotNaN) = NaN. In other words, if flag + /// this is false we always propagate NaNs through Min and Max. + /// + /// Note, this does not correspond to the exact same behavior as the gpu flag + /// below! + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaCpuEnableFastMinMax { + get { return xlaCpuEnableFastMinMax_; } + set { + xlaCpuEnableFastMinMax_ = value; + } + } + + /// Field number for the "xla_gpu_enable_fast_min_max" field. + public const int XlaGpuEnableFastMinMaxFieldNumber = 100; + private bool xlaGpuEnableFastMinMax_; + /// + /// When true we lower the Minimum and Maximum hlos in the GPU backend such + /// that Min(NotNaN, NaN) = Min(NaN, NotNaN) = NotNaN. In other words, if flag + /// this is true we don't propagate NaNs through Min and Max. + /// + /// Note, this does not correspond to the exact same behavior as the cpu flag + /// above! + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaGpuEnableFastMinMax { + get { return xlaGpuEnableFastMinMax_; } + set { + xlaGpuEnableFastMinMax_ = value; + } + } + + /// Field number for the "xla_allow_excess_precision" field. + public const int XlaAllowExcessPrecisionFieldNumber = 122; + private bool xlaAllowExcessPrecision_; + /// + /// Allows xla to increase the output precision of floating point operations. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaAllowExcessPrecision { + get { return xlaAllowExcessPrecision_; } + set { + xlaAllowExcessPrecision_ = value; + } + } + + /// Field number for the "xla_gpu_crash_on_verification_failures" field. + public const int XlaGpuCrashOnVerificationFailuresFieldNumber = 101; + private bool xlaGpuCrashOnVerificationFailures_; + /// + /// Crashes the program when any kind of verification fails, instead of just + /// logging the failures. One example is cross checking of convolution results + /// among different algorithms. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaGpuCrashOnVerificationFailures { + get { return xlaGpuCrashOnVerificationFailures_; } + set { + xlaGpuCrashOnVerificationFailures_ = value; + } + } + + /// Field number for the "xla_gpu_autotune_level" field. + public const int XlaGpuAutotuneLevelFieldNumber = 123; + private int xlaGpuAutotuneLevel_; + /// + /// 0: Disable gemm and convolution autotuning. + /// 1: Enable autotuning, but disable correctness checking. + /// 2: Also set output buffers to random numbers during autotuning. + /// 3: Also reset output buffers to random numbers after autotuning each + /// algorithm. + /// 4+: Also check for correct outputs and for out-of-bounds reads/writes. + /// + /// Default: 4. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int XlaGpuAutotuneLevel { + get { return xlaGpuAutotuneLevel_; } + set { + xlaGpuAutotuneLevel_ = value; + } + } + + /// Field number for the "xla_force_host_platform_device_count" field. + public const int XlaForceHostPlatformDeviceCountFieldNumber = 102; + private int xlaForceHostPlatformDeviceCount_; + /// + /// Force the host platform to pretend that there are these many host + /// "devices". All these devices are backed by the same threadpool. Defaults + /// to 1. + /// + /// Setting this to anything other than 1 can increase overhead from context + /// switching but we let the user override this behavior to help run tests on + /// the host that run models in parallel across multiple devices. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int XlaForceHostPlatformDeviceCount { + get { return xlaForceHostPlatformDeviceCount_; } + set { + xlaForceHostPlatformDeviceCount_ = value; + } + } + + /// Field number for the "xla_gpu_disable_gpuasm_optimizations" field. + public const int XlaGpuDisableGpuasmOptimizationsFieldNumber = 103; + private bool xlaGpuDisableGpuasmOptimizations_; + /// + /// If set to true XLA:GPU invokes `ptxas` with -O0 (default is -O3). + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaGpuDisableGpuasmOptimizations { + get { return xlaGpuDisableGpuasmOptimizations_; } + set { + xlaGpuDisableGpuasmOptimizations_ = value; + } + } + + /// Field number for the "xla_gpu_shape_checks" field. + public const int XlaGpuShapeChecksFieldNumber = 170; + private global::Xla.DebugOptions.Types.ShapeChecks xlaGpuShapeChecks_ = global::Xla.DebugOptions.Types.ShapeChecks.Ignore; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.DebugOptions.Types.ShapeChecks XlaGpuShapeChecks { + get { return xlaGpuShapeChecks_; } + set { + xlaGpuShapeChecks_ = value; + } + } + + /// Field number for the "xla_cpu_enable_mlir_lowering" field. + public const int XlaCpuEnableMlirLoweringFieldNumber = 171; + private bool xlaCpuEnableMlirLowering_; + /// + /// Enable MLIR-based lowering in XLA:CPU instead of LLVM emitters. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaCpuEnableMlirLowering { + get { return xlaCpuEnableMlirLowering_; } + set { + xlaCpuEnableMlirLowering_ = value; + } + } + + /// Field number for the "xla_gpu_enable_mlir_lowering" field. + public const int XlaGpuEnableMlirLoweringFieldNumber = 173; + private bool xlaGpuEnableMlirLowering_; + /// + /// If true, use MLIR instead of IR emitter to generate device code for + /// supported lmhlo.fusion ops. See xla::gpu::RewriteFusionOps() for details. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaGpuEnableMlirLowering { + get { return xlaGpuEnableMlirLowering_; } + set { + xlaGpuEnableMlirLowering_ = value; + } + } + + /// Field number for the "xla_hlo_evaluator_use_fast_path" field. + public const int XlaHloEvaluatorUseFastPathFieldNumber = 106; + private bool xlaHloEvaluatorUseFastPath_; + /// + /// Enable fast math with eigen in the HLO evaluator. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaHloEvaluatorUseFastPath { + get { return xlaHloEvaluatorUseFastPath_; } + set { + xlaHloEvaluatorUseFastPath_ = value; + } + } + + /// Field number for the "xla_allow_scalar_index_dynamic_ops" field. + public const int XlaAllowScalarIndexDynamicOpsFieldNumber = 107; + private bool xlaAllowScalarIndexDynamicOps_; + /// + /// Temporary option to allow support for both the R1 and the scalar index + /// versions of DynamicSlice and DynamicUpdateSlice. Only used for testing. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaAllowScalarIndexDynamicOps { + get { return xlaAllowScalarIndexDynamicOps_; } + set { + xlaAllowScalarIndexDynamicOps_ = value; + } + } + + /// Field number for the "xla_step_marker_location" field. + public const int XlaStepMarkerLocationFieldNumber = 108; + private global::Xla.DebugOptions.Types.StepMarkerLocation xlaStepMarkerLocation_ = global::Xla.DebugOptions.Types.StepMarkerLocation.StepMarkAtEntry; + /// + /// Option to emit a target-specific marker to indicate the start of a training + /// step. The location of the marker (if any) is determined by the option + /// value. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.DebugOptions.Types.StepMarkerLocation XlaStepMarkerLocation { + get { return xlaStepMarkerLocation_; } + set { + xlaStepMarkerLocation_ = value; + } + } + + /// Field number for the "xla_dump_to" field. + public const int XlaDumpToFieldNumber = 109; + private string xlaDumpTo_ = ""; + /// + /// Directory to dump into. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string XlaDumpTo { + get { return xlaDumpTo_; } + set { + xlaDumpTo_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "xla_dump_hlo_module_re" field. + public const int XlaDumpHloModuleReFieldNumber = 110; + private string xlaDumpHloModuleRe_ = ""; + /// + /// If specified, will only dump modules which match this regexp. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string XlaDumpHloModuleRe { + get { return xlaDumpHloModuleRe_; } + set { + xlaDumpHloModuleRe_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "xla_dump_hlo_pass_re" field. + public const int XlaDumpHloPassReFieldNumber = 111; + private string xlaDumpHloPassRe_ = ""; + /// + /// If this flag is specified, will also dump HLO before and after passes that + /// match this regular expression. Set to .* to dump before/after all passes. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string XlaDumpHloPassRe { + get { return xlaDumpHloPassRe_; } + set { + xlaDumpHloPassRe_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "xla_dump_hlo_as_text" field. + public const int XlaDumpHloAsTextFieldNumber = 112; + private bool xlaDumpHloAsText_; + /// + /// Specifies the format that HLO is dumped in. Multiple of these may be + /// specified. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaDumpHloAsText { + get { return xlaDumpHloAsText_; } + set { + xlaDumpHloAsText_ = value; + } + } + + /// Field number for the "xla_dump_hlo_as_proto" field. + public const int XlaDumpHloAsProtoFieldNumber = 113; + private bool xlaDumpHloAsProto_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaDumpHloAsProto { + get { return xlaDumpHloAsProto_; } + set { + xlaDumpHloAsProto_ = value; + } + } + + /// Field number for the "xla_dump_hlo_as_dot" field. + public const int XlaDumpHloAsDotFieldNumber = 114; + private bool xlaDumpHloAsDot_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaDumpHloAsDot { + get { return xlaDumpHloAsDot_; } + set { + xlaDumpHloAsDot_ = value; + } + } + + /// Field number for the "xla_dump_hlo_as_url" field. + public const int XlaDumpHloAsUrlFieldNumber = 115; + private bool xlaDumpHloAsUrl_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaDumpHloAsUrl { + get { return xlaDumpHloAsUrl_; } + set { + xlaDumpHloAsUrl_ = value; + } + } + + /// Field number for the "xla_dump_hlo_as_html" field. + public const int XlaDumpHloAsHtmlFieldNumber = 116; + private bool xlaDumpHloAsHtml_; + /// + /// Dump HLO graphs as an HTML (DOT -> SVG inlined in HTML) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaDumpHloAsHtml { + get { return xlaDumpHloAsHtml_; } + set { + xlaDumpHloAsHtml_ = value; + } + } + + /// Field number for the "xla_dump_fusion_visualization" field. + public const int XlaDumpFusionVisualizationFieldNumber = 149; + private bool xlaDumpFusionVisualization_; + /// + /// Dump the visualization of the fusion progress. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaDumpFusionVisualization { + get { return xlaDumpFusionVisualization_; } + set { + xlaDumpFusionVisualization_ = value; + } + } + + /// Field number for the "xla_dump_hlo_snapshots" field. + public const int XlaDumpHloSnapshotsFieldNumber = 118; + private bool xlaDumpHloSnapshots_; + /// + /// If true, every time an HLO module is run, we will dump an HloSnapshot + /// (essentially, a serialized module plus its inputs) to the --xla_dump_to + /// directory. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaDumpHloSnapshots { + get { return xlaDumpHloSnapshots_; } + set { + xlaDumpHloSnapshots_ = value; + } + } + + /// Field number for the "xla_dump_include_timestamp" field. + public const int XlaDumpIncludeTimestampFieldNumber = 131; + private bool xlaDumpIncludeTimestamp_; + /// + /// Include a timestamp in the dumped filenames. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaDumpIncludeTimestamp { + get { return xlaDumpIncludeTimestamp_; } + set { + xlaDumpIncludeTimestamp_ = value; + } + } + + /// Field number for the "xla_dump_max_hlo_modules" field. + public const int XlaDumpMaxHloModulesFieldNumber = 132; + private int xlaDumpMaxHloModules_; + /// + /// Max number of hlo module dumps in a directory. Set to < 0 for unbounded. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int XlaDumpMaxHloModules { + get { return xlaDumpMaxHloModules_; } + set { + xlaDumpMaxHloModules_ = value; + } + } + + /// Field number for the "xla_dump_module_metadata" field. + public const int XlaDumpModuleMetadataFieldNumber = 144; + private bool xlaDumpModuleMetadata_; + /// + /// Dump HloModuleMetadata as a text proto for each HLO module. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaDumpModuleMetadata { + get { return xlaDumpModuleMetadata_; } + set { + xlaDumpModuleMetadata_ = value; + } + } + + /// Field number for the "xla_dump_compress_protos" field. + public const int XlaDumpCompressProtosFieldNumber = 151; + private bool xlaDumpCompressProtos_; + /// + /// GZip-compress protos dumped via --xla_dump_hlo_as_proto. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaDumpCompressProtos { + get { return xlaDumpCompressProtos_; } + set { + xlaDumpCompressProtos_ = value; + } + } + + /// Field number for the "xla_dump_hlo_as_long_text" field. + public const int XlaDumpHloAsLongTextFieldNumber = 164; + private bool xlaDumpHloAsLongText_; + /// + /// Dump HLO in long text format. Ignored unless xla_dump_hlo_as_text is true. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaDumpHloAsLongText { + get { return xlaDumpHloAsLongText_; } + set { + xlaDumpHloAsLongText_ = value; + } + } + + /// Field number for the "xla_gpu_force_conv_nchw" field. + public const int XlaGpuForceConvNchwFieldNumber = 125; + private bool xlaGpuForceConvNchw_; + /// + /// Overrides for XLA GPU's convolution layout heuristic. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaGpuForceConvNchw { + get { return xlaGpuForceConvNchw_; } + set { + xlaGpuForceConvNchw_ = value; + } + } + + /// Field number for the "xla_gpu_force_conv_nhwc" field. + public const int XlaGpuForceConvNhwcFieldNumber = 146; + private bool xlaGpuForceConvNhwc_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaGpuForceConvNhwc { + get { return xlaGpuForceConvNhwc_; } + set { + xlaGpuForceConvNhwc_ = value; + } + } + + /// Field number for the "xla_gpu_ptx_file" field. + public const int XlaGpuPtxFileFieldNumber = 127; + private static readonly pb::FieldCodec _repeated_xlaGpuPtxFile_codec + = pb::FieldCodec.ForString(1018); + private readonly pbc::RepeatedField xlaGpuPtxFile_ = new pbc::RepeatedField(); + /// + /// Paths to files with ptx code. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField XlaGpuPtxFile { + get { return xlaGpuPtxFile_; } + } + + /// Field number for the "xla_gpu_dump_llvmir" field. + public const int XlaGpuDumpLlvmirFieldNumber = 155; + private bool xlaGpuDumpLlvmir_; + /// + /// Whether to dump llvm ir when compiling to ptx. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaGpuDumpLlvmir { + get { return xlaGpuDumpLlvmir_; } + set { + xlaGpuDumpLlvmir_ = value; + } + } + + /// Field number for the "xla_gpu_algorithm_denylist_path" field. + public const int XlaGpuAlgorithmDenylistPathFieldNumber = 128; + private string xlaGpuAlgorithmDenylistPath_ = ""; + /// + /// Denylist for cuDNN convolutions. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string XlaGpuAlgorithmDenylistPath { + get { return xlaGpuAlgorithmDenylistPath_; } + set { + xlaGpuAlgorithmDenylistPath_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "xla_tpu_detect_nan" field. + public const int XlaTpuDetectNanFieldNumber = 135; + private bool xlaTpuDetectNan_; + /// + /// Debug options that trigger execution errors when NaN or Inf are detected. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaTpuDetectNan { + get { return xlaTpuDetectNan_; } + set { + xlaTpuDetectNan_ = value; + } + } + + /// Field number for the "xla_tpu_detect_inf" field. + public const int XlaTpuDetectInfFieldNumber = 136; + private bool xlaTpuDetectInf_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaTpuDetectInf { + get { return xlaTpuDetectInf_; } + set { + xlaTpuDetectInf_ = value; + } + } + + /// Field number for the "xla_cpu_enable_xprof_traceme" field. + public const int XlaCpuEnableXprofTracemeFieldNumber = 137; + private bool xlaCpuEnableXprofTraceme_; + /// + /// True if TraceMe annotations are enabled for XLA:CPU. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaCpuEnableXprofTraceme { + get { return xlaCpuEnableXprofTraceme_; } + set { + xlaCpuEnableXprofTraceme_ = value; + } + } + + /// Field number for the "xla_gpu_unsafe_fallback_to_driver_on_ptxas_not_found" field. + public const int XlaGpuUnsafeFallbackToDriverOnPtxasNotFoundFieldNumber = 138; + private bool xlaGpuUnsafeFallbackToDriverOnPtxasNotFound_; + /// + /// It is usually preferable to not fallback to the driver; it can consume more + /// memory, or have bugs. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaGpuUnsafeFallbackToDriverOnPtxasNotFound { + get { return xlaGpuUnsafeFallbackToDriverOnPtxasNotFound_; } + set { + xlaGpuUnsafeFallbackToDriverOnPtxasNotFound_ = value; + } + } + + /// Field number for the "xla_gpu_asm_extra_flags" field. + public const int XlaGpuAsmExtraFlagsFieldNumber = 141; + private string xlaGpuAsmExtraFlags_ = ""; + /// + /// Extra parameters to pass the GPU assembler. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string XlaGpuAsmExtraFlags { + get { return xlaGpuAsmExtraFlags_; } + set { + xlaGpuAsmExtraFlags_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "xla_multiheap_size_constraint_per_heap" field. + public const int XlaMultiheapSizeConstraintPerHeapFieldNumber = 142; + private int xlaMultiheapSizeConstraintPerHeap_; + /// + /// Per-heap size constraint. New heaps will be created if per-heap max size is + /// reached. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int XlaMultiheapSizeConstraintPerHeap { + get { return xlaMultiheapSizeConstraintPerHeap_; } + set { + xlaMultiheapSizeConstraintPerHeap_ = value; + } + } + + /// Field number for the "xla_detailed_logging_and_dumping" field. + public const int XlaDetailedLoggingAndDumpingFieldNumber = 143; + private bool xlaDetailedLoggingAndDumping_; + /// + /// Enable detailed logging into vlog and xla dumping. If this is disabled, no + /// compilation summary will be printed in the end of computation and no hlo + /// modules will be dumped. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaDetailedLoggingAndDumping { + get { return xlaDetailedLoggingAndDumping_; } + set { + xlaDetailedLoggingAndDumping_ = value; + } + } + + /// Field number for the "xla_gpu_force_compilation_parallelism" field. + public const int XlaGpuForceCompilationParallelismFieldNumber = 147; + private int xlaGpuForceCompilationParallelism_; + /// + /// Overrides normal multi-threaded compilation settting to use this many + /// threads. Setting to 0 (the default value) means no enforcement. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int XlaGpuForceCompilationParallelism { + get { return xlaGpuForceCompilationParallelism_; } + set { + xlaGpuForceCompilationParallelism_ = value; + } + } + + /// Field number for the "xla_gpu_deterministic_ops" field. + public const int XlaGpuDeterministicOpsFieldNumber = 148; + private bool xlaGpuDeterministicOps_; + /// + /// Guarantees run-to-run determinism. At present, the HLO ops Scatter and + /// SelectAndScatter do not have deterministic XLA:GPU implementations. + /// Compilation errors out if these ops are encountered. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaGpuDeterministicOps { + get { return xlaGpuDeterministicOps_; } + set { + xlaGpuDeterministicOps_ = value; + } + } + + /// Field number for the "xla_gpu_llvm_ir_file" field. + public const int XlaGpuLlvmIrFileFieldNumber = 150; + private static readonly pb::FieldCodec _repeated_xlaGpuLlvmIrFile_codec + = pb::FieldCodec.ForString(1202); + private readonly pbc::RepeatedField xlaGpuLlvmIrFile_ = new pbc::RepeatedField(); + /// + /// Paths to files with LLVM code. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField XlaGpuLlvmIrFile { + get { return xlaGpuLlvmIrFile_; } + } + + /// Field number for the "xla_gpu_enable_async_all_reduce" field. + public const int XlaGpuEnableAsyncAllReduceFieldNumber = 152; + private bool xlaGpuEnableAsyncAllReduce_; + /// + /// Convert synchronous all-reduces ops into asynchronous. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaGpuEnableAsyncAllReduce { + get { return xlaGpuEnableAsyncAllReduce_; } + set { + xlaGpuEnableAsyncAllReduce_ = value; + } + } + + /// Field number for the "xla_gpu_all_reduce_combine_threshold_bytes" field. + public const int XlaGpuAllReduceCombineThresholdBytesFieldNumber = 157; + private long xlaGpuAllReduceCombineThresholdBytes_; + /// + /// Size threshold (in bytes) for the GPU all-reduce combiner. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long XlaGpuAllReduceCombineThresholdBytes { + get { return xlaGpuAllReduceCombineThresholdBytes_; } + set { + xlaGpuAllReduceCombineThresholdBytes_ = value; + } + } + + /// Field number for the "xla_gpu_all_reduce_contiguous" field. + public const int XlaGpuAllReduceContiguousFieldNumber = 158; + private bool xlaGpuAllReduceContiguous_; + /// + /// Combine GPU all-reduces into a single operation over a contiguous buffer. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaGpuAllReduceContiguous { + get { return xlaGpuAllReduceContiguous_; } + set { + xlaGpuAllReduceContiguous_ = value; + } + } + + /// Field number for the "xla_gpu_all_reduce_blueconnect_num_devices_per_host" field. + public const int XlaGpuAllReduceBlueconnectNumDevicesPerHostFieldNumber = 159; + private int xlaGpuAllReduceBlueconnectNumDevicesPerHost_; + /// + /// Number of devices per host for first stage of BlueConnect decomposition + /// pass. The pass will attempt to decompose all-reduces ops into a + /// ReduceScatter-AllReduce-AllGather sequence, with the initial ReduceScatter + /// being performed over all of the devices in the same host. Set to < 1 to + /// disable all-reduce decomposition. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int XlaGpuAllReduceBlueconnectNumDevicesPerHost { + get { return xlaGpuAllReduceBlueconnectNumDevicesPerHost_; } + set { + xlaGpuAllReduceBlueconnectNumDevicesPerHost_ = value; + } + } + + /// Field number for the "xla_gpu_enable_cudnn_frontend" field. + public const int XlaGpuEnableCudnnFrontendFieldNumber = 160; + private bool xlaGpuEnableCudnnFrontend_; + /// + /// Whether to use the cuDNN frontend API for convolutions when possible. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaGpuEnableCudnnFrontend { + get { return xlaGpuEnableCudnnFrontend_; } + set { + xlaGpuEnableCudnnFrontend_ = value; + } + } + + /// Field number for the "xla_dump_disable_metadata" field. + public const int XlaDumpDisableMetadataFieldNumber = 153; + private bool xlaDumpDisableMetadata_; + /// + /// Disable dumping metadata in HLO dumps. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaDumpDisableMetadata { + get { return xlaDumpDisableMetadata_; } + set { + xlaDumpDisableMetadata_ = value; + } + } + + /// Field number for the "xla_dump_hlo_pipeline_re" field. + public const int XlaDumpHloPipelineReFieldNumber = 154; + private string xlaDumpHloPipelineRe_ = ""; + /// + /// If this flag is specified, will only dump HLO before and after passes in + /// the pass pipeline that matches this regular expression. Default empty value + /// enables dumping in all pipelines. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string XlaDumpHloPipelineRe { + get { return xlaDumpHloPipelineRe_; } + set { + xlaDumpHloPipelineRe_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "xla_gpu_strict_conv_algorithm_picker" field. + public const int XlaGpuStrictConvAlgorithmPickerFieldNumber = 156; + private bool xlaGpuStrictConvAlgorithmPicker_; + /// + /// If true, abort immediately when conv algorithm picker fails, rather than + /// logging a warning and proceeding with fallback. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaGpuStrictConvAlgorithmPicker { + get { return xlaGpuStrictConvAlgorithmPicker_; } + set { + xlaGpuStrictConvAlgorithmPicker_ = value; + } + } + + /// Field number for the "xla_gpu_enable_xla_runtime_executable" field. + public const int XlaGpuEnableXlaRuntimeExecutableFieldNumber = 169; + private bool xlaGpuEnableXlaRuntimeExecutable_; + /// + /// If true, use XLA runtime for XLA:GPU backend. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaGpuEnableXlaRuntimeExecutable { + get { return xlaGpuEnableXlaRuntimeExecutable_; } + set { + xlaGpuEnableXlaRuntimeExecutable_ = value; + } + } + + /// Field number for the "xla_gpu_nccl_termination_timeout_seconds" field. + public const int XlaGpuNcclTerminationTimeoutSecondsFieldNumber = 163; + private long xlaGpuNcclTerminationTimeoutSeconds_; + /// + /// Timeout in seconds before terminating jobs that are stuck in a NCCL + /// Rendezvous. Negative value disables the timeout and will not terminate. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long XlaGpuNcclTerminationTimeoutSeconds { + get { return xlaGpuNcclTerminationTimeoutSeconds_; } + set { + xlaGpuNcclTerminationTimeoutSeconds_ = value; + } + } + + /// Field number for the "xla_gpu_enable_shared_constants" field. + public const int XlaGpuEnableSharedConstantsFieldNumber = 165; + private bool xlaGpuEnableSharedConstants_; + /// + /// Enables shared constants for XLA/GPU. This allows large constants to be + /// shared among multiple GPU executables. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaGpuEnableSharedConstants { + get { return xlaGpuEnableSharedConstants_; } + set { + xlaGpuEnableSharedConstants_ = value; + } + } + + /// Field number for the "xla_gpu_enable_cublaslt" field. + public const int XlaGpuEnableCublasltFieldNumber = 166; + private bool xlaGpuEnableCublaslt_; + /// + /// Whether to use cuBLASLt for GEMMs on GPUs. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaGpuEnableCublaslt { + get { return xlaGpuEnableCublaslt_; } + set { + xlaGpuEnableCublaslt_ = value; + } + } + + /// Field number for the "xla_gpu_redzone_scratch_max_megabytes" field. + public const int XlaGpuRedzoneScratchMaxMegabytesFieldNumber = 167; + private long xlaGpuRedzoneScratchMaxMegabytes_; + /// + /// Size threshold (in megabytes) for the GPU redzone scratch allocator. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long XlaGpuRedzoneScratchMaxMegabytes { + get { return xlaGpuRedzoneScratchMaxMegabytes_; } + set { + xlaGpuRedzoneScratchMaxMegabytes_ = value; + } + } + + /// Field number for the "xla_gpu_simplify_all_fp_conversions" field. + public const int XlaGpuSimplifyAllFpConversionsFieldNumber = 168; + private bool xlaGpuSimplifyAllFpConversions_; + /// + /// Allows all floating-point conversions to be simplified, including those + /// that affect the numerics. The `BFloat16Normalization` pass inserts many + /// `f32 -> bf16 -> f32` conversion pairs. These are not removed by the + /// `AlgebraicSimplifier`, as that will only simplify conversions that are + /// no-ops, e.g. `bf16 -> f32 -> bf16`. Removing these improves accuracy. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaGpuSimplifyAllFpConversions { + get { return xlaGpuSimplifyAllFpConversions_; } + set { + xlaGpuSimplifyAllFpConversions_ = value; + } + } + + /// Field number for the "xla_gpu_normalize_layouts" field. + public const int XlaGpuNormalizeLayoutsFieldNumber = 172; + private bool xlaGpuNormalizeLayouts_; + /// + /// An experimental option to force all layouts present in the + /// after-optimizations HLO to be descending, e.g. + /// ShapeUtil::MakeShapeWithDescendingLayout is an identity on all + /// instructions. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaGpuNormalizeLayouts { + get { return xlaGpuNormalizeLayouts_; } + set { + xlaGpuNormalizeLayouts_ = value; + } + } + + /// Field number for the "xla_cpu_use_acl" field. + public const int XlaCpuUseAclFieldNumber = 174; + private bool xlaCpuUseAcl_; + /// + /// Generate calls to Arm Compute Library in the CPU backend. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaCpuUseAcl { + get { return xlaCpuUseAcl_; } + set { + xlaCpuUseAcl_ = value; + } + } + + /// Field number for the "xla_cpu_strict_dot_conv_math" field. + public const int XlaCpuStrictDotConvMathFieldNumber = 175; + private bool xlaCpuStrictDotConvMath_; + /// + /// By default, XLA:CPU will run fp16 dot/conv as fp32, as this is generally + /// (much) faster on our hardware. Set this flag to disable this behavior. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool XlaCpuStrictDotConvMath { + get { return xlaCpuStrictDotConvMath_; } + set { + xlaCpuStrictDotConvMath_ = value; + } + } + + /// Field number for the "xla_backend_extra_options" field. + public const int XlaBackendExtraOptionsFieldNumber = 500; + private static readonly pbc::MapField.Codec _map_xlaBackendExtraOptions_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForString(18, ""), 4002); + private readonly pbc::MapField xlaBackendExtraOptions_ = new pbc::MapField(); + /// + /// Extra options to pass to the compilation backend (e.g. LLVM); specific + /// interpretation of these values is left to the backend. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::MapField XlaBackendExtraOptions { + get { return xlaBackendExtraOptions_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as DebugOptions); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(DebugOptions other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (XlaHloGraphAddresses != other.XlaHloGraphAddresses) return false; + if (XlaHloProfile != other.XlaHloProfile) return false; + if(!xlaDisableHloPasses_.Equals(other.xlaDisableHloPasses_)) return false; + if(!xlaEnableHloPassesOnly_.Equals(other.xlaEnableHloPassesOnly_)) return false; + if (XlaDisableAllHloPasses != other.XlaDisableAllHloPasses) return false; + if (XlaBackendOptimizationLevel != other.XlaBackendOptimizationLevel) return false; + if (XlaEmbedIrInExecutable != other.XlaEmbedIrInExecutable) return false; + if (XlaEliminateHloImplicitBroadcast != other.XlaEliminateHloImplicitBroadcast) return false; + if (XlaCpuMultiThreadEigen != other.XlaCpuMultiThreadEigen) return false; + if (XlaGpuCudaDataDir != other.XlaGpuCudaDataDir) return false; + if (XlaGpuFtz != other.XlaGpuFtz) return false; + if (XlaLlvmEnableAliasScopeMetadata != other.XlaLlvmEnableAliasScopeMetadata) return false; + if (XlaLlvmEnableNoaliasMetadata != other.XlaLlvmEnableNoaliasMetadata) return false; + if (XlaLlvmEnableInvariantLoadMetadata != other.XlaLlvmEnableInvariantLoadMetadata) return false; + if (XlaLlvmDisableExpensivePasses != other.XlaLlvmDisableExpensivePasses) return false; + if (XlaTestAllOutputLayouts != other.XlaTestAllOutputLayouts) return false; + if (XlaTestAllInputLayouts != other.XlaTestAllInputLayouts) return false; + if (XlaHloGraphShardingColor != other.XlaHloGraphShardingColor) return false; + if (XlaCpuUseMklDnn != other.XlaCpuUseMklDnn) return false; + if (XlaCpuUseXlaRuntime != other.XlaCpuUseXlaRuntime) return false; + if (XlaGpuMaxKernelUnrollFactor != other.XlaGpuMaxKernelUnrollFactor) return false; + if (XlaCpuEnableFastMath != other.XlaCpuEnableFastMath) return false; + if (XlaCpuFastMathHonorNans != other.XlaCpuFastMathHonorNans) return false; + if (XlaCpuFastMathHonorInfs != other.XlaCpuFastMathHonorInfs) return false; + if (XlaCpuFastMathHonorDivision != other.XlaCpuFastMathHonorDivision) return false; + if (XlaCpuFastMathHonorFunctions != other.XlaCpuFastMathHonorFunctions) return false; + if (XlaCpuEnableFastMinMax != other.XlaCpuEnableFastMinMax) return false; + if (XlaGpuEnableFastMinMax != other.XlaGpuEnableFastMinMax) return false; + if (XlaAllowExcessPrecision != other.XlaAllowExcessPrecision) return false; + if (XlaGpuCrashOnVerificationFailures != other.XlaGpuCrashOnVerificationFailures) return false; + if (XlaGpuAutotuneLevel != other.XlaGpuAutotuneLevel) return false; + if (XlaForceHostPlatformDeviceCount != other.XlaForceHostPlatformDeviceCount) return false; + if (XlaGpuDisableGpuasmOptimizations != other.XlaGpuDisableGpuasmOptimizations) return false; + if (XlaGpuShapeChecks != other.XlaGpuShapeChecks) return false; + if (XlaCpuEnableMlirLowering != other.XlaCpuEnableMlirLowering) return false; + if (XlaGpuEnableMlirLowering != other.XlaGpuEnableMlirLowering) return false; + if (XlaHloEvaluatorUseFastPath != other.XlaHloEvaluatorUseFastPath) return false; + if (XlaAllowScalarIndexDynamicOps != other.XlaAllowScalarIndexDynamicOps) return false; + if (XlaStepMarkerLocation != other.XlaStepMarkerLocation) return false; + if (XlaDumpTo != other.XlaDumpTo) return false; + if (XlaDumpHloModuleRe != other.XlaDumpHloModuleRe) return false; + if (XlaDumpHloPassRe != other.XlaDumpHloPassRe) return false; + if (XlaDumpHloAsText != other.XlaDumpHloAsText) return false; + if (XlaDumpHloAsProto != other.XlaDumpHloAsProto) return false; + if (XlaDumpHloAsDot != other.XlaDumpHloAsDot) return false; + if (XlaDumpHloAsUrl != other.XlaDumpHloAsUrl) return false; + if (XlaDumpHloAsHtml != other.XlaDumpHloAsHtml) return false; + if (XlaDumpFusionVisualization != other.XlaDumpFusionVisualization) return false; + if (XlaDumpHloSnapshots != other.XlaDumpHloSnapshots) return false; + if (XlaDumpIncludeTimestamp != other.XlaDumpIncludeTimestamp) return false; + if (XlaDumpMaxHloModules != other.XlaDumpMaxHloModules) return false; + if (XlaDumpModuleMetadata != other.XlaDumpModuleMetadata) return false; + if (XlaDumpCompressProtos != other.XlaDumpCompressProtos) return false; + if (XlaDumpHloAsLongText != other.XlaDumpHloAsLongText) return false; + if (XlaGpuForceConvNchw != other.XlaGpuForceConvNchw) return false; + if (XlaGpuForceConvNhwc != other.XlaGpuForceConvNhwc) return false; + if(!xlaGpuPtxFile_.Equals(other.xlaGpuPtxFile_)) return false; + if (XlaGpuDumpLlvmir != other.XlaGpuDumpLlvmir) return false; + if (XlaGpuAlgorithmDenylistPath != other.XlaGpuAlgorithmDenylistPath) return false; + if (XlaTpuDetectNan != other.XlaTpuDetectNan) return false; + if (XlaTpuDetectInf != other.XlaTpuDetectInf) return false; + if (XlaCpuEnableXprofTraceme != other.XlaCpuEnableXprofTraceme) return false; + if (XlaGpuUnsafeFallbackToDriverOnPtxasNotFound != other.XlaGpuUnsafeFallbackToDriverOnPtxasNotFound) return false; + if (XlaGpuAsmExtraFlags != other.XlaGpuAsmExtraFlags) return false; + if (XlaMultiheapSizeConstraintPerHeap != other.XlaMultiheapSizeConstraintPerHeap) return false; + if (XlaDetailedLoggingAndDumping != other.XlaDetailedLoggingAndDumping) return false; + if (XlaGpuForceCompilationParallelism != other.XlaGpuForceCompilationParallelism) return false; + if (XlaGpuDeterministicOps != other.XlaGpuDeterministicOps) return false; + if(!xlaGpuLlvmIrFile_.Equals(other.xlaGpuLlvmIrFile_)) return false; + if (XlaGpuEnableAsyncAllReduce != other.XlaGpuEnableAsyncAllReduce) return false; + if (XlaGpuAllReduceCombineThresholdBytes != other.XlaGpuAllReduceCombineThresholdBytes) return false; + if (XlaGpuAllReduceContiguous != other.XlaGpuAllReduceContiguous) return false; + if (XlaGpuAllReduceBlueconnectNumDevicesPerHost != other.XlaGpuAllReduceBlueconnectNumDevicesPerHost) return false; + if (XlaGpuEnableCudnnFrontend != other.XlaGpuEnableCudnnFrontend) return false; + if (XlaDumpDisableMetadata != other.XlaDumpDisableMetadata) return false; + if (XlaDumpHloPipelineRe != other.XlaDumpHloPipelineRe) return false; + if (XlaGpuStrictConvAlgorithmPicker != other.XlaGpuStrictConvAlgorithmPicker) return false; + if (XlaGpuEnableXlaRuntimeExecutable != other.XlaGpuEnableXlaRuntimeExecutable) return false; + if (XlaGpuNcclTerminationTimeoutSeconds != other.XlaGpuNcclTerminationTimeoutSeconds) return false; + if (XlaGpuEnableSharedConstants != other.XlaGpuEnableSharedConstants) return false; + if (XlaGpuEnableCublaslt != other.XlaGpuEnableCublaslt) return false; + if (XlaGpuRedzoneScratchMaxMegabytes != other.XlaGpuRedzoneScratchMaxMegabytes) return false; + if (XlaGpuSimplifyAllFpConversions != other.XlaGpuSimplifyAllFpConversions) return false; + if (XlaGpuNormalizeLayouts != other.XlaGpuNormalizeLayouts) return false; + if (XlaCpuUseAcl != other.XlaCpuUseAcl) return false; + if (XlaCpuStrictDotConvMath != other.XlaCpuStrictDotConvMath) return false; + if (!XlaBackendExtraOptions.Equals(other.XlaBackendExtraOptions)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (XlaHloGraphAddresses != false) hash ^= XlaHloGraphAddresses.GetHashCode(); + if (XlaHloProfile != false) hash ^= XlaHloProfile.GetHashCode(); + hash ^= xlaDisableHloPasses_.GetHashCode(); + hash ^= xlaEnableHloPassesOnly_.GetHashCode(); + if (XlaDisableAllHloPasses != false) hash ^= XlaDisableAllHloPasses.GetHashCode(); + if (XlaBackendOptimizationLevel != 0) hash ^= XlaBackendOptimizationLevel.GetHashCode(); + if (XlaEmbedIrInExecutable != false) hash ^= XlaEmbedIrInExecutable.GetHashCode(); + if (XlaEliminateHloImplicitBroadcast != false) hash ^= XlaEliminateHloImplicitBroadcast.GetHashCode(); + if (XlaCpuMultiThreadEigen != false) hash ^= XlaCpuMultiThreadEigen.GetHashCode(); + if (XlaGpuCudaDataDir.Length != 0) hash ^= XlaGpuCudaDataDir.GetHashCode(); + if (XlaGpuFtz != false) hash ^= XlaGpuFtz.GetHashCode(); + if (XlaLlvmEnableAliasScopeMetadata != false) hash ^= XlaLlvmEnableAliasScopeMetadata.GetHashCode(); + if (XlaLlvmEnableNoaliasMetadata != false) hash ^= XlaLlvmEnableNoaliasMetadata.GetHashCode(); + if (XlaLlvmEnableInvariantLoadMetadata != false) hash ^= XlaLlvmEnableInvariantLoadMetadata.GetHashCode(); + if (XlaLlvmDisableExpensivePasses != false) hash ^= XlaLlvmDisableExpensivePasses.GetHashCode(); + if (XlaTestAllOutputLayouts != false) hash ^= XlaTestAllOutputLayouts.GetHashCode(); + if (XlaTestAllInputLayouts != false) hash ^= XlaTestAllInputLayouts.GetHashCode(); + if (XlaHloGraphShardingColor != false) hash ^= XlaHloGraphShardingColor.GetHashCode(); + if (XlaCpuUseMklDnn != false) hash ^= XlaCpuUseMklDnn.GetHashCode(); + if (XlaCpuUseXlaRuntime != false) hash ^= XlaCpuUseXlaRuntime.GetHashCode(); + if (XlaGpuMaxKernelUnrollFactor != 0) hash ^= XlaGpuMaxKernelUnrollFactor.GetHashCode(); + if (XlaCpuEnableFastMath != false) hash ^= XlaCpuEnableFastMath.GetHashCode(); + if (XlaCpuFastMathHonorNans != false) hash ^= XlaCpuFastMathHonorNans.GetHashCode(); + if (XlaCpuFastMathHonorInfs != false) hash ^= XlaCpuFastMathHonorInfs.GetHashCode(); + if (XlaCpuFastMathHonorDivision != false) hash ^= XlaCpuFastMathHonorDivision.GetHashCode(); + if (XlaCpuFastMathHonorFunctions != false) hash ^= XlaCpuFastMathHonorFunctions.GetHashCode(); + if (XlaCpuEnableFastMinMax != false) hash ^= XlaCpuEnableFastMinMax.GetHashCode(); + if (XlaGpuEnableFastMinMax != false) hash ^= XlaGpuEnableFastMinMax.GetHashCode(); + if (XlaAllowExcessPrecision != false) hash ^= XlaAllowExcessPrecision.GetHashCode(); + if (XlaGpuCrashOnVerificationFailures != false) hash ^= XlaGpuCrashOnVerificationFailures.GetHashCode(); + if (XlaGpuAutotuneLevel != 0) hash ^= XlaGpuAutotuneLevel.GetHashCode(); + if (XlaForceHostPlatformDeviceCount != 0) hash ^= XlaForceHostPlatformDeviceCount.GetHashCode(); + if (XlaGpuDisableGpuasmOptimizations != false) hash ^= XlaGpuDisableGpuasmOptimizations.GetHashCode(); + if (XlaGpuShapeChecks != global::Xla.DebugOptions.Types.ShapeChecks.Ignore) hash ^= XlaGpuShapeChecks.GetHashCode(); + if (XlaCpuEnableMlirLowering != false) hash ^= XlaCpuEnableMlirLowering.GetHashCode(); + if (XlaGpuEnableMlirLowering != false) hash ^= XlaGpuEnableMlirLowering.GetHashCode(); + if (XlaHloEvaluatorUseFastPath != false) hash ^= XlaHloEvaluatorUseFastPath.GetHashCode(); + if (XlaAllowScalarIndexDynamicOps != false) hash ^= XlaAllowScalarIndexDynamicOps.GetHashCode(); + if (XlaStepMarkerLocation != global::Xla.DebugOptions.Types.StepMarkerLocation.StepMarkAtEntry) hash ^= XlaStepMarkerLocation.GetHashCode(); + if (XlaDumpTo.Length != 0) hash ^= XlaDumpTo.GetHashCode(); + if (XlaDumpHloModuleRe.Length != 0) hash ^= XlaDumpHloModuleRe.GetHashCode(); + if (XlaDumpHloPassRe.Length != 0) hash ^= XlaDumpHloPassRe.GetHashCode(); + if (XlaDumpHloAsText != false) hash ^= XlaDumpHloAsText.GetHashCode(); + if (XlaDumpHloAsProto != false) hash ^= XlaDumpHloAsProto.GetHashCode(); + if (XlaDumpHloAsDot != false) hash ^= XlaDumpHloAsDot.GetHashCode(); + if (XlaDumpHloAsUrl != false) hash ^= XlaDumpHloAsUrl.GetHashCode(); + if (XlaDumpHloAsHtml != false) hash ^= XlaDumpHloAsHtml.GetHashCode(); + if (XlaDumpFusionVisualization != false) hash ^= XlaDumpFusionVisualization.GetHashCode(); + if (XlaDumpHloSnapshots != false) hash ^= XlaDumpHloSnapshots.GetHashCode(); + if (XlaDumpIncludeTimestamp != false) hash ^= XlaDumpIncludeTimestamp.GetHashCode(); + if (XlaDumpMaxHloModules != 0) hash ^= XlaDumpMaxHloModules.GetHashCode(); + if (XlaDumpModuleMetadata != false) hash ^= XlaDumpModuleMetadata.GetHashCode(); + if (XlaDumpCompressProtos != false) hash ^= XlaDumpCompressProtos.GetHashCode(); + if (XlaDumpHloAsLongText != false) hash ^= XlaDumpHloAsLongText.GetHashCode(); + if (XlaGpuForceConvNchw != false) hash ^= XlaGpuForceConvNchw.GetHashCode(); + if (XlaGpuForceConvNhwc != false) hash ^= XlaGpuForceConvNhwc.GetHashCode(); + hash ^= xlaGpuPtxFile_.GetHashCode(); + if (XlaGpuDumpLlvmir != false) hash ^= XlaGpuDumpLlvmir.GetHashCode(); + if (XlaGpuAlgorithmDenylistPath.Length != 0) hash ^= XlaGpuAlgorithmDenylistPath.GetHashCode(); + if (XlaTpuDetectNan != false) hash ^= XlaTpuDetectNan.GetHashCode(); + if (XlaTpuDetectInf != false) hash ^= XlaTpuDetectInf.GetHashCode(); + if (XlaCpuEnableXprofTraceme != false) hash ^= XlaCpuEnableXprofTraceme.GetHashCode(); + if (XlaGpuUnsafeFallbackToDriverOnPtxasNotFound != false) hash ^= XlaGpuUnsafeFallbackToDriverOnPtxasNotFound.GetHashCode(); + if (XlaGpuAsmExtraFlags.Length != 0) hash ^= XlaGpuAsmExtraFlags.GetHashCode(); + if (XlaMultiheapSizeConstraintPerHeap != 0) hash ^= XlaMultiheapSizeConstraintPerHeap.GetHashCode(); + if (XlaDetailedLoggingAndDumping != false) hash ^= XlaDetailedLoggingAndDumping.GetHashCode(); + if (XlaGpuForceCompilationParallelism != 0) hash ^= XlaGpuForceCompilationParallelism.GetHashCode(); + if (XlaGpuDeterministicOps != false) hash ^= XlaGpuDeterministicOps.GetHashCode(); + hash ^= xlaGpuLlvmIrFile_.GetHashCode(); + if (XlaGpuEnableAsyncAllReduce != false) hash ^= XlaGpuEnableAsyncAllReduce.GetHashCode(); + if (XlaGpuAllReduceCombineThresholdBytes != 0L) hash ^= XlaGpuAllReduceCombineThresholdBytes.GetHashCode(); + if (XlaGpuAllReduceContiguous != false) hash ^= XlaGpuAllReduceContiguous.GetHashCode(); + if (XlaGpuAllReduceBlueconnectNumDevicesPerHost != 0) hash ^= XlaGpuAllReduceBlueconnectNumDevicesPerHost.GetHashCode(); + if (XlaGpuEnableCudnnFrontend != false) hash ^= XlaGpuEnableCudnnFrontend.GetHashCode(); + if (XlaDumpDisableMetadata != false) hash ^= XlaDumpDisableMetadata.GetHashCode(); + if (XlaDumpHloPipelineRe.Length != 0) hash ^= XlaDumpHloPipelineRe.GetHashCode(); + if (XlaGpuStrictConvAlgorithmPicker != false) hash ^= XlaGpuStrictConvAlgorithmPicker.GetHashCode(); + if (XlaGpuEnableXlaRuntimeExecutable != false) hash ^= XlaGpuEnableXlaRuntimeExecutable.GetHashCode(); + if (XlaGpuNcclTerminationTimeoutSeconds != 0L) hash ^= XlaGpuNcclTerminationTimeoutSeconds.GetHashCode(); + if (XlaGpuEnableSharedConstants != false) hash ^= XlaGpuEnableSharedConstants.GetHashCode(); + if (XlaGpuEnableCublaslt != false) hash ^= XlaGpuEnableCublaslt.GetHashCode(); + if (XlaGpuRedzoneScratchMaxMegabytes != 0L) hash ^= XlaGpuRedzoneScratchMaxMegabytes.GetHashCode(); + if (XlaGpuSimplifyAllFpConversions != false) hash ^= XlaGpuSimplifyAllFpConversions.GetHashCode(); + if (XlaGpuNormalizeLayouts != false) hash ^= XlaGpuNormalizeLayouts.GetHashCode(); + if (XlaCpuUseAcl != false) hash ^= XlaCpuUseAcl.GetHashCode(); + if (XlaCpuStrictDotConvMath != false) hash ^= XlaCpuStrictDotConvMath.GetHashCode(); + hash ^= XlaBackendExtraOptions.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (XlaHloGraphAddresses != false) { + output.WriteRawTag(16); + output.WriteBool(XlaHloGraphAddresses); + } + if (XlaHloProfile != false) { + output.WriteRawTag(72); + output.WriteBool(XlaHloProfile); + } + xlaDisableHloPasses_.WriteTo(output, _repeated_xlaDisableHloPasses_codec); + if (XlaBackendOptimizationLevel != 0) { + output.WriteRawTag(248, 1); + output.WriteInt32(XlaBackendOptimizationLevel); + } + if (XlaEmbedIrInExecutable != false) { + output.WriteRawTag(136, 2); + output.WriteBool(XlaEmbedIrInExecutable); + } + if (XlaEliminateHloImplicitBroadcast != false) { + output.WriteRawTag(152, 2); + output.WriteBool(XlaEliminateHloImplicitBroadcast); + } + if (XlaCpuMultiThreadEigen != false) { + output.WriteRawTag(224, 3); + output.WriteBool(XlaCpuMultiThreadEigen); + } + if (XlaGpuCudaDataDir.Length != 0) { + output.WriteRawTag(234, 3); + output.WriteString(XlaGpuCudaDataDir); + } + if (XlaGpuFtz != false) { + output.WriteRawTag(240, 3); + output.WriteBool(XlaGpuFtz); + } + if (XlaLlvmEnableAliasScopeMetadata != false) { + output.WriteRawTag(176, 4); + output.WriteBool(XlaLlvmEnableAliasScopeMetadata); + } + if (XlaLlvmEnableNoaliasMetadata != false) { + output.WriteRawTag(184, 4); + output.WriteBool(XlaLlvmEnableNoaliasMetadata); + } + if (XlaLlvmEnableInvariantLoadMetadata != false) { + output.WriteRawTag(192, 4); + output.WriteBool(XlaLlvmEnableInvariantLoadMetadata); + } + if (XlaLlvmDisableExpensivePasses != false) { + output.WriteRawTag(200, 4); + output.WriteBool(XlaLlvmDisableExpensivePasses); + } + if (XlaTestAllOutputLayouts != false) { + output.WriteRawTag(208, 5); + output.WriteBool(XlaTestAllOutputLayouts); + } + if (XlaTestAllInputLayouts != false) { + output.WriteRawTag(216, 5); + output.WriteBool(XlaTestAllInputLayouts); + } + if (XlaHloGraphShardingColor != false) { + output.WriteRawTag(224, 5); + output.WriteBool(XlaHloGraphShardingColor); + } + if (XlaCpuUseMklDnn != false) { + output.WriteRawTag(136, 6); + output.WriteBool(XlaCpuUseMklDnn); + } + if (XlaGpuMaxKernelUnrollFactor != 0) { + output.WriteRawTag(144, 6); + output.WriteInt32(XlaGpuMaxKernelUnrollFactor); + } + if (XlaCpuEnableFastMath != false) { + output.WriteRawTag(152, 6); + output.WriteBool(XlaCpuEnableFastMath); + } + if (XlaGpuEnableFastMinMax != false) { + output.WriteRawTag(160, 6); + output.WriteBool(XlaGpuEnableFastMinMax); + } + if (XlaGpuCrashOnVerificationFailures != false) { + output.WriteRawTag(168, 6); + output.WriteBool(XlaGpuCrashOnVerificationFailures); + } + if (XlaForceHostPlatformDeviceCount != 0) { + output.WriteRawTag(176, 6); + output.WriteInt32(XlaForceHostPlatformDeviceCount); + } + if (XlaGpuDisableGpuasmOptimizations != false) { + output.WriteRawTag(184, 6); + output.WriteBool(XlaGpuDisableGpuasmOptimizations); + } + if (XlaDisableAllHloPasses != false) { + output.WriteRawTag(192, 6); + output.WriteBool(XlaDisableAllHloPasses); + } + if (XlaHloEvaluatorUseFastPath != false) { + output.WriteRawTag(208, 6); + output.WriteBool(XlaHloEvaluatorUseFastPath); + } + if (XlaAllowScalarIndexDynamicOps != false) { + output.WriteRawTag(216, 6); + output.WriteBool(XlaAllowScalarIndexDynamicOps); + } + if (XlaStepMarkerLocation != global::Xla.DebugOptions.Types.StepMarkerLocation.StepMarkAtEntry) { + output.WriteRawTag(224, 6); + output.WriteEnum((int) XlaStepMarkerLocation); + } + if (XlaDumpTo.Length != 0) { + output.WriteRawTag(234, 6); + output.WriteString(XlaDumpTo); + } + if (XlaDumpHloModuleRe.Length != 0) { + output.WriteRawTag(242, 6); + output.WriteString(XlaDumpHloModuleRe); + } + if (XlaDumpHloPassRe.Length != 0) { + output.WriteRawTag(250, 6); + output.WriteString(XlaDumpHloPassRe); + } + if (XlaDumpHloAsText != false) { + output.WriteRawTag(128, 7); + output.WriteBool(XlaDumpHloAsText); + } + if (XlaDumpHloAsProto != false) { + output.WriteRawTag(136, 7); + output.WriteBool(XlaDumpHloAsProto); + } + if (XlaDumpHloAsDot != false) { + output.WriteRawTag(144, 7); + output.WriteBool(XlaDumpHloAsDot); + } + if (XlaDumpHloAsUrl != false) { + output.WriteRawTag(152, 7); + output.WriteBool(XlaDumpHloAsUrl); + } + if (XlaDumpHloAsHtml != false) { + output.WriteRawTag(160, 7); + output.WriteBool(XlaDumpHloAsHtml); + } + if (XlaDumpHloSnapshots != false) { + output.WriteRawTag(176, 7); + output.WriteBool(XlaDumpHloSnapshots); + } + if (XlaCpuFastMathHonorNans != false) { + output.WriteRawTag(192, 7); + output.WriteBool(XlaCpuFastMathHonorNans); + } + if (XlaCpuFastMathHonorInfs != false) { + output.WriteRawTag(200, 7); + output.WriteBool(XlaCpuFastMathHonorInfs); + } + if (XlaAllowExcessPrecision != false) { + output.WriteRawTag(208, 7); + output.WriteBool(XlaAllowExcessPrecision); + } + if (XlaGpuAutotuneLevel != 0) { + output.WriteRawTag(216, 7); + output.WriteInt32(XlaGpuAutotuneLevel); + } + xlaEnableHloPassesOnly_.WriteTo(output, _repeated_xlaEnableHloPassesOnly_codec); + if (XlaGpuForceConvNchw != false) { + output.WriteRawTag(232, 7); + output.WriteBool(XlaGpuForceConvNchw); + } + if (XlaCpuFastMathHonorDivision != false) { + output.WriteRawTag(240, 7); + output.WriteBool(XlaCpuFastMathHonorDivision); + } + xlaGpuPtxFile_.WriteTo(output, _repeated_xlaGpuPtxFile_codec); + if (XlaGpuAlgorithmDenylistPath.Length != 0) { + output.WriteRawTag(130, 8); + output.WriteString(XlaGpuAlgorithmDenylistPath); + } + if (XlaCpuFastMathHonorFunctions != false) { + output.WriteRawTag(136, 8); + output.WriteBool(XlaCpuFastMathHonorFunctions); + } + if (XlaDumpIncludeTimestamp != false) { + output.WriteRawTag(152, 8); + output.WriteBool(XlaDumpIncludeTimestamp); + } + if (XlaDumpMaxHloModules != 0) { + output.WriteRawTag(160, 8); + output.WriteInt32(XlaDumpMaxHloModules); + } + if (XlaTpuDetectNan != false) { + output.WriteRawTag(184, 8); + output.WriteBool(XlaTpuDetectNan); + } + if (XlaTpuDetectInf != false) { + output.WriteRawTag(192, 8); + output.WriteBool(XlaTpuDetectInf); + } + if (XlaCpuEnableXprofTraceme != false) { + output.WriteRawTag(200, 8); + output.WriteBool(XlaCpuEnableXprofTraceme); + } + if (XlaGpuUnsafeFallbackToDriverOnPtxasNotFound != false) { + output.WriteRawTag(208, 8); + output.WriteBool(XlaGpuUnsafeFallbackToDriverOnPtxasNotFound); + } + if (XlaCpuEnableFastMinMax != false) { + output.WriteRawTag(224, 8); + output.WriteBool(XlaCpuEnableFastMinMax); + } + if (XlaGpuAsmExtraFlags.Length != 0) { + output.WriteRawTag(234, 8); + output.WriteString(XlaGpuAsmExtraFlags); + } + if (XlaMultiheapSizeConstraintPerHeap != 0) { + output.WriteRawTag(240, 8); + output.WriteInt32(XlaMultiheapSizeConstraintPerHeap); + } + if (XlaDetailedLoggingAndDumping != false) { + output.WriteRawTag(248, 8); + output.WriteBool(XlaDetailedLoggingAndDumping); + } + if (XlaDumpModuleMetadata != false) { + output.WriteRawTag(128, 9); + output.WriteBool(XlaDumpModuleMetadata); + } + if (XlaGpuForceConvNhwc != false) { + output.WriteRawTag(144, 9); + output.WriteBool(XlaGpuForceConvNhwc); + } + if (XlaGpuForceCompilationParallelism != 0) { + output.WriteRawTag(152, 9); + output.WriteInt32(XlaGpuForceCompilationParallelism); + } + if (XlaGpuDeterministicOps != false) { + output.WriteRawTag(160, 9); + output.WriteBool(XlaGpuDeterministicOps); + } + if (XlaDumpFusionVisualization != false) { + output.WriteRawTag(168, 9); + output.WriteBool(XlaDumpFusionVisualization); + } + xlaGpuLlvmIrFile_.WriteTo(output, _repeated_xlaGpuLlvmIrFile_codec); + if (XlaDumpCompressProtos != false) { + output.WriteRawTag(184, 9); + output.WriteBool(XlaDumpCompressProtos); + } + if (XlaGpuEnableAsyncAllReduce != false) { + output.WriteRawTag(192, 9); + output.WriteBool(XlaGpuEnableAsyncAllReduce); + } + if (XlaDumpDisableMetadata != false) { + output.WriteRawTag(200, 9); + output.WriteBool(XlaDumpDisableMetadata); + } + if (XlaDumpHloPipelineRe.Length != 0) { + output.WriteRawTag(210, 9); + output.WriteString(XlaDumpHloPipelineRe); + } + if (XlaGpuDumpLlvmir != false) { + output.WriteRawTag(216, 9); + output.WriteBool(XlaGpuDumpLlvmir); + } + if (XlaGpuStrictConvAlgorithmPicker != false) { + output.WriteRawTag(224, 9); + output.WriteBool(XlaGpuStrictConvAlgorithmPicker); + } + if (XlaGpuAllReduceCombineThresholdBytes != 0L) { + output.WriteRawTag(232, 9); + output.WriteInt64(XlaGpuAllReduceCombineThresholdBytes); + } + if (XlaGpuAllReduceContiguous != false) { + output.WriteRawTag(240, 9); + output.WriteBool(XlaGpuAllReduceContiguous); + } + if (XlaGpuAllReduceBlueconnectNumDevicesPerHost != 0) { + output.WriteRawTag(248, 9); + output.WriteInt32(XlaGpuAllReduceBlueconnectNumDevicesPerHost); + } + if (XlaGpuEnableCudnnFrontend != false) { + output.WriteRawTag(128, 10); + output.WriteBool(XlaGpuEnableCudnnFrontend); + } + if (XlaGpuNcclTerminationTimeoutSeconds != 0L) { + output.WriteRawTag(152, 10); + output.WriteInt64(XlaGpuNcclTerminationTimeoutSeconds); + } + if (XlaDumpHloAsLongText != false) { + output.WriteRawTag(160, 10); + output.WriteBool(XlaDumpHloAsLongText); + } + if (XlaGpuEnableSharedConstants != false) { + output.WriteRawTag(168, 10); + output.WriteBool(XlaGpuEnableSharedConstants); + } + if (XlaGpuEnableCublaslt != false) { + output.WriteRawTag(176, 10); + output.WriteBool(XlaGpuEnableCublaslt); + } + if (XlaGpuRedzoneScratchMaxMegabytes != 0L) { + output.WriteRawTag(184, 10); + output.WriteInt64(XlaGpuRedzoneScratchMaxMegabytes); + } + if (XlaGpuSimplifyAllFpConversions != false) { + output.WriteRawTag(192, 10); + output.WriteBool(XlaGpuSimplifyAllFpConversions); + } + if (XlaGpuEnableXlaRuntimeExecutable != false) { + output.WriteRawTag(200, 10); + output.WriteBool(XlaGpuEnableXlaRuntimeExecutable); + } + if (XlaGpuShapeChecks != global::Xla.DebugOptions.Types.ShapeChecks.Ignore) { + output.WriteRawTag(208, 10); + output.WriteEnum((int) XlaGpuShapeChecks); + } + if (XlaCpuEnableMlirLowering != false) { + output.WriteRawTag(216, 10); + output.WriteBool(XlaCpuEnableMlirLowering); + } + if (XlaGpuNormalizeLayouts != false) { + output.WriteRawTag(224, 10); + output.WriteBool(XlaGpuNormalizeLayouts); + } + if (XlaGpuEnableMlirLowering != false) { + output.WriteRawTag(232, 10); + output.WriteBool(XlaGpuEnableMlirLowering); + } + if (XlaCpuUseAcl != false) { + output.WriteRawTag(240, 10); + output.WriteBool(XlaCpuUseAcl); + } + if (XlaCpuStrictDotConvMath != false) { + output.WriteRawTag(248, 10); + output.WriteBool(XlaCpuStrictDotConvMath); + } + if (XlaCpuUseXlaRuntime != false) { + output.WriteRawTag(136, 11); + output.WriteBool(XlaCpuUseXlaRuntime); + } + xlaBackendExtraOptions_.WriteTo(output, _map_xlaBackendExtraOptions_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (XlaHloGraphAddresses != false) { + output.WriteRawTag(16); + output.WriteBool(XlaHloGraphAddresses); + } + if (XlaHloProfile != false) { + output.WriteRawTag(72); + output.WriteBool(XlaHloProfile); + } + xlaDisableHloPasses_.WriteTo(ref output, _repeated_xlaDisableHloPasses_codec); + if (XlaBackendOptimizationLevel != 0) { + output.WriteRawTag(248, 1); + output.WriteInt32(XlaBackendOptimizationLevel); + } + if (XlaEmbedIrInExecutable != false) { + output.WriteRawTag(136, 2); + output.WriteBool(XlaEmbedIrInExecutable); + } + if (XlaEliminateHloImplicitBroadcast != false) { + output.WriteRawTag(152, 2); + output.WriteBool(XlaEliminateHloImplicitBroadcast); + } + if (XlaCpuMultiThreadEigen != false) { + output.WriteRawTag(224, 3); + output.WriteBool(XlaCpuMultiThreadEigen); + } + if (XlaGpuCudaDataDir.Length != 0) { + output.WriteRawTag(234, 3); + output.WriteString(XlaGpuCudaDataDir); + } + if (XlaGpuFtz != false) { + output.WriteRawTag(240, 3); + output.WriteBool(XlaGpuFtz); + } + if (XlaLlvmEnableAliasScopeMetadata != false) { + output.WriteRawTag(176, 4); + output.WriteBool(XlaLlvmEnableAliasScopeMetadata); + } + if (XlaLlvmEnableNoaliasMetadata != false) { + output.WriteRawTag(184, 4); + output.WriteBool(XlaLlvmEnableNoaliasMetadata); + } + if (XlaLlvmEnableInvariantLoadMetadata != false) { + output.WriteRawTag(192, 4); + output.WriteBool(XlaLlvmEnableInvariantLoadMetadata); + } + if (XlaLlvmDisableExpensivePasses != false) { + output.WriteRawTag(200, 4); + output.WriteBool(XlaLlvmDisableExpensivePasses); + } + if (XlaTestAllOutputLayouts != false) { + output.WriteRawTag(208, 5); + output.WriteBool(XlaTestAllOutputLayouts); + } + if (XlaTestAllInputLayouts != false) { + output.WriteRawTag(216, 5); + output.WriteBool(XlaTestAllInputLayouts); + } + if (XlaHloGraphShardingColor != false) { + output.WriteRawTag(224, 5); + output.WriteBool(XlaHloGraphShardingColor); + } + if (XlaCpuUseMklDnn != false) { + output.WriteRawTag(136, 6); + output.WriteBool(XlaCpuUseMklDnn); + } + if (XlaGpuMaxKernelUnrollFactor != 0) { + output.WriteRawTag(144, 6); + output.WriteInt32(XlaGpuMaxKernelUnrollFactor); + } + if (XlaCpuEnableFastMath != false) { + output.WriteRawTag(152, 6); + output.WriteBool(XlaCpuEnableFastMath); + } + if (XlaGpuEnableFastMinMax != false) { + output.WriteRawTag(160, 6); + output.WriteBool(XlaGpuEnableFastMinMax); + } + if (XlaGpuCrashOnVerificationFailures != false) { + output.WriteRawTag(168, 6); + output.WriteBool(XlaGpuCrashOnVerificationFailures); + } + if (XlaForceHostPlatformDeviceCount != 0) { + output.WriteRawTag(176, 6); + output.WriteInt32(XlaForceHostPlatformDeviceCount); + } + if (XlaGpuDisableGpuasmOptimizations != false) { + output.WriteRawTag(184, 6); + output.WriteBool(XlaGpuDisableGpuasmOptimizations); + } + if (XlaDisableAllHloPasses != false) { + output.WriteRawTag(192, 6); + output.WriteBool(XlaDisableAllHloPasses); + } + if (XlaHloEvaluatorUseFastPath != false) { + output.WriteRawTag(208, 6); + output.WriteBool(XlaHloEvaluatorUseFastPath); + } + if (XlaAllowScalarIndexDynamicOps != false) { + output.WriteRawTag(216, 6); + output.WriteBool(XlaAllowScalarIndexDynamicOps); + } + if (XlaStepMarkerLocation != global::Xla.DebugOptions.Types.StepMarkerLocation.StepMarkAtEntry) { + output.WriteRawTag(224, 6); + output.WriteEnum((int) XlaStepMarkerLocation); + } + if (XlaDumpTo.Length != 0) { + output.WriteRawTag(234, 6); + output.WriteString(XlaDumpTo); + } + if (XlaDumpHloModuleRe.Length != 0) { + output.WriteRawTag(242, 6); + output.WriteString(XlaDumpHloModuleRe); + } + if (XlaDumpHloPassRe.Length != 0) { + output.WriteRawTag(250, 6); + output.WriteString(XlaDumpHloPassRe); + } + if (XlaDumpHloAsText != false) { + output.WriteRawTag(128, 7); + output.WriteBool(XlaDumpHloAsText); + } + if (XlaDumpHloAsProto != false) { + output.WriteRawTag(136, 7); + output.WriteBool(XlaDumpHloAsProto); + } + if (XlaDumpHloAsDot != false) { + output.WriteRawTag(144, 7); + output.WriteBool(XlaDumpHloAsDot); + } + if (XlaDumpHloAsUrl != false) { + output.WriteRawTag(152, 7); + output.WriteBool(XlaDumpHloAsUrl); + } + if (XlaDumpHloAsHtml != false) { + output.WriteRawTag(160, 7); + output.WriteBool(XlaDumpHloAsHtml); + } + if (XlaDumpHloSnapshots != false) { + output.WriteRawTag(176, 7); + output.WriteBool(XlaDumpHloSnapshots); + } + if (XlaCpuFastMathHonorNans != false) { + output.WriteRawTag(192, 7); + output.WriteBool(XlaCpuFastMathHonorNans); + } + if (XlaCpuFastMathHonorInfs != false) { + output.WriteRawTag(200, 7); + output.WriteBool(XlaCpuFastMathHonorInfs); + } + if (XlaAllowExcessPrecision != false) { + output.WriteRawTag(208, 7); + output.WriteBool(XlaAllowExcessPrecision); + } + if (XlaGpuAutotuneLevel != 0) { + output.WriteRawTag(216, 7); + output.WriteInt32(XlaGpuAutotuneLevel); + } + xlaEnableHloPassesOnly_.WriteTo(ref output, _repeated_xlaEnableHloPassesOnly_codec); + if (XlaGpuForceConvNchw != false) { + output.WriteRawTag(232, 7); + output.WriteBool(XlaGpuForceConvNchw); + } + if (XlaCpuFastMathHonorDivision != false) { + output.WriteRawTag(240, 7); + output.WriteBool(XlaCpuFastMathHonorDivision); + } + xlaGpuPtxFile_.WriteTo(ref output, _repeated_xlaGpuPtxFile_codec); + if (XlaGpuAlgorithmDenylistPath.Length != 0) { + output.WriteRawTag(130, 8); + output.WriteString(XlaGpuAlgorithmDenylistPath); + } + if (XlaCpuFastMathHonorFunctions != false) { + output.WriteRawTag(136, 8); + output.WriteBool(XlaCpuFastMathHonorFunctions); + } + if (XlaDumpIncludeTimestamp != false) { + output.WriteRawTag(152, 8); + output.WriteBool(XlaDumpIncludeTimestamp); + } + if (XlaDumpMaxHloModules != 0) { + output.WriteRawTag(160, 8); + output.WriteInt32(XlaDumpMaxHloModules); + } + if (XlaTpuDetectNan != false) { + output.WriteRawTag(184, 8); + output.WriteBool(XlaTpuDetectNan); + } + if (XlaTpuDetectInf != false) { + output.WriteRawTag(192, 8); + output.WriteBool(XlaTpuDetectInf); + } + if (XlaCpuEnableXprofTraceme != false) { + output.WriteRawTag(200, 8); + output.WriteBool(XlaCpuEnableXprofTraceme); + } + if (XlaGpuUnsafeFallbackToDriverOnPtxasNotFound != false) { + output.WriteRawTag(208, 8); + output.WriteBool(XlaGpuUnsafeFallbackToDriverOnPtxasNotFound); + } + if (XlaCpuEnableFastMinMax != false) { + output.WriteRawTag(224, 8); + output.WriteBool(XlaCpuEnableFastMinMax); + } + if (XlaGpuAsmExtraFlags.Length != 0) { + output.WriteRawTag(234, 8); + output.WriteString(XlaGpuAsmExtraFlags); + } + if (XlaMultiheapSizeConstraintPerHeap != 0) { + output.WriteRawTag(240, 8); + output.WriteInt32(XlaMultiheapSizeConstraintPerHeap); + } + if (XlaDetailedLoggingAndDumping != false) { + output.WriteRawTag(248, 8); + output.WriteBool(XlaDetailedLoggingAndDumping); + } + if (XlaDumpModuleMetadata != false) { + output.WriteRawTag(128, 9); + output.WriteBool(XlaDumpModuleMetadata); + } + if (XlaGpuForceConvNhwc != false) { + output.WriteRawTag(144, 9); + output.WriteBool(XlaGpuForceConvNhwc); + } + if (XlaGpuForceCompilationParallelism != 0) { + output.WriteRawTag(152, 9); + output.WriteInt32(XlaGpuForceCompilationParallelism); + } + if (XlaGpuDeterministicOps != false) { + output.WriteRawTag(160, 9); + output.WriteBool(XlaGpuDeterministicOps); + } + if (XlaDumpFusionVisualization != false) { + output.WriteRawTag(168, 9); + output.WriteBool(XlaDumpFusionVisualization); + } + xlaGpuLlvmIrFile_.WriteTo(ref output, _repeated_xlaGpuLlvmIrFile_codec); + if (XlaDumpCompressProtos != false) { + output.WriteRawTag(184, 9); + output.WriteBool(XlaDumpCompressProtos); + } + if (XlaGpuEnableAsyncAllReduce != false) { + output.WriteRawTag(192, 9); + output.WriteBool(XlaGpuEnableAsyncAllReduce); + } + if (XlaDumpDisableMetadata != false) { + output.WriteRawTag(200, 9); + output.WriteBool(XlaDumpDisableMetadata); + } + if (XlaDumpHloPipelineRe.Length != 0) { + output.WriteRawTag(210, 9); + output.WriteString(XlaDumpHloPipelineRe); + } + if (XlaGpuDumpLlvmir != false) { + output.WriteRawTag(216, 9); + output.WriteBool(XlaGpuDumpLlvmir); + } + if (XlaGpuStrictConvAlgorithmPicker != false) { + output.WriteRawTag(224, 9); + output.WriteBool(XlaGpuStrictConvAlgorithmPicker); + } + if (XlaGpuAllReduceCombineThresholdBytes != 0L) { + output.WriteRawTag(232, 9); + output.WriteInt64(XlaGpuAllReduceCombineThresholdBytes); + } + if (XlaGpuAllReduceContiguous != false) { + output.WriteRawTag(240, 9); + output.WriteBool(XlaGpuAllReduceContiguous); + } + if (XlaGpuAllReduceBlueconnectNumDevicesPerHost != 0) { + output.WriteRawTag(248, 9); + output.WriteInt32(XlaGpuAllReduceBlueconnectNumDevicesPerHost); + } + if (XlaGpuEnableCudnnFrontend != false) { + output.WriteRawTag(128, 10); + output.WriteBool(XlaGpuEnableCudnnFrontend); + } + if (XlaGpuNcclTerminationTimeoutSeconds != 0L) { + output.WriteRawTag(152, 10); + output.WriteInt64(XlaGpuNcclTerminationTimeoutSeconds); + } + if (XlaDumpHloAsLongText != false) { + output.WriteRawTag(160, 10); + output.WriteBool(XlaDumpHloAsLongText); + } + if (XlaGpuEnableSharedConstants != false) { + output.WriteRawTag(168, 10); + output.WriteBool(XlaGpuEnableSharedConstants); + } + if (XlaGpuEnableCublaslt != false) { + output.WriteRawTag(176, 10); + output.WriteBool(XlaGpuEnableCublaslt); + } + if (XlaGpuRedzoneScratchMaxMegabytes != 0L) { + output.WriteRawTag(184, 10); + output.WriteInt64(XlaGpuRedzoneScratchMaxMegabytes); + } + if (XlaGpuSimplifyAllFpConversions != false) { + output.WriteRawTag(192, 10); + output.WriteBool(XlaGpuSimplifyAllFpConversions); + } + if (XlaGpuEnableXlaRuntimeExecutable != false) { + output.WriteRawTag(200, 10); + output.WriteBool(XlaGpuEnableXlaRuntimeExecutable); + } + if (XlaGpuShapeChecks != global::Xla.DebugOptions.Types.ShapeChecks.Ignore) { + output.WriteRawTag(208, 10); + output.WriteEnum((int) XlaGpuShapeChecks); + } + if (XlaCpuEnableMlirLowering != false) { + output.WriteRawTag(216, 10); + output.WriteBool(XlaCpuEnableMlirLowering); + } + if (XlaGpuNormalizeLayouts != false) { + output.WriteRawTag(224, 10); + output.WriteBool(XlaGpuNormalizeLayouts); + } + if (XlaGpuEnableMlirLowering != false) { + output.WriteRawTag(232, 10); + output.WriteBool(XlaGpuEnableMlirLowering); + } + if (XlaCpuUseAcl != false) { + output.WriteRawTag(240, 10); + output.WriteBool(XlaCpuUseAcl); + } + if (XlaCpuStrictDotConvMath != false) { + output.WriteRawTag(248, 10); + output.WriteBool(XlaCpuStrictDotConvMath); + } + if (XlaCpuUseXlaRuntime != false) { + output.WriteRawTag(136, 11); + output.WriteBool(XlaCpuUseXlaRuntime); + } + xlaBackendExtraOptions_.WriteTo(ref output, _map_xlaBackendExtraOptions_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (XlaHloGraphAddresses != false) { + size += 1 + 1; + } + if (XlaHloProfile != false) { + size += 1 + 1; + } + size += xlaDisableHloPasses_.CalculateSize(_repeated_xlaDisableHloPasses_codec); + size += xlaEnableHloPassesOnly_.CalculateSize(_repeated_xlaEnableHloPassesOnly_codec); + if (XlaDisableAllHloPasses != false) { + size += 2 + 1; + } + if (XlaBackendOptimizationLevel != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(XlaBackendOptimizationLevel); + } + if (XlaEmbedIrInExecutable != false) { + size += 2 + 1; + } + if (XlaEliminateHloImplicitBroadcast != false) { + size += 2 + 1; + } + if (XlaCpuMultiThreadEigen != false) { + size += 2 + 1; + } + if (XlaGpuCudaDataDir.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(XlaGpuCudaDataDir); + } + if (XlaGpuFtz != false) { + size += 2 + 1; + } + if (XlaLlvmEnableAliasScopeMetadata != false) { + size += 2 + 1; + } + if (XlaLlvmEnableNoaliasMetadata != false) { + size += 2 + 1; + } + if (XlaLlvmEnableInvariantLoadMetadata != false) { + size += 2 + 1; + } + if (XlaLlvmDisableExpensivePasses != false) { + size += 2 + 1; + } + if (XlaTestAllOutputLayouts != false) { + size += 2 + 1; + } + if (XlaTestAllInputLayouts != false) { + size += 2 + 1; + } + if (XlaHloGraphShardingColor != false) { + size += 2 + 1; + } + if (XlaCpuUseMklDnn != false) { + size += 2 + 1; + } + if (XlaCpuUseXlaRuntime != false) { + size += 2 + 1; + } + if (XlaGpuMaxKernelUnrollFactor != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(XlaGpuMaxKernelUnrollFactor); + } + if (XlaCpuEnableFastMath != false) { + size += 2 + 1; + } + if (XlaCpuFastMathHonorNans != false) { + size += 2 + 1; + } + if (XlaCpuFastMathHonorInfs != false) { + size += 2 + 1; + } + if (XlaCpuFastMathHonorDivision != false) { + size += 2 + 1; + } + if (XlaCpuFastMathHonorFunctions != false) { + size += 2 + 1; + } + if (XlaCpuEnableFastMinMax != false) { + size += 2 + 1; + } + if (XlaGpuEnableFastMinMax != false) { + size += 2 + 1; + } + if (XlaAllowExcessPrecision != false) { + size += 2 + 1; + } + if (XlaGpuCrashOnVerificationFailures != false) { + size += 2 + 1; + } + if (XlaGpuAutotuneLevel != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(XlaGpuAutotuneLevel); + } + if (XlaForceHostPlatformDeviceCount != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(XlaForceHostPlatformDeviceCount); + } + if (XlaGpuDisableGpuasmOptimizations != false) { + size += 2 + 1; + } + if (XlaGpuShapeChecks != global::Xla.DebugOptions.Types.ShapeChecks.Ignore) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) XlaGpuShapeChecks); + } + if (XlaCpuEnableMlirLowering != false) { + size += 2 + 1; + } + if (XlaGpuEnableMlirLowering != false) { + size += 2 + 1; + } + if (XlaHloEvaluatorUseFastPath != false) { + size += 2 + 1; + } + if (XlaAllowScalarIndexDynamicOps != false) { + size += 2 + 1; + } + if (XlaStepMarkerLocation != global::Xla.DebugOptions.Types.StepMarkerLocation.StepMarkAtEntry) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) XlaStepMarkerLocation); + } + if (XlaDumpTo.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(XlaDumpTo); + } + if (XlaDumpHloModuleRe.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(XlaDumpHloModuleRe); + } + if (XlaDumpHloPassRe.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(XlaDumpHloPassRe); + } + if (XlaDumpHloAsText != false) { + size += 2 + 1; + } + if (XlaDumpHloAsProto != false) { + size += 2 + 1; + } + if (XlaDumpHloAsDot != false) { + size += 2 + 1; + } + if (XlaDumpHloAsUrl != false) { + size += 2 + 1; + } + if (XlaDumpHloAsHtml != false) { + size += 2 + 1; + } + if (XlaDumpFusionVisualization != false) { + size += 2 + 1; + } + if (XlaDumpHloSnapshots != false) { + size += 2 + 1; + } + if (XlaDumpIncludeTimestamp != false) { + size += 2 + 1; + } + if (XlaDumpMaxHloModules != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(XlaDumpMaxHloModules); + } + if (XlaDumpModuleMetadata != false) { + size += 2 + 1; + } + if (XlaDumpCompressProtos != false) { + size += 2 + 1; + } + if (XlaDumpHloAsLongText != false) { + size += 2 + 1; + } + if (XlaGpuForceConvNchw != false) { + size += 2 + 1; + } + if (XlaGpuForceConvNhwc != false) { + size += 2 + 1; + } + size += xlaGpuPtxFile_.CalculateSize(_repeated_xlaGpuPtxFile_codec); + if (XlaGpuDumpLlvmir != false) { + size += 2 + 1; + } + if (XlaGpuAlgorithmDenylistPath.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(XlaGpuAlgorithmDenylistPath); + } + if (XlaTpuDetectNan != false) { + size += 2 + 1; + } + if (XlaTpuDetectInf != false) { + size += 2 + 1; + } + if (XlaCpuEnableXprofTraceme != false) { + size += 2 + 1; + } + if (XlaGpuUnsafeFallbackToDriverOnPtxasNotFound != false) { + size += 2 + 1; + } + if (XlaGpuAsmExtraFlags.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(XlaGpuAsmExtraFlags); + } + if (XlaMultiheapSizeConstraintPerHeap != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(XlaMultiheapSizeConstraintPerHeap); + } + if (XlaDetailedLoggingAndDumping != false) { + size += 2 + 1; + } + if (XlaGpuForceCompilationParallelism != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(XlaGpuForceCompilationParallelism); + } + if (XlaGpuDeterministicOps != false) { + size += 2 + 1; + } + size += xlaGpuLlvmIrFile_.CalculateSize(_repeated_xlaGpuLlvmIrFile_codec); + if (XlaGpuEnableAsyncAllReduce != false) { + size += 2 + 1; + } + if (XlaGpuAllReduceCombineThresholdBytes != 0L) { + size += 2 + pb::CodedOutputStream.ComputeInt64Size(XlaGpuAllReduceCombineThresholdBytes); + } + if (XlaGpuAllReduceContiguous != false) { + size += 2 + 1; + } + if (XlaGpuAllReduceBlueconnectNumDevicesPerHost != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(XlaGpuAllReduceBlueconnectNumDevicesPerHost); + } + if (XlaGpuEnableCudnnFrontend != false) { + size += 2 + 1; + } + if (XlaDumpDisableMetadata != false) { + size += 2 + 1; + } + if (XlaDumpHloPipelineRe.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(XlaDumpHloPipelineRe); + } + if (XlaGpuStrictConvAlgorithmPicker != false) { + size += 2 + 1; + } + if (XlaGpuEnableXlaRuntimeExecutable != false) { + size += 2 + 1; + } + if (XlaGpuNcclTerminationTimeoutSeconds != 0L) { + size += 2 + pb::CodedOutputStream.ComputeInt64Size(XlaGpuNcclTerminationTimeoutSeconds); + } + if (XlaGpuEnableSharedConstants != false) { + size += 2 + 1; + } + if (XlaGpuEnableCublaslt != false) { + size += 2 + 1; + } + if (XlaGpuRedzoneScratchMaxMegabytes != 0L) { + size += 2 + pb::CodedOutputStream.ComputeInt64Size(XlaGpuRedzoneScratchMaxMegabytes); + } + if (XlaGpuSimplifyAllFpConversions != false) { + size += 2 + 1; + } + if (XlaGpuNormalizeLayouts != false) { + size += 2 + 1; + } + if (XlaCpuUseAcl != false) { + size += 2 + 1; + } + if (XlaCpuStrictDotConvMath != false) { + size += 2 + 1; + } + size += xlaBackendExtraOptions_.CalculateSize(_map_xlaBackendExtraOptions_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(DebugOptions other) { + if (other == null) { + return; + } + if (other.XlaHloGraphAddresses != false) { + XlaHloGraphAddresses = other.XlaHloGraphAddresses; + } + if (other.XlaHloProfile != false) { + XlaHloProfile = other.XlaHloProfile; + } + xlaDisableHloPasses_.Add(other.xlaDisableHloPasses_); + xlaEnableHloPassesOnly_.Add(other.xlaEnableHloPassesOnly_); + if (other.XlaDisableAllHloPasses != false) { + XlaDisableAllHloPasses = other.XlaDisableAllHloPasses; + } + if (other.XlaBackendOptimizationLevel != 0) { + XlaBackendOptimizationLevel = other.XlaBackendOptimizationLevel; + } + if (other.XlaEmbedIrInExecutable != false) { + XlaEmbedIrInExecutable = other.XlaEmbedIrInExecutable; + } + if (other.XlaEliminateHloImplicitBroadcast != false) { + XlaEliminateHloImplicitBroadcast = other.XlaEliminateHloImplicitBroadcast; + } + if (other.XlaCpuMultiThreadEigen != false) { + XlaCpuMultiThreadEigen = other.XlaCpuMultiThreadEigen; + } + if (other.XlaGpuCudaDataDir.Length != 0) { + XlaGpuCudaDataDir = other.XlaGpuCudaDataDir; + } + if (other.XlaGpuFtz != false) { + XlaGpuFtz = other.XlaGpuFtz; + } + if (other.XlaLlvmEnableAliasScopeMetadata != false) { + XlaLlvmEnableAliasScopeMetadata = other.XlaLlvmEnableAliasScopeMetadata; + } + if (other.XlaLlvmEnableNoaliasMetadata != false) { + XlaLlvmEnableNoaliasMetadata = other.XlaLlvmEnableNoaliasMetadata; + } + if (other.XlaLlvmEnableInvariantLoadMetadata != false) { + XlaLlvmEnableInvariantLoadMetadata = other.XlaLlvmEnableInvariantLoadMetadata; + } + if (other.XlaLlvmDisableExpensivePasses != false) { + XlaLlvmDisableExpensivePasses = other.XlaLlvmDisableExpensivePasses; + } + if (other.XlaTestAllOutputLayouts != false) { + XlaTestAllOutputLayouts = other.XlaTestAllOutputLayouts; + } + if (other.XlaTestAllInputLayouts != false) { + XlaTestAllInputLayouts = other.XlaTestAllInputLayouts; + } + if (other.XlaHloGraphShardingColor != false) { + XlaHloGraphShardingColor = other.XlaHloGraphShardingColor; + } + if (other.XlaCpuUseMklDnn != false) { + XlaCpuUseMklDnn = other.XlaCpuUseMklDnn; + } + if (other.XlaCpuUseXlaRuntime != false) { + XlaCpuUseXlaRuntime = other.XlaCpuUseXlaRuntime; + } + if (other.XlaGpuMaxKernelUnrollFactor != 0) { + XlaGpuMaxKernelUnrollFactor = other.XlaGpuMaxKernelUnrollFactor; + } + if (other.XlaCpuEnableFastMath != false) { + XlaCpuEnableFastMath = other.XlaCpuEnableFastMath; + } + if (other.XlaCpuFastMathHonorNans != false) { + XlaCpuFastMathHonorNans = other.XlaCpuFastMathHonorNans; + } + if (other.XlaCpuFastMathHonorInfs != false) { + XlaCpuFastMathHonorInfs = other.XlaCpuFastMathHonorInfs; + } + if (other.XlaCpuFastMathHonorDivision != false) { + XlaCpuFastMathHonorDivision = other.XlaCpuFastMathHonorDivision; + } + if (other.XlaCpuFastMathHonorFunctions != false) { + XlaCpuFastMathHonorFunctions = other.XlaCpuFastMathHonorFunctions; + } + if (other.XlaCpuEnableFastMinMax != false) { + XlaCpuEnableFastMinMax = other.XlaCpuEnableFastMinMax; + } + if (other.XlaGpuEnableFastMinMax != false) { + XlaGpuEnableFastMinMax = other.XlaGpuEnableFastMinMax; + } + if (other.XlaAllowExcessPrecision != false) { + XlaAllowExcessPrecision = other.XlaAllowExcessPrecision; + } + if (other.XlaGpuCrashOnVerificationFailures != false) { + XlaGpuCrashOnVerificationFailures = other.XlaGpuCrashOnVerificationFailures; + } + if (other.XlaGpuAutotuneLevel != 0) { + XlaGpuAutotuneLevel = other.XlaGpuAutotuneLevel; + } + if (other.XlaForceHostPlatformDeviceCount != 0) { + XlaForceHostPlatformDeviceCount = other.XlaForceHostPlatformDeviceCount; + } + if (other.XlaGpuDisableGpuasmOptimizations != false) { + XlaGpuDisableGpuasmOptimizations = other.XlaGpuDisableGpuasmOptimizations; + } + if (other.XlaGpuShapeChecks != global::Xla.DebugOptions.Types.ShapeChecks.Ignore) { + XlaGpuShapeChecks = other.XlaGpuShapeChecks; + } + if (other.XlaCpuEnableMlirLowering != false) { + XlaCpuEnableMlirLowering = other.XlaCpuEnableMlirLowering; + } + if (other.XlaGpuEnableMlirLowering != false) { + XlaGpuEnableMlirLowering = other.XlaGpuEnableMlirLowering; + } + if (other.XlaHloEvaluatorUseFastPath != false) { + XlaHloEvaluatorUseFastPath = other.XlaHloEvaluatorUseFastPath; + } + if (other.XlaAllowScalarIndexDynamicOps != false) { + XlaAllowScalarIndexDynamicOps = other.XlaAllowScalarIndexDynamicOps; + } + if (other.XlaStepMarkerLocation != global::Xla.DebugOptions.Types.StepMarkerLocation.StepMarkAtEntry) { + XlaStepMarkerLocation = other.XlaStepMarkerLocation; + } + if (other.XlaDumpTo.Length != 0) { + XlaDumpTo = other.XlaDumpTo; + } + if (other.XlaDumpHloModuleRe.Length != 0) { + XlaDumpHloModuleRe = other.XlaDumpHloModuleRe; + } + if (other.XlaDumpHloPassRe.Length != 0) { + XlaDumpHloPassRe = other.XlaDumpHloPassRe; + } + if (other.XlaDumpHloAsText != false) { + XlaDumpHloAsText = other.XlaDumpHloAsText; + } + if (other.XlaDumpHloAsProto != false) { + XlaDumpHloAsProto = other.XlaDumpHloAsProto; + } + if (other.XlaDumpHloAsDot != false) { + XlaDumpHloAsDot = other.XlaDumpHloAsDot; + } + if (other.XlaDumpHloAsUrl != false) { + XlaDumpHloAsUrl = other.XlaDumpHloAsUrl; + } + if (other.XlaDumpHloAsHtml != false) { + XlaDumpHloAsHtml = other.XlaDumpHloAsHtml; + } + if (other.XlaDumpFusionVisualization != false) { + XlaDumpFusionVisualization = other.XlaDumpFusionVisualization; + } + if (other.XlaDumpHloSnapshots != false) { + XlaDumpHloSnapshots = other.XlaDumpHloSnapshots; + } + if (other.XlaDumpIncludeTimestamp != false) { + XlaDumpIncludeTimestamp = other.XlaDumpIncludeTimestamp; + } + if (other.XlaDumpMaxHloModules != 0) { + XlaDumpMaxHloModules = other.XlaDumpMaxHloModules; + } + if (other.XlaDumpModuleMetadata != false) { + XlaDumpModuleMetadata = other.XlaDumpModuleMetadata; + } + if (other.XlaDumpCompressProtos != false) { + XlaDumpCompressProtos = other.XlaDumpCompressProtos; + } + if (other.XlaDumpHloAsLongText != false) { + XlaDumpHloAsLongText = other.XlaDumpHloAsLongText; + } + if (other.XlaGpuForceConvNchw != false) { + XlaGpuForceConvNchw = other.XlaGpuForceConvNchw; + } + if (other.XlaGpuForceConvNhwc != false) { + XlaGpuForceConvNhwc = other.XlaGpuForceConvNhwc; + } + xlaGpuPtxFile_.Add(other.xlaGpuPtxFile_); + if (other.XlaGpuDumpLlvmir != false) { + XlaGpuDumpLlvmir = other.XlaGpuDumpLlvmir; + } + if (other.XlaGpuAlgorithmDenylistPath.Length != 0) { + XlaGpuAlgorithmDenylistPath = other.XlaGpuAlgorithmDenylistPath; + } + if (other.XlaTpuDetectNan != false) { + XlaTpuDetectNan = other.XlaTpuDetectNan; + } + if (other.XlaTpuDetectInf != false) { + XlaTpuDetectInf = other.XlaTpuDetectInf; + } + if (other.XlaCpuEnableXprofTraceme != false) { + XlaCpuEnableXprofTraceme = other.XlaCpuEnableXprofTraceme; + } + if (other.XlaGpuUnsafeFallbackToDriverOnPtxasNotFound != false) { + XlaGpuUnsafeFallbackToDriverOnPtxasNotFound = other.XlaGpuUnsafeFallbackToDriverOnPtxasNotFound; + } + if (other.XlaGpuAsmExtraFlags.Length != 0) { + XlaGpuAsmExtraFlags = other.XlaGpuAsmExtraFlags; + } + if (other.XlaMultiheapSizeConstraintPerHeap != 0) { + XlaMultiheapSizeConstraintPerHeap = other.XlaMultiheapSizeConstraintPerHeap; + } + if (other.XlaDetailedLoggingAndDumping != false) { + XlaDetailedLoggingAndDumping = other.XlaDetailedLoggingAndDumping; + } + if (other.XlaGpuForceCompilationParallelism != 0) { + XlaGpuForceCompilationParallelism = other.XlaGpuForceCompilationParallelism; + } + if (other.XlaGpuDeterministicOps != false) { + XlaGpuDeterministicOps = other.XlaGpuDeterministicOps; + } + xlaGpuLlvmIrFile_.Add(other.xlaGpuLlvmIrFile_); + if (other.XlaGpuEnableAsyncAllReduce != false) { + XlaGpuEnableAsyncAllReduce = other.XlaGpuEnableAsyncAllReduce; + } + if (other.XlaGpuAllReduceCombineThresholdBytes != 0L) { + XlaGpuAllReduceCombineThresholdBytes = other.XlaGpuAllReduceCombineThresholdBytes; + } + if (other.XlaGpuAllReduceContiguous != false) { + XlaGpuAllReduceContiguous = other.XlaGpuAllReduceContiguous; + } + if (other.XlaGpuAllReduceBlueconnectNumDevicesPerHost != 0) { + XlaGpuAllReduceBlueconnectNumDevicesPerHost = other.XlaGpuAllReduceBlueconnectNumDevicesPerHost; + } + if (other.XlaGpuEnableCudnnFrontend != false) { + XlaGpuEnableCudnnFrontend = other.XlaGpuEnableCudnnFrontend; + } + if (other.XlaDumpDisableMetadata != false) { + XlaDumpDisableMetadata = other.XlaDumpDisableMetadata; + } + if (other.XlaDumpHloPipelineRe.Length != 0) { + XlaDumpHloPipelineRe = other.XlaDumpHloPipelineRe; + } + if (other.XlaGpuStrictConvAlgorithmPicker != false) { + XlaGpuStrictConvAlgorithmPicker = other.XlaGpuStrictConvAlgorithmPicker; + } + if (other.XlaGpuEnableXlaRuntimeExecutable != false) { + XlaGpuEnableXlaRuntimeExecutable = other.XlaGpuEnableXlaRuntimeExecutable; + } + if (other.XlaGpuNcclTerminationTimeoutSeconds != 0L) { + XlaGpuNcclTerminationTimeoutSeconds = other.XlaGpuNcclTerminationTimeoutSeconds; + } + if (other.XlaGpuEnableSharedConstants != false) { + XlaGpuEnableSharedConstants = other.XlaGpuEnableSharedConstants; + } + if (other.XlaGpuEnableCublaslt != false) { + XlaGpuEnableCublaslt = other.XlaGpuEnableCublaslt; + } + if (other.XlaGpuRedzoneScratchMaxMegabytes != 0L) { + XlaGpuRedzoneScratchMaxMegabytes = other.XlaGpuRedzoneScratchMaxMegabytes; + } + if (other.XlaGpuSimplifyAllFpConversions != false) { + XlaGpuSimplifyAllFpConversions = other.XlaGpuSimplifyAllFpConversions; + } + if (other.XlaGpuNormalizeLayouts != false) { + XlaGpuNormalizeLayouts = other.XlaGpuNormalizeLayouts; + } + if (other.XlaCpuUseAcl != false) { + XlaCpuUseAcl = other.XlaCpuUseAcl; + } + if (other.XlaCpuStrictDotConvMath != false) { + XlaCpuStrictDotConvMath = other.XlaCpuStrictDotConvMath; + } + xlaBackendExtraOptions_.Add(other.xlaBackendExtraOptions_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 16: { + XlaHloGraphAddresses = input.ReadBool(); + break; + } + case 72: { + XlaHloProfile = input.ReadBool(); + break; + } + case 242: { + xlaDisableHloPasses_.AddEntriesFrom(input, _repeated_xlaDisableHloPasses_codec); + break; + } + case 248: { + XlaBackendOptimizationLevel = input.ReadInt32(); + break; + } + case 264: { + XlaEmbedIrInExecutable = input.ReadBool(); + break; + } + case 280: { + XlaEliminateHloImplicitBroadcast = input.ReadBool(); + break; + } + case 480: { + XlaCpuMultiThreadEigen = input.ReadBool(); + break; + } + case 490: { + XlaGpuCudaDataDir = input.ReadString(); + break; + } + case 496: { + XlaGpuFtz = input.ReadBool(); + break; + } + case 560: { + XlaLlvmEnableAliasScopeMetadata = input.ReadBool(); + break; + } + case 568: { + XlaLlvmEnableNoaliasMetadata = input.ReadBool(); + break; + } + case 576: { + XlaLlvmEnableInvariantLoadMetadata = input.ReadBool(); + break; + } + case 584: { + XlaLlvmDisableExpensivePasses = input.ReadBool(); + break; + } + case 720: { + XlaTestAllOutputLayouts = input.ReadBool(); + break; + } + case 728: { + XlaTestAllInputLayouts = input.ReadBool(); + break; + } + case 736: { + XlaHloGraphShardingColor = input.ReadBool(); + break; + } + case 776: { + XlaCpuUseMklDnn = input.ReadBool(); + break; + } + case 784: { + XlaGpuMaxKernelUnrollFactor = input.ReadInt32(); + break; + } + case 792: { + XlaCpuEnableFastMath = input.ReadBool(); + break; + } + case 800: { + XlaGpuEnableFastMinMax = input.ReadBool(); + break; + } + case 808: { + XlaGpuCrashOnVerificationFailures = input.ReadBool(); + break; + } + case 816: { + XlaForceHostPlatformDeviceCount = input.ReadInt32(); + break; + } + case 824: { + XlaGpuDisableGpuasmOptimizations = input.ReadBool(); + break; + } + case 832: { + XlaDisableAllHloPasses = input.ReadBool(); + break; + } + case 848: { + XlaHloEvaluatorUseFastPath = input.ReadBool(); + break; + } + case 856: { + XlaAllowScalarIndexDynamicOps = input.ReadBool(); + break; + } + case 864: { + XlaStepMarkerLocation = (global::Xla.DebugOptions.Types.StepMarkerLocation) input.ReadEnum(); + break; + } + case 874: { + XlaDumpTo = input.ReadString(); + break; + } + case 882: { + XlaDumpHloModuleRe = input.ReadString(); + break; + } + case 890: { + XlaDumpHloPassRe = input.ReadString(); + break; + } + case 896: { + XlaDumpHloAsText = input.ReadBool(); + break; + } + case 904: { + XlaDumpHloAsProto = input.ReadBool(); + break; + } + case 912: { + XlaDumpHloAsDot = input.ReadBool(); + break; + } + case 920: { + XlaDumpHloAsUrl = input.ReadBool(); + break; + } + case 928: { + XlaDumpHloAsHtml = input.ReadBool(); + break; + } + case 944: { + XlaDumpHloSnapshots = input.ReadBool(); + break; + } + case 960: { + XlaCpuFastMathHonorNans = input.ReadBool(); + break; + } + case 968: { + XlaCpuFastMathHonorInfs = input.ReadBool(); + break; + } + case 976: { + XlaAllowExcessPrecision = input.ReadBool(); + break; + } + case 984: { + XlaGpuAutotuneLevel = input.ReadInt32(); + break; + } + case 994: { + xlaEnableHloPassesOnly_.AddEntriesFrom(input, _repeated_xlaEnableHloPassesOnly_codec); + break; + } + case 1000: { + XlaGpuForceConvNchw = input.ReadBool(); + break; + } + case 1008: { + XlaCpuFastMathHonorDivision = input.ReadBool(); + break; + } + case 1018: { + xlaGpuPtxFile_.AddEntriesFrom(input, _repeated_xlaGpuPtxFile_codec); + break; + } + case 1026: { + XlaGpuAlgorithmDenylistPath = input.ReadString(); + break; + } + case 1032: { + XlaCpuFastMathHonorFunctions = input.ReadBool(); + break; + } + case 1048: { + XlaDumpIncludeTimestamp = input.ReadBool(); + break; + } + case 1056: { + XlaDumpMaxHloModules = input.ReadInt32(); + break; + } + case 1080: { + XlaTpuDetectNan = input.ReadBool(); + break; + } + case 1088: { + XlaTpuDetectInf = input.ReadBool(); + break; + } + case 1096: { + XlaCpuEnableXprofTraceme = input.ReadBool(); + break; + } + case 1104: { + XlaGpuUnsafeFallbackToDriverOnPtxasNotFound = input.ReadBool(); + break; + } + case 1120: { + XlaCpuEnableFastMinMax = input.ReadBool(); + break; + } + case 1130: { + XlaGpuAsmExtraFlags = input.ReadString(); + break; + } + case 1136: { + XlaMultiheapSizeConstraintPerHeap = input.ReadInt32(); + break; + } + case 1144: { + XlaDetailedLoggingAndDumping = input.ReadBool(); + break; + } + case 1152: { + XlaDumpModuleMetadata = input.ReadBool(); + break; + } + case 1168: { + XlaGpuForceConvNhwc = input.ReadBool(); + break; + } + case 1176: { + XlaGpuForceCompilationParallelism = input.ReadInt32(); + break; + } + case 1184: { + XlaGpuDeterministicOps = input.ReadBool(); + break; + } + case 1192: { + XlaDumpFusionVisualization = input.ReadBool(); + break; + } + case 1202: { + xlaGpuLlvmIrFile_.AddEntriesFrom(input, _repeated_xlaGpuLlvmIrFile_codec); + break; + } + case 1208: { + XlaDumpCompressProtos = input.ReadBool(); + break; + } + case 1216: { + XlaGpuEnableAsyncAllReduce = input.ReadBool(); + break; + } + case 1224: { + XlaDumpDisableMetadata = input.ReadBool(); + break; + } + case 1234: { + XlaDumpHloPipelineRe = input.ReadString(); + break; + } + case 1240: { + XlaGpuDumpLlvmir = input.ReadBool(); + break; + } + case 1248: { + XlaGpuStrictConvAlgorithmPicker = input.ReadBool(); + break; + } + case 1256: { + XlaGpuAllReduceCombineThresholdBytes = input.ReadInt64(); + break; + } + case 1264: { + XlaGpuAllReduceContiguous = input.ReadBool(); + break; + } + case 1272: { + XlaGpuAllReduceBlueconnectNumDevicesPerHost = input.ReadInt32(); + break; + } + case 1280: { + XlaGpuEnableCudnnFrontend = input.ReadBool(); + break; + } + case 1304: { + XlaGpuNcclTerminationTimeoutSeconds = input.ReadInt64(); + break; + } + case 1312: { + XlaDumpHloAsLongText = input.ReadBool(); + break; + } + case 1320: { + XlaGpuEnableSharedConstants = input.ReadBool(); + break; + } + case 1328: { + XlaGpuEnableCublaslt = input.ReadBool(); + break; + } + case 1336: { + XlaGpuRedzoneScratchMaxMegabytes = input.ReadInt64(); + break; + } + case 1344: { + XlaGpuSimplifyAllFpConversions = input.ReadBool(); + break; + } + case 1352: { + XlaGpuEnableXlaRuntimeExecutable = input.ReadBool(); + break; + } + case 1360: { + XlaGpuShapeChecks = (global::Xla.DebugOptions.Types.ShapeChecks) input.ReadEnum(); + break; + } + case 1368: { + XlaCpuEnableMlirLowering = input.ReadBool(); + break; + } + case 1376: { + XlaGpuNormalizeLayouts = input.ReadBool(); + break; + } + case 1384: { + XlaGpuEnableMlirLowering = input.ReadBool(); + break; + } + case 1392: { + XlaCpuUseAcl = input.ReadBool(); + break; + } + case 1400: { + XlaCpuStrictDotConvMath = input.ReadBool(); + break; + } + case 1416: { + XlaCpuUseXlaRuntime = input.ReadBool(); + break; + } + case 4002: { + xlaBackendExtraOptions_.AddEntriesFrom(input, _map_xlaBackendExtraOptions_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 16: { + XlaHloGraphAddresses = input.ReadBool(); + break; + } + case 72: { + XlaHloProfile = input.ReadBool(); + break; + } + case 242: { + xlaDisableHloPasses_.AddEntriesFrom(ref input, _repeated_xlaDisableHloPasses_codec); + break; + } + case 248: { + XlaBackendOptimizationLevel = input.ReadInt32(); + break; + } + case 264: { + XlaEmbedIrInExecutable = input.ReadBool(); + break; + } + case 280: { + XlaEliminateHloImplicitBroadcast = input.ReadBool(); + break; + } + case 480: { + XlaCpuMultiThreadEigen = input.ReadBool(); + break; + } + case 490: { + XlaGpuCudaDataDir = input.ReadString(); + break; + } + case 496: { + XlaGpuFtz = input.ReadBool(); + break; + } + case 560: { + XlaLlvmEnableAliasScopeMetadata = input.ReadBool(); + break; + } + case 568: { + XlaLlvmEnableNoaliasMetadata = input.ReadBool(); + break; + } + case 576: { + XlaLlvmEnableInvariantLoadMetadata = input.ReadBool(); + break; + } + case 584: { + XlaLlvmDisableExpensivePasses = input.ReadBool(); + break; + } + case 720: { + XlaTestAllOutputLayouts = input.ReadBool(); + break; + } + case 728: { + XlaTestAllInputLayouts = input.ReadBool(); + break; + } + case 736: { + XlaHloGraphShardingColor = input.ReadBool(); + break; + } + case 776: { + XlaCpuUseMklDnn = input.ReadBool(); + break; + } + case 784: { + XlaGpuMaxKernelUnrollFactor = input.ReadInt32(); + break; + } + case 792: { + XlaCpuEnableFastMath = input.ReadBool(); + break; + } + case 800: { + XlaGpuEnableFastMinMax = input.ReadBool(); + break; + } + case 808: { + XlaGpuCrashOnVerificationFailures = input.ReadBool(); + break; + } + case 816: { + XlaForceHostPlatformDeviceCount = input.ReadInt32(); + break; + } + case 824: { + XlaGpuDisableGpuasmOptimizations = input.ReadBool(); + break; + } + case 832: { + XlaDisableAllHloPasses = input.ReadBool(); + break; + } + case 848: { + XlaHloEvaluatorUseFastPath = input.ReadBool(); + break; + } + case 856: { + XlaAllowScalarIndexDynamicOps = input.ReadBool(); + break; + } + case 864: { + XlaStepMarkerLocation = (global::Xla.DebugOptions.Types.StepMarkerLocation) input.ReadEnum(); + break; + } + case 874: { + XlaDumpTo = input.ReadString(); + break; + } + case 882: { + XlaDumpHloModuleRe = input.ReadString(); + break; + } + case 890: { + XlaDumpHloPassRe = input.ReadString(); + break; + } + case 896: { + XlaDumpHloAsText = input.ReadBool(); + break; + } + case 904: { + XlaDumpHloAsProto = input.ReadBool(); + break; + } + case 912: { + XlaDumpHloAsDot = input.ReadBool(); + break; + } + case 920: { + XlaDumpHloAsUrl = input.ReadBool(); + break; + } + case 928: { + XlaDumpHloAsHtml = input.ReadBool(); + break; + } + case 944: { + XlaDumpHloSnapshots = input.ReadBool(); + break; + } + case 960: { + XlaCpuFastMathHonorNans = input.ReadBool(); + break; + } + case 968: { + XlaCpuFastMathHonorInfs = input.ReadBool(); + break; + } + case 976: { + XlaAllowExcessPrecision = input.ReadBool(); + break; + } + case 984: { + XlaGpuAutotuneLevel = input.ReadInt32(); + break; + } + case 994: { + xlaEnableHloPassesOnly_.AddEntriesFrom(ref input, _repeated_xlaEnableHloPassesOnly_codec); + break; + } + case 1000: { + XlaGpuForceConvNchw = input.ReadBool(); + break; + } + case 1008: { + XlaCpuFastMathHonorDivision = input.ReadBool(); + break; + } + case 1018: { + xlaGpuPtxFile_.AddEntriesFrom(ref input, _repeated_xlaGpuPtxFile_codec); + break; + } + case 1026: { + XlaGpuAlgorithmDenylistPath = input.ReadString(); + break; + } + case 1032: { + XlaCpuFastMathHonorFunctions = input.ReadBool(); + break; + } + case 1048: { + XlaDumpIncludeTimestamp = input.ReadBool(); + break; + } + case 1056: { + XlaDumpMaxHloModules = input.ReadInt32(); + break; + } + case 1080: { + XlaTpuDetectNan = input.ReadBool(); + break; + } + case 1088: { + XlaTpuDetectInf = input.ReadBool(); + break; + } + case 1096: { + XlaCpuEnableXprofTraceme = input.ReadBool(); + break; + } + case 1104: { + XlaGpuUnsafeFallbackToDriverOnPtxasNotFound = input.ReadBool(); + break; + } + case 1120: { + XlaCpuEnableFastMinMax = input.ReadBool(); + break; + } + case 1130: { + XlaGpuAsmExtraFlags = input.ReadString(); + break; + } + case 1136: { + XlaMultiheapSizeConstraintPerHeap = input.ReadInt32(); + break; + } + case 1144: { + XlaDetailedLoggingAndDumping = input.ReadBool(); + break; + } + case 1152: { + XlaDumpModuleMetadata = input.ReadBool(); + break; + } + case 1168: { + XlaGpuForceConvNhwc = input.ReadBool(); + break; + } + case 1176: { + XlaGpuForceCompilationParallelism = input.ReadInt32(); + break; + } + case 1184: { + XlaGpuDeterministicOps = input.ReadBool(); + break; + } + case 1192: { + XlaDumpFusionVisualization = input.ReadBool(); + break; + } + case 1202: { + xlaGpuLlvmIrFile_.AddEntriesFrom(ref input, _repeated_xlaGpuLlvmIrFile_codec); + break; + } + case 1208: { + XlaDumpCompressProtos = input.ReadBool(); + break; + } + case 1216: { + XlaGpuEnableAsyncAllReduce = input.ReadBool(); + break; + } + case 1224: { + XlaDumpDisableMetadata = input.ReadBool(); + break; + } + case 1234: { + XlaDumpHloPipelineRe = input.ReadString(); + break; + } + case 1240: { + XlaGpuDumpLlvmir = input.ReadBool(); + break; + } + case 1248: { + XlaGpuStrictConvAlgorithmPicker = input.ReadBool(); + break; + } + case 1256: { + XlaGpuAllReduceCombineThresholdBytes = input.ReadInt64(); + break; + } + case 1264: { + XlaGpuAllReduceContiguous = input.ReadBool(); + break; + } + case 1272: { + XlaGpuAllReduceBlueconnectNumDevicesPerHost = input.ReadInt32(); + break; + } + case 1280: { + XlaGpuEnableCudnnFrontend = input.ReadBool(); + break; + } + case 1304: { + XlaGpuNcclTerminationTimeoutSeconds = input.ReadInt64(); + break; + } + case 1312: { + XlaDumpHloAsLongText = input.ReadBool(); + break; + } + case 1320: { + XlaGpuEnableSharedConstants = input.ReadBool(); + break; + } + case 1328: { + XlaGpuEnableCublaslt = input.ReadBool(); + break; + } + case 1336: { + XlaGpuRedzoneScratchMaxMegabytes = input.ReadInt64(); + break; + } + case 1344: { + XlaGpuSimplifyAllFpConversions = input.ReadBool(); + break; + } + case 1352: { + XlaGpuEnableXlaRuntimeExecutable = input.ReadBool(); + break; + } + case 1360: { + XlaGpuShapeChecks = (global::Xla.DebugOptions.Types.ShapeChecks) input.ReadEnum(); + break; + } + case 1368: { + XlaCpuEnableMlirLowering = input.ReadBool(); + break; + } + case 1376: { + XlaGpuNormalizeLayouts = input.ReadBool(); + break; + } + case 1384: { + XlaGpuEnableMlirLowering = input.ReadBool(); + break; + } + case 1392: { + XlaCpuUseAcl = input.ReadBool(); + break; + } + case 1400: { + XlaCpuStrictDotConvMath = input.ReadBool(); + break; + } + case 1416: { + XlaCpuUseXlaRuntime = input.ReadBool(); + break; + } + case 4002: { + xlaBackendExtraOptions_.AddEntriesFrom(ref input, _map_xlaBackendExtraOptions_codec); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the DebugOptions message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + public enum ShapeChecks { + /// + /// Do not insert any shape checks for dynamically shaped operations; output + /// buffers might contain garbage data if shapes don't match. + /// + [pbr::OriginalName("IGNORE")] Ignore = 0, + /// + /// Check shapes at runtime, will insert an extra synchronization if shapes + /// cannot be proven correct at compile time. + /// + [pbr::OriginalName("RUNTIME")] Runtime = 1, + /// + /// Will refuse to compile any program where shape correctness can not be + /// established at compile time. + /// + [pbr::OriginalName("COMPILE_TIME")] CompileTime = 2, + } + + public enum StepMarkerLocation { + /// + /// Generate a step marker at the program entry. This handles the case where + /// each step is done by one or multiple program execution(s). Only the first + /// program will be tagged for generating a step marker at the program entry. + /// This is the default. + /// + [pbr::OriginalName("STEP_MARK_AT_ENTRY")] StepMarkAtEntry = 0, + /// + /// Generate a step marker at each iteration of the top level while loop, + /// which is assumed to be a training loop. + /// + [pbr::OriginalName("STEP_MARK_AT_TOP_LEVEL_WHILE_LOOP")] StepMarkAtTopLevelWhileLoop = 1, + /// + /// Generate a step marker at each iteration of the second level while loops, + /// which is assumed to be a training or eval loop. + /// + [pbr::OriginalName("STEP_MARK_AT_SECOND_LEVEL_WHILE_LOOP")] StepMarkAtSecondLevelWhileLoop = 3, + /// + /// No step marker generated. + /// + [pbr::OriginalName("STEP_MARK_NONE")] StepMarkNone = 2, + } + + } + #endregion + + } + + /// + /// These settings control how XLA compiles and/or runs code. Not all settings + /// will have an effect on every platform. + /// + /// When adding new fields, keep in mind that boolean fields default to false. + /// + public sealed partial class ExecutionOptions : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExecutionOptions()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecutionOptions() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecutionOptions(ExecutionOptions other) : this() { + shapeWithOutputLayout_ = other.shapeWithOutputLayout_ != null ? other.shapeWithOutputLayout_.Clone() : null; + seed_ = other.seed_; + debugOptions_ = other.debugOptions_ != null ? other.debugOptions_.Clone() : null; + deviceHandles_ = other.deviceHandles_.Clone(); + numReplicas_ = other.numReplicas_; + deviceAssignment_ = other.deviceAssignment_ != null ? other.deviceAssignment_.Clone() : null; + aliasPassthroughParams_ = other.aliasPassthroughParams_; + numPartitions_ = other.numPartitions_; + launchId_ = other.launchId_; + useSpmdPartitioning_ = other.useSpmdPartitioning_; + useAutoSpmdPartitioning_ = other.useAutoSpmdPartitioning_; + autoSpmdPartitioningMeshShape_ = other.autoSpmdPartitioningMeshShape_.Clone(); + autoSpmdPartitioningMeshIds_ = other.autoSpmdPartitioningMeshIds_.Clone(); + deduplicateHlo_ = other.deduplicateHlo_; + allowSpmdShardingPropagationToOutput_ = other.allowSpmdShardingPropagationToOutput_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecutionOptions Clone() { + return new ExecutionOptions(this); + } + + /// Field number for the "shape_with_output_layout" field. + public const int ShapeWithOutputLayoutFieldNumber = 2; + private global::Xla.ShapeProto shapeWithOutputLayout_; + /// + /// This optional field's layout is used as a hint when storing the output of + /// this computation. Subsequent transfers of this output array to the client + /// may be faster when using this layout. + /// + /// We use a Shape here to accommodate computations that return a tuple. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ShapeProto ShapeWithOutputLayout { + get { return shapeWithOutputLayout_; } + set { + shapeWithOutputLayout_ = value; + } + } + + /// Field number for the "seed" field. + public const int SeedFieldNumber = 3; + private ulong seed_; + /// + /// Used to seed random-number generators used in this computation. If this is + /// 0, we generate a seed ourselves. + /// + /// TODO(b/32083678): Changing the seed unnecessarily forces a recompilation. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ulong Seed { + get { return seed_; } + set { + seed_ = value; + } + } + + /// Field number for the "debug_options" field. + public const int DebugOptionsFieldNumber = 4; + private global::Xla.DebugOptions debugOptions_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.DebugOptions DebugOptions { + get { return debugOptions_; } + set { + debugOptions_ = value; + } + } + + /// Field number for the "device_handles" field. + public const int DeviceHandlesFieldNumber = 5; + private static readonly pb::FieldCodec _repeated_deviceHandles_codec + = pb::FieldCodec.ForMessage(42, global::Xla.DeviceHandle.Parser); + private readonly pbc::RepeatedField deviceHandles_ = new pbc::RepeatedField(); + /// + /// This optional field specifies a particular set of devices to run the + /// computation on. The computation will be partitioned across these devices. + /// If not provided, the default device will be chosen. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField DeviceHandles { + get { return deviceHandles_; } + } + + /// Field number for the "num_replicas" field. + public const int NumReplicasFieldNumber = 6; + private int numReplicas_; + /// + /// Number of replicas of the computation to run. If zero, uses the default + /// number of replicas for the XLA service. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int NumReplicas { + get { return numReplicas_; } + set { + numReplicas_ = value; + } + } + + /// Field number for the "device_assignment" field. + public const int DeviceAssignmentFieldNumber = 7; + private global::Xla.DeviceAssignmentProto deviceAssignment_; + /// + /// This optional field specifies the device assignment if known at compile + /// time. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.DeviceAssignmentProto DeviceAssignment { + get { return deviceAssignment_; } + set { + deviceAssignment_ = value; + } + } + + /// Field number for the "alias_passthrough_params" field. + public const int AliasPassthroughParamsFieldNumber = 8; + private bool aliasPassthroughParams_; + /// + /// Alias input and output buffers for parameters that are passed-through XLA + /// modules without being changed. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool AliasPassthroughParams { + get { return aliasPassthroughParams_; } + set { + aliasPassthroughParams_ = value; + } + } + + /// Field number for the "num_partitions" field. + public const int NumPartitionsFieldNumber = 9; + private int numPartitions_; + /// + /// Number of partitions of the computation to run (model parallelism). + /// If zero, uses the default number of partitions for the XLA service. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int NumPartitions { + get { return numPartitions_; } + set { + numPartitions_ = value; + } + } + + /// Field number for the "launch_id" field. + public const int LaunchIdFieldNumber = 10; + private int launchId_; + /// + /// Used to identify a set of programs that should be launch together. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int LaunchId { + get { return launchId_; } + set { + launchId_ = value; + } + } + + /// Field number for the "use_spmd_partitioning" field. + public const int UseSpmdPartitioningFieldNumber = 11; + private bool useSpmdPartitioning_; + /// + /// Indicates whether to use SPMD (true) or MPMD (false) partitioning when + /// num_partitions > 1 and XLA is requested to partition the input program. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool UseSpmdPartitioning { + get { return useSpmdPartitioning_; } + set { + useSpmdPartitioning_ = value; + } + } + + /// Field number for the "use_auto_spmd_partitioning" field. + public const int UseAutoSpmdPartitioningFieldNumber = 15; + private bool useAutoSpmdPartitioning_; + /// + /// Whether to automatically generate XLA shardings for SPMD partitioner. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool UseAutoSpmdPartitioning { + get { return useAutoSpmdPartitioning_; } + set { + useAutoSpmdPartitioning_ = value; + } + } + + /// Field number for the "auto_spmd_partitioning_mesh_shape" field. + public const int AutoSpmdPartitioningMeshShapeFieldNumber = 16; + private static readonly pb::FieldCodec _repeated_autoSpmdPartitioningMeshShape_codec + = pb::FieldCodec.ForInt64(130); + private readonly pbc::RepeatedField autoSpmdPartitioningMeshShape_ = new pbc::RepeatedField(); + /// + /// Device mesh shape used to create the sharding search space when + /// use_auto_spmd_partitioning=true. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField AutoSpmdPartitioningMeshShape { + get { return autoSpmdPartitioningMeshShape_; } + } + + /// Field number for the "auto_spmd_partitioning_mesh_ids" field. + public const int AutoSpmdPartitioningMeshIdsFieldNumber = 17; + private static readonly pb::FieldCodec _repeated_autoSpmdPartitioningMeshIds_codec + = pb::FieldCodec.ForInt64(138); + private readonly pbc::RepeatedField autoSpmdPartitioningMeshIds_ = new pbc::RepeatedField(); + /// + /// Device mesh ids compatible with the above mesh_shape used when + /// use_auto_spmd_partitioning=true. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField AutoSpmdPartitioningMeshIds { + get { return autoSpmdPartitioningMeshIds_; } + } + + /// Field number for the "deduplicate_hlo" field. + public const int DeduplicateHloFieldNumber = 12; + private bool deduplicateHlo_; + /// + /// If set, deduplicate hlo into function calls to reduce binary size. Only + /// works on TPU. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool DeduplicateHlo { + get { return deduplicateHlo_; } + set { + deduplicateHlo_ = value; + } + } + + /// Field number for the "allow_spmd_sharding_propagation_to_output" field. + public const int AllowSpmdShardingPropagationToOutputFieldNumber = 14; + private bool allowSpmdShardingPropagationToOutput_; + /// + /// Allows sharding propagation to propagate to the outputs. This changes the + /// output shape of the computation (which is undesirable), but it can be used + /// to allow to run partial compilation to determine what would be the output + /// sharding of a computation if XLA would be allowed to propagate the sharding + /// which can be used by higher level framework as a way to query intermediate + /// sharding of operations when multiple computation would be chained and + /// merged together. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool AllowSpmdShardingPropagationToOutput { + get { return allowSpmdShardingPropagationToOutput_; } + set { + allowSpmdShardingPropagationToOutput_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ExecutionOptions); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ExecutionOptions other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(ShapeWithOutputLayout, other.ShapeWithOutputLayout)) return false; + if (Seed != other.Seed) return false; + if (!object.Equals(DebugOptions, other.DebugOptions)) return false; + if(!deviceHandles_.Equals(other.deviceHandles_)) return false; + if (NumReplicas != other.NumReplicas) return false; + if (!object.Equals(DeviceAssignment, other.DeviceAssignment)) return false; + if (AliasPassthroughParams != other.AliasPassthroughParams) return false; + if (NumPartitions != other.NumPartitions) return false; + if (LaunchId != other.LaunchId) return false; + if (UseSpmdPartitioning != other.UseSpmdPartitioning) return false; + if (UseAutoSpmdPartitioning != other.UseAutoSpmdPartitioning) return false; + if(!autoSpmdPartitioningMeshShape_.Equals(other.autoSpmdPartitioningMeshShape_)) return false; + if(!autoSpmdPartitioningMeshIds_.Equals(other.autoSpmdPartitioningMeshIds_)) return false; + if (DeduplicateHlo != other.DeduplicateHlo) return false; + if (AllowSpmdShardingPropagationToOutput != other.AllowSpmdShardingPropagationToOutput) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (shapeWithOutputLayout_ != null) hash ^= ShapeWithOutputLayout.GetHashCode(); + if (Seed != 0UL) hash ^= Seed.GetHashCode(); + if (debugOptions_ != null) hash ^= DebugOptions.GetHashCode(); + hash ^= deviceHandles_.GetHashCode(); + if (NumReplicas != 0) hash ^= NumReplicas.GetHashCode(); + if (deviceAssignment_ != null) hash ^= DeviceAssignment.GetHashCode(); + if (AliasPassthroughParams != false) hash ^= AliasPassthroughParams.GetHashCode(); + if (NumPartitions != 0) hash ^= NumPartitions.GetHashCode(); + if (LaunchId != 0) hash ^= LaunchId.GetHashCode(); + if (UseSpmdPartitioning != false) hash ^= UseSpmdPartitioning.GetHashCode(); + if (UseAutoSpmdPartitioning != false) hash ^= UseAutoSpmdPartitioning.GetHashCode(); + hash ^= autoSpmdPartitioningMeshShape_.GetHashCode(); + hash ^= autoSpmdPartitioningMeshIds_.GetHashCode(); + if (DeduplicateHlo != false) hash ^= DeduplicateHlo.GetHashCode(); + if (AllowSpmdShardingPropagationToOutput != false) hash ^= AllowSpmdShardingPropagationToOutput.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (shapeWithOutputLayout_ != null) { + output.WriteRawTag(18); + output.WriteMessage(ShapeWithOutputLayout); + } + if (Seed != 0UL) { + output.WriteRawTag(24); + output.WriteUInt64(Seed); + } + if (debugOptions_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DebugOptions); + } + deviceHandles_.WriteTo(output, _repeated_deviceHandles_codec); + if (NumReplicas != 0) { + output.WriteRawTag(48); + output.WriteInt32(NumReplicas); + } + if (deviceAssignment_ != null) { + output.WriteRawTag(58); + output.WriteMessage(DeviceAssignment); + } + if (AliasPassthroughParams != false) { + output.WriteRawTag(64); + output.WriteBool(AliasPassthroughParams); + } + if (NumPartitions != 0) { + output.WriteRawTag(72); + output.WriteInt32(NumPartitions); + } + if (LaunchId != 0) { + output.WriteRawTag(80); + output.WriteInt32(LaunchId); + } + if (UseSpmdPartitioning != false) { + output.WriteRawTag(88); + output.WriteBool(UseSpmdPartitioning); + } + if (DeduplicateHlo != false) { + output.WriteRawTag(96); + output.WriteBool(DeduplicateHlo); + } + if (AllowSpmdShardingPropagationToOutput != false) { + output.WriteRawTag(112); + output.WriteBool(AllowSpmdShardingPropagationToOutput); + } + if (UseAutoSpmdPartitioning != false) { + output.WriteRawTag(120); + output.WriteBool(UseAutoSpmdPartitioning); + } + autoSpmdPartitioningMeshShape_.WriteTo(output, _repeated_autoSpmdPartitioningMeshShape_codec); + autoSpmdPartitioningMeshIds_.WriteTo(output, _repeated_autoSpmdPartitioningMeshIds_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (shapeWithOutputLayout_ != null) { + output.WriteRawTag(18); + output.WriteMessage(ShapeWithOutputLayout); + } + if (Seed != 0UL) { + output.WriteRawTag(24); + output.WriteUInt64(Seed); + } + if (debugOptions_ != null) { + output.WriteRawTag(34); + output.WriteMessage(DebugOptions); + } + deviceHandles_.WriteTo(ref output, _repeated_deviceHandles_codec); + if (NumReplicas != 0) { + output.WriteRawTag(48); + output.WriteInt32(NumReplicas); + } + if (deviceAssignment_ != null) { + output.WriteRawTag(58); + output.WriteMessage(DeviceAssignment); + } + if (AliasPassthroughParams != false) { + output.WriteRawTag(64); + output.WriteBool(AliasPassthroughParams); + } + if (NumPartitions != 0) { + output.WriteRawTag(72); + output.WriteInt32(NumPartitions); + } + if (LaunchId != 0) { + output.WriteRawTag(80); + output.WriteInt32(LaunchId); + } + if (UseSpmdPartitioning != false) { + output.WriteRawTag(88); + output.WriteBool(UseSpmdPartitioning); + } + if (DeduplicateHlo != false) { + output.WriteRawTag(96); + output.WriteBool(DeduplicateHlo); + } + if (AllowSpmdShardingPropagationToOutput != false) { + output.WriteRawTag(112); + output.WriteBool(AllowSpmdShardingPropagationToOutput); + } + if (UseAutoSpmdPartitioning != false) { + output.WriteRawTag(120); + output.WriteBool(UseAutoSpmdPartitioning); + } + autoSpmdPartitioningMeshShape_.WriteTo(ref output, _repeated_autoSpmdPartitioningMeshShape_codec); + autoSpmdPartitioningMeshIds_.WriteTo(ref output, _repeated_autoSpmdPartitioningMeshIds_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (shapeWithOutputLayout_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ShapeWithOutputLayout); + } + if (Seed != 0UL) { + size += 1 + pb::CodedOutputStream.ComputeUInt64Size(Seed); + } + if (debugOptions_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DebugOptions); + } + size += deviceHandles_.CalculateSize(_repeated_deviceHandles_codec); + if (NumReplicas != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(NumReplicas); + } + if (deviceAssignment_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DeviceAssignment); + } + if (AliasPassthroughParams != false) { + size += 1 + 1; + } + if (NumPartitions != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(NumPartitions); + } + if (LaunchId != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(LaunchId); + } + if (UseSpmdPartitioning != false) { + size += 1 + 1; + } + if (UseAutoSpmdPartitioning != false) { + size += 1 + 1; + } + size += autoSpmdPartitioningMeshShape_.CalculateSize(_repeated_autoSpmdPartitioningMeshShape_codec); + size += autoSpmdPartitioningMeshIds_.CalculateSize(_repeated_autoSpmdPartitioningMeshIds_codec); + if (DeduplicateHlo != false) { + size += 1 + 1; + } + if (AllowSpmdShardingPropagationToOutput != false) { + size += 1 + 1; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ExecutionOptions other) { + if (other == null) { + return; + } + if (other.shapeWithOutputLayout_ != null) { + if (shapeWithOutputLayout_ == null) { + ShapeWithOutputLayout = new global::Xla.ShapeProto(); + } + ShapeWithOutputLayout.MergeFrom(other.ShapeWithOutputLayout); + } + if (other.Seed != 0UL) { + Seed = other.Seed; + } + if (other.debugOptions_ != null) { + if (debugOptions_ == null) { + DebugOptions = new global::Xla.DebugOptions(); + } + DebugOptions.MergeFrom(other.DebugOptions); + } + deviceHandles_.Add(other.deviceHandles_); + if (other.NumReplicas != 0) { + NumReplicas = other.NumReplicas; + } + if (other.deviceAssignment_ != null) { + if (deviceAssignment_ == null) { + DeviceAssignment = new global::Xla.DeviceAssignmentProto(); + } + DeviceAssignment.MergeFrom(other.DeviceAssignment); + } + if (other.AliasPassthroughParams != false) { + AliasPassthroughParams = other.AliasPassthroughParams; + } + if (other.NumPartitions != 0) { + NumPartitions = other.NumPartitions; + } + if (other.LaunchId != 0) { + LaunchId = other.LaunchId; + } + if (other.UseSpmdPartitioning != false) { + UseSpmdPartitioning = other.UseSpmdPartitioning; + } + if (other.UseAutoSpmdPartitioning != false) { + UseAutoSpmdPartitioning = other.UseAutoSpmdPartitioning; + } + autoSpmdPartitioningMeshShape_.Add(other.autoSpmdPartitioningMeshShape_); + autoSpmdPartitioningMeshIds_.Add(other.autoSpmdPartitioningMeshIds_); + if (other.DeduplicateHlo != false) { + DeduplicateHlo = other.DeduplicateHlo; + } + if (other.AllowSpmdShardingPropagationToOutput != false) { + AllowSpmdShardingPropagationToOutput = other.AllowSpmdShardingPropagationToOutput; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 18: { + if (shapeWithOutputLayout_ == null) { + ShapeWithOutputLayout = new global::Xla.ShapeProto(); + } + input.ReadMessage(ShapeWithOutputLayout); + break; + } + case 24: { + Seed = input.ReadUInt64(); + break; + } + case 34: { + if (debugOptions_ == null) { + DebugOptions = new global::Xla.DebugOptions(); + } + input.ReadMessage(DebugOptions); + break; + } + case 42: { + deviceHandles_.AddEntriesFrom(input, _repeated_deviceHandles_codec); + break; + } + case 48: { + NumReplicas = input.ReadInt32(); + break; + } + case 58: { + if (deviceAssignment_ == null) { + DeviceAssignment = new global::Xla.DeviceAssignmentProto(); + } + input.ReadMessage(DeviceAssignment); + break; + } + case 64: { + AliasPassthroughParams = input.ReadBool(); + break; + } + case 72: { + NumPartitions = input.ReadInt32(); + break; + } + case 80: { + LaunchId = input.ReadInt32(); + break; + } + case 88: { + UseSpmdPartitioning = input.ReadBool(); + break; + } + case 96: { + DeduplicateHlo = input.ReadBool(); + break; + } + case 112: { + AllowSpmdShardingPropagationToOutput = input.ReadBool(); + break; + } + case 120: { + UseAutoSpmdPartitioning = input.ReadBool(); + break; + } + case 130: + case 128: { + autoSpmdPartitioningMeshShape_.AddEntriesFrom(input, _repeated_autoSpmdPartitioningMeshShape_codec); + break; + } + case 138: + case 136: { + autoSpmdPartitioningMeshIds_.AddEntriesFrom(input, _repeated_autoSpmdPartitioningMeshIds_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 18: { + if (shapeWithOutputLayout_ == null) { + ShapeWithOutputLayout = new global::Xla.ShapeProto(); + } + input.ReadMessage(ShapeWithOutputLayout); + break; + } + case 24: { + Seed = input.ReadUInt64(); + break; + } + case 34: { + if (debugOptions_ == null) { + DebugOptions = new global::Xla.DebugOptions(); + } + input.ReadMessage(DebugOptions); + break; + } + case 42: { + deviceHandles_.AddEntriesFrom(ref input, _repeated_deviceHandles_codec); + break; + } + case 48: { + NumReplicas = input.ReadInt32(); + break; + } + case 58: { + if (deviceAssignment_ == null) { + DeviceAssignment = new global::Xla.DeviceAssignmentProto(); + } + input.ReadMessage(DeviceAssignment); + break; + } + case 64: { + AliasPassthroughParams = input.ReadBool(); + break; + } + case 72: { + NumPartitions = input.ReadInt32(); + break; + } + case 80: { + LaunchId = input.ReadInt32(); + break; + } + case 88: { + UseSpmdPartitioning = input.ReadBool(); + break; + } + case 96: { + DeduplicateHlo = input.ReadBool(); + break; + } + case 112: { + AllowSpmdShardingPropagationToOutput = input.ReadBool(); + break; + } + case 120: { + UseAutoSpmdPartitioning = input.ReadBool(); + break; + } + case 130: + case 128: { + autoSpmdPartitioningMeshShape_.AddEntriesFrom(ref input, _repeated_autoSpmdPartitioningMeshShape_codec); + break; + } + case 138: + case 136: { + autoSpmdPartitioningMeshIds_.AddEntriesFrom(ref input, _repeated_autoSpmdPartitioningMeshIds_codec); + break; + } + } + } + } + #endif + + } + + public sealed partial class GetDeviceHandlesRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetDeviceHandlesRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetDeviceHandlesRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetDeviceHandlesRequest(GetDeviceHandlesRequest other) : this() { + deviceCount_ = other.deviceCount_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetDeviceHandlesRequest Clone() { + return new GetDeviceHandlesRequest(this); + } + + /// Field number for the "device_count" field. + public const int DeviceCountFieldNumber = 1; + private long deviceCount_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long DeviceCount { + get { return deviceCount_; } + set { + deviceCount_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as GetDeviceHandlesRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(GetDeviceHandlesRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (DeviceCount != other.DeviceCount) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (DeviceCount != 0L) hash ^= DeviceCount.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (DeviceCount != 0L) { + output.WriteRawTag(8); + output.WriteInt64(DeviceCount); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (DeviceCount != 0L) { + output.WriteRawTag(8); + output.WriteInt64(DeviceCount); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (DeviceCount != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(DeviceCount); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(GetDeviceHandlesRequest other) { + if (other == null) { + return; + } + if (other.DeviceCount != 0L) { + DeviceCount = other.DeviceCount; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + DeviceCount = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + DeviceCount = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + public sealed partial class GetDeviceHandlesResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetDeviceHandlesResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetDeviceHandlesResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetDeviceHandlesResponse(GetDeviceHandlesResponse other) : this() { + deviceHandles_ = other.deviceHandles_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetDeviceHandlesResponse Clone() { + return new GetDeviceHandlesResponse(this); + } + + /// Field number for the "device_handles" field. + public const int DeviceHandlesFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_deviceHandles_codec + = pb::FieldCodec.ForMessage(10, global::Xla.DeviceHandle.Parser); + private readonly pbc::RepeatedField deviceHandles_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField DeviceHandles { + get { return deviceHandles_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as GetDeviceHandlesResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(GetDeviceHandlesResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!deviceHandles_.Equals(other.deviceHandles_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= deviceHandles_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + deviceHandles_.WriteTo(output, _repeated_deviceHandles_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + deviceHandles_.WriteTo(ref output, _repeated_deviceHandles_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += deviceHandles_.CalculateSize(_repeated_deviceHandles_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(GetDeviceHandlesResponse other) { + if (other == null) { + return; + } + deviceHandles_.Add(other.deviceHandles_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + deviceHandles_.AddEntriesFrom(input, _repeated_deviceHandles_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + deviceHandles_.AddEntriesFrom(ref input, _repeated_deviceHandles_codec); + break; + } + } + } + } + #endif + + } + + public sealed partial class TransferToClientRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TransferToClientRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferToClientRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferToClientRequest(TransferToClientRequest other) : this() { + data_ = other.data_ != null ? other.data_.Clone() : null; + shapeWithLayout_ = other.shapeWithLayout_ != null ? other.shapeWithLayout_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferToClientRequest Clone() { + return new TransferToClientRequest(this); + } + + /// Field number for the "data" field. + public const int DataFieldNumber = 1; + private global::Xla.GlobalDataHandle data_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.GlobalDataHandle Data { + get { return data_; } + set { + data_ = value; + } + } + + /// Field number for the "shape_with_layout" field. + public const int ShapeWithLayoutFieldNumber = 2; + private global::Xla.ShapeProto shapeWithLayout_; + /// + /// This optional field directs the service to return the literal in this + /// layout. A shape is used to hold the layout to accommodate tuples. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ShapeProto ShapeWithLayout { + get { return shapeWithLayout_; } + set { + shapeWithLayout_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TransferToClientRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TransferToClientRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Data, other.Data)) return false; + if (!object.Equals(ShapeWithLayout, other.ShapeWithLayout)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (data_ != null) hash ^= Data.GetHashCode(); + if (shapeWithLayout_ != null) hash ^= ShapeWithLayout.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (data_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Data); + } + if (shapeWithLayout_ != null) { + output.WriteRawTag(18); + output.WriteMessage(ShapeWithLayout); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (data_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Data); + } + if (shapeWithLayout_ != null) { + output.WriteRawTag(18); + output.WriteMessage(ShapeWithLayout); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (data_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Data); + } + if (shapeWithLayout_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ShapeWithLayout); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TransferToClientRequest other) { + if (other == null) { + return; + } + if (other.data_ != null) { + if (data_ == null) { + Data = new global::Xla.GlobalDataHandle(); + } + Data.MergeFrom(other.Data); + } + if (other.shapeWithLayout_ != null) { + if (shapeWithLayout_ == null) { + ShapeWithLayout = new global::Xla.ShapeProto(); + } + ShapeWithLayout.MergeFrom(other.ShapeWithLayout); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (data_ == null) { + Data = new global::Xla.GlobalDataHandle(); + } + input.ReadMessage(Data); + break; + } + case 18: { + if (shapeWithLayout_ == null) { + ShapeWithLayout = new global::Xla.ShapeProto(); + } + input.ReadMessage(ShapeWithLayout); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (data_ == null) { + Data = new global::Xla.GlobalDataHandle(); + } + input.ReadMessage(Data); + break; + } + case 18: { + if (shapeWithLayout_ == null) { + ShapeWithLayout = new global::Xla.ShapeProto(); + } + input.ReadMessage(ShapeWithLayout); + break; + } + } + } + } + #endif + + } + + public sealed partial class TransferToClientResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TransferToClientResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[5]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferToClientResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferToClientResponse(TransferToClientResponse other) : this() { + literal_ = other.literal_ != null ? other.literal_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferToClientResponse Clone() { + return new TransferToClientResponse(this); + } + + /// Field number for the "literal" field. + public const int LiteralFieldNumber = 1; + private global::Xla.LiteralProto literal_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.LiteralProto Literal { + get { return literal_; } + set { + literal_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TransferToClientResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TransferToClientResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Literal, other.Literal)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (literal_ != null) hash ^= Literal.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (literal_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Literal); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (literal_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Literal); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (literal_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Literal); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TransferToClientResponse other) { + if (other == null) { + return; + } + if (other.literal_ != null) { + if (literal_ == null) { + Literal = new global::Xla.LiteralProto(); + } + Literal.MergeFrom(other.Literal); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (literal_ == null) { + Literal = new global::Xla.LiteralProto(); + } + input.ReadMessage(Literal); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (literal_ == null) { + Literal = new global::Xla.LiteralProto(); + } + input.ReadMessage(Literal); + break; + } + } + } + } + #endif + + } + + public sealed partial class TransferToServerRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TransferToServerRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[6]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferToServerRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferToServerRequest(TransferToServerRequest other) : this() { + literal_ = other.literal_ != null ? other.literal_.Clone() : null; + deviceHandle_ = other.deviceHandle_ != null ? other.deviceHandle_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferToServerRequest Clone() { + return new TransferToServerRequest(this); + } + + /// Field number for the "literal" field. + public const int LiteralFieldNumber = 1; + private global::Xla.LiteralProto literal_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.LiteralProto Literal { + get { return literal_; } + set { + literal_ = value; + } + } + + /// Field number for the "device_handle" field. + public const int DeviceHandleFieldNumber = 2; + private global::Xla.DeviceHandle deviceHandle_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.DeviceHandle DeviceHandle { + get { return deviceHandle_; } + set { + deviceHandle_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TransferToServerRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TransferToServerRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Literal, other.Literal)) return false; + if (!object.Equals(DeviceHandle, other.DeviceHandle)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (literal_ != null) hash ^= Literal.GetHashCode(); + if (deviceHandle_ != null) hash ^= DeviceHandle.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (literal_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Literal); + } + if (deviceHandle_ != null) { + output.WriteRawTag(18); + output.WriteMessage(DeviceHandle); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (literal_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Literal); + } + if (deviceHandle_ != null) { + output.WriteRawTag(18); + output.WriteMessage(DeviceHandle); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (literal_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Literal); + } + if (deviceHandle_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DeviceHandle); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TransferToServerRequest other) { + if (other == null) { + return; + } + if (other.literal_ != null) { + if (literal_ == null) { + Literal = new global::Xla.LiteralProto(); + } + Literal.MergeFrom(other.Literal); + } + if (other.deviceHandle_ != null) { + if (deviceHandle_ == null) { + DeviceHandle = new global::Xla.DeviceHandle(); + } + DeviceHandle.MergeFrom(other.DeviceHandle); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (literal_ == null) { + Literal = new global::Xla.LiteralProto(); + } + input.ReadMessage(Literal); + break; + } + case 18: { + if (deviceHandle_ == null) { + DeviceHandle = new global::Xla.DeviceHandle(); + } + input.ReadMessage(DeviceHandle); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (literal_ == null) { + Literal = new global::Xla.LiteralProto(); + } + input.ReadMessage(Literal); + break; + } + case 18: { + if (deviceHandle_ == null) { + DeviceHandle = new global::Xla.DeviceHandle(); + } + input.ReadMessage(DeviceHandle); + break; + } + } + } + } + #endif + + } + + public sealed partial class TransferToServerResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TransferToServerResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[7]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferToServerResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferToServerResponse(TransferToServerResponse other) : this() { + data_ = other.data_ != null ? other.data_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferToServerResponse Clone() { + return new TransferToServerResponse(this); + } + + /// Field number for the "data" field. + public const int DataFieldNumber = 1; + private global::Xla.GlobalDataHandle data_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.GlobalDataHandle Data { + get { return data_; } + set { + data_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TransferToServerResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TransferToServerResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Data, other.Data)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (data_ != null) hash ^= Data.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (data_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Data); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (data_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Data); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (data_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Data); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TransferToServerResponse other) { + if (other == null) { + return; + } + if (other.data_ != null) { + if (data_ == null) { + Data = new global::Xla.GlobalDataHandle(); + } + Data.MergeFrom(other.Data); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (data_ == null) { + Data = new global::Xla.GlobalDataHandle(); + } + input.ReadMessage(Data); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (data_ == null) { + Data = new global::Xla.GlobalDataHandle(); + } + input.ReadMessage(Data); + break; + } + } + } + } + #endif + + } + + public sealed partial class TransferToInfeedRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TransferToInfeedRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[8]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferToInfeedRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferToInfeedRequest(TransferToInfeedRequest other) : this() { + literal_ = other.literal_ != null ? other.literal_.Clone() : null; + replicaId_ = other.replicaId_; + deviceHandle_ = other.deviceHandle_ != null ? other.deviceHandle_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferToInfeedRequest Clone() { + return new TransferToInfeedRequest(this); + } + + /// Field number for the "literal" field. + public const int LiteralFieldNumber = 1; + private global::Xla.LiteralProto literal_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.LiteralProto Literal { + get { return literal_; } + set { + literal_ = value; + } + } + + /// Field number for the "replica_id" field. + public const int ReplicaIdFieldNumber = 2; + private long replicaId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long ReplicaId { + get { return replicaId_; } + set { + replicaId_ = value; + } + } + + /// Field number for the "device_handle" field. + public const int DeviceHandleFieldNumber = 3; + private global::Xla.DeviceHandle deviceHandle_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.DeviceHandle DeviceHandle { + get { return deviceHandle_; } + set { + deviceHandle_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TransferToInfeedRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TransferToInfeedRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Literal, other.Literal)) return false; + if (ReplicaId != other.ReplicaId) return false; + if (!object.Equals(DeviceHandle, other.DeviceHandle)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (literal_ != null) hash ^= Literal.GetHashCode(); + if (ReplicaId != 0L) hash ^= ReplicaId.GetHashCode(); + if (deviceHandle_ != null) hash ^= DeviceHandle.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (literal_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Literal); + } + if (ReplicaId != 0L) { + output.WriteRawTag(16); + output.WriteInt64(ReplicaId); + } + if (deviceHandle_ != null) { + output.WriteRawTag(26); + output.WriteMessage(DeviceHandle); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (literal_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Literal); + } + if (ReplicaId != 0L) { + output.WriteRawTag(16); + output.WriteInt64(ReplicaId); + } + if (deviceHandle_ != null) { + output.WriteRawTag(26); + output.WriteMessage(DeviceHandle); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (literal_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Literal); + } + if (ReplicaId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(ReplicaId); + } + if (deviceHandle_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DeviceHandle); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TransferToInfeedRequest other) { + if (other == null) { + return; + } + if (other.literal_ != null) { + if (literal_ == null) { + Literal = new global::Xla.LiteralProto(); + } + Literal.MergeFrom(other.Literal); + } + if (other.ReplicaId != 0L) { + ReplicaId = other.ReplicaId; + } + if (other.deviceHandle_ != null) { + if (deviceHandle_ == null) { + DeviceHandle = new global::Xla.DeviceHandle(); + } + DeviceHandle.MergeFrom(other.DeviceHandle); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (literal_ == null) { + Literal = new global::Xla.LiteralProto(); + } + input.ReadMessage(Literal); + break; + } + case 16: { + ReplicaId = input.ReadInt64(); + break; + } + case 26: { + if (deviceHandle_ == null) { + DeviceHandle = new global::Xla.DeviceHandle(); + } + input.ReadMessage(DeviceHandle); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (literal_ == null) { + Literal = new global::Xla.LiteralProto(); + } + input.ReadMessage(Literal); + break; + } + case 16: { + ReplicaId = input.ReadInt64(); + break; + } + case 26: { + if (deviceHandle_ == null) { + DeviceHandle = new global::Xla.DeviceHandle(); + } + input.ReadMessage(DeviceHandle); + break; + } + } + } + } + #endif + + } + + public sealed partial class TransferToInfeedResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TransferToInfeedResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[9]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferToInfeedResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferToInfeedResponse(TransferToInfeedResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferToInfeedResponse Clone() { + return new TransferToInfeedResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TransferToInfeedResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TransferToInfeedResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TransferToInfeedResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + public sealed partial class TransferFromOutfeedRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TransferFromOutfeedRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[10]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferFromOutfeedRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferFromOutfeedRequest(TransferFromOutfeedRequest other) : this() { + shapeWithLayout_ = other.shapeWithLayout_ != null ? other.shapeWithLayout_.Clone() : null; + replicaId_ = other.replicaId_; + deviceHandle_ = other.deviceHandle_ != null ? other.deviceHandle_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferFromOutfeedRequest Clone() { + return new TransferFromOutfeedRequest(this); + } + + /// Field number for the "shape_with_layout" field. + public const int ShapeWithLayoutFieldNumber = 1; + private global::Xla.ShapeProto shapeWithLayout_; + /// + /// This optional field directs the service to return the literal in this + /// layout. A shape is used to hold the layout to accommodate tuples. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ShapeProto ShapeWithLayout { + get { return shapeWithLayout_; } + set { + shapeWithLayout_ = value; + } + } + + /// Field number for the "replica_id" field. + public const int ReplicaIdFieldNumber = 2; + private long replicaId_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long ReplicaId { + get { return replicaId_; } + set { + replicaId_ = value; + } + } + + /// Field number for the "device_handle" field. + public const int DeviceHandleFieldNumber = 3; + private global::Xla.DeviceHandle deviceHandle_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.DeviceHandle DeviceHandle { + get { return deviceHandle_; } + set { + deviceHandle_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TransferFromOutfeedRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TransferFromOutfeedRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(ShapeWithLayout, other.ShapeWithLayout)) return false; + if (ReplicaId != other.ReplicaId) return false; + if (!object.Equals(DeviceHandle, other.DeviceHandle)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (shapeWithLayout_ != null) hash ^= ShapeWithLayout.GetHashCode(); + if (ReplicaId != 0L) hash ^= ReplicaId.GetHashCode(); + if (deviceHandle_ != null) hash ^= DeviceHandle.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (shapeWithLayout_ != null) { + output.WriteRawTag(10); + output.WriteMessage(ShapeWithLayout); + } + if (ReplicaId != 0L) { + output.WriteRawTag(16); + output.WriteInt64(ReplicaId); + } + if (deviceHandle_ != null) { + output.WriteRawTag(26); + output.WriteMessage(DeviceHandle); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (shapeWithLayout_ != null) { + output.WriteRawTag(10); + output.WriteMessage(ShapeWithLayout); + } + if (ReplicaId != 0L) { + output.WriteRawTag(16); + output.WriteInt64(ReplicaId); + } + if (deviceHandle_ != null) { + output.WriteRawTag(26); + output.WriteMessage(DeviceHandle); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (shapeWithLayout_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ShapeWithLayout); + } + if (ReplicaId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(ReplicaId); + } + if (deviceHandle_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DeviceHandle); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TransferFromOutfeedRequest other) { + if (other == null) { + return; + } + if (other.shapeWithLayout_ != null) { + if (shapeWithLayout_ == null) { + ShapeWithLayout = new global::Xla.ShapeProto(); + } + ShapeWithLayout.MergeFrom(other.ShapeWithLayout); + } + if (other.ReplicaId != 0L) { + ReplicaId = other.ReplicaId; + } + if (other.deviceHandle_ != null) { + if (deviceHandle_ == null) { + DeviceHandle = new global::Xla.DeviceHandle(); + } + DeviceHandle.MergeFrom(other.DeviceHandle); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (shapeWithLayout_ == null) { + ShapeWithLayout = new global::Xla.ShapeProto(); + } + input.ReadMessage(ShapeWithLayout); + break; + } + case 16: { + ReplicaId = input.ReadInt64(); + break; + } + case 26: { + if (deviceHandle_ == null) { + DeviceHandle = new global::Xla.DeviceHandle(); + } + input.ReadMessage(DeviceHandle); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (shapeWithLayout_ == null) { + ShapeWithLayout = new global::Xla.ShapeProto(); + } + input.ReadMessage(ShapeWithLayout); + break; + } + case 16: { + ReplicaId = input.ReadInt64(); + break; + } + case 26: { + if (deviceHandle_ == null) { + DeviceHandle = new global::Xla.DeviceHandle(); + } + input.ReadMessage(DeviceHandle); + break; + } + } + } + } + #endif + + } + + public sealed partial class TransferFromOutfeedResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TransferFromOutfeedResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[11]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferFromOutfeedResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferFromOutfeedResponse(TransferFromOutfeedResponse other) : this() { + literal_ = other.literal_ != null ? other.literal_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TransferFromOutfeedResponse Clone() { + return new TransferFromOutfeedResponse(this); + } + + /// Field number for the "literal" field. + public const int LiteralFieldNumber = 1; + private global::Xla.LiteralProto literal_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.LiteralProto Literal { + get { return literal_; } + set { + literal_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TransferFromOutfeedResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TransferFromOutfeedResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Literal, other.Literal)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (literal_ != null) hash ^= Literal.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (literal_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Literal); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (literal_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Literal); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (literal_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Literal); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TransferFromOutfeedResponse other) { + if (other == null) { + return; + } + if (other.literal_ != null) { + if (literal_ == null) { + Literal = new global::Xla.LiteralProto(); + } + Literal.MergeFrom(other.Literal); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (literal_ == null) { + Literal = new global::Xla.LiteralProto(); + } + input.ReadMessage(Literal); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (literal_ == null) { + Literal = new global::Xla.LiteralProto(); + } + input.ReadMessage(Literal); + break; + } + } + } + } + #endif + + } + + public sealed partial class ResetDeviceRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ResetDeviceRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[12]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ResetDeviceRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ResetDeviceRequest(ResetDeviceRequest other) : this() { + deviceHandle_ = other.deviceHandle_ != null ? other.deviceHandle_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ResetDeviceRequest Clone() { + return new ResetDeviceRequest(this); + } + + /// Field number for the "device_handle" field. + public const int DeviceHandleFieldNumber = 1; + private global::Xla.DeviceHandle deviceHandle_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.DeviceHandle DeviceHandle { + get { return deviceHandle_; } + set { + deviceHandle_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ResetDeviceRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ResetDeviceRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(DeviceHandle, other.DeviceHandle)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (deviceHandle_ != null) hash ^= DeviceHandle.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (deviceHandle_ != null) { + output.WriteRawTag(10); + output.WriteMessage(DeviceHandle); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (deviceHandle_ != null) { + output.WriteRawTag(10); + output.WriteMessage(DeviceHandle); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (deviceHandle_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DeviceHandle); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ResetDeviceRequest other) { + if (other == null) { + return; + } + if (other.deviceHandle_ != null) { + if (deviceHandle_ == null) { + DeviceHandle = new global::Xla.DeviceHandle(); + } + DeviceHandle.MergeFrom(other.DeviceHandle); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (deviceHandle_ == null) { + DeviceHandle = new global::Xla.DeviceHandle(); + } + input.ReadMessage(DeviceHandle); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (deviceHandle_ == null) { + DeviceHandle = new global::Xla.DeviceHandle(); + } + input.ReadMessage(DeviceHandle); + break; + } + } + } + } + #endif + + } + + public sealed partial class ResetDeviceResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ResetDeviceResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[13]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ResetDeviceResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ResetDeviceResponse(ResetDeviceResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ResetDeviceResponse Clone() { + return new ResetDeviceResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ResetDeviceResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ResetDeviceResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ResetDeviceResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + public sealed partial class ComputationGraphStatsRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ComputationGraphStatsRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[14]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ComputationGraphStatsRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ComputationGraphStatsRequest(ComputationGraphStatsRequest other) : this() { + computation_ = other.computation_ != null ? other.computation_.Clone() : null; + debugOptions_ = other.debugOptions_ != null ? other.debugOptions_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ComputationGraphStatsRequest Clone() { + return new ComputationGraphStatsRequest(this); + } + + /// Field number for the "computation" field. + public const int ComputationFieldNumber = 1; + private global::Xla.HloModuleProto computation_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.HloModuleProto Computation { + get { return computation_; } + set { + computation_ = value; + } + } + + /// Field number for the "debug_options" field. + public const int DebugOptionsFieldNumber = 2; + private global::Xla.DebugOptions debugOptions_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.DebugOptions DebugOptions { + get { return debugOptions_; } + set { + debugOptions_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ComputationGraphStatsRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ComputationGraphStatsRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Computation, other.Computation)) return false; + if (!object.Equals(DebugOptions, other.DebugOptions)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (computation_ != null) hash ^= Computation.GetHashCode(); + if (debugOptions_ != null) hash ^= DebugOptions.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (computation_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Computation); + } + if (debugOptions_ != null) { + output.WriteRawTag(18); + output.WriteMessage(DebugOptions); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (computation_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Computation); + } + if (debugOptions_ != null) { + output.WriteRawTag(18); + output.WriteMessage(DebugOptions); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (computation_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Computation); + } + if (debugOptions_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DebugOptions); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ComputationGraphStatsRequest other) { + if (other == null) { + return; + } + if (other.computation_ != null) { + if (computation_ == null) { + Computation = new global::Xla.HloModuleProto(); + } + Computation.MergeFrom(other.Computation); + } + if (other.debugOptions_ != null) { + if (debugOptions_ == null) { + DebugOptions = new global::Xla.DebugOptions(); + } + DebugOptions.MergeFrom(other.DebugOptions); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (computation_ == null) { + Computation = new global::Xla.HloModuleProto(); + } + input.ReadMessage(Computation); + break; + } + case 18: { + if (debugOptions_ == null) { + DebugOptions = new global::Xla.DebugOptions(); + } + input.ReadMessage(DebugOptions); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (computation_ == null) { + Computation = new global::Xla.HloModuleProto(); + } + input.ReadMessage(Computation); + break; + } + case 18: { + if (debugOptions_ == null) { + DebugOptions = new global::Xla.DebugOptions(); + } + input.ReadMessage(DebugOptions); + break; + } + } + } + } + #endif + + } + + public sealed partial class ComputationStatsResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ComputationStatsResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[15]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ComputationStatsResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ComputationStatsResponse(ComputationStatsResponse other) : this() { + stats_ = other.stats_ != null ? other.stats_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ComputationStatsResponse Clone() { + return new ComputationStatsResponse(this); + } + + /// Field number for the "stats" field. + public const int StatsFieldNumber = 1; + private global::Xla.ComputationStats stats_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ComputationStats Stats { + get { return stats_; } + set { + stats_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ComputationStatsResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ComputationStatsResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Stats, other.Stats)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (stats_ != null) hash ^= Stats.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (stats_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Stats); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (stats_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Stats); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (stats_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Stats); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ComputationStatsResponse other) { + if (other == null) { + return; + } + if (other.stats_ != null) { + if (stats_ == null) { + Stats = new global::Xla.ComputationStats(); + } + Stats.MergeFrom(other.Stats); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (stats_ == null) { + Stats = new global::Xla.ComputationStats(); + } + input.ReadMessage(Stats); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (stats_ == null) { + Stats = new global::Xla.ComputationStats(); + } + input.ReadMessage(Stats); + break; + } + } + } + } + #endif + + } + + public sealed partial class CreateChannelHandleRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateChannelHandleRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[16]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CreateChannelHandleRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CreateChannelHandleRequest(CreateChannelHandleRequest other) : this() { + channelType_ = other.channelType_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CreateChannelHandleRequest Clone() { + return new CreateChannelHandleRequest(this); + } + + /// Field number for the "channel_type" field. + public const int ChannelTypeFieldNumber = 1; + private global::Xla.ChannelHandle.Types.ChannelType channelType_ = global::Xla.ChannelHandle.Types.ChannelType.Invalid; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ChannelHandle.Types.ChannelType ChannelType { + get { return channelType_; } + set { + channelType_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as CreateChannelHandleRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(CreateChannelHandleRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ChannelType != other.ChannelType) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (ChannelType != global::Xla.ChannelHandle.Types.ChannelType.Invalid) hash ^= ChannelType.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ChannelType != global::Xla.ChannelHandle.Types.ChannelType.Invalid) { + output.WriteRawTag(8); + output.WriteEnum((int) ChannelType); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ChannelType != global::Xla.ChannelHandle.Types.ChannelType.Invalid) { + output.WriteRawTag(8); + output.WriteEnum((int) ChannelType); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (ChannelType != global::Xla.ChannelHandle.Types.ChannelType.Invalid) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) ChannelType); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(CreateChannelHandleRequest other) { + if (other == null) { + return; + } + if (other.ChannelType != global::Xla.ChannelHandle.Types.ChannelType.Invalid) { + ChannelType = other.ChannelType; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + ChannelType = (global::Xla.ChannelHandle.Types.ChannelType) input.ReadEnum(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + ChannelType = (global::Xla.ChannelHandle.Types.ChannelType) input.ReadEnum(); + break; + } + } + } + } + #endif + + } + + public sealed partial class CreateChannelHandleResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateChannelHandleResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[17]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CreateChannelHandleResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CreateChannelHandleResponse(CreateChannelHandleResponse other) : this() { + channel_ = other.channel_ != null ? other.channel_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CreateChannelHandleResponse Clone() { + return new CreateChannelHandleResponse(this); + } + + /// Field number for the "channel" field. + public const int ChannelFieldNumber = 1; + private global::Xla.ChannelHandle channel_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ChannelHandle Channel { + get { return channel_; } + set { + channel_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as CreateChannelHandleResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(CreateChannelHandleResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Channel, other.Channel)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (channel_ != null) hash ^= Channel.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (channel_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Channel); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (channel_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Channel); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (channel_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Channel); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(CreateChannelHandleResponse other) { + if (other == null) { + return; + } + if (other.channel_ != null) { + if (channel_ == null) { + Channel = new global::Xla.ChannelHandle(); + } + Channel.MergeFrom(other.Channel); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (channel_ == null) { + Channel = new global::Xla.ChannelHandle(); + } + input.ReadMessage(Channel); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (channel_ == null) { + Channel = new global::Xla.ChannelHandle(); + } + input.ReadMessage(Channel); + break; + } + } + } + } + #endif + + } + + public sealed partial class UnregisterRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UnregisterRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[18]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public UnregisterRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public UnregisterRequest(UnregisterRequest other) : this() { + data_ = other.data_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public UnregisterRequest Clone() { + return new UnregisterRequest(this); + } + + /// Field number for the "data" field. + public const int DataFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_data_codec + = pb::FieldCodec.ForMessage(10, global::Xla.GlobalDataHandle.Parser); + private readonly pbc::RepeatedField data_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Data { + get { return data_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as UnregisterRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(UnregisterRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!data_.Equals(other.data_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= data_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + data_.WriteTo(output, _repeated_data_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + data_.WriteTo(ref output, _repeated_data_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += data_.CalculateSize(_repeated_data_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(UnregisterRequest other) { + if (other == null) { + return; + } + data_.Add(other.data_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + data_.AddEntriesFrom(input, _repeated_data_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + data_.AddEntriesFrom(ref input, _repeated_data_codec); + break; + } + } + } + } + #endif + + } + + public sealed partial class UnregisterResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UnregisterResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[19]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public UnregisterResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public UnregisterResponse(UnregisterResponse other) : this() { + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public UnregisterResponse Clone() { + return new UnregisterResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as UnregisterResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(UnregisterResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(UnregisterResponse other) { + if (other == null) { + return; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + } + } + } + #endif + + } + + public sealed partial class CompileRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CompileRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[20]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CompileRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CompileRequest(CompileRequest other) : this() { + computation_ = other.computation_ != null ? other.computation_.Clone() : null; + executionOptions_ = other.executionOptions_ != null ? other.executionOptions_.Clone() : null; + inputShapeWithLayout_ = other.inputShapeWithLayout_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CompileRequest Clone() { + return new CompileRequest(this); + } + + /// Field number for the "computation" field. + public const int ComputationFieldNumber = 1; + private global::Xla.HloModuleProto computation_; + /// + /// The graph to be compiled. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.HloModuleProto Computation { + get { return computation_; } + set { + computation_ = value; + } + } + + /// Field number for the "execution_options" field. + public const int ExecutionOptionsFieldNumber = 2; + private global::Xla.ExecutionOptions executionOptions_; + /// + /// Options that affect how XLA compiles code to service this request. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ExecutionOptions ExecutionOptions { + get { return executionOptions_; } + set { + executionOptions_ = value; + } + } + + /// Field number for the "input_shape_with_layout" field. + public const int InputShapeWithLayoutFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_inputShapeWithLayout_codec + = pb::FieldCodec.ForMessage(26, global::Xla.ShapeProto.Parser); + private readonly pbc::RepeatedField inputShapeWithLayout_ = new pbc::RepeatedField(); + /// + /// The layouts of the input arguments. If not set, the default layout will be + /// used. Although the real arguments are not needed in compilation, the + /// layouts of the arguments can affect the compilation. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField InputShapeWithLayout { + get { return inputShapeWithLayout_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as CompileRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(CompileRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Computation, other.Computation)) return false; + if (!object.Equals(ExecutionOptions, other.ExecutionOptions)) return false; + if(!inputShapeWithLayout_.Equals(other.inputShapeWithLayout_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (computation_ != null) hash ^= Computation.GetHashCode(); + if (executionOptions_ != null) hash ^= ExecutionOptions.GetHashCode(); + hash ^= inputShapeWithLayout_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (computation_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Computation); + } + if (executionOptions_ != null) { + output.WriteRawTag(18); + output.WriteMessage(ExecutionOptions); + } + inputShapeWithLayout_.WriteTo(output, _repeated_inputShapeWithLayout_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (computation_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Computation); + } + if (executionOptions_ != null) { + output.WriteRawTag(18); + output.WriteMessage(ExecutionOptions); + } + inputShapeWithLayout_.WriteTo(ref output, _repeated_inputShapeWithLayout_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (computation_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Computation); + } + if (executionOptions_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ExecutionOptions); + } + size += inputShapeWithLayout_.CalculateSize(_repeated_inputShapeWithLayout_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(CompileRequest other) { + if (other == null) { + return; + } + if (other.computation_ != null) { + if (computation_ == null) { + Computation = new global::Xla.HloModuleProto(); + } + Computation.MergeFrom(other.Computation); + } + if (other.executionOptions_ != null) { + if (executionOptions_ == null) { + ExecutionOptions = new global::Xla.ExecutionOptions(); + } + ExecutionOptions.MergeFrom(other.ExecutionOptions); + } + inputShapeWithLayout_.Add(other.inputShapeWithLayout_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (computation_ == null) { + Computation = new global::Xla.HloModuleProto(); + } + input.ReadMessage(Computation); + break; + } + case 18: { + if (executionOptions_ == null) { + ExecutionOptions = new global::Xla.ExecutionOptions(); + } + input.ReadMessage(ExecutionOptions); + break; + } + case 26: { + inputShapeWithLayout_.AddEntriesFrom(input, _repeated_inputShapeWithLayout_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (computation_ == null) { + Computation = new global::Xla.HloModuleProto(); + } + input.ReadMessage(Computation); + break; + } + case 18: { + if (executionOptions_ == null) { + ExecutionOptions = new global::Xla.ExecutionOptions(); + } + input.ReadMessage(ExecutionOptions); + break; + } + case 26: { + inputShapeWithLayout_.AddEntriesFrom(ref input, _repeated_inputShapeWithLayout_codec); + break; + } + } + } + } + #endif + + } + + public sealed partial class CompileResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CompileResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[21]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CompileResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CompileResponse(CompileResponse other) : this() { + handle_ = other.handle_ != null ? other.handle_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CompileResponse Clone() { + return new CompileResponse(this); + } + + /// Field number for the "handle" field. + public const int HandleFieldNumber = 1; + private global::Xla.ExecutionHandle handle_; + /// + /// The handle to the executable. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ExecutionHandle Handle { + get { return handle_; } + set { + handle_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as CompileResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(CompileResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Handle, other.Handle)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (handle_ != null) hash ^= Handle.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (handle_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Handle); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (handle_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Handle); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (handle_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Handle); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(CompileResponse other) { + if (other == null) { + return; + } + if (other.handle_ != null) { + if (handle_ == null) { + Handle = new global::Xla.ExecutionHandle(); + } + Handle.MergeFrom(other.Handle); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (handle_ == null) { + Handle = new global::Xla.ExecutionHandle(); + } + input.ReadMessage(Handle); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (handle_ == null) { + Handle = new global::Xla.ExecutionHandle(); + } + input.ReadMessage(Handle); + break; + } + } + } + } + #endif + + } + + public sealed partial class ExecuteRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExecuteRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[22]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecuteRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecuteRequest(ExecuteRequest other) : this() { + handle_ = other.handle_ != null ? other.handle_.Clone() : null; + arguments_ = other.arguments_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecuteRequest Clone() { + return new ExecuteRequest(this); + } + + /// Field number for the "handle" field. + public const int HandleFieldNumber = 1; + private global::Xla.ExecutionHandle handle_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ExecutionHandle Handle { + get { return handle_; } + set { + handle_ = value; + } + } + + /// Field number for the "arguments" field. + public const int ArgumentsFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_arguments_codec + = pb::FieldCodec.ForMessage(18, global::Xla.GlobalDataHandle.Parser); + private readonly pbc::RepeatedField arguments_ = new pbc::RepeatedField(); + /// + /// The shape and layout of the arguments must be the same as the those of the + /// executable's parameters. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Arguments { + get { return arguments_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ExecuteRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ExecuteRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Handle, other.Handle)) return false; + if(!arguments_.Equals(other.arguments_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (handle_ != null) hash ^= Handle.GetHashCode(); + hash ^= arguments_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (handle_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Handle); + } + arguments_.WriteTo(output, _repeated_arguments_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (handle_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Handle); + } + arguments_.WriteTo(ref output, _repeated_arguments_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (handle_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Handle); + } + size += arguments_.CalculateSize(_repeated_arguments_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ExecuteRequest other) { + if (other == null) { + return; + } + if (other.handle_ != null) { + if (handle_ == null) { + Handle = new global::Xla.ExecutionHandle(); + } + Handle.MergeFrom(other.Handle); + } + arguments_.Add(other.arguments_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (handle_ == null) { + Handle = new global::Xla.ExecutionHandle(); + } + input.ReadMessage(Handle); + break; + } + case 18: { + arguments_.AddEntriesFrom(input, _repeated_arguments_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (handle_ == null) { + Handle = new global::Xla.ExecutionHandle(); + } + input.ReadMessage(Handle); + break; + } + case 18: { + arguments_.AddEntriesFrom(ref input, _repeated_arguments_codec); + break; + } + } + } + } + #endif + + } + + /// + /// TODO(b/118493728): Remove this and ExecuteGraphParallelRequest and replace + /// the uses with calls to Compile and Execute. + /// + public sealed partial class ExecuteGraphRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExecuteGraphRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[23]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecuteGraphRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecuteGraphRequest(ExecuteGraphRequest other) : this() { + computation_ = other.computation_ != null ? other.computation_.Clone() : null; + arguments_ = other.arguments_.Clone(); + executionOptions_ = other.executionOptions_ != null ? other.executionOptions_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecuteGraphRequest Clone() { + return new ExecuteGraphRequest(this); + } + + /// Field number for the "computation" field. + public const int ComputationFieldNumber = 1; + private global::Xla.HloModuleProto computation_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.HloModuleProto Computation { + get { return computation_; } + set { + computation_ = value; + } + } + + /// Field number for the "arguments" field. + public const int ArgumentsFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_arguments_codec + = pb::FieldCodec.ForMessage(18, global::Xla.GlobalDataHandle.Parser); + private readonly pbc::RepeatedField arguments_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Arguments { + get { return arguments_; } + } + + /// Field number for the "execution_options" field. + public const int ExecutionOptionsFieldNumber = 3; + private global::Xla.ExecutionOptions executionOptions_; + /// + /// Options that affect how XLA compiles and runs code to service this request. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ExecutionOptions ExecutionOptions { + get { return executionOptions_; } + set { + executionOptions_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ExecuteGraphRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ExecuteGraphRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Computation, other.Computation)) return false; + if(!arguments_.Equals(other.arguments_)) return false; + if (!object.Equals(ExecutionOptions, other.ExecutionOptions)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (computation_ != null) hash ^= Computation.GetHashCode(); + hash ^= arguments_.GetHashCode(); + if (executionOptions_ != null) hash ^= ExecutionOptions.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (computation_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Computation); + } + arguments_.WriteTo(output, _repeated_arguments_codec); + if (executionOptions_ != null) { + output.WriteRawTag(26); + output.WriteMessage(ExecutionOptions); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (computation_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Computation); + } + arguments_.WriteTo(ref output, _repeated_arguments_codec); + if (executionOptions_ != null) { + output.WriteRawTag(26); + output.WriteMessage(ExecutionOptions); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (computation_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Computation); + } + size += arguments_.CalculateSize(_repeated_arguments_codec); + if (executionOptions_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ExecutionOptions); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ExecuteGraphRequest other) { + if (other == null) { + return; + } + if (other.computation_ != null) { + if (computation_ == null) { + Computation = new global::Xla.HloModuleProto(); + } + Computation.MergeFrom(other.Computation); + } + arguments_.Add(other.arguments_); + if (other.executionOptions_ != null) { + if (executionOptions_ == null) { + ExecutionOptions = new global::Xla.ExecutionOptions(); + } + ExecutionOptions.MergeFrom(other.ExecutionOptions); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (computation_ == null) { + Computation = new global::Xla.HloModuleProto(); + } + input.ReadMessage(Computation); + break; + } + case 18: { + arguments_.AddEntriesFrom(input, _repeated_arguments_codec); + break; + } + case 26: { + if (executionOptions_ == null) { + ExecutionOptions = new global::Xla.ExecutionOptions(); + } + input.ReadMessage(ExecutionOptions); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (computation_ == null) { + Computation = new global::Xla.HloModuleProto(); + } + input.ReadMessage(Computation); + break; + } + case 18: { + arguments_.AddEntriesFrom(ref input, _repeated_arguments_codec); + break; + } + case 26: { + if (executionOptions_ == null) { + ExecutionOptions = new global::Xla.ExecutionOptions(); + } + input.ReadMessage(ExecutionOptions); + break; + } + } + } + } + #endif + + } + + public sealed partial class ExecuteGraphParallelRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExecuteGraphParallelRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[24]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecuteGraphParallelRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecuteGraphParallelRequest(ExecuteGraphParallelRequest other) : this() { + requests_ = other.requests_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecuteGraphParallelRequest Clone() { + return new ExecuteGraphParallelRequest(this); + } + + /// Field number for the "requests" field. + public const int RequestsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_requests_codec + = pb::FieldCodec.ForMessage(10, global::Xla.ExecuteGraphRequest.Parser); + private readonly pbc::RepeatedField requests_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Requests { + get { return requests_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ExecuteGraphParallelRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ExecuteGraphParallelRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!requests_.Equals(other.requests_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= requests_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + requests_.WriteTo(output, _repeated_requests_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + requests_.WriteTo(ref output, _repeated_requests_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += requests_.CalculateSize(_repeated_requests_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ExecuteGraphParallelRequest other) { + if (other == null) { + return; + } + requests_.Add(other.requests_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + requests_.AddEntriesFrom(input, _repeated_requests_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + requests_.AddEntriesFrom(ref input, _repeated_requests_codec); + break; + } + } + } + } + #endif + + } + + public sealed partial class ExecuteResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExecuteResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[25]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecuteResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecuteResponse(ExecuteResponse other) : this() { + output_ = other.output_ != null ? other.output_.Clone() : null; + profile_ = other.profile_ != null ? other.profile_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecuteResponse Clone() { + return new ExecuteResponse(this); + } + + /// Field number for the "output" field. + public const int OutputFieldNumber = 1; + private global::Xla.GlobalDataHandle output_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.GlobalDataHandle Output { + get { return output_; } + set { + output_ = value; + } + } + + /// Field number for the "profile" field. + public const int ProfileFieldNumber = 2; + private global::Xla.ExecutionProfile profile_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ExecutionProfile Profile { + get { return profile_; } + set { + profile_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ExecuteResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ExecuteResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Output, other.Output)) return false; + if (!object.Equals(Profile, other.Profile)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (output_ != null) hash ^= Output.GetHashCode(); + if (profile_ != null) hash ^= Profile.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (output_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Output); + } + if (profile_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Profile); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (output_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Output); + } + if (profile_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Profile); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (output_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Output); + } + if (profile_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Profile); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ExecuteResponse other) { + if (other == null) { + return; + } + if (other.output_ != null) { + if (output_ == null) { + Output = new global::Xla.GlobalDataHandle(); + } + Output.MergeFrom(other.Output); + } + if (other.profile_ != null) { + if (profile_ == null) { + Profile = new global::Xla.ExecutionProfile(); + } + Profile.MergeFrom(other.Profile); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (output_ == null) { + Output = new global::Xla.GlobalDataHandle(); + } + input.ReadMessage(Output); + break; + } + case 18: { + if (profile_ == null) { + Profile = new global::Xla.ExecutionProfile(); + } + input.ReadMessage(Profile); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (output_ == null) { + Output = new global::Xla.GlobalDataHandle(); + } + input.ReadMessage(Output); + break; + } + case 18: { + if (profile_ == null) { + Profile = new global::Xla.ExecutionProfile(); + } + input.ReadMessage(Profile); + break; + } + } + } + } + #endif + + } + + public sealed partial class ExecuteParallelResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExecuteParallelResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[26]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecuteParallelResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecuteParallelResponse(ExecuteParallelResponse other) : this() { + responses_ = other.responses_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecuteParallelResponse Clone() { + return new ExecuteParallelResponse(this); + } + + /// Field number for the "responses" field. + public const int ResponsesFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_responses_codec + = pb::FieldCodec.ForMessage(10, global::Xla.ExecuteResponse.Parser); + private readonly pbc::RepeatedField responses_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Responses { + get { return responses_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ExecuteParallelResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ExecuteParallelResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!responses_.Equals(other.responses_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= responses_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + responses_.WriteTo(output, _repeated_responses_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + responses_.WriteTo(ref output, _repeated_responses_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += responses_.CalculateSize(_repeated_responses_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ExecuteParallelResponse other) { + if (other == null) { + return; + } + responses_.Add(other.responses_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + responses_.AddEntriesFrom(input, _repeated_responses_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + responses_.AddEntriesFrom(ref input, _repeated_responses_codec); + break; + } + } + } + } + #endif + + } + + public sealed partial class WaitForExecutionRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WaitForExecutionRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[27]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WaitForExecutionRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WaitForExecutionRequest(WaitForExecutionRequest other) : this() { + execution_ = other.execution_ != null ? other.execution_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WaitForExecutionRequest Clone() { + return new WaitForExecutionRequest(this); + } + + /// Field number for the "execution" field. + public const int ExecutionFieldNumber = 1; + private global::Xla.ExecutionHandle execution_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ExecutionHandle Execution { + get { return execution_; } + set { + execution_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as WaitForExecutionRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(WaitForExecutionRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Execution, other.Execution)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (execution_ != null) hash ^= Execution.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (execution_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Execution); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (execution_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Execution); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (execution_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Execution); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(WaitForExecutionRequest other) { + if (other == null) { + return; + } + if (other.execution_ != null) { + if (execution_ == null) { + Execution = new global::Xla.ExecutionHandle(); + } + Execution.MergeFrom(other.Execution); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (execution_ == null) { + Execution = new global::Xla.ExecutionHandle(); + } + input.ReadMessage(Execution); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (execution_ == null) { + Execution = new global::Xla.ExecutionHandle(); + } + input.ReadMessage(Execution); + break; + } + } + } + } + #endif + + } + + public sealed partial class WaitForExecutionResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WaitForExecutionResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[28]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WaitForExecutionResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WaitForExecutionResponse(WaitForExecutionResponse other) : this() { + output_ = other.output_ != null ? other.output_.Clone() : null; + profile_ = other.profile_ != null ? other.profile_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WaitForExecutionResponse Clone() { + return new WaitForExecutionResponse(this); + } + + /// Field number for the "output" field. + public const int OutputFieldNumber = 1; + private global::Xla.GlobalDataHandle output_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.GlobalDataHandle Output { + get { return output_; } + set { + output_ = value; + } + } + + /// Field number for the "profile" field. + public const int ProfileFieldNumber = 2; + private global::Xla.ExecutionProfile profile_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ExecutionProfile Profile { + get { return profile_; } + set { + profile_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as WaitForExecutionResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(WaitForExecutionResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Output, other.Output)) return false; + if (!object.Equals(Profile, other.Profile)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (output_ != null) hash ^= Output.GetHashCode(); + if (profile_ != null) hash ^= Profile.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (output_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Output); + } + if (profile_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Profile); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (output_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Output); + } + if (profile_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Profile); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (output_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Output); + } + if (profile_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Profile); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(WaitForExecutionResponse other) { + if (other == null) { + return; + } + if (other.output_ != null) { + if (output_ == null) { + Output = new global::Xla.GlobalDataHandle(); + } + Output.MergeFrom(other.Output); + } + if (other.profile_ != null) { + if (profile_ == null) { + Profile = new global::Xla.ExecutionProfile(); + } + Profile.MergeFrom(other.Profile); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (output_ == null) { + Output = new global::Xla.GlobalDataHandle(); + } + input.ReadMessage(Output); + break; + } + case 18: { + if (profile_ == null) { + Profile = new global::Xla.ExecutionProfile(); + } + input.ReadMessage(Profile); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (output_ == null) { + Output = new global::Xla.GlobalDataHandle(); + } + input.ReadMessage(Output); + break; + } + case 18: { + if (profile_ == null) { + Profile = new global::Xla.ExecutionProfile(); + } + input.ReadMessage(Profile); + break; + } + } + } + } + #endif + + } + + public sealed partial class ComputeConstantGraphRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ComputeConstantGraphRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[29]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ComputeConstantGraphRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ComputeConstantGraphRequest(ComputeConstantGraphRequest other) : this() { + computation_ = other.computation_ != null ? other.computation_.Clone() : null; + outputLayout_ = other.outputLayout_ != null ? other.outputLayout_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ComputeConstantGraphRequest Clone() { + return new ComputeConstantGraphRequest(this); + } + + /// Field number for the "computation" field. + public const int ComputationFieldNumber = 1; + private global::Xla.HloModuleProto computation_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.HloModuleProto Computation { + get { return computation_; } + set { + computation_ = value; + } + } + + /// Field number for the "output_layout" field. + public const int OutputLayoutFieldNumber = 2; + private global::Xla.LayoutProto outputLayout_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.LayoutProto OutputLayout { + get { return outputLayout_; } + set { + outputLayout_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ComputeConstantGraphRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ComputeConstantGraphRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Computation, other.Computation)) return false; + if (!object.Equals(OutputLayout, other.OutputLayout)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (computation_ != null) hash ^= Computation.GetHashCode(); + if (outputLayout_ != null) hash ^= OutputLayout.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (computation_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Computation); + } + if (outputLayout_ != null) { + output.WriteRawTag(18); + output.WriteMessage(OutputLayout); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (computation_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Computation); + } + if (outputLayout_ != null) { + output.WriteRawTag(18); + output.WriteMessage(OutputLayout); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (computation_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Computation); + } + if (outputLayout_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(OutputLayout); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ComputeConstantGraphRequest other) { + if (other == null) { + return; + } + if (other.computation_ != null) { + if (computation_ == null) { + Computation = new global::Xla.HloModuleProto(); + } + Computation.MergeFrom(other.Computation); + } + if (other.outputLayout_ != null) { + if (outputLayout_ == null) { + OutputLayout = new global::Xla.LayoutProto(); + } + OutputLayout.MergeFrom(other.OutputLayout); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (computation_ == null) { + Computation = new global::Xla.HloModuleProto(); + } + input.ReadMessage(Computation); + break; + } + case 18: { + if (outputLayout_ == null) { + OutputLayout = new global::Xla.LayoutProto(); + } + input.ReadMessage(OutputLayout); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (computation_ == null) { + Computation = new global::Xla.HloModuleProto(); + } + input.ReadMessage(Computation); + break; + } + case 18: { + if (outputLayout_ == null) { + OutputLayout = new global::Xla.LayoutProto(); + } + input.ReadMessage(OutputLayout); + break; + } + } + } + } + #endif + + } + + public sealed partial class ComputeConstantResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ComputeConstantResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[30]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ComputeConstantResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ComputeConstantResponse(ComputeConstantResponse other) : this() { + literal_ = other.literal_ != null ? other.literal_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ComputeConstantResponse Clone() { + return new ComputeConstantResponse(this); + } + + /// Field number for the "literal" field. + public const int LiteralFieldNumber = 1; + private global::Xla.LiteralProto literal_; + /// + /// A LiteralProto is returned directly for this request. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.LiteralProto Literal { + get { return literal_; } + set { + literal_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ComputeConstantResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ComputeConstantResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Literal, other.Literal)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (literal_ != null) hash ^= Literal.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (literal_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Literal); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (literal_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Literal); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (literal_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Literal); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ComputeConstantResponse other) { + if (other == null) { + return; + } + if (other.literal_ != null) { + if (literal_ == null) { + Literal = new global::Xla.LiteralProto(); + } + Literal.MergeFrom(other.Literal); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (literal_ == null) { + Literal = new global::Xla.LiteralProto(); + } + input.ReadMessage(Literal); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (literal_ == null) { + Literal = new global::Xla.LiteralProto(); + } + input.ReadMessage(Literal); + break; + } + } + } + } + #endif + + } + + public sealed partial class DeconstructTupleRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeconstructTupleRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[31]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeconstructTupleRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeconstructTupleRequest(DeconstructTupleRequest other) : this() { + tupleHandle_ = other.tupleHandle_ != null ? other.tupleHandle_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeconstructTupleRequest Clone() { + return new DeconstructTupleRequest(this); + } + + /// Field number for the "tuple_handle" field. + public const int TupleHandleFieldNumber = 2; + private global::Xla.GlobalDataHandle tupleHandle_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.GlobalDataHandle TupleHandle { + get { return tupleHandle_; } + set { + tupleHandle_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as DeconstructTupleRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(DeconstructTupleRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(TupleHandle, other.TupleHandle)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (tupleHandle_ != null) hash ^= TupleHandle.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (tupleHandle_ != null) { + output.WriteRawTag(18); + output.WriteMessage(TupleHandle); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (tupleHandle_ != null) { + output.WriteRawTag(18); + output.WriteMessage(TupleHandle); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (tupleHandle_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(TupleHandle); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(DeconstructTupleRequest other) { + if (other == null) { + return; + } + if (other.tupleHandle_ != null) { + if (tupleHandle_ == null) { + TupleHandle = new global::Xla.GlobalDataHandle(); + } + TupleHandle.MergeFrom(other.TupleHandle); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 18: { + if (tupleHandle_ == null) { + TupleHandle = new global::Xla.GlobalDataHandle(); + } + input.ReadMessage(TupleHandle); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 18: { + if (tupleHandle_ == null) { + TupleHandle = new global::Xla.GlobalDataHandle(); + } + input.ReadMessage(TupleHandle); + break; + } + } + } + } + #endif + + } + + public sealed partial class DeconstructTupleResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeconstructTupleResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[32]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeconstructTupleResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeconstructTupleResponse(DeconstructTupleResponse other) : this() { + elementHandles_ = other.elementHandles_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeconstructTupleResponse Clone() { + return new DeconstructTupleResponse(this); + } + + /// Field number for the "element_handles" field. + public const int ElementHandlesFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_elementHandles_codec + = pb::FieldCodec.ForMessage(10, global::Xla.GlobalDataHandle.Parser); + private readonly pbc::RepeatedField elementHandles_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField ElementHandles { + get { return elementHandles_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as DeconstructTupleResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(DeconstructTupleResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!elementHandles_.Equals(other.elementHandles_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= elementHandles_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + elementHandles_.WriteTo(output, _repeated_elementHandles_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + elementHandles_.WriteTo(ref output, _repeated_elementHandles_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += elementHandles_.CalculateSize(_repeated_elementHandles_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(DeconstructTupleResponse other) { + if (other == null) { + return; + } + elementHandles_.Add(other.elementHandles_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + elementHandles_.AddEntriesFrom(input, _repeated_elementHandles_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + elementHandles_.AddEntriesFrom(ref input, _repeated_elementHandles_codec); + break; + } + } + } + } + #endif + + } + + public sealed partial class LoadDataRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new LoadDataRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[33]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LoadDataRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LoadDataRequest(LoadDataRequest other) : this() { + columnioTabletPath_ = other.columnioTabletPath_; + columnioField_ = other.columnioField_; + elementShape_ = other.elementShape_ != null ? other.elementShape_.Clone() : null; + offset_ = other.offset_; + limit_ = other.limit_; + zip_ = other.zip_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LoadDataRequest Clone() { + return new LoadDataRequest(this); + } + + /// Field number for the "columnio_tablet_path" field. + public const int ColumnioTabletPathFieldNumber = 1; + private string columnioTabletPath_ = ""; + /// + /// Describes the path of the ColumnIO tablet to load. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string ColumnioTabletPath { + get { return columnioTabletPath_; } + set { + columnioTabletPath_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "columnio_field" field. + public const int ColumnioFieldFieldNumber = 2; + private string columnioField_ = ""; + /// + /// Describes the field to load within the ColumnIO tablet. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string ColumnioField { + get { return columnioField_; } + set { + columnioField_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "element_shape" field. + public const int ElementShapeFieldNumber = 3; + private global::Xla.ShapeProto elementShape_; + /// + /// Individual element shape, excluding rows. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ShapeProto ElementShape { + get { return elementShape_; } + set { + elementShape_ = value; + } + } + + /// Field number for the "offset" field. + public const int OffsetFieldNumber = 4; + private long offset_; + /// + /// Warning: ColumnIO does not support random-access, so use offset with + /// caution in performance-critical scenarios. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Offset { + get { return offset_; } + set { + offset_ = value; + } + } + + /// Field number for the "limit" field. + public const int LimitFieldNumber = 5; + private long limit_; + /// + /// Maximum number of elements (with shape element_shape) to load. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Limit { + get { return limit_; } + set { + limit_ = value; + } + } + + /// Field number for the "zip" field. + public const int ZipFieldNumber = 6; + private bool zip_; + /// + /// If more than one item is requested (via limit > 1), then this request + /// attribute zips together the produced vectors. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Zip { + get { return zip_; } + set { + zip_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as LoadDataRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(LoadDataRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ColumnioTabletPath != other.ColumnioTabletPath) return false; + if (ColumnioField != other.ColumnioField) return false; + if (!object.Equals(ElementShape, other.ElementShape)) return false; + if (Offset != other.Offset) return false; + if (Limit != other.Limit) return false; + if (Zip != other.Zip) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (ColumnioTabletPath.Length != 0) hash ^= ColumnioTabletPath.GetHashCode(); + if (ColumnioField.Length != 0) hash ^= ColumnioField.GetHashCode(); + if (elementShape_ != null) hash ^= ElementShape.GetHashCode(); + if (Offset != 0L) hash ^= Offset.GetHashCode(); + if (Limit != 0L) hash ^= Limit.GetHashCode(); + if (Zip != false) hash ^= Zip.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ColumnioTabletPath.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ColumnioTabletPath); + } + if (ColumnioField.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ColumnioField); + } + if (elementShape_ != null) { + output.WriteRawTag(26); + output.WriteMessage(ElementShape); + } + if (Offset != 0L) { + output.WriteRawTag(32); + output.WriteInt64(Offset); + } + if (Limit != 0L) { + output.WriteRawTag(40); + output.WriteInt64(Limit); + } + if (Zip != false) { + output.WriteRawTag(48); + output.WriteBool(Zip); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ColumnioTabletPath.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ColumnioTabletPath); + } + if (ColumnioField.Length != 0) { + output.WriteRawTag(18); + output.WriteString(ColumnioField); + } + if (elementShape_ != null) { + output.WriteRawTag(26); + output.WriteMessage(ElementShape); + } + if (Offset != 0L) { + output.WriteRawTag(32); + output.WriteInt64(Offset); + } + if (Limit != 0L) { + output.WriteRawTag(40); + output.WriteInt64(Limit); + } + if (Zip != false) { + output.WriteRawTag(48); + output.WriteBool(Zip); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (ColumnioTabletPath.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ColumnioTabletPath); + } + if (ColumnioField.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ColumnioField); + } + if (elementShape_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ElementShape); + } + if (Offset != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Offset); + } + if (Limit != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Limit); + } + if (Zip != false) { + size += 1 + 1; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(LoadDataRequest other) { + if (other == null) { + return; + } + if (other.ColumnioTabletPath.Length != 0) { + ColumnioTabletPath = other.ColumnioTabletPath; + } + if (other.ColumnioField.Length != 0) { + ColumnioField = other.ColumnioField; + } + if (other.elementShape_ != null) { + if (elementShape_ == null) { + ElementShape = new global::Xla.ShapeProto(); + } + ElementShape.MergeFrom(other.ElementShape); + } + if (other.Offset != 0L) { + Offset = other.Offset; + } + if (other.Limit != 0L) { + Limit = other.Limit; + } + if (other.Zip != false) { + Zip = other.Zip; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + ColumnioTabletPath = input.ReadString(); + break; + } + case 18: { + ColumnioField = input.ReadString(); + break; + } + case 26: { + if (elementShape_ == null) { + ElementShape = new global::Xla.ShapeProto(); + } + input.ReadMessage(ElementShape); + break; + } + case 32: { + Offset = input.ReadInt64(); + break; + } + case 40: { + Limit = input.ReadInt64(); + break; + } + case 48: { + Zip = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + ColumnioTabletPath = input.ReadString(); + break; + } + case 18: { + ColumnioField = input.ReadString(); + break; + } + case 26: { + if (elementShape_ == null) { + ElementShape = new global::Xla.ShapeProto(); + } + input.ReadMessage(ElementShape); + break; + } + case 32: { + Offset = input.ReadInt64(); + break; + } + case 40: { + Limit = input.ReadInt64(); + break; + } + case 48: { + Zip = input.ReadBool(); + break; + } + } + } + } + #endif + + } + + public sealed partial class LoadDataResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new LoadDataResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[34]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LoadDataResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LoadDataResponse(LoadDataResponse other) : this() { + data_ = other.data_ != null ? other.data_.Clone() : null; + dataShape_ = other.dataShape_ != null ? other.dataShape_.Clone() : null; + availableRows_ = other.availableRows_; + rowsLoaded_ = other.rowsLoaded_; + nanoseconds_ = other.nanoseconds_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LoadDataResponse Clone() { + return new LoadDataResponse(this); + } + + /// Field number for the "data" field. + public const int DataFieldNumber = 1; + private global::Xla.GlobalDataHandle data_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.GlobalDataHandle Data { + get { return data_; } + set { + data_ = value; + } + } + + /// Field number for the "data_shape" field. + public const int DataShapeFieldNumber = 2; + private global::Xla.ShapeProto dataShape_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ShapeProto DataShape { + get { return dataShape_; } + set { + dataShape_ = value; + } + } + + /// Field number for the "available_rows" field. + public const int AvailableRowsFieldNumber = 3; + private long availableRows_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long AvailableRows { + get { return availableRows_; } + set { + availableRows_ = value; + } + } + + /// Field number for the "rows_loaded" field. + public const int RowsLoadedFieldNumber = 4; + private long rowsLoaded_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long RowsLoaded { + get { return rowsLoaded_; } + set { + rowsLoaded_ = value; + } + } + + /// Field number for the "nanoseconds" field. + public const int NanosecondsFieldNumber = 5; + private long nanoseconds_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Nanoseconds { + get { return nanoseconds_; } + set { + nanoseconds_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as LoadDataResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(LoadDataResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Data, other.Data)) return false; + if (!object.Equals(DataShape, other.DataShape)) return false; + if (AvailableRows != other.AvailableRows) return false; + if (RowsLoaded != other.RowsLoaded) return false; + if (Nanoseconds != other.Nanoseconds) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (data_ != null) hash ^= Data.GetHashCode(); + if (dataShape_ != null) hash ^= DataShape.GetHashCode(); + if (AvailableRows != 0L) hash ^= AvailableRows.GetHashCode(); + if (RowsLoaded != 0L) hash ^= RowsLoaded.GetHashCode(); + if (Nanoseconds != 0L) hash ^= Nanoseconds.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (data_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Data); + } + if (dataShape_ != null) { + output.WriteRawTag(18); + output.WriteMessage(DataShape); + } + if (AvailableRows != 0L) { + output.WriteRawTag(24); + output.WriteInt64(AvailableRows); + } + if (RowsLoaded != 0L) { + output.WriteRawTag(32); + output.WriteInt64(RowsLoaded); + } + if (Nanoseconds != 0L) { + output.WriteRawTag(40); + output.WriteInt64(Nanoseconds); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (data_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Data); + } + if (dataShape_ != null) { + output.WriteRawTag(18); + output.WriteMessage(DataShape); + } + if (AvailableRows != 0L) { + output.WriteRawTag(24); + output.WriteInt64(AvailableRows); + } + if (RowsLoaded != 0L) { + output.WriteRawTag(32); + output.WriteInt64(RowsLoaded); + } + if (Nanoseconds != 0L) { + output.WriteRawTag(40); + output.WriteInt64(Nanoseconds); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (data_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Data); + } + if (dataShape_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(DataShape); + } + if (AvailableRows != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(AvailableRows); + } + if (RowsLoaded != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(RowsLoaded); + } + if (Nanoseconds != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Nanoseconds); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(LoadDataResponse other) { + if (other == null) { + return; + } + if (other.data_ != null) { + if (data_ == null) { + Data = new global::Xla.GlobalDataHandle(); + } + Data.MergeFrom(other.Data); + } + if (other.dataShape_ != null) { + if (dataShape_ == null) { + DataShape = new global::Xla.ShapeProto(); + } + DataShape.MergeFrom(other.DataShape); + } + if (other.AvailableRows != 0L) { + AvailableRows = other.AvailableRows; + } + if (other.RowsLoaded != 0L) { + RowsLoaded = other.RowsLoaded; + } + if (other.Nanoseconds != 0L) { + Nanoseconds = other.Nanoseconds; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (data_ == null) { + Data = new global::Xla.GlobalDataHandle(); + } + input.ReadMessage(Data); + break; + } + case 18: { + if (dataShape_ == null) { + DataShape = new global::Xla.ShapeProto(); + } + input.ReadMessage(DataShape); + break; + } + case 24: { + AvailableRows = input.ReadInt64(); + break; + } + case 32: { + RowsLoaded = input.ReadInt64(); + break; + } + case 40: { + Nanoseconds = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (data_ == null) { + Data = new global::Xla.GlobalDataHandle(); + } + input.ReadMessage(Data); + break; + } + case 18: { + if (dataShape_ == null) { + DataShape = new global::Xla.ShapeProto(); + } + input.ReadMessage(DataShape); + break; + } + case 24: { + AvailableRows = input.ReadInt64(); + break; + } + case 32: { + RowsLoaded = input.ReadInt64(); + break; + } + case 40: { + Nanoseconds = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + public sealed partial class GetShapeRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetShapeRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[35]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetShapeRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetShapeRequest(GetShapeRequest other) : this() { + data_ = other.data_ != null ? other.data_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetShapeRequest Clone() { + return new GetShapeRequest(this); + } + + /// Field number for the "data" field. + public const int DataFieldNumber = 1; + private global::Xla.GlobalDataHandle data_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.GlobalDataHandle Data { + get { return data_; } + set { + data_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as GetShapeRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(GetShapeRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Data, other.Data)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (data_ != null) hash ^= Data.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (data_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Data); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (data_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Data); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (data_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Data); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(GetShapeRequest other) { + if (other == null) { + return; + } + if (other.data_ != null) { + if (data_ == null) { + Data = new global::Xla.GlobalDataHandle(); + } + Data.MergeFrom(other.Data); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (data_ == null) { + Data = new global::Xla.GlobalDataHandle(); + } + input.ReadMessage(Data); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (data_ == null) { + Data = new global::Xla.GlobalDataHandle(); + } + input.ReadMessage(Data); + break; + } + } + } + } + #endif + + } + + public sealed partial class GetShapeResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetShapeResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[36]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetShapeResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetShapeResponse(GetShapeResponse other) : this() { + shape_ = other.shape_ != null ? other.shape_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GetShapeResponse Clone() { + return new GetShapeResponse(this); + } + + /// Field number for the "shape" field. + public const int ShapeFieldNumber = 1; + private global::Xla.ShapeProto shape_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ShapeProto Shape { + get { return shape_; } + set { + shape_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as GetShapeResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(GetShapeResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Shape, other.Shape)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (shape_ != null) hash ^= Shape.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (shape_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Shape); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (shape_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Shape); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (shape_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Shape); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(GetShapeResponse other) { + if (other == null) { + return; + } + if (other.shape_ != null) { + if (shape_ == null) { + Shape = new global::Xla.ShapeProto(); + } + Shape.MergeFrom(other.Shape); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (shape_ == null) { + Shape = new global::Xla.ShapeProto(); + } + input.ReadMessage(Shape); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (shape_ == null) { + Shape = new global::Xla.ShapeProto(); + } + input.ReadMessage(Shape); + break; + } + } + } + } + #endif + + } + + public sealed partial class UnpackRequest : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UnpackRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[37]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public UnpackRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public UnpackRequest(UnpackRequest other) : this() { + data_ = other.data_ != null ? other.data_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public UnpackRequest Clone() { + return new UnpackRequest(this); + } + + /// Field number for the "data" field. + public const int DataFieldNumber = 1; + private global::Xla.GlobalDataHandle data_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.GlobalDataHandle Data { + get { return data_; } + set { + data_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as UnpackRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(UnpackRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Data, other.Data)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (data_ != null) hash ^= Data.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (data_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Data); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (data_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Data); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (data_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Data); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(UnpackRequest other) { + if (other == null) { + return; + } + if (other.data_ != null) { + if (data_ == null) { + Data = new global::Xla.GlobalDataHandle(); + } + Data.MergeFrom(other.Data); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (data_ == null) { + Data = new global::Xla.GlobalDataHandle(); + } + input.ReadMessage(Data); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (data_ == null) { + Data = new global::Xla.GlobalDataHandle(); + } + input.ReadMessage(Data); + break; + } + } + } + } + #endif + + } + + public sealed partial class UnpackResponse : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UnpackResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaReflection.Descriptor.MessageTypes[38]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public UnpackResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public UnpackResponse(UnpackResponse other) : this() { + tiedData_ = other.tiedData_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public UnpackResponse Clone() { + return new UnpackResponse(this); + } + + /// Field number for the "tied_data" field. + public const int TiedDataFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_tiedData_codec + = pb::FieldCodec.ForMessage(10, global::Xla.GlobalDataHandle.Parser); + private readonly pbc::RepeatedField tiedData_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField TiedData { + get { return tiedData_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as UnpackResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(UnpackResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!tiedData_.Equals(other.tiedData_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= tiedData_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + tiedData_.WriteTo(output, _repeated_tiedData_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + tiedData_.WriteTo(ref output, _repeated_tiedData_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += tiedData_.CalculateSize(_repeated_tiedData_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(UnpackResponse other) { + if (other == null) { + return; + } + tiedData_.Add(other.tiedData_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + tiedData_.AddEntriesFrom(input, _repeated_tiedData_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + tiedData_.AddEntriesFrom(ref input, _repeated_tiedData_codec); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/TensorFlowNET.Core/Protobuf/XlaData.cs b/src/TensorFlowNET.Core/Protobuf/XlaData.cs new file mode 100644 index 000000000..b281ab778 --- /dev/null +++ b/src/TensorFlowNET.Core/Protobuf/XlaData.cs @@ -0,0 +1,10350 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tensorflow/compiler/xla/xla_data.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Xla { + + /// Holder for reflection information generated from tensorflow/compiler/xla/xla_data.proto + public static partial class XlaDataReflection { + + #region Descriptor + /// File descriptor for tensorflow/compiler/xla/xla_data.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static XlaDataReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiZ0ZW5zb3JmbG93L2NvbXBpbGVyL3hsYS94bGFfZGF0YS5wcm90bxIDeGxh", + "IrcBCg1QYWRkaW5nQ29uZmlnEj0KCmRpbWVuc2lvbnMYASADKAsyKS54bGEu", + "UGFkZGluZ0NvbmZpZy5QYWRkaW5nQ29uZmlnRGltZW5zaW9uGmcKFlBhZGRp", + "bmdDb25maWdEaW1lbnNpb24SGAoQZWRnZV9wYWRkaW5nX2xvdxgBIAEoAxIZ", + "ChFlZGdlX3BhZGRpbmdfaGlnaBgCIAEoAxIYChBpbnRlcmlvcl9wYWRkaW5n", + "GAMgASgDIh8KCVRpbGVQcm90bxISCgpkaW1lbnNpb25zGAEgAygDIqQCCgtM", + "YXlvdXRQcm90bxIqCg9kaW1fbGV2ZWxfdHlwZXMYCSADKA4yES54bGEuRGlt", + "TGV2ZWxUeXBlEhYKDm1pbm9yX3RvX21ham9yGAEgAygDEh0KBXRpbGVzGAYg", + "AygLMg4ueGxhLlRpbGVQcm90bxIcChRlbGVtZW50X3NpemVfaW5fYml0cxgH", + "IAEoAxIUCgxtZW1vcnlfc3BhY2UYCCABKAMSJwoOcGh5c2ljYWxfc2hhcGUY", + "CiABKAsyDy54bGEuU2hhcGVQcm90b0oECAIQA0oECAMQBEoECAQQBUoECAUQ", + "BlIRcGFkZGVkX2RpbWVuc2lvbnNSDXBhZGRpbmdfdmFsdWVSBmZvcm1hdFIT", + "bWF4X3NwYXJzZV9lbGVtZW50cyK9AQoKU2hhcGVQcm90bxIoCgxlbGVtZW50", + "X3R5cGUYAiABKA4yEi54bGEuUHJpbWl0aXZlVHlwZRISCgpkaW1lbnNpb25z", + "GAMgAygDEiUKDHR1cGxlX3NoYXBlcxgEIAMoCzIPLnhsYS5TaGFwZVByb3Rv", + "EiAKBmxheW91dBgFIAEoCzIQLnhsYS5MYXlvdXRQcm90bxIcChRpc19keW5h", + "bWljX2RpbWVuc2lvbhgGIAMoCEoECAEQAlIEcmFuayJyChFQcm9ncmFtU2hh", + "cGVQcm90bxIjCgpwYXJhbWV0ZXJzGAEgAygLMg8ueGxhLlNoYXBlUHJvdG8S", + "HwoGcmVzdWx0GAIgASgLMg8ueGxhLlNoYXBlUHJvdG8SFwoPcGFyYW1ldGVy", + "X25hbWVzGAMgAygJIkQKEENvbXB1dGF0aW9uU3RhdHMSEgoKZmxvcF9jb3Vu", + "dBgBIAEoARIcChR0cmFuc2NlbmRlbnRhbF9jb3VudBgCIAEoASL/AwoKT3BN", + "ZXRhZGF0YRIPCgdvcF90eXBlGAEgASgJEg8KB29wX25hbWUYAiABKAkSEwoL", + "c291cmNlX2ZpbGUYAyABKAkSEwoLc291cmNlX2xpbmUYBCABKAUSKgoMcHJv", + "ZmlsZV90eXBlGAUgAygOMhAueGxhLlByb2ZpbGVUeXBlQgIYARIYChBjcmVh", + "dGlvbl9wYXNzX2lkGAYgASgDEiAKGGxvZ2ljYWxfY3JlYXRpb25fcGFzc19p", + "ZBgHIAEoAxInCh9zaXplX29mX2dlbmVyYXRlZF9jb2RlX2luX2J5dGVzGAgg", + "ASgDEisKI3NpemVfb2ZfbWVtb3J5X3dvcmtpbmdfc2V0X2luX2J5dGVzGAkg", + "ASgDEjEKDHByb2ZpbGVfaW5mbxgKIAEoCzIbLnhsYS5PcE1ldGFkYXRhLlBy", + "b2ZpbGVJbmZvGq0BCgtQcm9maWxlSW5mbxImCgxwcm9maWxlX3R5cGUYASAD", + "KA4yEC54bGEuUHJvZmlsZVR5cGUSGAoQcmVsYXRpdmVfc3BlZWR1cBgCIAEo", + "ARIqCg5wcm9maWxlX3NvdXJjZRgDIAEoDjISLnhsYS5Qcm9maWxlU291cmNl", + "EjAKEWNvbXBpbGF0aW9uX2V2ZW50GAQgASgOMhUueGxhLkNvbXBpbGF0aW9u", + "RXZlbnRKBAgLEAwi4wEKEEV4ZWN1dGlvblByb2ZpbGUSHQoVY29tcGlsYXRp", + "b25fY2FjaGVfaGl0GAEgASgIEhcKD2NvbXBpbGVfdGltZV9tcxgCIAEoAxIb", + "ChNjb21wdXRlX2N5Y2xlX2NvdW50GAMgASgDEhcKD2NvbXB1dGVfdGltZV9u", + "cxgEIAEoAxIkChxjb21wdXRlX2FuZF90cmFuc2Zlcl90aW1lX25zGAUgASgD", + "EiAKGGV4ZWN1dGFibGVfc2l6ZV9pbl9ieXRlcxgGIAEoAxIZChFwcm9maWxl", + "X2NhY2hlX2hpdBgHIAEoCCIhCg9FeGVjdXRpb25IYW5kbGUSDgoGaGFuZGxl", + "GAEgASgDIiIKEEdsb2JhbERhdGFIYW5kbGUSDgoGaGFuZGxlGAEgASgDIjQK", + "DERldmljZUhhbmRsZRIOCgZoYW5kbGUYASABKAMSFAoMZGV2aWNlX2NvdW50", + "GAIgASgDIrQBCg1DaGFubmVsSGFuZGxlEg4KBmhhbmRsZRgBIAEoAxIsCgR0", + "eXBlGAIgASgOMh4ueGxhLkNoYW5uZWxIYW5kbGUuQ2hhbm5lbFR5cGUiZQoL", + "Q2hhbm5lbFR5cGUSGAoUQ0hBTk5FTF9UWVBFX0lOVkFMSUQQABIUChBERVZJ", + "Q0VfVE9fREVWSUNFEAESEgoOREVWSUNFX1RPX0hPU1QQAhISCg5IT1NUX1RP", + "X0RFVklDRRADIsUBChVEZXZpY2VBc3NpZ25tZW50UHJvdG8SFQoNcmVwbGlj", + "YV9jb3VudBgBIAEoBRIZChFjb21wdXRhdGlvbl9jb3VudBgCIAEoBRJJChNj", + "b21wdXRhdGlvbl9kZXZpY2VzGAMgAygLMiwueGxhLkRldmljZUFzc2lnbm1l", + "bnRQcm90by5Db21wdXRhdGlvbkRldmljZRovChFDb21wdXRhdGlvbkRldmlj", + "ZRIaChJyZXBsaWNhX2RldmljZV9pZHMYASADKAUixAIKDExpdGVyYWxQcm90", + "bxIeCgVzaGFwZRgBIAEoCzIPLnhsYS5TaGFwZVByb3RvEg0KBXByZWRzGAIg", + "AygIEgsKA3M4cxgPIAEoDBILCgN1OHMYAyABKAwSDAoEczMycxgEIAMoBRIM", + "CgRzNjRzGAUgAygDEgwKBHUzMnMYBiADKA0SDAoEdTY0cxgHIAMoBBIMCgRm", + "MzJzGAggAygCEgwKBGY2NHMYCSADKAESDAoEYzY0cxgMIAMoAhINCgVjMTI4", + "cxgSIAMoARIpCg50dXBsZV9saXRlcmFscxgKIAMoCzIRLnhsYS5MaXRlcmFs", + "UHJvdG8SDAoEZjE2cxgLIAEoDBINCgViZjE2cxgNIAEoDBIMCgR1MTZzGBAg", + "ASgMEgwKBHMxNnMYESABKAwSFgoOc3BhcnNlX2luZGljZXMYDiADKAMiowEK", + "D1dpbmRvd0RpbWVuc2lvbhIMCgRzaXplGAEgASgDEg4KBnN0cmlkZRgCIAEo", + "AxITCgtwYWRkaW5nX2xvdxgDIAEoAxIUCgxwYWRkaW5nX2hpZ2gYBCABKAMS", + "FwoPd2luZG93X2RpbGF0aW9uGAUgASgDEhUKDWJhc2VfZGlsYXRpb24YBiAB", + "KAMSFwoPd2luZG93X3JldmVyc2FsGAcgASgIIjIKBldpbmRvdxIoCgpkaW1l", + "bnNpb25zGAEgAygLMhQueGxhLldpbmRvd0RpbWVuc2lvbiJ+ChZHYXRoZXJE", + "aW1lbnNpb25OdW1iZXJzEhMKC29mZnNldF9kaW1zGAEgAygDEhwKFGNvbGxh", + "cHNlZF9zbGljZV9kaW1zGAIgAygDEhcKD3N0YXJ0X2luZGV4X21hcBgDIAMo", + "AxIYChBpbmRleF92ZWN0b3JfZGltGAQgASgDIpMBChdTY2F0dGVyRGltZW5z", + "aW9uTnVtYmVycxIaChJ1cGRhdGVfd2luZG93X2RpbXMYASADKAMSHAoUaW5z", + "ZXJ0ZWRfd2luZG93X2RpbXMYAiADKAMSJAocc2NhdHRlcl9kaW1zX3RvX29w", + "ZXJhbmRfZGltcxgDIAMoAxIYChBpbmRleF92ZWN0b3JfZGltGAQgASgDItgC", + "ChtDb252b2x1dGlvbkRpbWVuc2lvbk51bWJlcnMSHQoVaW5wdXRfYmF0Y2hf", + "ZGltZW5zaW9uGAcgASgDEh8KF2lucHV0X2ZlYXR1cmVfZGltZW5zaW9uGAgg", + "ASgDEiAKGGlucHV0X3NwYXRpYWxfZGltZW5zaW9ucxgLIAMoAxImCh5rZXJu", + "ZWxfaW5wdXRfZmVhdHVyZV9kaW1lbnNpb24YAyABKAMSJwofa2VybmVsX291", + "dHB1dF9mZWF0dXJlX2RpbWVuc2lvbhgEIAEoAxIhChlrZXJuZWxfc3BhdGlh", + "bF9kaW1lbnNpb25zGAYgAygDEh4KFm91dHB1dF9iYXRjaF9kaW1lbnNpb24Y", + "CSABKAMSIAoYb3V0cHV0X2ZlYXR1cmVfZGltZW5zaW9uGAogASgDEiEKGW91", + "dHB1dF9zcGF0aWFsX2RpbWVuc2lvbnMYDCADKAMimQEKE0RvdERpbWVuc2lv", + "bk51bWJlcnMSIgoabGhzX2NvbnRyYWN0aW5nX2RpbWVuc2lvbnMYASADKAMS", + "IgoacmhzX2NvbnRyYWN0aW5nX2RpbWVuc2lvbnMYAiADKAMSHAoUbGhzX2Jh", + "dGNoX2RpbWVuc2lvbnMYAyADKAMSHAoUcmhzX2JhdGNoX2RpbWVuc2lvbnMY", + "BCADKAMi3wEKFlRyaWFuZ3VsYXJTb2x2ZU9wdGlvbnMSEQoJbGVmdF9zaWRl", + "GAEgASgIEg0KBWxvd2VyGAIgASgIEhUKDXVuaXRfZGlhZ29uYWwYAyABKAgS", + "OgoLdHJhbnNwb3NlX2EYBCABKA4yJS54bGEuVHJpYW5ndWxhclNvbHZlT3B0", + "aW9ucy5UcmFuc3Bvc2UiUAoJVHJhbnNwb3NlEhUKEVRSQU5TUE9TRV9JTlZB", + "TElEEAASEAoMTk9fVFJBTlNQT1NFEAESDQoJVFJBTlNQT1NFEAISCwoHQURK", + "T0lOVBADIiAKD0Nob2xlc2t5T3B0aW9ucxINCgVsb3dlchgBIAEoCCJvChJG", + "cm9udGVuZEF0dHJpYnV0ZXMSLQoDbWFwGAEgAygLMiAueGxhLkZyb250ZW5k", + "QXR0cmlidXRlcy5NYXBFbnRyeRoqCghNYXBFbnRyeRILCgNrZXkYASABKAkS", + "DQoFdmFsdWUYAiABKAk6AjgBIoADCgpPcFNoYXJkaW5nEiIKBHR5cGUYASAB", + "KA4yFC54bGEuT3BTaGFyZGluZy5UeXBlEiMKCnRpbGVfc2hhcGUYAiABKAsy", + "Dy54bGEuU2hhcGVQcm90bxIiChp0aWxlX2Fzc2lnbm1lbnRfZGltZW5zaW9u", + "cxgDIAMoAxIfChd0aWxlX2Fzc2lnbm1lbnRfZGV2aWNlcxgEIAMoAxIoCg90", + "dXBsZV9zaGFyZGluZ3MYBSADKAsyDy54bGEuT3BTaGFyZGluZxIiChpyZXBs", + "aWNhdGVfb25fbGFzdF90aWxlX2RpbRgGIAEoCBIhCghtZXRhZGF0YRgHIAMo", + "CzIPLnhsYS5PcE1ldGFkYXRhEiwKDmxhc3RfdGlsZV9kaW1zGAggAygOMhQu", + "eGxhLk9wU2hhcmRpbmcuVHlwZSJFCgRUeXBlEg4KClJFUExJQ0FURUQQABIL", + "CgdNQVhJTUFMEAESCQoFVFVQTEUQAhIJCgVPVEhFUhADEgoKBk1BTlVBTBAE", + "IiMKDFJlcGxpY2FHcm91cBITCgtyZXBsaWNhX2lkcxgBIAMoAyIuCgxTb3Vy", + "Y2VUYXJnZXQSDgoGc291cmNlGAEgASgDEg4KBnRhcmdldBgCIAEoAyKQAQoP", + "UHJlY2lzaW9uQ29uZmlnEjkKEW9wZXJhbmRfcHJlY2lzaW9uGAEgAygOMh4u", + "eGxhLlByZWNpc2lvbkNvbmZpZy5QcmVjaXNpb24iQgoJUHJlY2lzaW9uEgsK", + "B0RFRkFVTFQQABIICgRISUdIEAESCwoHSElHSEVTVBACEhEKDVBBQ0tFRF9O", + "SUJCTEUQAyI6ChRQYXJhbWV0ZXJSZXBsaWNhdGlvbhIiChpyZXBsaWNhdGVk", + "X2F0X2xlYWZfYnVmZmVycxgBIAMoCCJ7ChZXaGlsZUxvb3BCYWNrZW5kQ29u", + "ZmlnEkQKEGtub3duX3RyaXBfY291bnQYASABKAsyKi54bGEuV2hpbGVMb29w", + "QmFja2VuZENvbmZpZy5Lbm93blRyaXBDb3VudBobCg5Lbm93blRyaXBDb3Vu", + "dBIJCgFuGAEgASgDInEKH0N1c3RvbUNhbGxPdXRwdXRPcGVyYW5kQWxpYXNp", + "bmcSGgoSb3V0cHV0X3NoYXBlX2luZGV4GAEgAygDEhUKDW9wZXJhbmRfaW5k", + "ZXgYAiABKAMSGwoTb3BlcmFuZF9zaGFwZV9pbmRleBgDIAMoAyraAQoNUHJp", + "bWl0aXZlVHlwZRIaChZQUklNSVRJVkVfVFlQRV9JTlZBTElEEAASCAoEUFJF", + "RBABEgYKAlM4EAISBwoDUzE2EAMSBwoDUzMyEAQSBwoDUzY0EAUSBgoCVTgQ", + "BhIHCgNVMTYQBxIHCgNVMzIQCBIHCgNVNjQQCRIHCgNGMTYQChIHCgNGMzIQ", + "CxIICgRCRjE2EBASBwoDRjY0EAwSBwoDQzY0EA8SCAoEQzEyOBASEgkKBVRV", + "UExFEA0SDwoLT1BBUVVFX1RZUEUQDhIJCgVUT0tFThARKkQKDERpbUxldmVs", + "VHlwZRINCglESU1fREVOU0UQABISCg5ESU1fQ09NUFJFU1NFRBABEhEKDURJ", + "TV9TSU5HTEVUT04QAio9CgtQcm9maWxlVHlwZRILCgdJTlZBTElEEAASCgoG", + "V0lORE9XEAESCAoERkxBRxACEgsKB0lOVEVHRVIQAypqCg1Qcm9maWxlU291", + "cmNlEiEKHVBST0ZJTEVfU09VUkNFX1VOS05PV05fU09VUkNFEAASGwoXUFJP", + "RklMRV9TT1VSQ0VfRU1CRURERUQQARIZChVQUk9GSUxFX1NPVVJDRV9SRU1P", + "VEUQAiqFAQoQQ29tcGlsYXRpb25FdmVudBIjCh9DT01QSUxBVElPTl9FVkVO", + "VF9VTktOT1dOX0VWRU5UEAASJwojQ09NUElMQVRJT05fRVZFTlRfRklSU1Rf", + "Q09NUElMQVRJT04QARIjCh9DT01QSUxBVElPTl9FVkVOVF9SRUNPTVBJTEFU", + "SU9OEAIqRwoLUGFkZGluZ1R5cGUSEwoPUEFERElOR19JTlZBTElEEAASEQoN", + "UEFERElOR19WQUxJRBABEhAKDFBBRERJTkdfU0FNRRACKjEKB0ZmdFR5cGUS", + "BwoDRkZUEAASCAoESUZGVBABEggKBFJGRlQQAhIJCgVJUkZGVBADKkYKElJh", + "bmRvbURpc3RyaWJ1dGlvbhIPCgtSTkdfSU5WQUxJRBAAEg8KC1JOR19VTklG", + "T1JNEAESDgoKUk5HX05PUk1BTBACKkUKD1JhbmRvbUFsZ29yaXRobRIPCgtS", + "TkdfREVGQVVMVBAAEhEKDVJOR19USFJFRV9GUlkQARIOCgpSTkdfUEhJTE9Y", + "EAJCA/gBAWIGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Xla.PrimitiveType), typeof(global::Xla.DimLevelType), typeof(global::Xla.ProfileType), typeof(global::Xla.ProfileSource), typeof(global::Xla.CompilationEvent), typeof(global::Xla.PaddingType), typeof(global::Xla.FftType), typeof(global::Xla.RandomDistribution), typeof(global::Xla.RandomAlgorithm), }, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.PaddingConfig), global::Xla.PaddingConfig.Parser, new[]{ "Dimensions" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Xla.PaddingConfig.Types.PaddingConfigDimension), global::Xla.PaddingConfig.Types.PaddingConfigDimension.Parser, new[]{ "EdgePaddingLow", "EdgePaddingHigh", "InteriorPadding" }, null, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.TileProto), global::Xla.TileProto.Parser, new[]{ "Dimensions" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.LayoutProto), global::Xla.LayoutProto.Parser, new[]{ "DimLevelTypes", "MinorToMajor", "Tiles", "ElementSizeInBits", "MemorySpace", "PhysicalShape" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ShapeProto), global::Xla.ShapeProto.Parser, new[]{ "ElementType", "Dimensions", "TupleShapes", "Layout", "IsDynamicDimension" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ProgramShapeProto), global::Xla.ProgramShapeProto.Parser, new[]{ "Parameters", "Result", "ParameterNames" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ComputationStats), global::Xla.ComputationStats.Parser, new[]{ "FlopCount", "TranscendentalCount" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.OpMetadata), global::Xla.OpMetadata.Parser, new[]{ "OpType", "OpName", "SourceFile", "SourceLine", "ProfileType", "CreationPassId", "LogicalCreationPassId", "SizeOfGeneratedCodeInBytes", "SizeOfMemoryWorkingSetInBytes", "ProfileInfo" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Xla.OpMetadata.Types.ProfileInfo), global::Xla.OpMetadata.Types.ProfileInfo.Parser, new[]{ "ProfileType", "RelativeSpeedup", "ProfileSource", "CompilationEvent" }, null, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ExecutionProfile), global::Xla.ExecutionProfile.Parser, new[]{ "CompilationCacheHit", "CompileTimeMs", "ComputeCycleCount", "ComputeTimeNs", "ComputeAndTransferTimeNs", "ExecutableSizeInBytes", "ProfileCacheHit" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ExecutionHandle), global::Xla.ExecutionHandle.Parser, new[]{ "Handle" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.GlobalDataHandle), global::Xla.GlobalDataHandle.Parser, new[]{ "Handle" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.DeviceHandle), global::Xla.DeviceHandle.Parser, new[]{ "Handle", "DeviceCount" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ChannelHandle), global::Xla.ChannelHandle.Parser, new[]{ "Handle", "Type" }, null, new[]{ typeof(global::Xla.ChannelHandle.Types.ChannelType) }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.DeviceAssignmentProto), global::Xla.DeviceAssignmentProto.Parser, new[]{ "ReplicaCount", "ComputationCount", "ComputationDevices" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Xla.DeviceAssignmentProto.Types.ComputationDevice), global::Xla.DeviceAssignmentProto.Types.ComputationDevice.Parser, new[]{ "ReplicaDeviceIds" }, null, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.LiteralProto), global::Xla.LiteralProto.Parser, new[]{ "Shape", "Preds", "S8S", "U8S", "S32S", "S64S", "U32S", "U64S", "F32S", "F64S", "C64S", "C128S", "TupleLiterals", "F16S", "Bf16S", "U16S", "S16S", "SparseIndices" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.WindowDimension), global::Xla.WindowDimension.Parser, new[]{ "Size", "Stride", "PaddingLow", "PaddingHigh", "WindowDilation", "BaseDilation", "WindowReversal" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.Window), global::Xla.Window.Parser, new[]{ "Dimensions" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.GatherDimensionNumbers), global::Xla.GatherDimensionNumbers.Parser, new[]{ "OffsetDims", "CollapsedSliceDims", "StartIndexMap", "IndexVectorDim" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ScatterDimensionNumbers), global::Xla.ScatterDimensionNumbers.Parser, new[]{ "UpdateWindowDims", "InsertedWindowDims", "ScatterDimsToOperandDims", "IndexVectorDim" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ConvolutionDimensionNumbers), global::Xla.ConvolutionDimensionNumbers.Parser, new[]{ "InputBatchDimension", "InputFeatureDimension", "InputSpatialDimensions", "KernelInputFeatureDimension", "KernelOutputFeatureDimension", "KernelSpatialDimensions", "OutputBatchDimension", "OutputFeatureDimension", "OutputSpatialDimensions" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.DotDimensionNumbers), global::Xla.DotDimensionNumbers.Parser, new[]{ "LhsContractingDimensions", "RhsContractingDimensions", "LhsBatchDimensions", "RhsBatchDimensions" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.TriangularSolveOptions), global::Xla.TriangularSolveOptions.Parser, new[]{ "LeftSide", "Lower", "UnitDiagonal", "TransposeA" }, null, new[]{ typeof(global::Xla.TriangularSolveOptions.Types.Transpose) }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.CholeskyOptions), global::Xla.CholeskyOptions.Parser, new[]{ "Lower" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.FrontendAttributes), global::Xla.FrontendAttributes.Parser, new[]{ "Map" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.OpSharding), global::Xla.OpSharding.Parser, new[]{ "Type", "TileShape", "TileAssignmentDimensions", "TileAssignmentDevices", "TupleShardings", "ReplicateOnLastTileDim", "Metadata", "LastTileDims" }, null, new[]{ typeof(global::Xla.OpSharding.Types.Type) }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ReplicaGroup), global::Xla.ReplicaGroup.Parser, new[]{ "ReplicaIds" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.SourceTarget), global::Xla.SourceTarget.Parser, new[]{ "Source", "Target" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.PrecisionConfig), global::Xla.PrecisionConfig.Parser, new[]{ "OperandPrecision" }, null, new[]{ typeof(global::Xla.PrecisionConfig.Types.Precision) }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.ParameterReplication), global::Xla.ParameterReplication.Parser, new[]{ "ReplicatedAtLeafBuffers" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.WhileLoopBackendConfig), global::Xla.WhileLoopBackendConfig.Parser, new[]{ "KnownTripCount" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Xla.WhileLoopBackendConfig.Types.KnownTripCount), global::Xla.WhileLoopBackendConfig.Types.KnownTripCount.Parser, new[]{ "N" }, null, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.CustomCallOutputOperandAliasing), global::Xla.CustomCallOutputOperandAliasing.Parser, new[]{ "OutputShapeIndex", "OperandIndex", "OperandShapeIndex" }, null, null, null, null) + })); + } + #endregion + + } + #region Enums + /// + /// Primitive types are the individual values that can be held in rectangular + /// multidimensional arrays. A description of the rectangular multidimensional + /// array dimensions / primitive type is given by Shape, below. + /// + /// LINT.IfChange + /// + public enum PrimitiveType { + /// + /// Invalid primitive type to serve as default. + /// + [pbr::OriginalName("PRIMITIVE_TYPE_INVALID")] Invalid = 0, + /// + /// Predicates are two-state booleans. + /// + [pbr::OriginalName("PRED")] Pred = 1, + /// + /// Signed integral values of fixed width. + /// + [pbr::OriginalName("S8")] S8 = 2, + [pbr::OriginalName("S16")] S16 = 3, + [pbr::OriginalName("S32")] S32 = 4, + [pbr::OriginalName("S64")] S64 = 5, + /// + /// Unsigned integral values of fixed width. + /// + [pbr::OriginalName("U8")] U8 = 6, + [pbr::OriginalName("U16")] U16 = 7, + [pbr::OriginalName("U32")] U32 = 8, + [pbr::OriginalName("U64")] U64 = 9, + /// + /// Floating-point values of fixed width. + /// + /// Note: if f16s are not natively supported on the device, they will be + /// converted to f16 from f32 at arbirary points in the computation. + /// + [pbr::OriginalName("F16")] F16 = 10, + [pbr::OriginalName("F32")] F32 = 11, + /// + /// Truncated 16 bit floating-point format. This is similar to IEEE's 16 bit + /// floating-point format, but uses 1 bit for the sign, 8 bits for the exponent + /// and 7 bits for the mantissa. + /// + [pbr::OriginalName("BF16")] Bf16 = 16, + [pbr::OriginalName("F64")] F64 = 12, + /// + /// Complex values of fixed width. + /// + [pbr::OriginalName("C64")] C64 = 15, + /// + /// Paired F64 (real, imag), as in std::complex<double>. + /// + [pbr::OriginalName("C128")] C128 = 18, + /// + /// A tuple is a polymorphic sequence; e.g. a shape that holds different + /// sub-shapes. They are used for things like returning multiple values from a + /// computation; e.g. a computation that returns weights and biases may have a + /// signature that results in a tuple like (f32[784x2000], f32[2000]) + /// + /// If a shape proto has the tuple element type, it may not have any entries + /// in the dimensions field. + /// + [pbr::OriginalName("TUPLE")] Tuple = 13, + /// + /// An opaque type used for passing context-specific data to a custom + /// operation. Shapes of this primitive type will have empty dimensions and + /// tuple_shapes fields. + /// + /// (OPAQUE would be a better name for this identifier, but that conflicts with + /// a macro defined in windows.h.) + /// + [pbr::OriginalName("OPAQUE_TYPE")] OpaqueType = 14, + /// + /// A token type threaded between side-effecting operations. Shapes of this + /// primitive type will have empty dimensions and tuple_shapes fields. + /// + [pbr::OriginalName("TOKEN")] Token = 17, + } + + /// + /// A DimLevelType indicates the encoding method for a dimension in an array. + /// The semantics of this field are identical to those of the MLIR SparseTensor + /// dialect. + /// This should be kept in sync with the SparseTensor DimLevelType enum: + /// https://github.com/llvm/llvm-project/blob/5674a3c88088e668b684326c2194a6282e8270ff/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td#L86 + /// + public enum DimLevelType { + /// + /// The corresponding dimension is Dense, every entry is stored. + /// + [pbr::OriginalName("DIM_DENSE")] DimDense = 0, + /// + /// The corresponding dimension is Compressed, only nonzeros are stored. + /// + [pbr::OriginalName("DIM_COMPRESSED")] DimCompressed = 1, + /// + /// The corresponding dimension contains a single coordinate, no sibling + /// elements for each parent. + /// + [pbr::OriginalName("DIM_SINGLETON")] DimSingleton = 2, + } + + /// + /// The type optimization profiles in use for Op-level optimizations. + /// + public enum ProfileType { + [pbr::OriginalName("INVALID")] Invalid = 0, + [pbr::OriginalName("WINDOW")] Window = 1, + [pbr::OriginalName("FLAG")] Flag = 2, + [pbr::OriginalName("INTEGER")] Integer = 3, + } + + /// + /// The source of the optimization profile. + /// + public enum ProfileSource { + [pbr::OriginalName("PROFILE_SOURCE_UNKNOWN_SOURCE")] UnknownSource = 0, + [pbr::OriginalName("PROFILE_SOURCE_EMBEDDED")] Embedded = 1, + [pbr::OriginalName("PROFILE_SOURCE_REMOTE")] Remote = 2, + } + + /// + /// The compilation event that triggered the use of the profile. + /// + public enum CompilationEvent { + [pbr::OriginalName("COMPILATION_EVENT_UNKNOWN_EVENT")] UnknownEvent = 0, + [pbr::OriginalName("COMPILATION_EVENT_FIRST_COMPILATION")] FirstCompilation = 1, + [pbr::OriginalName("COMPILATION_EVENT_RECOMPILATION")] Recompilation = 2, + } + + public enum PaddingType { + [pbr::OriginalName("PADDING_INVALID")] PaddingInvalid = 0, + /// + /// Only valid portion of the base are covered. + /// + [pbr::OriginalName("PADDING_VALID")] PaddingValid = 1, + /// + /// Extra is added to produce same output size as the input. + /// + [pbr::OriginalName("PADDING_SAME")] PaddingSame = 2, + } + + public enum FftType { + /// + /// Forward FFT; complex in, complex out. + /// + [pbr::OriginalName("FFT")] Fft = 0, + /// + /// Inverse FFT; complex in, complex out. + /// + [pbr::OriginalName("IFFT")] Ifft = 1, + /// + /// Forward real FFT; real in, fft_length / 2 + 1 complex out + /// + [pbr::OriginalName("RFFT")] Rfft = 2, + /// + /// Inverse real FFT; fft_length / 2 + 1 complex in, + /// + [pbr::OriginalName("IRFFT")] Irfft = 3, + } + + public enum RandomDistribution { + [pbr::OriginalName("RNG_INVALID")] RngInvalid = 0, + /// + /// Creates a uniform-distribution-generated random number on the semi-open + /// interval [parameter[0], parameter[1]). + /// + [pbr::OriginalName("RNG_UNIFORM")] RngUniform = 1, + /// + /// Creates a normal-distribution-generated random number with mean + /// parameter[0] and standard deviation parameter[1]. + /// + [pbr::OriginalName("RNG_NORMAL")] RngNormal = 2, + } + + public enum RandomAlgorithm { + /// + /// Backend dependent default algorithm. + /// + [pbr::OriginalName("RNG_DEFAULT")] RngDefault = 0, + [pbr::OriginalName("RNG_THREE_FRY")] RngThreeFry = 1, + /// + /// Next: 2 + /// + [pbr::OriginalName("RNG_PHILOX")] RngPhilox = 2, + } + + #endregion + + #region Messages + /// + /// Describes the padding configuration for Pad operation. The padding amount on + /// both edges as well as between the elements are specified for each dimension. + /// + public sealed partial class PaddingConfig : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PaddingConfig()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PaddingConfig() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PaddingConfig(PaddingConfig other) : this() { + dimensions_ = other.dimensions_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PaddingConfig Clone() { + return new PaddingConfig(this); + } + + /// Field number for the "dimensions" field. + public const int DimensionsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_dimensions_codec + = pb::FieldCodec.ForMessage(10, global::Xla.PaddingConfig.Types.PaddingConfigDimension.Parser); + private readonly pbc::RepeatedField dimensions_ = new pbc::RepeatedField(); + /// + /// The padding configuration for all dimensions. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Dimensions { + get { return dimensions_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as PaddingConfig); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(PaddingConfig other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!dimensions_.Equals(other.dimensions_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= dimensions_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + dimensions_.WriteTo(output, _repeated_dimensions_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + dimensions_.WriteTo(ref output, _repeated_dimensions_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += dimensions_.CalculateSize(_repeated_dimensions_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(PaddingConfig other) { + if (other == null) { + return; + } + dimensions_.Add(other.dimensions_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + dimensions_.AddEntriesFrom(input, _repeated_dimensions_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + dimensions_.AddEntriesFrom(ref input, _repeated_dimensions_codec); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the PaddingConfig message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + /// + /// Describes the padding configuration for a dimension. + /// + public sealed partial class PaddingConfigDimension : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PaddingConfigDimension()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.PaddingConfig.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PaddingConfigDimension() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PaddingConfigDimension(PaddingConfigDimension other) : this() { + edgePaddingLow_ = other.edgePaddingLow_; + edgePaddingHigh_ = other.edgePaddingHigh_; + interiorPadding_ = other.interiorPadding_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PaddingConfigDimension Clone() { + return new PaddingConfigDimension(this); + } + + /// Field number for the "edge_padding_low" field. + public const int EdgePaddingLowFieldNumber = 1; + private long edgePaddingLow_; + /// + /// Padding amount on the low-end (next to the index 0). May be negative. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long EdgePaddingLow { + get { return edgePaddingLow_; } + set { + edgePaddingLow_ = value; + } + } + + /// Field number for the "edge_padding_high" field. + public const int EdgePaddingHighFieldNumber = 2; + private long edgePaddingHigh_; + /// + /// Padding amount on the high-end (next to the highest index). May be + /// negative. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long EdgePaddingHigh { + get { return edgePaddingHigh_; } + set { + edgePaddingHigh_ = value; + } + } + + /// Field number for the "interior_padding" field. + public const int InteriorPaddingFieldNumber = 3; + private long interiorPadding_; + /// + /// Padding amount between the elements. May not be negative. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long InteriorPadding { + get { return interiorPadding_; } + set { + interiorPadding_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as PaddingConfigDimension); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(PaddingConfigDimension other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (EdgePaddingLow != other.EdgePaddingLow) return false; + if (EdgePaddingHigh != other.EdgePaddingHigh) return false; + if (InteriorPadding != other.InteriorPadding) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (EdgePaddingLow != 0L) hash ^= EdgePaddingLow.GetHashCode(); + if (EdgePaddingHigh != 0L) hash ^= EdgePaddingHigh.GetHashCode(); + if (InteriorPadding != 0L) hash ^= InteriorPadding.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (EdgePaddingLow != 0L) { + output.WriteRawTag(8); + output.WriteInt64(EdgePaddingLow); + } + if (EdgePaddingHigh != 0L) { + output.WriteRawTag(16); + output.WriteInt64(EdgePaddingHigh); + } + if (InteriorPadding != 0L) { + output.WriteRawTag(24); + output.WriteInt64(InteriorPadding); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (EdgePaddingLow != 0L) { + output.WriteRawTag(8); + output.WriteInt64(EdgePaddingLow); + } + if (EdgePaddingHigh != 0L) { + output.WriteRawTag(16); + output.WriteInt64(EdgePaddingHigh); + } + if (InteriorPadding != 0L) { + output.WriteRawTag(24); + output.WriteInt64(InteriorPadding); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (EdgePaddingLow != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(EdgePaddingLow); + } + if (EdgePaddingHigh != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(EdgePaddingHigh); + } + if (InteriorPadding != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(InteriorPadding); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(PaddingConfigDimension other) { + if (other == null) { + return; + } + if (other.EdgePaddingLow != 0L) { + EdgePaddingLow = other.EdgePaddingLow; + } + if (other.EdgePaddingHigh != 0L) { + EdgePaddingHigh = other.EdgePaddingHigh; + } + if (other.InteriorPadding != 0L) { + InteriorPadding = other.InteriorPadding; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + EdgePaddingLow = input.ReadInt64(); + break; + } + case 16: { + EdgePaddingHigh = input.ReadInt64(); + break; + } + case 24: { + InteriorPadding = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + EdgePaddingLow = input.ReadInt64(); + break; + } + case 16: { + EdgePaddingHigh = input.ReadInt64(); + break; + } + case 24: { + InteriorPadding = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + } + #endregion + + } + + /// + /// Describes a tile used in tiling-based layout. Refer to + /// g3doc/third_party/tensorflow/compiler/xla/g3doc/tiled_layout.md for + /// details about tiling-based layout. + /// + public sealed partial class TileProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TileProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TileProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TileProto(TileProto other) : this() { + dimensions_ = other.dimensions_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TileProto Clone() { + return new TileProto(this); + } + + /// Field number for the "dimensions" field. + public const int DimensionsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_dimensions_codec + = pb::FieldCodec.ForInt64(10); + private readonly pbc::RepeatedField dimensions_ = new pbc::RepeatedField(); + /// + /// Number of elements in each dimension of the tile. It's ordered from the + /// most major dimension of the tile to the most minor dimension of the tile. + /// The dimensions correspond to a suffix of the dimensions of the shape being + /// tiled. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Dimensions { + get { return dimensions_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TileProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TileProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!dimensions_.Equals(other.dimensions_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= dimensions_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + dimensions_.WriteTo(output, _repeated_dimensions_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + dimensions_.WriteTo(ref output, _repeated_dimensions_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += dimensions_.CalculateSize(_repeated_dimensions_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TileProto other) { + if (other == null) { + return; + } + dimensions_.Add(other.dimensions_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: + case 8: { + dimensions_.AddEntriesFrom(input, _repeated_dimensions_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: + case 8: { + dimensions_.AddEntriesFrom(ref input, _repeated_dimensions_codec); + break; + } + } + } + } + #endif + + } + + /// + /// A layout describes how the array is placed in (1D) memory space. This + /// includes the minor-to-major ordering of dimensions within a shape. + /// + /// Clients must specify the layouts of input Literals to the + /// computation. Layouts specified in interior operations which take Shapes (for + /// example, Convert) are ignored. + /// + /// See the XLA documentation for more information on shapes and layouts. + /// + /// LINT.IfChange + /// + public sealed partial class LayoutProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new LayoutProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LayoutProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LayoutProto(LayoutProto other) : this() { + dimLevelTypes_ = other.dimLevelTypes_.Clone(); + minorToMajor_ = other.minorToMajor_.Clone(); + tiles_ = other.tiles_.Clone(); + elementSizeInBits_ = other.elementSizeInBits_; + memorySpace_ = other.memorySpace_; + physicalShape_ = other.physicalShape_ != null ? other.physicalShape_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LayoutProto Clone() { + return new LayoutProto(this); + } + + /// Field number for the "dim_level_types" field. + public const int DimLevelTypesFieldNumber = 9; + private static readonly pb::FieldCodec _repeated_dimLevelTypes_codec + = pb::FieldCodec.ForEnum(74, x => (int) x, x => (global::Xla.DimLevelType) x); + private readonly pbc::RepeatedField dimLevelTypes_ = new pbc::RepeatedField(); + /// + /// The dimension level type list for this array, specifying the way in which + /// each array dimension is represented in memory. If this list is empty, the + /// array is assumed to be dense. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField DimLevelTypes { + get { return dimLevelTypes_; } + } + + /// Field number for the "minor_to_major" field. + public const int MinorToMajorFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_minorToMajor_codec + = pb::FieldCodec.ForInt64(10); + private readonly pbc::RepeatedField minorToMajor_ = new pbc::RepeatedField(); + /// + /// Sequence of dimension numbers, from minor (fastest varying index) to major + /// (slowest varying index). This field is required. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField MinorToMajor { + get { return minorToMajor_; } + } + + /// Field number for the "tiles" field. + public const int TilesFieldNumber = 6; + private static readonly pb::FieldCodec _repeated_tiles_codec + = pb::FieldCodec.ForMessage(50, global::Xla.TileProto.Parser); + private readonly pbc::RepeatedField tiles_ = new pbc::RepeatedField(); + /// + /// A sequence of tiles, starting from the tile that's applied first to the + /// Shape. + /// + /// TODO(b/119839262): implement tiling in each backend or add Unimplemented + /// error. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Tiles { + get { return tiles_; } + } + + /// Field number for the "element_size_in_bits" field. + public const int ElementSizeInBitsFieldNumber = 7; + private long elementSizeInBits_; + /// + /// Bit size of each element. If the size is bigger than what the element + /// type requires, the value is stored in the least significant + /// bits and the additional most significant bits are filled with 0's. + /// + /// TODO(b/119839262): implement in each backend or add Unimplemented error. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long ElementSizeInBits { + get { return elementSizeInBits_; } + set { + elementSizeInBits_ = value; + } + } + + /// Field number for the "memory_space" field. + public const int MemorySpaceFieldNumber = 8; + private long memorySpace_; + /// + /// Memory space where this array resides. The integer field is interpreted in + /// a backend-specific manner. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long MemorySpace { + get { return memorySpace_; } + set { + memorySpace_ = value; + } + } + + /// Field number for the "physical_shape" field. + public const int PhysicalShapeFieldNumber = 10; + private global::Xla.ShapeProto physicalShape_; + /// + /// The physical, on-device shape used to represent the shape this layout + /// belongs to. Only used for sparse arrays. + /// The layout(s) contained within the physical shape should not also contain + /// a physical shape. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ShapeProto PhysicalShape { + get { return physicalShape_; } + set { + physicalShape_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as LayoutProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(LayoutProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!dimLevelTypes_.Equals(other.dimLevelTypes_)) return false; + if(!minorToMajor_.Equals(other.minorToMajor_)) return false; + if(!tiles_.Equals(other.tiles_)) return false; + if (ElementSizeInBits != other.ElementSizeInBits) return false; + if (MemorySpace != other.MemorySpace) return false; + if (!object.Equals(PhysicalShape, other.PhysicalShape)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= dimLevelTypes_.GetHashCode(); + hash ^= minorToMajor_.GetHashCode(); + hash ^= tiles_.GetHashCode(); + if (ElementSizeInBits != 0L) hash ^= ElementSizeInBits.GetHashCode(); + if (MemorySpace != 0L) hash ^= MemorySpace.GetHashCode(); + if (physicalShape_ != null) hash ^= PhysicalShape.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + minorToMajor_.WriteTo(output, _repeated_minorToMajor_codec); + tiles_.WriteTo(output, _repeated_tiles_codec); + if (ElementSizeInBits != 0L) { + output.WriteRawTag(56); + output.WriteInt64(ElementSizeInBits); + } + if (MemorySpace != 0L) { + output.WriteRawTag(64); + output.WriteInt64(MemorySpace); + } + dimLevelTypes_.WriteTo(output, _repeated_dimLevelTypes_codec); + if (physicalShape_ != null) { + output.WriteRawTag(82); + output.WriteMessage(PhysicalShape); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + minorToMajor_.WriteTo(ref output, _repeated_minorToMajor_codec); + tiles_.WriteTo(ref output, _repeated_tiles_codec); + if (ElementSizeInBits != 0L) { + output.WriteRawTag(56); + output.WriteInt64(ElementSizeInBits); + } + if (MemorySpace != 0L) { + output.WriteRawTag(64); + output.WriteInt64(MemorySpace); + } + dimLevelTypes_.WriteTo(ref output, _repeated_dimLevelTypes_codec); + if (physicalShape_ != null) { + output.WriteRawTag(82); + output.WriteMessage(PhysicalShape); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += dimLevelTypes_.CalculateSize(_repeated_dimLevelTypes_codec); + size += minorToMajor_.CalculateSize(_repeated_minorToMajor_codec); + size += tiles_.CalculateSize(_repeated_tiles_codec); + if (ElementSizeInBits != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(ElementSizeInBits); + } + if (MemorySpace != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(MemorySpace); + } + if (physicalShape_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(PhysicalShape); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(LayoutProto other) { + if (other == null) { + return; + } + dimLevelTypes_.Add(other.dimLevelTypes_); + minorToMajor_.Add(other.minorToMajor_); + tiles_.Add(other.tiles_); + if (other.ElementSizeInBits != 0L) { + ElementSizeInBits = other.ElementSizeInBits; + } + if (other.MemorySpace != 0L) { + MemorySpace = other.MemorySpace; + } + if (other.physicalShape_ != null) { + if (physicalShape_ == null) { + PhysicalShape = new global::Xla.ShapeProto(); + } + PhysicalShape.MergeFrom(other.PhysicalShape); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: + case 8: { + minorToMajor_.AddEntriesFrom(input, _repeated_minorToMajor_codec); + break; + } + case 50: { + tiles_.AddEntriesFrom(input, _repeated_tiles_codec); + break; + } + case 56: { + ElementSizeInBits = input.ReadInt64(); + break; + } + case 64: { + MemorySpace = input.ReadInt64(); + break; + } + case 74: + case 72: { + dimLevelTypes_.AddEntriesFrom(input, _repeated_dimLevelTypes_codec); + break; + } + case 82: { + if (physicalShape_ == null) { + PhysicalShape = new global::Xla.ShapeProto(); + } + input.ReadMessage(PhysicalShape); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: + case 8: { + minorToMajor_.AddEntriesFrom(ref input, _repeated_minorToMajor_codec); + break; + } + case 50: { + tiles_.AddEntriesFrom(ref input, _repeated_tiles_codec); + break; + } + case 56: { + ElementSizeInBits = input.ReadInt64(); + break; + } + case 64: { + MemorySpace = input.ReadInt64(); + break; + } + case 74: + case 72: { + dimLevelTypes_.AddEntriesFrom(ref input, _repeated_dimLevelTypes_codec); + break; + } + case 82: { + if (physicalShape_ == null) { + PhysicalShape = new global::Xla.ShapeProto(); + } + input.ReadMessage(PhysicalShape); + break; + } + } + } + } + #endif + + } + + /// + /// A shape describes the number of dimensions in the array, the size of each + /// dimension, and the primitive component type. + /// + /// Tuples are a special case in that they have rank zero and have tuple_shapes + /// defined. + /// + /// See the XLA documentation for more information on shapes and layouts. + /// + /// LINT.IfChange + /// + public sealed partial class ShapeProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ShapeProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ShapeProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ShapeProto(ShapeProto other) : this() { + elementType_ = other.elementType_; + dimensions_ = other.dimensions_.Clone(); + tupleShapes_ = other.tupleShapes_.Clone(); + layout_ = other.layout_ != null ? other.layout_.Clone() : null; + isDynamicDimension_ = other.isDynamicDimension_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ShapeProto Clone() { + return new ShapeProto(this); + } + + /// Field number for the "element_type" field. + public const int ElementTypeFieldNumber = 2; + private global::Xla.PrimitiveType elementType_ = global::Xla.PrimitiveType.Invalid; + /// + /// The element type for this shape. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.PrimitiveType ElementType { + get { return elementType_; } + set { + elementType_ = value; + } + } + + /// Field number for the "dimensions" field. + public const int DimensionsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_dimensions_codec + = pb::FieldCodec.ForInt64(26); + private readonly pbc::RepeatedField dimensions_ = new pbc::RepeatedField(); + /// + /// The size (number of elements) for each dimension, or an upper bound on the + /// size if the dimension is dynamic. In XLA, dimensions are numbered from 0 + /// to N-1 for an N-dimensional array. The first element of 'dimensions' is the + /// size of dimension 0, the second element is the size of dimension 1, and so + /// forth. Empty list indicates a scalar. + /// + /// If the respective element in 'is_dimension_dynamic' is true then the value + /// in this field represents an upper bound on the size of the dimension. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Dimensions { + get { return dimensions_; } + } + + /// Field number for the "tuple_shapes" field. + public const int TupleShapesFieldNumber = 4; + private static readonly pb::FieldCodec _repeated_tupleShapes_codec + = pb::FieldCodec.ForMessage(34, global::Xla.ShapeProto.Parser); + private readonly pbc::RepeatedField tupleShapes_ = new pbc::RepeatedField(); + /// + /// For tuples only, the shapes of constituent shapes in the tuple sequence. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField TupleShapes { + get { return tupleShapes_; } + } + + /// Field number for the "layout" field. + public const int LayoutFieldNumber = 5; + private global::Xla.LayoutProto layout_; + /// + /// The layout used to back this shape. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.LayoutProto Layout { + get { return layout_; } + set { + layout_ = value; + } + } + + /// Field number for the "is_dynamic_dimension" field. + public const int IsDynamicDimensionFieldNumber = 6; + private static readonly pb::FieldCodec _repeated_isDynamicDimension_codec + = pb::FieldCodec.ForBool(50); + private readonly pbc::RepeatedField isDynamicDimension_ = new pbc::RepeatedField(); + /// + /// For arrays, this indicates whether or not each dimension is + /// dynamically-sized. The number of elements in this repeated field should be + /// zero (indicating that no dimensions are dynamic) or equal to the number of + /// elements in the 'dimensions' field. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField IsDynamicDimension { + get { return isDynamicDimension_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ShapeProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ShapeProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ElementType != other.ElementType) return false; + if(!dimensions_.Equals(other.dimensions_)) return false; + if(!tupleShapes_.Equals(other.tupleShapes_)) return false; + if (!object.Equals(Layout, other.Layout)) return false; + if(!isDynamicDimension_.Equals(other.isDynamicDimension_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (ElementType != global::Xla.PrimitiveType.Invalid) hash ^= ElementType.GetHashCode(); + hash ^= dimensions_.GetHashCode(); + hash ^= tupleShapes_.GetHashCode(); + if (layout_ != null) hash ^= Layout.GetHashCode(); + hash ^= isDynamicDimension_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ElementType != global::Xla.PrimitiveType.Invalid) { + output.WriteRawTag(16); + output.WriteEnum((int) ElementType); + } + dimensions_.WriteTo(output, _repeated_dimensions_codec); + tupleShapes_.WriteTo(output, _repeated_tupleShapes_codec); + if (layout_ != null) { + output.WriteRawTag(42); + output.WriteMessage(Layout); + } + isDynamicDimension_.WriteTo(output, _repeated_isDynamicDimension_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ElementType != global::Xla.PrimitiveType.Invalid) { + output.WriteRawTag(16); + output.WriteEnum((int) ElementType); + } + dimensions_.WriteTo(ref output, _repeated_dimensions_codec); + tupleShapes_.WriteTo(ref output, _repeated_tupleShapes_codec); + if (layout_ != null) { + output.WriteRawTag(42); + output.WriteMessage(Layout); + } + isDynamicDimension_.WriteTo(ref output, _repeated_isDynamicDimension_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (ElementType != global::Xla.PrimitiveType.Invalid) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) ElementType); + } + size += dimensions_.CalculateSize(_repeated_dimensions_codec); + size += tupleShapes_.CalculateSize(_repeated_tupleShapes_codec); + if (layout_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Layout); + } + size += isDynamicDimension_.CalculateSize(_repeated_isDynamicDimension_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ShapeProto other) { + if (other == null) { + return; + } + if (other.ElementType != global::Xla.PrimitiveType.Invalid) { + ElementType = other.ElementType; + } + dimensions_.Add(other.dimensions_); + tupleShapes_.Add(other.tupleShapes_); + if (other.layout_ != null) { + if (layout_ == null) { + Layout = new global::Xla.LayoutProto(); + } + Layout.MergeFrom(other.Layout); + } + isDynamicDimension_.Add(other.isDynamicDimension_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 16: { + ElementType = (global::Xla.PrimitiveType) input.ReadEnum(); + break; + } + case 26: + case 24: { + dimensions_.AddEntriesFrom(input, _repeated_dimensions_codec); + break; + } + case 34: { + tupleShapes_.AddEntriesFrom(input, _repeated_tupleShapes_codec); + break; + } + case 42: { + if (layout_ == null) { + Layout = new global::Xla.LayoutProto(); + } + input.ReadMessage(Layout); + break; + } + case 50: + case 48: { + isDynamicDimension_.AddEntriesFrom(input, _repeated_isDynamicDimension_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 16: { + ElementType = (global::Xla.PrimitiveType) input.ReadEnum(); + break; + } + case 26: + case 24: { + dimensions_.AddEntriesFrom(ref input, _repeated_dimensions_codec); + break; + } + case 34: { + tupleShapes_.AddEntriesFrom(ref input, _repeated_tupleShapes_codec); + break; + } + case 42: { + if (layout_ == null) { + Layout = new global::Xla.LayoutProto(); + } + input.ReadMessage(Layout); + break; + } + case 50: + case 48: { + isDynamicDimension_.AddEntriesFrom(ref input, _repeated_isDynamicDimension_codec); + break; + } + } + } + } + #endif + + } + + /// + /// Shape of the parameters and output of a computation (like a traditional + /// function signature). + /// + public sealed partial class ProgramShapeProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ProgramShapeProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ProgramShapeProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ProgramShapeProto(ProgramShapeProto other) : this() { + parameters_ = other.parameters_.Clone(); + result_ = other.result_ != null ? other.result_.Clone() : null; + parameterNames_ = other.parameterNames_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ProgramShapeProto Clone() { + return new ProgramShapeProto(this); + } + + /// Field number for the "parameters" field. + public const int ParametersFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_parameters_codec + = pb::FieldCodec.ForMessage(10, global::Xla.ShapeProto.Parser); + private readonly pbc::RepeatedField parameters_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Parameters { + get { return parameters_; } + } + + /// Field number for the "result" field. + public const int ResultFieldNumber = 2; + private global::Xla.ShapeProto result_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ShapeProto Result { + get { return result_; } + set { + result_ = value; + } + } + + /// Field number for the "parameter_names" field. + public const int ParameterNamesFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_parameterNames_codec + = pb::FieldCodec.ForString(26); + private readonly pbc::RepeatedField parameterNames_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField ParameterNames { + get { return parameterNames_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ProgramShapeProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ProgramShapeProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!parameters_.Equals(other.parameters_)) return false; + if (!object.Equals(Result, other.Result)) return false; + if(!parameterNames_.Equals(other.parameterNames_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= parameters_.GetHashCode(); + if (result_ != null) hash ^= Result.GetHashCode(); + hash ^= parameterNames_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + parameters_.WriteTo(output, _repeated_parameters_codec); + if (result_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Result); + } + parameterNames_.WriteTo(output, _repeated_parameterNames_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + parameters_.WriteTo(ref output, _repeated_parameters_codec); + if (result_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Result); + } + parameterNames_.WriteTo(ref output, _repeated_parameterNames_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += parameters_.CalculateSize(_repeated_parameters_codec); + if (result_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Result); + } + size += parameterNames_.CalculateSize(_repeated_parameterNames_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ProgramShapeProto other) { + if (other == null) { + return; + } + parameters_.Add(other.parameters_); + if (other.result_ != null) { + if (result_ == null) { + Result = new global::Xla.ShapeProto(); + } + Result.MergeFrom(other.Result); + } + parameterNames_.Add(other.parameterNames_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + parameters_.AddEntriesFrom(input, _repeated_parameters_codec); + break; + } + case 18: { + if (result_ == null) { + Result = new global::Xla.ShapeProto(); + } + input.ReadMessage(Result); + break; + } + case 26: { + parameterNames_.AddEntriesFrom(input, _repeated_parameterNames_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + parameters_.AddEntriesFrom(ref input, _repeated_parameters_codec); + break; + } + case 18: { + if (result_ == null) { + Result = new global::Xla.ShapeProto(); + } + input.ReadMessage(Result); + break; + } + case 26: { + parameterNames_.AddEntriesFrom(ref input, _repeated_parameterNames_codec); + break; + } + } + } + } + #endif + + } + + /// + /// Statistics of a computation. + /// + public sealed partial class ComputationStats : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ComputationStats()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[5]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ComputationStats() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ComputationStats(ComputationStats other) : this() { + flopCount_ = other.flopCount_; + transcendentalCount_ = other.transcendentalCount_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ComputationStats Clone() { + return new ComputationStats(this); + } + + /// Field number for the "flop_count" field. + public const int FlopCountFieldNumber = 1; + private double flopCount_; + /// + /// The number of floating point operations in the computation. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double FlopCount { + get { return flopCount_; } + set { + flopCount_ = value; + } + } + + /// Field number for the "transcendental_count" field. + public const int TranscendentalCountFieldNumber = 2; + private double transcendentalCount_; + /// + /// The number of transcendental operations (e.g., exp) in the computation. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double TranscendentalCount { + get { return transcendentalCount_; } + set { + transcendentalCount_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ComputationStats); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ComputationStats other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(FlopCount, other.FlopCount)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(TranscendentalCount, other.TranscendentalCount)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (FlopCount != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(FlopCount); + if (TranscendentalCount != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(TranscendentalCount); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (FlopCount != 0D) { + output.WriteRawTag(9); + output.WriteDouble(FlopCount); + } + if (TranscendentalCount != 0D) { + output.WriteRawTag(17); + output.WriteDouble(TranscendentalCount); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (FlopCount != 0D) { + output.WriteRawTag(9); + output.WriteDouble(FlopCount); + } + if (TranscendentalCount != 0D) { + output.WriteRawTag(17); + output.WriteDouble(TranscendentalCount); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (FlopCount != 0D) { + size += 1 + 8; + } + if (TranscendentalCount != 0D) { + size += 1 + 8; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ComputationStats other) { + if (other == null) { + return; + } + if (other.FlopCount != 0D) { + FlopCount = other.FlopCount; + } + if (other.TranscendentalCount != 0D) { + TranscendentalCount = other.TranscendentalCount; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 9: { + FlopCount = input.ReadDouble(); + break; + } + case 17: { + TranscendentalCount = input.ReadDouble(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 9: { + FlopCount = input.ReadDouble(); + break; + } + case 17: { + TranscendentalCount = input.ReadDouble(); + break; + } + } + } + } + #endif + + } + + /// + /// Symbolization metadata for HLO Instructions. + /// + /// This metadata is used for debugging XLA code generation, as well as + /// performance profiling of XLA-generated executables. + /// + public sealed partial class OpMetadata : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OpMetadata()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[6]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public OpMetadata() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public OpMetadata(OpMetadata other) : this() { + opType_ = other.opType_; + opName_ = other.opName_; + sourceFile_ = other.sourceFile_; + sourceLine_ = other.sourceLine_; + profileType_ = other.profileType_.Clone(); + creationPassId_ = other.creationPassId_; + logicalCreationPassId_ = other.logicalCreationPassId_; + sizeOfGeneratedCodeInBytes_ = other.sizeOfGeneratedCodeInBytes_; + sizeOfMemoryWorkingSetInBytes_ = other.sizeOfMemoryWorkingSetInBytes_; + profileInfo_ = other.profileInfo_ != null ? other.profileInfo_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public OpMetadata Clone() { + return new OpMetadata(this); + } + + /// Field number for the "op_type" field. + public const int OpTypeFieldNumber = 1; + private string opType_ = ""; + /// + /// The framework op name that generated this XLA op. + /// + /// Frameworks that build on top of XLA should mirror the names of their ops + /// back to users by specifying the op_type. In this way, even if the + /// framework's "ops" are implemented as multiple XLA HLO Ops, they can be + /// grouped appropriately. (e.g. if a SoftMax layer is emitted into XLA as + /// multiple ops, then each op should have the op_type be "SoftMax".) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string OpType { + get { return opType_; } + set { + opType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "op_name" field. + public const int OpNameFieldNumber = 2; + private string opName_ = ""; + /// + /// The user-specified name of the op. + /// + /// This name is often unique within a computation. Note: some frameworks + /// add auto-generated names if the user does not provide one. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string OpName { + get { return opName_; } + set { + opName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "source_file" field. + public const int SourceFileFieldNumber = 3; + private string sourceFile_ = ""; + /// + /// Indicate a file and line that this op is associated to in a user's program. + /// + /// e.g. it could be the file and line of user code that generated the op. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string SourceFile { + get { return sourceFile_; } + set { + sourceFile_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "source_line" field. + public const int SourceLineFieldNumber = 4; + private int sourceLine_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int SourceLine { + get { return sourceLine_; } + set { + sourceLine_ = value; + } + } + + /// Field number for the "profile_type" field. + public const int ProfileTypeFieldNumber = 5; + private static readonly pb::FieldCodec _repeated_profileType_codec + = pb::FieldCodec.ForEnum(42, x => (int) x, x => (global::Xla.ProfileType) x); + private readonly pbc::RepeatedField profileType_ = new pbc::RepeatedField(); + /// + /// Deprecated, use [ProfileInfo][profile_type] instead. + /// + [global::System.ObsoleteAttribute] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField ProfileType { + get { return profileType_; } + } + + /// Field number for the "creation_pass_id" field. + public const int CreationPassIdFieldNumber = 6; + private long creationPassId_; + /// + /// HloPassMetadata.pass_id of the pass that created this HLO instruction + /// object. Should never be copied between HLO instructions. Zero if unset and + /// -1 if the instruction was created before HLO passes began. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long CreationPassId { + get { return creationPassId_; } + set { + creationPassId_ = value; + } + } + + /// Field number for the "logical_creation_pass_id" field. + public const int LogicalCreationPassIdFieldNumber = 7; + private long logicalCreationPassId_; + /// + /// HloPassMetadata.pass_id of the pass that created the logical functionality + /// that this HLO instruction represents. Should be copied between HLO + /// instructions that correspond across compilation passes. Zero if unset and + /// -1 if the instruction was created before HLO passes began. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long LogicalCreationPassId { + get { return logicalCreationPassId_; } + set { + logicalCreationPassId_ = value; + } + } + + /// Field number for the "size_of_generated_code_in_bytes" field. + public const int SizeOfGeneratedCodeInBytesFieldNumber = 8; + private long sizeOfGeneratedCodeInBytes_; + /// + /// The footprint of the generated code for the instruction. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long SizeOfGeneratedCodeInBytes { + get { return sizeOfGeneratedCodeInBytes_; } + set { + sizeOfGeneratedCodeInBytes_ = value; + } + } + + /// Field number for the "size_of_memory_working_set_in_bytes" field. + public const int SizeOfMemoryWorkingSetInBytesFieldNumber = 9; + private long sizeOfMemoryWorkingSetInBytes_; + /// + /// The size of the working set, i.e., the amount of memory, used by the + /// instruction in a compiler-managed fast device memory. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long SizeOfMemoryWorkingSetInBytes { + get { return sizeOfMemoryWorkingSetInBytes_; } + set { + sizeOfMemoryWorkingSetInBytes_ = value; + } + } + + /// Field number for the "profile_info" field. + public const int ProfileInfoFieldNumber = 10; + private global::Xla.OpMetadata.Types.ProfileInfo profileInfo_; + /// + /// Profile information for the Op. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.OpMetadata.Types.ProfileInfo ProfileInfo { + get { return profileInfo_; } + set { + profileInfo_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as OpMetadata); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(OpMetadata other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (OpType != other.OpType) return false; + if (OpName != other.OpName) return false; + if (SourceFile != other.SourceFile) return false; + if (SourceLine != other.SourceLine) return false; + if(!profileType_.Equals(other.profileType_)) return false; + if (CreationPassId != other.CreationPassId) return false; + if (LogicalCreationPassId != other.LogicalCreationPassId) return false; + if (SizeOfGeneratedCodeInBytes != other.SizeOfGeneratedCodeInBytes) return false; + if (SizeOfMemoryWorkingSetInBytes != other.SizeOfMemoryWorkingSetInBytes) return false; + if (!object.Equals(ProfileInfo, other.ProfileInfo)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (OpType.Length != 0) hash ^= OpType.GetHashCode(); + if (OpName.Length != 0) hash ^= OpName.GetHashCode(); + if (SourceFile.Length != 0) hash ^= SourceFile.GetHashCode(); + if (SourceLine != 0) hash ^= SourceLine.GetHashCode(); + hash ^= profileType_.GetHashCode(); + if (CreationPassId != 0L) hash ^= CreationPassId.GetHashCode(); + if (LogicalCreationPassId != 0L) hash ^= LogicalCreationPassId.GetHashCode(); + if (SizeOfGeneratedCodeInBytes != 0L) hash ^= SizeOfGeneratedCodeInBytes.GetHashCode(); + if (SizeOfMemoryWorkingSetInBytes != 0L) hash ^= SizeOfMemoryWorkingSetInBytes.GetHashCode(); + if (profileInfo_ != null) hash ^= ProfileInfo.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (OpType.Length != 0) { + output.WriteRawTag(10); + output.WriteString(OpType); + } + if (OpName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(OpName); + } + if (SourceFile.Length != 0) { + output.WriteRawTag(26); + output.WriteString(SourceFile); + } + if (SourceLine != 0) { + output.WriteRawTag(32); + output.WriteInt32(SourceLine); + } + profileType_.WriteTo(output, _repeated_profileType_codec); + if (CreationPassId != 0L) { + output.WriteRawTag(48); + output.WriteInt64(CreationPassId); + } + if (LogicalCreationPassId != 0L) { + output.WriteRawTag(56); + output.WriteInt64(LogicalCreationPassId); + } + if (SizeOfGeneratedCodeInBytes != 0L) { + output.WriteRawTag(64); + output.WriteInt64(SizeOfGeneratedCodeInBytes); + } + if (SizeOfMemoryWorkingSetInBytes != 0L) { + output.WriteRawTag(72); + output.WriteInt64(SizeOfMemoryWorkingSetInBytes); + } + if (profileInfo_ != null) { + output.WriteRawTag(82); + output.WriteMessage(ProfileInfo); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (OpType.Length != 0) { + output.WriteRawTag(10); + output.WriteString(OpType); + } + if (OpName.Length != 0) { + output.WriteRawTag(18); + output.WriteString(OpName); + } + if (SourceFile.Length != 0) { + output.WriteRawTag(26); + output.WriteString(SourceFile); + } + if (SourceLine != 0) { + output.WriteRawTag(32); + output.WriteInt32(SourceLine); + } + profileType_.WriteTo(ref output, _repeated_profileType_codec); + if (CreationPassId != 0L) { + output.WriteRawTag(48); + output.WriteInt64(CreationPassId); + } + if (LogicalCreationPassId != 0L) { + output.WriteRawTag(56); + output.WriteInt64(LogicalCreationPassId); + } + if (SizeOfGeneratedCodeInBytes != 0L) { + output.WriteRawTag(64); + output.WriteInt64(SizeOfGeneratedCodeInBytes); + } + if (SizeOfMemoryWorkingSetInBytes != 0L) { + output.WriteRawTag(72); + output.WriteInt64(SizeOfMemoryWorkingSetInBytes); + } + if (profileInfo_ != null) { + output.WriteRawTag(82); + output.WriteMessage(ProfileInfo); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (OpType.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OpType); + } + if (OpName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OpName); + } + if (SourceFile.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(SourceFile); + } + if (SourceLine != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(SourceLine); + } + size += profileType_.CalculateSize(_repeated_profileType_codec); + if (CreationPassId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(CreationPassId); + } + if (LogicalCreationPassId != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(LogicalCreationPassId); + } + if (SizeOfGeneratedCodeInBytes != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(SizeOfGeneratedCodeInBytes); + } + if (SizeOfMemoryWorkingSetInBytes != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(SizeOfMemoryWorkingSetInBytes); + } + if (profileInfo_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(ProfileInfo); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(OpMetadata other) { + if (other == null) { + return; + } + if (other.OpType.Length != 0) { + OpType = other.OpType; + } + if (other.OpName.Length != 0) { + OpName = other.OpName; + } + if (other.SourceFile.Length != 0) { + SourceFile = other.SourceFile; + } + if (other.SourceLine != 0) { + SourceLine = other.SourceLine; + } + profileType_.Add(other.profileType_); + if (other.CreationPassId != 0L) { + CreationPassId = other.CreationPassId; + } + if (other.LogicalCreationPassId != 0L) { + LogicalCreationPassId = other.LogicalCreationPassId; + } + if (other.SizeOfGeneratedCodeInBytes != 0L) { + SizeOfGeneratedCodeInBytes = other.SizeOfGeneratedCodeInBytes; + } + if (other.SizeOfMemoryWorkingSetInBytes != 0L) { + SizeOfMemoryWorkingSetInBytes = other.SizeOfMemoryWorkingSetInBytes; + } + if (other.profileInfo_ != null) { + if (profileInfo_ == null) { + ProfileInfo = new global::Xla.OpMetadata.Types.ProfileInfo(); + } + ProfileInfo.MergeFrom(other.ProfileInfo); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + OpType = input.ReadString(); + break; + } + case 18: { + OpName = input.ReadString(); + break; + } + case 26: { + SourceFile = input.ReadString(); + break; + } + case 32: { + SourceLine = input.ReadInt32(); + break; + } + case 42: + case 40: { + profileType_.AddEntriesFrom(input, _repeated_profileType_codec); + break; + } + case 48: { + CreationPassId = input.ReadInt64(); + break; + } + case 56: { + LogicalCreationPassId = input.ReadInt64(); + break; + } + case 64: { + SizeOfGeneratedCodeInBytes = input.ReadInt64(); + break; + } + case 72: { + SizeOfMemoryWorkingSetInBytes = input.ReadInt64(); + break; + } + case 82: { + if (profileInfo_ == null) { + ProfileInfo = new global::Xla.OpMetadata.Types.ProfileInfo(); + } + input.ReadMessage(ProfileInfo); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + OpType = input.ReadString(); + break; + } + case 18: { + OpName = input.ReadString(); + break; + } + case 26: { + SourceFile = input.ReadString(); + break; + } + case 32: { + SourceLine = input.ReadInt32(); + break; + } + case 42: + case 40: { + profileType_.AddEntriesFrom(ref input, _repeated_profileType_codec); + break; + } + case 48: { + CreationPassId = input.ReadInt64(); + break; + } + case 56: { + LogicalCreationPassId = input.ReadInt64(); + break; + } + case 64: { + SizeOfGeneratedCodeInBytes = input.ReadInt64(); + break; + } + case 72: { + SizeOfMemoryWorkingSetInBytes = input.ReadInt64(); + break; + } + case 82: { + if (profileInfo_ == null) { + ProfileInfo = new global::Xla.OpMetadata.Types.ProfileInfo(); + } + input.ReadMessage(ProfileInfo); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the OpMetadata message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + /// + /// Information about the optimization profile that this operation contains. + /// + public sealed partial class ProfileInfo : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ProfileInfo()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.OpMetadata.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ProfileInfo() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ProfileInfo(ProfileInfo other) : this() { + profileType_ = other.profileType_.Clone(); + relativeSpeedup_ = other.relativeSpeedup_; + profileSource_ = other.profileSource_; + compilationEvent_ = other.compilationEvent_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ProfileInfo Clone() { + return new ProfileInfo(this); + } + + /// Field number for the "profile_type" field. + public const int ProfileTypeFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_profileType_codec + = pb::FieldCodec.ForEnum(10, x => (int) x, x => (global::Xla.ProfileType) x); + private readonly pbc::RepeatedField profileType_ = new pbc::RepeatedField(); + /// + /// The type of optimization profiles that this operation contains. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField ProfileType { + get { return profileType_; } + } + + /// Field number for the "relative_speedup" field. + public const int RelativeSpeedupFieldNumber = 2; + private double relativeSpeedup_; + /// + /// Speedup of tuned config compared to default config. + /// TODO(b/203817882) Set the relative_speedup. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public double RelativeSpeedup { + get { return relativeSpeedup_; } + set { + relativeSpeedup_ = value; + } + } + + /// Field number for the "profile_source" field. + public const int ProfileSourceFieldNumber = 3; + private global::Xla.ProfileSource profileSource_ = global::Xla.ProfileSource.UnknownSource; + /// + /// The source of the optimization profiles that this operation contains. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ProfileSource ProfileSource { + get { return profileSource_; } + set { + profileSource_ = value; + } + } + + /// Field number for the "compilation_event" field. + public const int CompilationEventFieldNumber = 4; + private global::Xla.CompilationEvent compilationEvent_ = global::Xla.CompilationEvent.UnknownEvent; + /// + /// The compilation event that triggered the use of the profiles. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.CompilationEvent CompilationEvent { + get { return compilationEvent_; } + set { + compilationEvent_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ProfileInfo); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ProfileInfo other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!profileType_.Equals(other.profileType_)) return false; + if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(RelativeSpeedup, other.RelativeSpeedup)) return false; + if (ProfileSource != other.ProfileSource) return false; + if (CompilationEvent != other.CompilationEvent) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= profileType_.GetHashCode(); + if (RelativeSpeedup != 0D) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(RelativeSpeedup); + if (ProfileSource != global::Xla.ProfileSource.UnknownSource) hash ^= ProfileSource.GetHashCode(); + if (CompilationEvent != global::Xla.CompilationEvent.UnknownEvent) hash ^= CompilationEvent.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + profileType_.WriteTo(output, _repeated_profileType_codec); + if (RelativeSpeedup != 0D) { + output.WriteRawTag(17); + output.WriteDouble(RelativeSpeedup); + } + if (ProfileSource != global::Xla.ProfileSource.UnknownSource) { + output.WriteRawTag(24); + output.WriteEnum((int) ProfileSource); + } + if (CompilationEvent != global::Xla.CompilationEvent.UnknownEvent) { + output.WriteRawTag(32); + output.WriteEnum((int) CompilationEvent); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + profileType_.WriteTo(ref output, _repeated_profileType_codec); + if (RelativeSpeedup != 0D) { + output.WriteRawTag(17); + output.WriteDouble(RelativeSpeedup); + } + if (ProfileSource != global::Xla.ProfileSource.UnknownSource) { + output.WriteRawTag(24); + output.WriteEnum((int) ProfileSource); + } + if (CompilationEvent != global::Xla.CompilationEvent.UnknownEvent) { + output.WriteRawTag(32); + output.WriteEnum((int) CompilationEvent); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += profileType_.CalculateSize(_repeated_profileType_codec); + if (RelativeSpeedup != 0D) { + size += 1 + 8; + } + if (ProfileSource != global::Xla.ProfileSource.UnknownSource) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) ProfileSource); + } + if (CompilationEvent != global::Xla.CompilationEvent.UnknownEvent) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) CompilationEvent); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ProfileInfo other) { + if (other == null) { + return; + } + profileType_.Add(other.profileType_); + if (other.RelativeSpeedup != 0D) { + RelativeSpeedup = other.RelativeSpeedup; + } + if (other.ProfileSource != global::Xla.ProfileSource.UnknownSource) { + ProfileSource = other.ProfileSource; + } + if (other.CompilationEvent != global::Xla.CompilationEvent.UnknownEvent) { + CompilationEvent = other.CompilationEvent; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: + case 8: { + profileType_.AddEntriesFrom(input, _repeated_profileType_codec); + break; + } + case 17: { + RelativeSpeedup = input.ReadDouble(); + break; + } + case 24: { + ProfileSource = (global::Xla.ProfileSource) input.ReadEnum(); + break; + } + case 32: { + CompilationEvent = (global::Xla.CompilationEvent) input.ReadEnum(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: + case 8: { + profileType_.AddEntriesFrom(ref input, _repeated_profileType_codec); + break; + } + case 17: { + RelativeSpeedup = input.ReadDouble(); + break; + } + case 24: { + ProfileSource = (global::Xla.ProfileSource) input.ReadEnum(); + break; + } + case 32: { + CompilationEvent = (global::Xla.CompilationEvent) input.ReadEnum(); + break; + } + } + } + } + #endif + + } + + } + #endregion + + } + + /// + /// Profile data from the execution of a computation. + /// + public sealed partial class ExecutionProfile : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExecutionProfile()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[7]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecutionProfile() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecutionProfile(ExecutionProfile other) : this() { + compilationCacheHit_ = other.compilationCacheHit_; + compileTimeMs_ = other.compileTimeMs_; + computeCycleCount_ = other.computeCycleCount_; + computeTimeNs_ = other.computeTimeNs_; + computeAndTransferTimeNs_ = other.computeAndTransferTimeNs_; + executableSizeInBytes_ = other.executableSizeInBytes_; + profileCacheHit_ = other.profileCacheHit_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecutionProfile Clone() { + return new ExecutionProfile(this); + } + + /// Field number for the "compilation_cache_hit" field. + public const int CompilationCacheHitFieldNumber = 1; + private bool compilationCacheHit_; + /// + /// Whether the executable was read from the compilation cache. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool CompilationCacheHit { + get { return compilationCacheHit_; } + set { + compilationCacheHit_ = value; + } + } + + /// Field number for the "compile_time_ms" field. + public const int CompileTimeMsFieldNumber = 2; + private long compileTimeMs_; + /// + /// The time in milliseconds spent to compile the computation. This only set if + /// the executable was not read from the compilation cache + /// (compilation_cache_hit == false). + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long CompileTimeMs { + get { return compileTimeMs_; } + set { + compileTimeMs_ = value; + } + } + + /// Field number for the "compute_cycle_count" field. + public const int ComputeCycleCountFieldNumber = 3; + private long computeCycleCount_; + /// + /// The number of cycles spent for the computation. This does not include the + /// time taken for the data transfers between the host and the device. This is + /// a target-dependent field and only used for debugging purposes. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long ComputeCycleCount { + get { return computeCycleCount_; } + set { + computeCycleCount_ = value; + } + } + + /// Field number for the "compute_time_ns" field. + public const int ComputeTimeNsFieldNumber = 4; + private long computeTimeNs_; + /// + /// The time in nanoseconds spent for the computation, without data transfer. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long ComputeTimeNs { + get { return computeTimeNs_; } + set { + computeTimeNs_ = value; + } + } + + /// Field number for the "compute_and_transfer_time_ns" field. + public const int ComputeAndTransferTimeNsFieldNumber = 5; + private long computeAndTransferTimeNs_; + /// + /// The time in nanoseconds spent for the entire computation, including the + /// result data transfer time. Current implementation does not spend any cycles + /// for the input data transfer since the memory is initialized with the proper + /// values before the execution. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long ComputeAndTransferTimeNs { + get { return computeAndTransferTimeNs_; } + set { + computeAndTransferTimeNs_ = value; + } + } + + /// Field number for the "executable_size_in_bytes" field. + public const int ExecutableSizeInBytesFieldNumber = 6; + private long executableSizeInBytes_; + /// + /// The size of the binary code in the executable. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long ExecutableSizeInBytes { + get { return executableSizeInBytes_; } + set { + executableSizeInBytes_ = value; + } + } + + /// Field number for the "profile_cache_hit" field. + public const int ProfileCacheHitFieldNumber = 7; + private bool profileCacheHit_; + /// + /// Whether this profile was drawn from a cache of profiles instead of from + /// execution on the hardware. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool ProfileCacheHit { + get { return profileCacheHit_; } + set { + profileCacheHit_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ExecutionProfile); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ExecutionProfile other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (CompilationCacheHit != other.CompilationCacheHit) return false; + if (CompileTimeMs != other.CompileTimeMs) return false; + if (ComputeCycleCount != other.ComputeCycleCount) return false; + if (ComputeTimeNs != other.ComputeTimeNs) return false; + if (ComputeAndTransferTimeNs != other.ComputeAndTransferTimeNs) return false; + if (ExecutableSizeInBytes != other.ExecutableSizeInBytes) return false; + if (ProfileCacheHit != other.ProfileCacheHit) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (CompilationCacheHit != false) hash ^= CompilationCacheHit.GetHashCode(); + if (CompileTimeMs != 0L) hash ^= CompileTimeMs.GetHashCode(); + if (ComputeCycleCount != 0L) hash ^= ComputeCycleCount.GetHashCode(); + if (ComputeTimeNs != 0L) hash ^= ComputeTimeNs.GetHashCode(); + if (ComputeAndTransferTimeNs != 0L) hash ^= ComputeAndTransferTimeNs.GetHashCode(); + if (ExecutableSizeInBytes != 0L) hash ^= ExecutableSizeInBytes.GetHashCode(); + if (ProfileCacheHit != false) hash ^= ProfileCacheHit.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (CompilationCacheHit != false) { + output.WriteRawTag(8); + output.WriteBool(CompilationCacheHit); + } + if (CompileTimeMs != 0L) { + output.WriteRawTag(16); + output.WriteInt64(CompileTimeMs); + } + if (ComputeCycleCount != 0L) { + output.WriteRawTag(24); + output.WriteInt64(ComputeCycleCount); + } + if (ComputeTimeNs != 0L) { + output.WriteRawTag(32); + output.WriteInt64(ComputeTimeNs); + } + if (ComputeAndTransferTimeNs != 0L) { + output.WriteRawTag(40); + output.WriteInt64(ComputeAndTransferTimeNs); + } + if (ExecutableSizeInBytes != 0L) { + output.WriteRawTag(48); + output.WriteInt64(ExecutableSizeInBytes); + } + if (ProfileCacheHit != false) { + output.WriteRawTag(56); + output.WriteBool(ProfileCacheHit); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (CompilationCacheHit != false) { + output.WriteRawTag(8); + output.WriteBool(CompilationCacheHit); + } + if (CompileTimeMs != 0L) { + output.WriteRawTag(16); + output.WriteInt64(CompileTimeMs); + } + if (ComputeCycleCount != 0L) { + output.WriteRawTag(24); + output.WriteInt64(ComputeCycleCount); + } + if (ComputeTimeNs != 0L) { + output.WriteRawTag(32); + output.WriteInt64(ComputeTimeNs); + } + if (ComputeAndTransferTimeNs != 0L) { + output.WriteRawTag(40); + output.WriteInt64(ComputeAndTransferTimeNs); + } + if (ExecutableSizeInBytes != 0L) { + output.WriteRawTag(48); + output.WriteInt64(ExecutableSizeInBytes); + } + if (ProfileCacheHit != false) { + output.WriteRawTag(56); + output.WriteBool(ProfileCacheHit); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (CompilationCacheHit != false) { + size += 1 + 1; + } + if (CompileTimeMs != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(CompileTimeMs); + } + if (ComputeCycleCount != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(ComputeCycleCount); + } + if (ComputeTimeNs != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(ComputeTimeNs); + } + if (ComputeAndTransferTimeNs != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(ComputeAndTransferTimeNs); + } + if (ExecutableSizeInBytes != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(ExecutableSizeInBytes); + } + if (ProfileCacheHit != false) { + size += 1 + 1; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ExecutionProfile other) { + if (other == null) { + return; + } + if (other.CompilationCacheHit != false) { + CompilationCacheHit = other.CompilationCacheHit; + } + if (other.CompileTimeMs != 0L) { + CompileTimeMs = other.CompileTimeMs; + } + if (other.ComputeCycleCount != 0L) { + ComputeCycleCount = other.ComputeCycleCount; + } + if (other.ComputeTimeNs != 0L) { + ComputeTimeNs = other.ComputeTimeNs; + } + if (other.ComputeAndTransferTimeNs != 0L) { + ComputeAndTransferTimeNs = other.ComputeAndTransferTimeNs; + } + if (other.ExecutableSizeInBytes != 0L) { + ExecutableSizeInBytes = other.ExecutableSizeInBytes; + } + if (other.ProfileCacheHit != false) { + ProfileCacheHit = other.ProfileCacheHit; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + CompilationCacheHit = input.ReadBool(); + break; + } + case 16: { + CompileTimeMs = input.ReadInt64(); + break; + } + case 24: { + ComputeCycleCount = input.ReadInt64(); + break; + } + case 32: { + ComputeTimeNs = input.ReadInt64(); + break; + } + case 40: { + ComputeAndTransferTimeNs = input.ReadInt64(); + break; + } + case 48: { + ExecutableSizeInBytes = input.ReadInt64(); + break; + } + case 56: { + ProfileCacheHit = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + CompilationCacheHit = input.ReadBool(); + break; + } + case 16: { + CompileTimeMs = input.ReadInt64(); + break; + } + case 24: { + ComputeCycleCount = input.ReadInt64(); + break; + } + case 32: { + ComputeTimeNs = input.ReadInt64(); + break; + } + case 40: { + ComputeAndTransferTimeNs = input.ReadInt64(); + break; + } + case 48: { + ExecutableSizeInBytes = input.ReadInt64(); + break; + } + case 56: { + ProfileCacheHit = input.ReadBool(); + break; + } + } + } + } + #endif + + } + + /// + /// Handle given to a user that represents an execution that the user launched + /// asynchronously on the device. + /// + public sealed partial class ExecutionHandle : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExecutionHandle()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[8]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecutionHandle() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecutionHandle(ExecutionHandle other) : this() { + handle_ = other.handle_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ExecutionHandle Clone() { + return new ExecutionHandle(this); + } + + /// Field number for the "handle" field. + public const int HandleFieldNumber = 1; + private long handle_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Handle { + get { return handle_; } + set { + handle_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ExecutionHandle); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ExecutionHandle other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Handle != other.Handle) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Handle != 0L) hash ^= Handle.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Handle != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Handle); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Handle != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Handle); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Handle != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Handle); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ExecutionHandle other) { + if (other == null) { + return; + } + if (other.Handle != 0L) { + Handle = other.Handle; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Handle = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Handle = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + /// + /// Handle given to a user that represents a globally accessible allocation. + /// Contrast this against a ComputationDataHandle, which is not globally + /// accessible, since it only exists within a specific computation. + /// + public sealed partial class GlobalDataHandle : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GlobalDataHandle()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[9]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GlobalDataHandle() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GlobalDataHandle(GlobalDataHandle other) : this() { + handle_ = other.handle_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GlobalDataHandle Clone() { + return new GlobalDataHandle(this); + } + + /// Field number for the "handle" field. + public const int HandleFieldNumber = 1; + private long handle_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Handle { + get { return handle_; } + set { + handle_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as GlobalDataHandle); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(GlobalDataHandle other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Handle != other.Handle) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Handle != 0L) hash ^= Handle.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Handle != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Handle); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Handle != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Handle); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Handle != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Handle); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(GlobalDataHandle other) { + if (other == null) { + return; + } + if (other.Handle != 0L) { + Handle = other.Handle; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Handle = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Handle = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + /// + /// Handle given to a user that represents a replicated virtual device. Each + /// replicated device represents N physical devices for execution where N is the + /// number of replicas. + /// + public sealed partial class DeviceHandle : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeviceHandle()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[10]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeviceHandle() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeviceHandle(DeviceHandle other) : this() { + handle_ = other.handle_; + deviceCount_ = other.deviceCount_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeviceHandle Clone() { + return new DeviceHandle(this); + } + + /// Field number for the "handle" field. + public const int HandleFieldNumber = 1; + private long handle_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Handle { + get { return handle_; } + set { + handle_ = value; + } + } + + /// Field number for the "device_count" field. + public const int DeviceCountFieldNumber = 2; + private long deviceCount_; + /// + /// The number of model-parallel virtual devices that communicate via XLA + /// Send/Recv instructions. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long DeviceCount { + get { return deviceCount_; } + set { + deviceCount_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as DeviceHandle); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(DeviceHandle other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Handle != other.Handle) return false; + if (DeviceCount != other.DeviceCount) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Handle != 0L) hash ^= Handle.GetHashCode(); + if (DeviceCount != 0L) hash ^= DeviceCount.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Handle != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Handle); + } + if (DeviceCount != 0L) { + output.WriteRawTag(16); + output.WriteInt64(DeviceCount); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Handle != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Handle); + } + if (DeviceCount != 0L) { + output.WriteRawTag(16); + output.WriteInt64(DeviceCount); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Handle != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Handle); + } + if (DeviceCount != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(DeviceCount); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(DeviceHandle other) { + if (other == null) { + return; + } + if (other.Handle != 0L) { + Handle = other.Handle; + } + if (other.DeviceCount != 0L) { + DeviceCount = other.DeviceCount; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Handle = input.ReadInt64(); + break; + } + case 16: { + DeviceCount = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Handle = input.ReadInt64(); + break; + } + case 16: { + DeviceCount = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + /// + /// Handle given to a user to represent a channel between two computations + /// via a Send and Recv instruction pair. Channels are unbuffered, so Send + /// Send instructions will be blocked until the data is transferred. + /// + public sealed partial class ChannelHandle : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ChannelHandle()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[11]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ChannelHandle() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ChannelHandle(ChannelHandle other) : this() { + handle_ = other.handle_; + type_ = other.type_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ChannelHandle Clone() { + return new ChannelHandle(this); + } + + /// Field number for the "handle" field. + public const int HandleFieldNumber = 1; + private long handle_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Handle { + get { return handle_; } + set { + handle_ = value; + } + } + + /// Field number for the "type" field. + public const int TypeFieldNumber = 2; + private global::Xla.ChannelHandle.Types.ChannelType type_ = global::Xla.ChannelHandle.Types.ChannelType.Invalid; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ChannelHandle.Types.ChannelType Type { + get { return type_; } + set { + type_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ChannelHandle); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ChannelHandle other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Handle != other.Handle) return false; + if (Type != other.Type) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Handle != 0L) hash ^= Handle.GetHashCode(); + if (Type != global::Xla.ChannelHandle.Types.ChannelType.Invalid) hash ^= Type.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Handle != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Handle); + } + if (Type != global::Xla.ChannelHandle.Types.ChannelType.Invalid) { + output.WriteRawTag(16); + output.WriteEnum((int) Type); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Handle != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Handle); + } + if (Type != global::Xla.ChannelHandle.Types.ChannelType.Invalid) { + output.WriteRawTag(16); + output.WriteEnum((int) Type); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Handle != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Handle); + } + if (Type != global::Xla.ChannelHandle.Types.ChannelType.Invalid) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ChannelHandle other) { + if (other == null) { + return; + } + if (other.Handle != 0L) { + Handle = other.Handle; + } + if (other.Type != global::Xla.ChannelHandle.Types.ChannelType.Invalid) { + Type = other.Type; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Handle = input.ReadInt64(); + break; + } + case 16: { + Type = (global::Xla.ChannelHandle.Types.ChannelType) input.ReadEnum(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Handle = input.ReadInt64(); + break; + } + case 16: { + Type = (global::Xla.ChannelHandle.Types.ChannelType) input.ReadEnum(); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the ChannelHandle message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + public enum ChannelType { + /// + /// Invalid primitive type to serve as default. + /// + [pbr::OriginalName("CHANNEL_TYPE_INVALID")] Invalid = 0, + /// + /// A channel for sending data between devices. + /// + [pbr::OriginalName("DEVICE_TO_DEVICE")] DeviceToDevice = 1, + /// + /// A channel for sending data from the device to the host. Can only be used + /// with a Send operation. + /// + [pbr::OriginalName("DEVICE_TO_HOST")] DeviceToHost = 2, + /// + /// A channel for sending data from the host to the device. Can only be used + /// with a Recv operation. + /// + [pbr::OriginalName("HOST_TO_DEVICE")] HostToDevice = 3, + } + + } + #endregion + + } + + /// + /// DeviceAssignmentProto is a serialized form of DeviceAssignment class, which + /// represents the device ids assigned to a set of replicated computations. + /// See xla::DeviceAssignment class comment for more details. + /// + public sealed partial class DeviceAssignmentProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeviceAssignmentProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[12]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeviceAssignmentProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeviceAssignmentProto(DeviceAssignmentProto other) : this() { + replicaCount_ = other.replicaCount_; + computationCount_ = other.computationCount_; + computationDevices_ = other.computationDevices_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DeviceAssignmentProto Clone() { + return new DeviceAssignmentProto(this); + } + + /// Field number for the "replica_count" field. + public const int ReplicaCountFieldNumber = 1; + private int replicaCount_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int ReplicaCount { + get { return replicaCount_; } + set { + replicaCount_ = value; + } + } + + /// Field number for the "computation_count" field. + public const int ComputationCountFieldNumber = 2; + private int computationCount_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int ComputationCount { + get { return computationCount_; } + set { + computationCount_ = value; + } + } + + /// Field number for the "computation_devices" field. + public const int ComputationDevicesFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_computationDevices_codec + = pb::FieldCodec.ForMessage(26, global::Xla.DeviceAssignmentProto.Types.ComputationDevice.Parser); + private readonly pbc::RepeatedField computationDevices_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField ComputationDevices { + get { return computationDevices_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as DeviceAssignmentProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(DeviceAssignmentProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ReplicaCount != other.ReplicaCount) return false; + if (ComputationCount != other.ComputationCount) return false; + if(!computationDevices_.Equals(other.computationDevices_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (ReplicaCount != 0) hash ^= ReplicaCount.GetHashCode(); + if (ComputationCount != 0) hash ^= ComputationCount.GetHashCode(); + hash ^= computationDevices_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (ReplicaCount != 0) { + output.WriteRawTag(8); + output.WriteInt32(ReplicaCount); + } + if (ComputationCount != 0) { + output.WriteRawTag(16); + output.WriteInt32(ComputationCount); + } + computationDevices_.WriteTo(output, _repeated_computationDevices_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (ReplicaCount != 0) { + output.WriteRawTag(8); + output.WriteInt32(ReplicaCount); + } + if (ComputationCount != 0) { + output.WriteRawTag(16); + output.WriteInt32(ComputationCount); + } + computationDevices_.WriteTo(ref output, _repeated_computationDevices_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (ReplicaCount != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(ReplicaCount); + } + if (ComputationCount != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(ComputationCount); + } + size += computationDevices_.CalculateSize(_repeated_computationDevices_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(DeviceAssignmentProto other) { + if (other == null) { + return; + } + if (other.ReplicaCount != 0) { + ReplicaCount = other.ReplicaCount; + } + if (other.ComputationCount != 0) { + ComputationCount = other.ComputationCount; + } + computationDevices_.Add(other.computationDevices_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + ReplicaCount = input.ReadInt32(); + break; + } + case 16: { + ComputationCount = input.ReadInt32(); + break; + } + case 26: { + computationDevices_.AddEntriesFrom(input, _repeated_computationDevices_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + ReplicaCount = input.ReadInt32(); + break; + } + case 16: { + ComputationCount = input.ReadInt32(); + break; + } + case 26: { + computationDevices_.AddEntriesFrom(ref input, _repeated_computationDevices_codec); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the DeviceAssignmentProto message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + /// + /// Each logical computation runs on replica_count physical devices. + /// ComputationDevice represents the device ids assinged to the replicas. + /// + public sealed partial class ComputationDevice : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ComputationDevice()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.DeviceAssignmentProto.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ComputationDevice() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ComputationDevice(ComputationDevice other) : this() { + replicaDeviceIds_ = other.replicaDeviceIds_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ComputationDevice Clone() { + return new ComputationDevice(this); + } + + /// Field number for the "replica_device_ids" field. + public const int ReplicaDeviceIdsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_replicaDeviceIds_codec + = pb::FieldCodec.ForInt32(10); + private readonly pbc::RepeatedField replicaDeviceIds_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField ReplicaDeviceIds { + get { return replicaDeviceIds_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ComputationDevice); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ComputationDevice other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!replicaDeviceIds_.Equals(other.replicaDeviceIds_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= replicaDeviceIds_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + replicaDeviceIds_.WriteTo(output, _repeated_replicaDeviceIds_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + replicaDeviceIds_.WriteTo(ref output, _repeated_replicaDeviceIds_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += replicaDeviceIds_.CalculateSize(_repeated_replicaDeviceIds_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ComputationDevice other) { + if (other == null) { + return; + } + replicaDeviceIds_.Add(other.replicaDeviceIds_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: + case 8: { + replicaDeviceIds_.AddEntriesFrom(input, _repeated_replicaDeviceIds_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: + case 8: { + replicaDeviceIds_.AddEntriesFrom(ref input, _repeated_replicaDeviceIds_codec); + break; + } + } + } + } + #endif + + } + + } + #endregion + + } + + /// + /// Literals are used when the server and client need to exchange materialized + /// data / results. Literals are also used to describe constants used in + /// computations. + /// + /// Transfers to/from the client are encoded in literal form, and the structure + /// of the repeated fields is implied by the shape. + /// + public sealed partial class LiteralProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new LiteralProto()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[13]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LiteralProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LiteralProto(LiteralProto other) : this() { + shape_ = other.shape_ != null ? other.shape_.Clone() : null; + preds_ = other.preds_.Clone(); + s8S_ = other.s8S_; + u8S_ = other.u8S_; + s32S_ = other.s32S_.Clone(); + s64S_ = other.s64S_.Clone(); + u32S_ = other.u32S_.Clone(); + u64S_ = other.u64S_.Clone(); + f32S_ = other.f32S_.Clone(); + f64S_ = other.f64S_.Clone(); + c64S_ = other.c64S_.Clone(); + c128S_ = other.c128S_.Clone(); + tupleLiterals_ = other.tupleLiterals_.Clone(); + f16S_ = other.f16S_; + bf16S_ = other.bf16S_; + u16S_ = other.u16S_; + s16S_ = other.s16S_; + sparseIndices_ = other.sparseIndices_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public LiteralProto Clone() { + return new LiteralProto(this); + } + + /// Field number for the "shape" field. + public const int ShapeFieldNumber = 1; + private global::Xla.ShapeProto shape_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ShapeProto Shape { + get { return shape_; } + set { + shape_ = value; + } + } + + /// Field number for the "preds" field. + public const int PredsFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_preds_codec + = pb::FieldCodec.ForBool(18); + private readonly pbc::RepeatedField preds_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Preds { + get { return preds_; } + } + + /// Field number for the "s8s" field. + public const int S8SFieldNumber = 15; + private pb::ByteString s8S_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pb::ByteString S8S { + get { return s8S_; } + set { + s8S_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "u8s" field. + public const int U8SFieldNumber = 3; + private pb::ByteString u8S_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pb::ByteString U8S { + get { return u8S_; } + set { + u8S_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "s32s" field. + public const int S32SFieldNumber = 4; + private static readonly pb::FieldCodec _repeated_s32S_codec + = pb::FieldCodec.ForInt32(34); + private readonly pbc::RepeatedField s32S_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField S32S { + get { return s32S_; } + } + + /// Field number for the "s64s" field. + public const int S64SFieldNumber = 5; + private static readonly pb::FieldCodec _repeated_s64S_codec + = pb::FieldCodec.ForInt64(42); + private readonly pbc::RepeatedField s64S_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField S64S { + get { return s64S_; } + } + + /// Field number for the "u32s" field. + public const int U32SFieldNumber = 6; + private static readonly pb::FieldCodec _repeated_u32S_codec + = pb::FieldCodec.ForUInt32(50); + private readonly pbc::RepeatedField u32S_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField U32S { + get { return u32S_; } + } + + /// Field number for the "u64s" field. + public const int U64SFieldNumber = 7; + private static readonly pb::FieldCodec _repeated_u64S_codec + = pb::FieldCodec.ForUInt64(58); + private readonly pbc::RepeatedField u64S_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField U64S { + get { return u64S_; } + } + + /// Field number for the "f32s" field. + public const int F32SFieldNumber = 8; + private static readonly pb::FieldCodec _repeated_f32S_codec + = pb::FieldCodec.ForFloat(66); + private readonly pbc::RepeatedField f32S_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField F32S { + get { return f32S_; } + } + + /// Field number for the "f64s" field. + public const int F64SFieldNumber = 9; + private static readonly pb::FieldCodec _repeated_f64S_codec + = pb::FieldCodec.ForDouble(74); + private readonly pbc::RepeatedField f64S_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField F64S { + get { return f64S_; } + } + + /// Field number for the "c64s" field. + public const int C64SFieldNumber = 12; + private static readonly pb::FieldCodec _repeated_c64S_codec + = pb::FieldCodec.ForFloat(98); + private readonly pbc::RepeatedField c64S_ = new pbc::RepeatedField(); + /// + /// Stored as interleaved real, imag floats. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField C64S { + get { return c64S_; } + } + + /// Field number for the "c128s" field. + public const int C128SFieldNumber = 18; + private static readonly pb::FieldCodec _repeated_c128S_codec + = pb::FieldCodec.ForDouble(146); + private readonly pbc::RepeatedField c128S_ = new pbc::RepeatedField(); + /// + /// Stored as interleaved real, imag doubles. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField C128S { + get { return c128S_; } + } + + /// Field number for the "tuple_literals" field. + public const int TupleLiteralsFieldNumber = 10; + private static readonly pb::FieldCodec _repeated_tupleLiterals_codec + = pb::FieldCodec.ForMessage(82, global::Xla.LiteralProto.Parser); + private readonly pbc::RepeatedField tupleLiterals_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField TupleLiterals { + get { return tupleLiterals_; } + } + + /// Field number for the "f16s" field. + public const int F16SFieldNumber = 11; + private pb::ByteString f16S_ = pb::ByteString.Empty; + /// + /// The F16s, BF16s, U16s and S16s are encoded in little endian byte order + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pb::ByteString F16S { + get { return f16S_; } + set { + f16S_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "bf16s" field. + public const int Bf16SFieldNumber = 13; + private pb::ByteString bf16S_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pb::ByteString Bf16S { + get { return bf16S_; } + set { + bf16S_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "u16s" field. + public const int U16SFieldNumber = 16; + private pb::ByteString u16S_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pb::ByteString U16S { + get { return u16S_; } + set { + u16S_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "s16s" field. + public const int S16SFieldNumber = 17; + private pb::ByteString s16S_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pb::ByteString S16S { + get { return s16S_; } + set { + s16S_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "sparse_indices" field. + public const int SparseIndicesFieldNumber = 14; + private static readonly pb::FieldCodec _repeated_sparseIndices_codec + = pb::FieldCodec.ForInt64(114); + private readonly pbc::RepeatedField sparseIndices_ = new pbc::RepeatedField(); + /// + /// Next = 19 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField SparseIndices { + get { return sparseIndices_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as LiteralProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(LiteralProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Shape, other.Shape)) return false; + if(!preds_.Equals(other.preds_)) return false; + if (S8S != other.S8S) return false; + if (U8S != other.U8S) return false; + if(!s32S_.Equals(other.s32S_)) return false; + if(!s64S_.Equals(other.s64S_)) return false; + if(!u32S_.Equals(other.u32S_)) return false; + if(!u64S_.Equals(other.u64S_)) return false; + if(!f32S_.Equals(other.f32S_)) return false; + if(!f64S_.Equals(other.f64S_)) return false; + if(!c64S_.Equals(other.c64S_)) return false; + if(!c128S_.Equals(other.c128S_)) return false; + if(!tupleLiterals_.Equals(other.tupleLiterals_)) return false; + if (F16S != other.F16S) return false; + if (Bf16S != other.Bf16S) return false; + if (U16S != other.U16S) return false; + if (S16S != other.S16S) return false; + if(!sparseIndices_.Equals(other.sparseIndices_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (shape_ != null) hash ^= Shape.GetHashCode(); + hash ^= preds_.GetHashCode(); + if (S8S.Length != 0) hash ^= S8S.GetHashCode(); + if (U8S.Length != 0) hash ^= U8S.GetHashCode(); + hash ^= s32S_.GetHashCode(); + hash ^= s64S_.GetHashCode(); + hash ^= u32S_.GetHashCode(); + hash ^= u64S_.GetHashCode(); + hash ^= f32S_.GetHashCode(); + hash ^= f64S_.GetHashCode(); + hash ^= c64S_.GetHashCode(); + hash ^= c128S_.GetHashCode(); + hash ^= tupleLiterals_.GetHashCode(); + if (F16S.Length != 0) hash ^= F16S.GetHashCode(); + if (Bf16S.Length != 0) hash ^= Bf16S.GetHashCode(); + if (U16S.Length != 0) hash ^= U16S.GetHashCode(); + if (S16S.Length != 0) hash ^= S16S.GetHashCode(); + hash ^= sparseIndices_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (shape_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Shape); + } + preds_.WriteTo(output, _repeated_preds_codec); + if (U8S.Length != 0) { + output.WriteRawTag(26); + output.WriteBytes(U8S); + } + s32S_.WriteTo(output, _repeated_s32S_codec); + s64S_.WriteTo(output, _repeated_s64S_codec); + u32S_.WriteTo(output, _repeated_u32S_codec); + u64S_.WriteTo(output, _repeated_u64S_codec); + f32S_.WriteTo(output, _repeated_f32S_codec); + f64S_.WriteTo(output, _repeated_f64S_codec); + tupleLiterals_.WriteTo(output, _repeated_tupleLiterals_codec); + if (F16S.Length != 0) { + output.WriteRawTag(90); + output.WriteBytes(F16S); + } + c64S_.WriteTo(output, _repeated_c64S_codec); + if (Bf16S.Length != 0) { + output.WriteRawTag(106); + output.WriteBytes(Bf16S); + } + sparseIndices_.WriteTo(output, _repeated_sparseIndices_codec); + if (S8S.Length != 0) { + output.WriteRawTag(122); + output.WriteBytes(S8S); + } + if (U16S.Length != 0) { + output.WriteRawTag(130, 1); + output.WriteBytes(U16S); + } + if (S16S.Length != 0) { + output.WriteRawTag(138, 1); + output.WriteBytes(S16S); + } + c128S_.WriteTo(output, _repeated_c128S_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (shape_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Shape); + } + preds_.WriteTo(ref output, _repeated_preds_codec); + if (U8S.Length != 0) { + output.WriteRawTag(26); + output.WriteBytes(U8S); + } + s32S_.WriteTo(ref output, _repeated_s32S_codec); + s64S_.WriteTo(ref output, _repeated_s64S_codec); + u32S_.WriteTo(ref output, _repeated_u32S_codec); + u64S_.WriteTo(ref output, _repeated_u64S_codec); + f32S_.WriteTo(ref output, _repeated_f32S_codec); + f64S_.WriteTo(ref output, _repeated_f64S_codec); + tupleLiterals_.WriteTo(ref output, _repeated_tupleLiterals_codec); + if (F16S.Length != 0) { + output.WriteRawTag(90); + output.WriteBytes(F16S); + } + c64S_.WriteTo(ref output, _repeated_c64S_codec); + if (Bf16S.Length != 0) { + output.WriteRawTag(106); + output.WriteBytes(Bf16S); + } + sparseIndices_.WriteTo(ref output, _repeated_sparseIndices_codec); + if (S8S.Length != 0) { + output.WriteRawTag(122); + output.WriteBytes(S8S); + } + if (U16S.Length != 0) { + output.WriteRawTag(130, 1); + output.WriteBytes(U16S); + } + if (S16S.Length != 0) { + output.WriteRawTag(138, 1); + output.WriteBytes(S16S); + } + c128S_.WriteTo(ref output, _repeated_c128S_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (shape_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Shape); + } + size += preds_.CalculateSize(_repeated_preds_codec); + if (S8S.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(S8S); + } + if (U8S.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(U8S); + } + size += s32S_.CalculateSize(_repeated_s32S_codec); + size += s64S_.CalculateSize(_repeated_s64S_codec); + size += u32S_.CalculateSize(_repeated_u32S_codec); + size += u64S_.CalculateSize(_repeated_u64S_codec); + size += f32S_.CalculateSize(_repeated_f32S_codec); + size += f64S_.CalculateSize(_repeated_f64S_codec); + size += c64S_.CalculateSize(_repeated_c64S_codec); + size += c128S_.CalculateSize(_repeated_c128S_codec); + size += tupleLiterals_.CalculateSize(_repeated_tupleLiterals_codec); + if (F16S.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(F16S); + } + if (Bf16S.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(Bf16S); + } + if (U16S.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeBytesSize(U16S); + } + if (S16S.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeBytesSize(S16S); + } + size += sparseIndices_.CalculateSize(_repeated_sparseIndices_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(LiteralProto other) { + if (other == null) { + return; + } + if (other.shape_ != null) { + if (shape_ == null) { + Shape = new global::Xla.ShapeProto(); + } + Shape.MergeFrom(other.Shape); + } + preds_.Add(other.preds_); + if (other.S8S.Length != 0) { + S8S = other.S8S; + } + if (other.U8S.Length != 0) { + U8S = other.U8S; + } + s32S_.Add(other.s32S_); + s64S_.Add(other.s64S_); + u32S_.Add(other.u32S_); + u64S_.Add(other.u64S_); + f32S_.Add(other.f32S_); + f64S_.Add(other.f64S_); + c64S_.Add(other.c64S_); + c128S_.Add(other.c128S_); + tupleLiterals_.Add(other.tupleLiterals_); + if (other.F16S.Length != 0) { + F16S = other.F16S; + } + if (other.Bf16S.Length != 0) { + Bf16S = other.Bf16S; + } + if (other.U16S.Length != 0) { + U16S = other.U16S; + } + if (other.S16S.Length != 0) { + S16S = other.S16S; + } + sparseIndices_.Add(other.sparseIndices_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (shape_ == null) { + Shape = new global::Xla.ShapeProto(); + } + input.ReadMessage(Shape); + break; + } + case 18: + case 16: { + preds_.AddEntriesFrom(input, _repeated_preds_codec); + break; + } + case 26: { + U8S = input.ReadBytes(); + break; + } + case 34: + case 32: { + s32S_.AddEntriesFrom(input, _repeated_s32S_codec); + break; + } + case 42: + case 40: { + s64S_.AddEntriesFrom(input, _repeated_s64S_codec); + break; + } + case 50: + case 48: { + u32S_.AddEntriesFrom(input, _repeated_u32S_codec); + break; + } + case 58: + case 56: { + u64S_.AddEntriesFrom(input, _repeated_u64S_codec); + break; + } + case 66: + case 69: { + f32S_.AddEntriesFrom(input, _repeated_f32S_codec); + break; + } + case 74: + case 73: { + f64S_.AddEntriesFrom(input, _repeated_f64S_codec); + break; + } + case 82: { + tupleLiterals_.AddEntriesFrom(input, _repeated_tupleLiterals_codec); + break; + } + case 90: { + F16S = input.ReadBytes(); + break; + } + case 98: + case 101: { + c64S_.AddEntriesFrom(input, _repeated_c64S_codec); + break; + } + case 106: { + Bf16S = input.ReadBytes(); + break; + } + case 114: + case 112: { + sparseIndices_.AddEntriesFrom(input, _repeated_sparseIndices_codec); + break; + } + case 122: { + S8S = input.ReadBytes(); + break; + } + case 130: { + U16S = input.ReadBytes(); + break; + } + case 138: { + S16S = input.ReadBytes(); + break; + } + case 146: + case 145: { + c128S_.AddEntriesFrom(input, _repeated_c128S_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (shape_ == null) { + Shape = new global::Xla.ShapeProto(); + } + input.ReadMessage(Shape); + break; + } + case 18: + case 16: { + preds_.AddEntriesFrom(ref input, _repeated_preds_codec); + break; + } + case 26: { + U8S = input.ReadBytes(); + break; + } + case 34: + case 32: { + s32S_.AddEntriesFrom(ref input, _repeated_s32S_codec); + break; + } + case 42: + case 40: { + s64S_.AddEntriesFrom(ref input, _repeated_s64S_codec); + break; + } + case 50: + case 48: { + u32S_.AddEntriesFrom(ref input, _repeated_u32S_codec); + break; + } + case 58: + case 56: { + u64S_.AddEntriesFrom(ref input, _repeated_u64S_codec); + break; + } + case 66: + case 69: { + f32S_.AddEntriesFrom(ref input, _repeated_f32S_codec); + break; + } + case 74: + case 73: { + f64S_.AddEntriesFrom(ref input, _repeated_f64S_codec); + break; + } + case 82: { + tupleLiterals_.AddEntriesFrom(ref input, _repeated_tupleLiterals_codec); + break; + } + case 90: { + F16S = input.ReadBytes(); + break; + } + case 98: + case 101: { + c64S_.AddEntriesFrom(ref input, _repeated_c64S_codec); + break; + } + case 106: { + Bf16S = input.ReadBytes(); + break; + } + case 114: + case 112: { + sparseIndices_.AddEntriesFrom(ref input, _repeated_sparseIndices_codec); + break; + } + case 122: { + S8S = input.ReadBytes(); + break; + } + case 130: { + U16S = input.ReadBytes(); + break; + } + case 138: { + S16S = input.ReadBytes(); + break; + } + case 146: + case 145: { + c128S_.AddEntriesFrom(ref input, _repeated_c128S_codec); + break; + } + } + } + } + #endif + + } + + public sealed partial class WindowDimension : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WindowDimension()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[14]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WindowDimension() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WindowDimension(WindowDimension other) : this() { + size_ = other.size_; + stride_ = other.stride_; + paddingLow_ = other.paddingLow_; + paddingHigh_ = other.paddingHigh_; + windowDilation_ = other.windowDilation_; + baseDilation_ = other.baseDilation_; + windowReversal_ = other.windowReversal_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WindowDimension Clone() { + return new WindowDimension(this); + } + + /// Field number for the "size" field. + public const int SizeFieldNumber = 1; + private long size_; + /// + /// The size of the window in this dimension. For a rectangle, this would be + /// the width or height. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Size { + get { return size_; } + set { + size_ = value; + } + } + + /// Field number for the "stride" field. + public const int StrideFieldNumber = 2; + private long stride_; + /// + /// The stride at which the window moves across the base area in this + /// dimension. In other words, this is the spacing between different + /// positions of the window in this dimension. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Stride { + get { return stride_; } + set { + stride_ = value; + } + } + + /// Field number for the "padding_low" field. + public const int PaddingLowFieldNumber = 3; + private long paddingLow_; + /// + /// If positive, means the amount of padding to add to the base area at the low + /// end of this dimension; if negative, its negative means the number of + /// elements removed from the low end of this dimension. For example, in the + /// horizontal dimension of a rectangle, this would be the number of padding + /// values to pad on the left, given that indices increase when going right. + /// The actual padding value depends upon the context. Convolution pads with + /// zeros. ReduceWindow and SelectAndScatter pads with the reduce function's + /// init value. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long PaddingLow { + get { return paddingLow_; } + set { + paddingLow_ = value; + } + } + + /// Field number for the "padding_high" field. + public const int PaddingHighFieldNumber = 4; + private long paddingHigh_; + /// + /// As padding_low, but on the high end of this dimension. For example, in the + /// horizontal dimension of a rectangle, this would be the number of values to + /// pad on the right, given that indices increase when going right. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long PaddingHigh { + get { return paddingHigh_; } + set { + paddingHigh_ = value; + } + } + + /// Field number for the "window_dilation" field. + public const int WindowDilationFieldNumber = 5; + private long windowDilation_; + /// + /// Dilation factor of the sliding window in this dimension. A dilation factor + /// of 1 means no dilation. window_dilation - 1 no-op entries ("holes") are + /// implicitly placed between each kernel element. This value may not be less + /// than 1. See documentation for convolution. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long WindowDilation { + get { return windowDilation_; } + set { + windowDilation_ = value; + } + } + + /// Field number for the "base_dilation" field. + public const int BaseDilationFieldNumber = 6; + private long baseDilation_; + /// + /// Dilation factor of the base area in this dimension. A dilation factor of 1 + /// means no dilation. base_dilation - 1 no-op entries ("holes") are implicitly + /// placed between each base area element. This value may not be less than 1. + /// See documentation for convolution. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long BaseDilation { + get { return baseDilation_; } + set { + baseDilation_ = value; + } + } + + /// Field number for the "window_reversal" field. + public const int WindowReversalFieldNumber = 7; + private bool windowReversal_; + /// + /// Window reversal means that this dimension was logically reversed before the + /// operation. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool WindowReversal { + get { return windowReversal_; } + set { + windowReversal_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as WindowDimension); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(WindowDimension other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Size != other.Size) return false; + if (Stride != other.Stride) return false; + if (PaddingLow != other.PaddingLow) return false; + if (PaddingHigh != other.PaddingHigh) return false; + if (WindowDilation != other.WindowDilation) return false; + if (BaseDilation != other.BaseDilation) return false; + if (WindowReversal != other.WindowReversal) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Size != 0L) hash ^= Size.GetHashCode(); + if (Stride != 0L) hash ^= Stride.GetHashCode(); + if (PaddingLow != 0L) hash ^= PaddingLow.GetHashCode(); + if (PaddingHigh != 0L) hash ^= PaddingHigh.GetHashCode(); + if (WindowDilation != 0L) hash ^= WindowDilation.GetHashCode(); + if (BaseDilation != 0L) hash ^= BaseDilation.GetHashCode(); + if (WindowReversal != false) hash ^= WindowReversal.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Size != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Size); + } + if (Stride != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Stride); + } + if (PaddingLow != 0L) { + output.WriteRawTag(24); + output.WriteInt64(PaddingLow); + } + if (PaddingHigh != 0L) { + output.WriteRawTag(32); + output.WriteInt64(PaddingHigh); + } + if (WindowDilation != 0L) { + output.WriteRawTag(40); + output.WriteInt64(WindowDilation); + } + if (BaseDilation != 0L) { + output.WriteRawTag(48); + output.WriteInt64(BaseDilation); + } + if (WindowReversal != false) { + output.WriteRawTag(56); + output.WriteBool(WindowReversal); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Size != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Size); + } + if (Stride != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Stride); + } + if (PaddingLow != 0L) { + output.WriteRawTag(24); + output.WriteInt64(PaddingLow); + } + if (PaddingHigh != 0L) { + output.WriteRawTag(32); + output.WriteInt64(PaddingHigh); + } + if (WindowDilation != 0L) { + output.WriteRawTag(40); + output.WriteInt64(WindowDilation); + } + if (BaseDilation != 0L) { + output.WriteRawTag(48); + output.WriteInt64(BaseDilation); + } + if (WindowReversal != false) { + output.WriteRawTag(56); + output.WriteBool(WindowReversal); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Size != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Size); + } + if (Stride != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Stride); + } + if (PaddingLow != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(PaddingLow); + } + if (PaddingHigh != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(PaddingHigh); + } + if (WindowDilation != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(WindowDilation); + } + if (BaseDilation != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(BaseDilation); + } + if (WindowReversal != false) { + size += 1 + 1; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(WindowDimension other) { + if (other == null) { + return; + } + if (other.Size != 0L) { + Size = other.Size; + } + if (other.Stride != 0L) { + Stride = other.Stride; + } + if (other.PaddingLow != 0L) { + PaddingLow = other.PaddingLow; + } + if (other.PaddingHigh != 0L) { + PaddingHigh = other.PaddingHigh; + } + if (other.WindowDilation != 0L) { + WindowDilation = other.WindowDilation; + } + if (other.BaseDilation != 0L) { + BaseDilation = other.BaseDilation; + } + if (other.WindowReversal != false) { + WindowReversal = other.WindowReversal; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Size = input.ReadInt64(); + break; + } + case 16: { + Stride = input.ReadInt64(); + break; + } + case 24: { + PaddingLow = input.ReadInt64(); + break; + } + case 32: { + PaddingHigh = input.ReadInt64(); + break; + } + case 40: { + WindowDilation = input.ReadInt64(); + break; + } + case 48: { + BaseDilation = input.ReadInt64(); + break; + } + case 56: { + WindowReversal = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Size = input.ReadInt64(); + break; + } + case 16: { + Stride = input.ReadInt64(); + break; + } + case 24: { + PaddingLow = input.ReadInt64(); + break; + } + case 32: { + PaddingHigh = input.ReadInt64(); + break; + } + case 40: { + WindowDilation = input.ReadInt64(); + break; + } + case 48: { + BaseDilation = input.ReadInt64(); + break; + } + case 56: { + WindowReversal = input.ReadBool(); + break; + } + } + } + } + #endif + + } + + /// + /// Describes the windowing in an operation such as convolution. + /// + /// The window is moved across a base area and for each position of the + /// window a computation is performed. The field below describes the + /// window and the movement of the window across a base area. + /// + public sealed partial class Window : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Window()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[15]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Window() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Window(Window other) : this() { + dimensions_ = other.dimensions_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Window Clone() { + return new Window(this); + } + + /// Field number for the "dimensions" field. + public const int DimensionsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_dimensions_codec + = pb::FieldCodec.ForMessage(10, global::Xla.WindowDimension.Parser); + private readonly pbc::RepeatedField dimensions_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Dimensions { + get { return dimensions_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as Window); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(Window other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!dimensions_.Equals(other.dimensions_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= dimensions_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + dimensions_.WriteTo(output, _repeated_dimensions_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + dimensions_.WriteTo(ref output, _repeated_dimensions_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += dimensions_.CalculateSize(_repeated_dimensions_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(Window other) { + if (other == null) { + return; + } + dimensions_.Add(other.dimensions_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + dimensions_.AddEntriesFrom(input, _repeated_dimensions_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + dimensions_.AddEntriesFrom(ref input, _repeated_dimensions_codec); + break; + } + } + } + } + #endif + + } + + /// + /// Describes the dimension numbers for a gather operation. + /// + /// See https://www.tensorflow.org/performance/xla/operation_semantics#gather for + /// more details. + /// + public sealed partial class GatherDimensionNumbers : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GatherDimensionNumbers()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[16]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GatherDimensionNumbers() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GatherDimensionNumbers(GatherDimensionNumbers other) : this() { + offsetDims_ = other.offsetDims_.Clone(); + collapsedSliceDims_ = other.collapsedSliceDims_.Clone(); + startIndexMap_ = other.startIndexMap_.Clone(); + indexVectorDim_ = other.indexVectorDim_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public GatherDimensionNumbers Clone() { + return new GatherDimensionNumbers(this); + } + + /// Field number for the "offset_dims" field. + public const int OffsetDimsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_offsetDims_codec + = pb::FieldCodec.ForInt64(10); + private readonly pbc::RepeatedField offsetDims_ = new pbc::RepeatedField(); + /// + /// "Window indices" is a term for a set of indices that index into the + /// interior of a dynamic-slice from the input tensor, the starting indices for + /// which were computed from output_gather_dims (see the operation semantic for + /// how this is defined) and the start_indices tensor. + /// + /// The window indices for a specific output index Out is computed as: + /// + /// i = 0 + /// for (k : [0, input_tensor_shape.rank)) + /// window_indices[k] = + /// if k in collapsed_slice_dims + /// then 0 + /// else Out[offset_dims[i++]] + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField OffsetDims { + get { return offsetDims_; } + } + + /// Field number for the "collapsed_slice_dims" field. + public const int CollapsedSliceDimsFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_collapsedSliceDims_codec + = pb::FieldCodec.ForInt64(18); + private readonly pbc::RepeatedField collapsedSliceDims_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField CollapsedSliceDims { + get { return collapsedSliceDims_; } + } + + /// Field number for the "start_index_map" field. + public const int StartIndexMapFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_startIndexMap_codec + = pb::FieldCodec.ForInt64(26); + private readonly pbc::RepeatedField startIndexMap_ = new pbc::RepeatedField(); + /// + /// This is interpreted as a map from i to start_index_map[i]. It + /// transforms the gather index looked up from the start_indices tensor into + /// the starting index in the input space. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField StartIndexMap { + get { return startIndexMap_; } + } + + /// Field number for the "index_vector_dim" field. + public const int IndexVectorDimFieldNumber = 4; + private long indexVectorDim_; + /// + /// The dimension in the start_indices input that contains the starting + /// indices. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long IndexVectorDim { + get { return indexVectorDim_; } + set { + indexVectorDim_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as GatherDimensionNumbers); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(GatherDimensionNumbers other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!offsetDims_.Equals(other.offsetDims_)) return false; + if(!collapsedSliceDims_.Equals(other.collapsedSliceDims_)) return false; + if(!startIndexMap_.Equals(other.startIndexMap_)) return false; + if (IndexVectorDim != other.IndexVectorDim) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= offsetDims_.GetHashCode(); + hash ^= collapsedSliceDims_.GetHashCode(); + hash ^= startIndexMap_.GetHashCode(); + if (IndexVectorDim != 0L) hash ^= IndexVectorDim.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + offsetDims_.WriteTo(output, _repeated_offsetDims_codec); + collapsedSliceDims_.WriteTo(output, _repeated_collapsedSliceDims_codec); + startIndexMap_.WriteTo(output, _repeated_startIndexMap_codec); + if (IndexVectorDim != 0L) { + output.WriteRawTag(32); + output.WriteInt64(IndexVectorDim); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + offsetDims_.WriteTo(ref output, _repeated_offsetDims_codec); + collapsedSliceDims_.WriteTo(ref output, _repeated_collapsedSliceDims_codec); + startIndexMap_.WriteTo(ref output, _repeated_startIndexMap_codec); + if (IndexVectorDim != 0L) { + output.WriteRawTag(32); + output.WriteInt64(IndexVectorDim); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += offsetDims_.CalculateSize(_repeated_offsetDims_codec); + size += collapsedSliceDims_.CalculateSize(_repeated_collapsedSliceDims_codec); + size += startIndexMap_.CalculateSize(_repeated_startIndexMap_codec); + if (IndexVectorDim != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(IndexVectorDim); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(GatherDimensionNumbers other) { + if (other == null) { + return; + } + offsetDims_.Add(other.offsetDims_); + collapsedSliceDims_.Add(other.collapsedSliceDims_); + startIndexMap_.Add(other.startIndexMap_); + if (other.IndexVectorDim != 0L) { + IndexVectorDim = other.IndexVectorDim; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: + case 8: { + offsetDims_.AddEntriesFrom(input, _repeated_offsetDims_codec); + break; + } + case 18: + case 16: { + collapsedSliceDims_.AddEntriesFrom(input, _repeated_collapsedSliceDims_codec); + break; + } + case 26: + case 24: { + startIndexMap_.AddEntriesFrom(input, _repeated_startIndexMap_codec); + break; + } + case 32: { + IndexVectorDim = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: + case 8: { + offsetDims_.AddEntriesFrom(ref input, _repeated_offsetDims_codec); + break; + } + case 18: + case 16: { + collapsedSliceDims_.AddEntriesFrom(ref input, _repeated_collapsedSliceDims_codec); + break; + } + case 26: + case 24: { + startIndexMap_.AddEntriesFrom(ref input, _repeated_startIndexMap_codec); + break; + } + case 32: { + IndexVectorDim = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + /// + /// Describes the dimension numbers for a scatter operation. + /// + /// All the fields are similar to the corresponding fields in + /// GatherDimensionNumbers. Differences are noted below. + /// + public sealed partial class ScatterDimensionNumbers : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ScatterDimensionNumbers()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[17]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ScatterDimensionNumbers() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ScatterDimensionNumbers(ScatterDimensionNumbers other) : this() { + updateWindowDims_ = other.updateWindowDims_.Clone(); + insertedWindowDims_ = other.insertedWindowDims_.Clone(); + scatterDimsToOperandDims_ = other.scatterDimsToOperandDims_.Clone(); + indexVectorDim_ = other.indexVectorDim_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ScatterDimensionNumbers Clone() { + return new ScatterDimensionNumbers(this); + } + + /// Field number for the "update_window_dims" field. + public const int UpdateWindowDimsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_updateWindowDims_codec + = pb::FieldCodec.ForInt64(10); + private readonly pbc::RepeatedField updateWindowDims_ = new pbc::RepeatedField(); + /// + /// The set of dimensions in the updates shape that are window dimensions. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField UpdateWindowDims { + get { return updateWindowDims_; } + } + + /// Field number for the "inserted_window_dims" field. + public const int InsertedWindowDimsFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_insertedWindowDims_codec + = pb::FieldCodec.ForInt64(18); + private readonly pbc::RepeatedField insertedWindowDims_ = new pbc::RepeatedField(); + /// + /// The set of window dimensions that must be inserted into the updates shape. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField InsertedWindowDims { + get { return insertedWindowDims_; } + } + + /// Field number for the "scatter_dims_to_operand_dims" field. + public const int ScatterDimsToOperandDimsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_scatterDimsToOperandDims_codec + = pb::FieldCodec.ForInt64(26); + private readonly pbc::RepeatedField scatterDimsToOperandDims_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField ScatterDimsToOperandDims { + get { return scatterDimsToOperandDims_; } + } + + /// Field number for the "index_vector_dim" field. + public const int IndexVectorDimFieldNumber = 4; + private long indexVectorDim_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long IndexVectorDim { + get { return indexVectorDim_; } + set { + indexVectorDim_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ScatterDimensionNumbers); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ScatterDimensionNumbers other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!updateWindowDims_.Equals(other.updateWindowDims_)) return false; + if(!insertedWindowDims_.Equals(other.insertedWindowDims_)) return false; + if(!scatterDimsToOperandDims_.Equals(other.scatterDimsToOperandDims_)) return false; + if (IndexVectorDim != other.IndexVectorDim) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= updateWindowDims_.GetHashCode(); + hash ^= insertedWindowDims_.GetHashCode(); + hash ^= scatterDimsToOperandDims_.GetHashCode(); + if (IndexVectorDim != 0L) hash ^= IndexVectorDim.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + updateWindowDims_.WriteTo(output, _repeated_updateWindowDims_codec); + insertedWindowDims_.WriteTo(output, _repeated_insertedWindowDims_codec); + scatterDimsToOperandDims_.WriteTo(output, _repeated_scatterDimsToOperandDims_codec); + if (IndexVectorDim != 0L) { + output.WriteRawTag(32); + output.WriteInt64(IndexVectorDim); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + updateWindowDims_.WriteTo(ref output, _repeated_updateWindowDims_codec); + insertedWindowDims_.WriteTo(ref output, _repeated_insertedWindowDims_codec); + scatterDimsToOperandDims_.WriteTo(ref output, _repeated_scatterDimsToOperandDims_codec); + if (IndexVectorDim != 0L) { + output.WriteRawTag(32); + output.WriteInt64(IndexVectorDim); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += updateWindowDims_.CalculateSize(_repeated_updateWindowDims_codec); + size += insertedWindowDims_.CalculateSize(_repeated_insertedWindowDims_codec); + size += scatterDimsToOperandDims_.CalculateSize(_repeated_scatterDimsToOperandDims_codec); + if (IndexVectorDim != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(IndexVectorDim); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ScatterDimensionNumbers other) { + if (other == null) { + return; + } + updateWindowDims_.Add(other.updateWindowDims_); + insertedWindowDims_.Add(other.insertedWindowDims_); + scatterDimsToOperandDims_.Add(other.scatterDimsToOperandDims_); + if (other.IndexVectorDim != 0L) { + IndexVectorDim = other.IndexVectorDim; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: + case 8: { + updateWindowDims_.AddEntriesFrom(input, _repeated_updateWindowDims_codec); + break; + } + case 18: + case 16: { + insertedWindowDims_.AddEntriesFrom(input, _repeated_insertedWindowDims_codec); + break; + } + case 26: + case 24: { + scatterDimsToOperandDims_.AddEntriesFrom(input, _repeated_scatterDimsToOperandDims_codec); + break; + } + case 32: { + IndexVectorDim = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: + case 8: { + updateWindowDims_.AddEntriesFrom(ref input, _repeated_updateWindowDims_codec); + break; + } + case 18: + case 16: { + insertedWindowDims_.AddEntriesFrom(ref input, _repeated_insertedWindowDims_codec); + break; + } + case 26: + case 24: { + scatterDimsToOperandDims_.AddEntriesFrom(ref input, _repeated_scatterDimsToOperandDims_codec); + break; + } + case 32: { + IndexVectorDim = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + public sealed partial class ConvolutionDimensionNumbers : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ConvolutionDimensionNumbers()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[18]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ConvolutionDimensionNumbers() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ConvolutionDimensionNumbers(ConvolutionDimensionNumbers other) : this() { + inputBatchDimension_ = other.inputBatchDimension_; + inputFeatureDimension_ = other.inputFeatureDimension_; + inputSpatialDimensions_ = other.inputSpatialDimensions_.Clone(); + kernelInputFeatureDimension_ = other.kernelInputFeatureDimension_; + kernelOutputFeatureDimension_ = other.kernelOutputFeatureDimension_; + kernelSpatialDimensions_ = other.kernelSpatialDimensions_.Clone(); + outputBatchDimension_ = other.outputBatchDimension_; + outputFeatureDimension_ = other.outputFeatureDimension_; + outputSpatialDimensions_ = other.outputSpatialDimensions_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ConvolutionDimensionNumbers Clone() { + return new ConvolutionDimensionNumbers(this); + } + + /// Field number for the "input_batch_dimension" field. + public const int InputBatchDimensionFieldNumber = 7; + private long inputBatchDimension_; + /// + /// The number of the dimension that represents batch in the input. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long InputBatchDimension { + get { return inputBatchDimension_; } + set { + inputBatchDimension_ = value; + } + } + + /// Field number for the "input_feature_dimension" field. + public const int InputFeatureDimensionFieldNumber = 8; + private long inputFeatureDimension_; + /// + /// The number of the dimension that represents features in the input. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long InputFeatureDimension { + get { return inputFeatureDimension_; } + set { + inputFeatureDimension_ = value; + } + } + + /// Field number for the "input_spatial_dimensions" field. + public const int InputSpatialDimensionsFieldNumber = 11; + private static readonly pb::FieldCodec _repeated_inputSpatialDimensions_codec + = pb::FieldCodec.ForInt64(90); + private readonly pbc::RepeatedField inputSpatialDimensions_ = new pbc::RepeatedField(); + /// + /// The dimension numbers for the spatial dimensions that the window + /// moves through in the input. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField InputSpatialDimensions { + get { return inputSpatialDimensions_; } + } + + /// Field number for the "kernel_input_feature_dimension" field. + public const int KernelInputFeatureDimensionFieldNumber = 3; + private long kernelInputFeatureDimension_; + /// + /// The number of the dimension that represents input features in the + /// convolutional kernel (rhs). + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long KernelInputFeatureDimension { + get { return kernelInputFeatureDimension_; } + set { + kernelInputFeatureDimension_ = value; + } + } + + /// Field number for the "kernel_output_feature_dimension" field. + public const int KernelOutputFeatureDimensionFieldNumber = 4; + private long kernelOutputFeatureDimension_; + /// + /// The number of the dimension that represents output features in + /// the convolutional kernel (rhs). + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long KernelOutputFeatureDimension { + get { return kernelOutputFeatureDimension_; } + set { + kernelOutputFeatureDimension_ = value; + } + } + + /// Field number for the "kernel_spatial_dimensions" field. + public const int KernelSpatialDimensionsFieldNumber = 6; + private static readonly pb::FieldCodec _repeated_kernelSpatialDimensions_codec + = pb::FieldCodec.ForInt64(50); + private readonly pbc::RepeatedField kernelSpatialDimensions_ = new pbc::RepeatedField(); + /// + /// The dimension numbers for the spatial dimensions that the window + /// moves through in the kernel (rhs). window.strides(0) is the + /// stride in the kernel_spatial_dimensions(0) dimension. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField KernelSpatialDimensions { + get { return kernelSpatialDimensions_; } + } + + /// Field number for the "output_batch_dimension" field. + public const int OutputBatchDimensionFieldNumber = 9; + private long outputBatchDimension_; + /// + /// The number of the dimension that represents batch in the output. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long OutputBatchDimension { + get { return outputBatchDimension_; } + set { + outputBatchDimension_ = value; + } + } + + /// Field number for the "output_feature_dimension" field. + public const int OutputFeatureDimensionFieldNumber = 10; + private long outputFeatureDimension_; + /// + /// The number of the dimension that represents features in the output. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long OutputFeatureDimension { + get { return outputFeatureDimension_; } + set { + outputFeatureDimension_ = value; + } + } + + /// Field number for the "output_spatial_dimensions" field. + public const int OutputSpatialDimensionsFieldNumber = 12; + private static readonly pb::FieldCodec _repeated_outputSpatialDimensions_codec + = pb::FieldCodec.ForInt64(98); + private readonly pbc::RepeatedField outputSpatialDimensions_ = new pbc::RepeatedField(); + /// + /// The dimension numbers for the spatial dimensions that the window + /// moves through in the output. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField OutputSpatialDimensions { + get { return outputSpatialDimensions_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ConvolutionDimensionNumbers); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ConvolutionDimensionNumbers other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (InputBatchDimension != other.InputBatchDimension) return false; + if (InputFeatureDimension != other.InputFeatureDimension) return false; + if(!inputSpatialDimensions_.Equals(other.inputSpatialDimensions_)) return false; + if (KernelInputFeatureDimension != other.KernelInputFeatureDimension) return false; + if (KernelOutputFeatureDimension != other.KernelOutputFeatureDimension) return false; + if(!kernelSpatialDimensions_.Equals(other.kernelSpatialDimensions_)) return false; + if (OutputBatchDimension != other.OutputBatchDimension) return false; + if (OutputFeatureDimension != other.OutputFeatureDimension) return false; + if(!outputSpatialDimensions_.Equals(other.outputSpatialDimensions_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (InputBatchDimension != 0L) hash ^= InputBatchDimension.GetHashCode(); + if (InputFeatureDimension != 0L) hash ^= InputFeatureDimension.GetHashCode(); + hash ^= inputSpatialDimensions_.GetHashCode(); + if (KernelInputFeatureDimension != 0L) hash ^= KernelInputFeatureDimension.GetHashCode(); + if (KernelOutputFeatureDimension != 0L) hash ^= KernelOutputFeatureDimension.GetHashCode(); + hash ^= kernelSpatialDimensions_.GetHashCode(); + if (OutputBatchDimension != 0L) hash ^= OutputBatchDimension.GetHashCode(); + if (OutputFeatureDimension != 0L) hash ^= OutputFeatureDimension.GetHashCode(); + hash ^= outputSpatialDimensions_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (KernelInputFeatureDimension != 0L) { + output.WriteRawTag(24); + output.WriteInt64(KernelInputFeatureDimension); + } + if (KernelOutputFeatureDimension != 0L) { + output.WriteRawTag(32); + output.WriteInt64(KernelOutputFeatureDimension); + } + kernelSpatialDimensions_.WriteTo(output, _repeated_kernelSpatialDimensions_codec); + if (InputBatchDimension != 0L) { + output.WriteRawTag(56); + output.WriteInt64(InputBatchDimension); + } + if (InputFeatureDimension != 0L) { + output.WriteRawTag(64); + output.WriteInt64(InputFeatureDimension); + } + if (OutputBatchDimension != 0L) { + output.WriteRawTag(72); + output.WriteInt64(OutputBatchDimension); + } + if (OutputFeatureDimension != 0L) { + output.WriteRawTag(80); + output.WriteInt64(OutputFeatureDimension); + } + inputSpatialDimensions_.WriteTo(output, _repeated_inputSpatialDimensions_codec); + outputSpatialDimensions_.WriteTo(output, _repeated_outputSpatialDimensions_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (KernelInputFeatureDimension != 0L) { + output.WriteRawTag(24); + output.WriteInt64(KernelInputFeatureDimension); + } + if (KernelOutputFeatureDimension != 0L) { + output.WriteRawTag(32); + output.WriteInt64(KernelOutputFeatureDimension); + } + kernelSpatialDimensions_.WriteTo(ref output, _repeated_kernelSpatialDimensions_codec); + if (InputBatchDimension != 0L) { + output.WriteRawTag(56); + output.WriteInt64(InputBatchDimension); + } + if (InputFeatureDimension != 0L) { + output.WriteRawTag(64); + output.WriteInt64(InputFeatureDimension); + } + if (OutputBatchDimension != 0L) { + output.WriteRawTag(72); + output.WriteInt64(OutputBatchDimension); + } + if (OutputFeatureDimension != 0L) { + output.WriteRawTag(80); + output.WriteInt64(OutputFeatureDimension); + } + inputSpatialDimensions_.WriteTo(ref output, _repeated_inputSpatialDimensions_codec); + outputSpatialDimensions_.WriteTo(ref output, _repeated_outputSpatialDimensions_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (InputBatchDimension != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(InputBatchDimension); + } + if (InputFeatureDimension != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(InputFeatureDimension); + } + size += inputSpatialDimensions_.CalculateSize(_repeated_inputSpatialDimensions_codec); + if (KernelInputFeatureDimension != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(KernelInputFeatureDimension); + } + if (KernelOutputFeatureDimension != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(KernelOutputFeatureDimension); + } + size += kernelSpatialDimensions_.CalculateSize(_repeated_kernelSpatialDimensions_codec); + if (OutputBatchDimension != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(OutputBatchDimension); + } + if (OutputFeatureDimension != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(OutputFeatureDimension); + } + size += outputSpatialDimensions_.CalculateSize(_repeated_outputSpatialDimensions_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ConvolutionDimensionNumbers other) { + if (other == null) { + return; + } + if (other.InputBatchDimension != 0L) { + InputBatchDimension = other.InputBatchDimension; + } + if (other.InputFeatureDimension != 0L) { + InputFeatureDimension = other.InputFeatureDimension; + } + inputSpatialDimensions_.Add(other.inputSpatialDimensions_); + if (other.KernelInputFeatureDimension != 0L) { + KernelInputFeatureDimension = other.KernelInputFeatureDimension; + } + if (other.KernelOutputFeatureDimension != 0L) { + KernelOutputFeatureDimension = other.KernelOutputFeatureDimension; + } + kernelSpatialDimensions_.Add(other.kernelSpatialDimensions_); + if (other.OutputBatchDimension != 0L) { + OutputBatchDimension = other.OutputBatchDimension; + } + if (other.OutputFeatureDimension != 0L) { + OutputFeatureDimension = other.OutputFeatureDimension; + } + outputSpatialDimensions_.Add(other.outputSpatialDimensions_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 24: { + KernelInputFeatureDimension = input.ReadInt64(); + break; + } + case 32: { + KernelOutputFeatureDimension = input.ReadInt64(); + break; + } + case 50: + case 48: { + kernelSpatialDimensions_.AddEntriesFrom(input, _repeated_kernelSpatialDimensions_codec); + break; + } + case 56: { + InputBatchDimension = input.ReadInt64(); + break; + } + case 64: { + InputFeatureDimension = input.ReadInt64(); + break; + } + case 72: { + OutputBatchDimension = input.ReadInt64(); + break; + } + case 80: { + OutputFeatureDimension = input.ReadInt64(); + break; + } + case 90: + case 88: { + inputSpatialDimensions_.AddEntriesFrom(input, _repeated_inputSpatialDimensions_codec); + break; + } + case 98: + case 96: { + outputSpatialDimensions_.AddEntriesFrom(input, _repeated_outputSpatialDimensions_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 24: { + KernelInputFeatureDimension = input.ReadInt64(); + break; + } + case 32: { + KernelOutputFeatureDimension = input.ReadInt64(); + break; + } + case 50: + case 48: { + kernelSpatialDimensions_.AddEntriesFrom(ref input, _repeated_kernelSpatialDimensions_codec); + break; + } + case 56: { + InputBatchDimension = input.ReadInt64(); + break; + } + case 64: { + InputFeatureDimension = input.ReadInt64(); + break; + } + case 72: { + OutputBatchDimension = input.ReadInt64(); + break; + } + case 80: { + OutputFeatureDimension = input.ReadInt64(); + break; + } + case 90: + case 88: { + inputSpatialDimensions_.AddEntriesFrom(ref input, _repeated_inputSpatialDimensions_codec); + break; + } + case 98: + case 96: { + outputSpatialDimensions_.AddEntriesFrom(ref input, _repeated_outputSpatialDimensions_codec); + break; + } + } + } + } + #endif + + } + + public sealed partial class DotDimensionNumbers : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DotDimensionNumbers()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[19]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DotDimensionNumbers() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DotDimensionNumbers(DotDimensionNumbers other) : this() { + lhsContractingDimensions_ = other.lhsContractingDimensions_.Clone(); + rhsContractingDimensions_ = other.rhsContractingDimensions_.Clone(); + lhsBatchDimensions_ = other.lhsBatchDimensions_.Clone(); + rhsBatchDimensions_ = other.rhsBatchDimensions_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public DotDimensionNumbers Clone() { + return new DotDimensionNumbers(this); + } + + /// Field number for the "lhs_contracting_dimensions" field. + public const int LhsContractingDimensionsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_lhsContractingDimensions_codec + = pb::FieldCodec.ForInt64(10); + private readonly pbc::RepeatedField lhsContractingDimensions_ = new pbc::RepeatedField(); + /// + /// The dimension numbers that represent the 'lhs' contracting dimensions. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField LhsContractingDimensions { + get { return lhsContractingDimensions_; } + } + + /// Field number for the "rhs_contracting_dimensions" field. + public const int RhsContractingDimensionsFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_rhsContractingDimensions_codec + = pb::FieldCodec.ForInt64(18); + private readonly pbc::RepeatedField rhsContractingDimensions_ = new pbc::RepeatedField(); + /// + /// The dimension numbers that represent the 'rhs' contracting dimensions. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField RhsContractingDimensions { + get { return rhsContractingDimensions_; } + } + + /// Field number for the "lhs_batch_dimensions" field. + public const int LhsBatchDimensionsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_lhsBatchDimensions_codec + = pb::FieldCodec.ForInt64(26); + private readonly pbc::RepeatedField lhsBatchDimensions_ = new pbc::RepeatedField(); + /// + /// The dimension numbers that represent the 'lhs' batch dimensions. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField LhsBatchDimensions { + get { return lhsBatchDimensions_; } + } + + /// Field number for the "rhs_batch_dimensions" field. + public const int RhsBatchDimensionsFieldNumber = 4; + private static readonly pb::FieldCodec _repeated_rhsBatchDimensions_codec + = pb::FieldCodec.ForInt64(34); + private readonly pbc::RepeatedField rhsBatchDimensions_ = new pbc::RepeatedField(); + /// + /// The dimension numbers that represent the 'rhs' batch dimensions. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField RhsBatchDimensions { + get { return rhsBatchDimensions_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as DotDimensionNumbers); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(DotDimensionNumbers other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!lhsContractingDimensions_.Equals(other.lhsContractingDimensions_)) return false; + if(!rhsContractingDimensions_.Equals(other.rhsContractingDimensions_)) return false; + if(!lhsBatchDimensions_.Equals(other.lhsBatchDimensions_)) return false; + if(!rhsBatchDimensions_.Equals(other.rhsBatchDimensions_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= lhsContractingDimensions_.GetHashCode(); + hash ^= rhsContractingDimensions_.GetHashCode(); + hash ^= lhsBatchDimensions_.GetHashCode(); + hash ^= rhsBatchDimensions_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + lhsContractingDimensions_.WriteTo(output, _repeated_lhsContractingDimensions_codec); + rhsContractingDimensions_.WriteTo(output, _repeated_rhsContractingDimensions_codec); + lhsBatchDimensions_.WriteTo(output, _repeated_lhsBatchDimensions_codec); + rhsBatchDimensions_.WriteTo(output, _repeated_rhsBatchDimensions_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + lhsContractingDimensions_.WriteTo(ref output, _repeated_lhsContractingDimensions_codec); + rhsContractingDimensions_.WriteTo(ref output, _repeated_rhsContractingDimensions_codec); + lhsBatchDimensions_.WriteTo(ref output, _repeated_lhsBatchDimensions_codec); + rhsBatchDimensions_.WriteTo(ref output, _repeated_rhsBatchDimensions_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += lhsContractingDimensions_.CalculateSize(_repeated_lhsContractingDimensions_codec); + size += rhsContractingDimensions_.CalculateSize(_repeated_rhsContractingDimensions_codec); + size += lhsBatchDimensions_.CalculateSize(_repeated_lhsBatchDimensions_codec); + size += rhsBatchDimensions_.CalculateSize(_repeated_rhsBatchDimensions_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(DotDimensionNumbers other) { + if (other == null) { + return; + } + lhsContractingDimensions_.Add(other.lhsContractingDimensions_); + rhsContractingDimensions_.Add(other.rhsContractingDimensions_); + lhsBatchDimensions_.Add(other.lhsBatchDimensions_); + rhsBatchDimensions_.Add(other.rhsBatchDimensions_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: + case 8: { + lhsContractingDimensions_.AddEntriesFrom(input, _repeated_lhsContractingDimensions_codec); + break; + } + case 18: + case 16: { + rhsContractingDimensions_.AddEntriesFrom(input, _repeated_rhsContractingDimensions_codec); + break; + } + case 26: + case 24: { + lhsBatchDimensions_.AddEntriesFrom(input, _repeated_lhsBatchDimensions_codec); + break; + } + case 34: + case 32: { + rhsBatchDimensions_.AddEntriesFrom(input, _repeated_rhsBatchDimensions_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: + case 8: { + lhsContractingDimensions_.AddEntriesFrom(ref input, _repeated_lhsContractingDimensions_codec); + break; + } + case 18: + case 16: { + rhsContractingDimensions_.AddEntriesFrom(ref input, _repeated_rhsContractingDimensions_codec); + break; + } + case 26: + case 24: { + lhsBatchDimensions_.AddEntriesFrom(ref input, _repeated_lhsBatchDimensions_codec); + break; + } + case 34: + case 32: { + rhsBatchDimensions_.AddEntriesFrom(ref input, _repeated_rhsBatchDimensions_codec); + break; + } + } + } + } + #endif + + } + + public sealed partial class TriangularSolveOptions : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TriangularSolveOptions()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[20]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TriangularSolveOptions() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TriangularSolveOptions(TriangularSolveOptions other) : this() { + leftSide_ = other.leftSide_; + lower_ = other.lower_; + unitDiagonal_ = other.unitDiagonal_; + transposeA_ = other.transposeA_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public TriangularSolveOptions Clone() { + return new TriangularSolveOptions(this); + } + + /// Field number for the "left_side" field. + public const int LeftSideFieldNumber = 1; + private bool leftSide_; + /// + /// If true, solves ax = b. If false, solves xa = b. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool LeftSide { + get { return leftSide_; } + set { + leftSide_ = value; + } + } + + /// Field number for the "lower" field. + public const int LowerFieldNumber = 2; + private bool lower_; + /// + /// If true, 'a' is lower triangular. If false, 'a' is upper triangular. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Lower { + get { return lower_; } + set { + lower_ = value; + } + } + + /// Field number for the "unit_diagonal" field. + public const int UnitDiagonalFieldNumber = 3; + private bool unitDiagonal_; + /// + /// If true, the diagonal elements of 'a' are assumed to be 1 and not accessed. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool UnitDiagonal { + get { return unitDiagonal_; } + set { + unitDiagonal_ = value; + } + } + + /// Field number for the "transpose_a" field. + public const int TransposeAFieldNumber = 4; + private global::Xla.TriangularSolveOptions.Types.Transpose transposeA_ = global::Xla.TriangularSolveOptions.Types.Transpose.Invalid; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.TriangularSolveOptions.Types.Transpose TransposeA { + get { return transposeA_; } + set { + transposeA_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as TriangularSolveOptions); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(TriangularSolveOptions other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (LeftSide != other.LeftSide) return false; + if (Lower != other.Lower) return false; + if (UnitDiagonal != other.UnitDiagonal) return false; + if (TransposeA != other.TransposeA) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (LeftSide != false) hash ^= LeftSide.GetHashCode(); + if (Lower != false) hash ^= Lower.GetHashCode(); + if (UnitDiagonal != false) hash ^= UnitDiagonal.GetHashCode(); + if (TransposeA != global::Xla.TriangularSolveOptions.Types.Transpose.Invalid) hash ^= TransposeA.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (LeftSide != false) { + output.WriteRawTag(8); + output.WriteBool(LeftSide); + } + if (Lower != false) { + output.WriteRawTag(16); + output.WriteBool(Lower); + } + if (UnitDiagonal != false) { + output.WriteRawTag(24); + output.WriteBool(UnitDiagonal); + } + if (TransposeA != global::Xla.TriangularSolveOptions.Types.Transpose.Invalid) { + output.WriteRawTag(32); + output.WriteEnum((int) TransposeA); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (LeftSide != false) { + output.WriteRawTag(8); + output.WriteBool(LeftSide); + } + if (Lower != false) { + output.WriteRawTag(16); + output.WriteBool(Lower); + } + if (UnitDiagonal != false) { + output.WriteRawTag(24); + output.WriteBool(UnitDiagonal); + } + if (TransposeA != global::Xla.TriangularSolveOptions.Types.Transpose.Invalid) { + output.WriteRawTag(32); + output.WriteEnum((int) TransposeA); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (LeftSide != false) { + size += 1 + 1; + } + if (Lower != false) { + size += 1 + 1; + } + if (UnitDiagonal != false) { + size += 1 + 1; + } + if (TransposeA != global::Xla.TriangularSolveOptions.Types.Transpose.Invalid) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) TransposeA); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(TriangularSolveOptions other) { + if (other == null) { + return; + } + if (other.LeftSide != false) { + LeftSide = other.LeftSide; + } + if (other.Lower != false) { + Lower = other.Lower; + } + if (other.UnitDiagonal != false) { + UnitDiagonal = other.UnitDiagonal; + } + if (other.TransposeA != global::Xla.TriangularSolveOptions.Types.Transpose.Invalid) { + TransposeA = other.TransposeA; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + LeftSide = input.ReadBool(); + break; + } + case 16: { + Lower = input.ReadBool(); + break; + } + case 24: { + UnitDiagonal = input.ReadBool(); + break; + } + case 32: { + TransposeA = (global::Xla.TriangularSolveOptions.Types.Transpose) input.ReadEnum(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + LeftSide = input.ReadBool(); + break; + } + case 16: { + Lower = input.ReadBool(); + break; + } + case 24: { + UnitDiagonal = input.ReadBool(); + break; + } + case 32: { + TransposeA = (global::Xla.TriangularSolveOptions.Types.Transpose) input.ReadEnum(); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the TriangularSolveOptions message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + /// + /// Should we transpose or use the adjoint of 'a'? + /// + public enum Transpose { + [pbr::OriginalName("TRANSPOSE_INVALID")] Invalid = 0, + /// + /// Don't transpose 'a'. + /// + [pbr::OriginalName("NO_TRANSPOSE")] NoTranspose = 1, + /// + /// Transpose 'a'. + /// + [pbr::OriginalName("TRANSPOSE")] Transpose = 2, + /// + /// Complex conjugate and transpose 'a'. + /// + [pbr::OriginalName("ADJOINT")] Adjoint = 3, + } + + } + #endregion + + } + + public sealed partial class CholeskyOptions : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CholeskyOptions()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[21]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CholeskyOptions() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CholeskyOptions(CholeskyOptions other) : this() { + lower_ = other.lower_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CholeskyOptions Clone() { + return new CholeskyOptions(this); + } + + /// Field number for the "lower" field. + public const int LowerFieldNumber = 1; + private bool lower_; + /// + /// If true, uses the lower triangle of `a`. If false, uses the upper triangle + /// of `a`. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Lower { + get { return lower_; } + set { + lower_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as CholeskyOptions); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(CholeskyOptions other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Lower != other.Lower) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Lower != false) hash ^= Lower.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Lower != false) { + output.WriteRawTag(8); + output.WriteBool(Lower); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Lower != false) { + output.WriteRawTag(8); + output.WriteBool(Lower); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Lower != false) { + size += 1 + 1; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(CholeskyOptions other) { + if (other == null) { + return; + } + if (other.Lower != false) { + Lower = other.Lower; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Lower = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Lower = input.ReadBool(); + break; + } + } + } + } + #endif + + } + + /// + /// Generic map of attributes used to pass hints / configuration options from + /// the Python frontend to the XLA backend. + /// + public sealed partial class FrontendAttributes : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FrontendAttributes()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[22]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public FrontendAttributes() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public FrontendAttributes(FrontendAttributes other) : this() { + map_ = other.map_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public FrontendAttributes Clone() { + return new FrontendAttributes(this); + } + + /// Field number for the "map" field. + public const int MapFieldNumber = 1; + private static readonly pbc::MapField.Codec _map_map_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForString(18, ""), 10); + private readonly pbc::MapField map_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::MapField Map { + get { return map_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as FrontendAttributes); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(FrontendAttributes other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!Map.Equals(other.Map)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= Map.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + map_.WriteTo(output, _map_map_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + map_.WriteTo(ref output, _map_map_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += map_.CalculateSize(_map_map_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(FrontendAttributes other) { + if (other == null) { + return; + } + map_.Add(other.map_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + map_.AddEntriesFrom(input, _map_map_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + map_.AddEntriesFrom(ref input, _map_map_codec); + break; + } + } + } + } + #endif + + } + + /// + /// LINT.IfChange + /// + public sealed partial class OpSharding : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OpSharding()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[23]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public OpSharding() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public OpSharding(OpSharding other) : this() { + type_ = other.type_; + tileShape_ = other.tileShape_ != null ? other.tileShape_.Clone() : null; + tileAssignmentDimensions_ = other.tileAssignmentDimensions_.Clone(); + tileAssignmentDevices_ = other.tileAssignmentDevices_.Clone(); + tupleShardings_ = other.tupleShardings_.Clone(); + replicateOnLastTileDim_ = other.replicateOnLastTileDim_; + metadata_ = other.metadata_.Clone(); + lastTileDims_ = other.lastTileDims_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public OpSharding Clone() { + return new OpSharding(this); + } + + /// Field number for the "type" field. + public const int TypeFieldNumber = 1; + private global::Xla.OpSharding.Types.Type type_ = global::Xla.OpSharding.Types.Type.Replicated; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.OpSharding.Types.Type Type { + get { return type_; } + set { + type_ = value; + } + } + + /// Field number for the "tile_shape" field. + public const int TileShapeFieldNumber = 2; + private global::Xla.ShapeProto tileShape_; + /// + /// The shape of the sharded tile. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.ShapeProto TileShape { + get { return tileShape_; } + set { + tileShape_ = value; + } + } + + /// Field number for the "tile_assignment_dimensions" field. + public const int TileAssignmentDimensionsFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_tileAssignmentDimensions_codec + = pb::FieldCodec.ForInt64(26); + private readonly pbc::RepeatedField tileAssignmentDimensions_ = new pbc::RepeatedField(); + /// + /// The shape of the tile assignment tensor - this must be the same rank as + /// tile_shape and the product of its dimensions must equal + /// tile_assignment_devices.size(). + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField TileAssignmentDimensions { + get { return tileAssignmentDimensions_; } + } + + /// Field number for the "tile_assignment_devices" field. + public const int TileAssignmentDevicesFieldNumber = 4; + private static readonly pb::FieldCodec _repeated_tileAssignmentDevices_codec + = pb::FieldCodec.ForInt64(34); + private readonly pbc::RepeatedField tileAssignmentDevices_ = new pbc::RepeatedField(); + /// + /// Flattened list of device IDs. The order of flattening is the same as used + /// by IndexUtil::MultiToLinearIndex(tile_assignment_shape). + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField TileAssignmentDevices { + get { return tileAssignmentDevices_; } + } + + /// Field number for the "tuple_shardings" field. + public const int TupleShardingsFieldNumber = 5; + private static readonly pb::FieldCodec _repeated_tupleShardings_codec + = pb::FieldCodec.ForMessage(42, global::Xla.OpSharding.Parser); + private readonly pbc::RepeatedField tupleShardings_ = new pbc::RepeatedField(); + /// + /// If type == TUPLE, the sub-shardings, one per leaf node in the tuple shape, + /// in pre-order. The tuple shape could be nested; here we store just a + /// flattened list of all leaves in the tuple shape. Note that the tuple shape + /// is not stored here; shardings do not store the shapes to which they are + /// applied, this is inferred from the instruction this sharding gets attached + /// to. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField TupleShardings { + get { return tupleShardings_; } + } + + /// Field number for the "replicate_on_last_tile_dim" field. + public const int ReplicateOnLastTileDimFieldNumber = 6; + private bool replicateOnLastTileDim_; + /// + /// Only used for OTHER type. If true, data is sharded according to other + /// dimensions of tile_assignment(), but replicated across devices along the + /// last dimension. (Experimental) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool ReplicateOnLastTileDim { + get { return replicateOnLastTileDim_; } + set { + replicateOnLastTileDim_ = value; + } + } + + /// Field number for the "metadata" field. + public const int MetadataFieldNumber = 7; + private static readonly pb::FieldCodec _repeated_metadata_codec + = pb::FieldCodec.ForMessage(58, global::Xla.OpMetadata.Parser); + private readonly pbc::RepeatedField metadata_ = new pbc::RepeatedField(); + /// + /// This field is used to track the source of this sharding, usually derived + /// from instructions. Multple metadata may be populated if sharding is + /// combined with other shardings. Metadata are to not be populated when + /// type == TUPLE and instead metadata should be set on individual tuple + /// elements. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Metadata { + get { return metadata_; } + } + + /// Field number for the "last_tile_dims" field. + public const int LastTileDimsFieldNumber = 8; + private static readonly pb::FieldCodec _repeated_lastTileDims_codec + = pb::FieldCodec.ForEnum(66, x => (int) x, x => (global::Xla.OpSharding.Types.Type) x); + private readonly pbc::RepeatedField lastTileDims_ = new pbc::RepeatedField(); + /// + /// This field is used to represented the sharding type of each subgroup. + /// For example, sharding={devices=[2,2,2,2]0,1,2,...,15 last_tile_dims={ + /// replicate, manual, unreduced}} means that each of the last 3 dimensions + /// in [2,2,2,2] represents a subgrouping in replicate, manual, + /// unreduced sharding type respectively. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField LastTileDims { + get { return lastTileDims_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as OpSharding); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(OpSharding other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Type != other.Type) return false; + if (!object.Equals(TileShape, other.TileShape)) return false; + if(!tileAssignmentDimensions_.Equals(other.tileAssignmentDimensions_)) return false; + if(!tileAssignmentDevices_.Equals(other.tileAssignmentDevices_)) return false; + if(!tupleShardings_.Equals(other.tupleShardings_)) return false; + if (ReplicateOnLastTileDim != other.ReplicateOnLastTileDim) return false; + if(!metadata_.Equals(other.metadata_)) return false; + if(!lastTileDims_.Equals(other.lastTileDims_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Type != global::Xla.OpSharding.Types.Type.Replicated) hash ^= Type.GetHashCode(); + if (tileShape_ != null) hash ^= TileShape.GetHashCode(); + hash ^= tileAssignmentDimensions_.GetHashCode(); + hash ^= tileAssignmentDevices_.GetHashCode(); + hash ^= tupleShardings_.GetHashCode(); + if (ReplicateOnLastTileDim != false) hash ^= ReplicateOnLastTileDim.GetHashCode(); + hash ^= metadata_.GetHashCode(); + hash ^= lastTileDims_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Type != global::Xla.OpSharding.Types.Type.Replicated) { + output.WriteRawTag(8); + output.WriteEnum((int) Type); + } + if (tileShape_ != null) { + output.WriteRawTag(18); + output.WriteMessage(TileShape); + } + tileAssignmentDimensions_.WriteTo(output, _repeated_tileAssignmentDimensions_codec); + tileAssignmentDevices_.WriteTo(output, _repeated_tileAssignmentDevices_codec); + tupleShardings_.WriteTo(output, _repeated_tupleShardings_codec); + if (ReplicateOnLastTileDim != false) { + output.WriteRawTag(48); + output.WriteBool(ReplicateOnLastTileDim); + } + metadata_.WriteTo(output, _repeated_metadata_codec); + lastTileDims_.WriteTo(output, _repeated_lastTileDims_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Type != global::Xla.OpSharding.Types.Type.Replicated) { + output.WriteRawTag(8); + output.WriteEnum((int) Type); + } + if (tileShape_ != null) { + output.WriteRawTag(18); + output.WriteMessage(TileShape); + } + tileAssignmentDimensions_.WriteTo(ref output, _repeated_tileAssignmentDimensions_codec); + tileAssignmentDevices_.WriteTo(ref output, _repeated_tileAssignmentDevices_codec); + tupleShardings_.WriteTo(ref output, _repeated_tupleShardings_codec); + if (ReplicateOnLastTileDim != false) { + output.WriteRawTag(48); + output.WriteBool(ReplicateOnLastTileDim); + } + metadata_.WriteTo(ref output, _repeated_metadata_codec); + lastTileDims_.WriteTo(ref output, _repeated_lastTileDims_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Type != global::Xla.OpSharding.Types.Type.Replicated) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type); + } + if (tileShape_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(TileShape); + } + size += tileAssignmentDimensions_.CalculateSize(_repeated_tileAssignmentDimensions_codec); + size += tileAssignmentDevices_.CalculateSize(_repeated_tileAssignmentDevices_codec); + size += tupleShardings_.CalculateSize(_repeated_tupleShardings_codec); + if (ReplicateOnLastTileDim != false) { + size += 1 + 1; + } + size += metadata_.CalculateSize(_repeated_metadata_codec); + size += lastTileDims_.CalculateSize(_repeated_lastTileDims_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(OpSharding other) { + if (other == null) { + return; + } + if (other.Type != global::Xla.OpSharding.Types.Type.Replicated) { + Type = other.Type; + } + if (other.tileShape_ != null) { + if (tileShape_ == null) { + TileShape = new global::Xla.ShapeProto(); + } + TileShape.MergeFrom(other.TileShape); + } + tileAssignmentDimensions_.Add(other.tileAssignmentDimensions_); + tileAssignmentDevices_.Add(other.tileAssignmentDevices_); + tupleShardings_.Add(other.tupleShardings_); + if (other.ReplicateOnLastTileDim != false) { + ReplicateOnLastTileDim = other.ReplicateOnLastTileDim; + } + metadata_.Add(other.metadata_); + lastTileDims_.Add(other.lastTileDims_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Type = (global::Xla.OpSharding.Types.Type) input.ReadEnum(); + break; + } + case 18: { + if (tileShape_ == null) { + TileShape = new global::Xla.ShapeProto(); + } + input.ReadMessage(TileShape); + break; + } + case 26: + case 24: { + tileAssignmentDimensions_.AddEntriesFrom(input, _repeated_tileAssignmentDimensions_codec); + break; + } + case 34: + case 32: { + tileAssignmentDevices_.AddEntriesFrom(input, _repeated_tileAssignmentDevices_codec); + break; + } + case 42: { + tupleShardings_.AddEntriesFrom(input, _repeated_tupleShardings_codec); + break; + } + case 48: { + ReplicateOnLastTileDim = input.ReadBool(); + break; + } + case 58: { + metadata_.AddEntriesFrom(input, _repeated_metadata_codec); + break; + } + case 66: + case 64: { + lastTileDims_.AddEntriesFrom(input, _repeated_lastTileDims_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Type = (global::Xla.OpSharding.Types.Type) input.ReadEnum(); + break; + } + case 18: { + if (tileShape_ == null) { + TileShape = new global::Xla.ShapeProto(); + } + input.ReadMessage(TileShape); + break; + } + case 26: + case 24: { + tileAssignmentDimensions_.AddEntriesFrom(ref input, _repeated_tileAssignmentDimensions_codec); + break; + } + case 34: + case 32: { + tileAssignmentDevices_.AddEntriesFrom(ref input, _repeated_tileAssignmentDevices_codec); + break; + } + case 42: { + tupleShardings_.AddEntriesFrom(ref input, _repeated_tupleShardings_codec); + break; + } + case 48: { + ReplicateOnLastTileDim = input.ReadBool(); + break; + } + case 58: { + metadata_.AddEntriesFrom(ref input, _repeated_metadata_codec); + break; + } + case 66: + case 64: { + lastTileDims_.AddEntriesFrom(ref input, _repeated_lastTileDims_codec); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the OpSharding message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + public enum Type { + /// + /// This sharding is replicated across all devices (implies maximal, + /// all other fields are unused). + /// + [pbr::OriginalName("REPLICATED")] Replicated = 0, + /// + /// This sharding is maximal - one device runs the entire operation. + /// + [pbr::OriginalName("MAXIMAL")] Maximal = 1, + /// + /// This sharding is a tuple - only the tuple_shardings field is valid. + /// + [pbr::OriginalName("TUPLE")] Tuple = 2, + /// + /// None of the above; tile_shape and tile_assignment are both used. + /// + [pbr::OriginalName("OTHER")] Other = 3, + /// + /// This op is manually sharded: the shapes are already partitioned and the + /// partitioner should not change this op. + /// + [pbr::OriginalName("MANUAL")] Manual = 4, + } + + } + #endregion + + } + + /// + /// Describes the replica groups in a cross replica op (e.g., all-reduce and + /// all-to-all). + /// + public sealed partial class ReplicaGroup : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReplicaGroup()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[24]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ReplicaGroup() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ReplicaGroup(ReplicaGroup other) : this() { + replicaIds_ = other.replicaIds_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ReplicaGroup Clone() { + return new ReplicaGroup(this); + } + + /// Field number for the "replica_ids" field. + public const int ReplicaIdsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_replicaIds_codec + = pb::FieldCodec.ForInt64(10); + private readonly pbc::RepeatedField replicaIds_ = new pbc::RepeatedField(); + /// + /// The ids of the replicas that belongs to the same group. The ordering of the + /// ids matters in some ops (e.g., all-to-all). + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField ReplicaIds { + get { return replicaIds_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ReplicaGroup); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ReplicaGroup other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!replicaIds_.Equals(other.replicaIds_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= replicaIds_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + replicaIds_.WriteTo(output, _repeated_replicaIds_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + replicaIds_.WriteTo(ref output, _repeated_replicaIds_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += replicaIds_.CalculateSize(_repeated_replicaIds_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ReplicaGroup other) { + if (other == null) { + return; + } + replicaIds_.Add(other.replicaIds_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: + case 8: { + replicaIds_.AddEntriesFrom(input, _repeated_replicaIds_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: + case 8: { + replicaIds_.AddEntriesFrom(ref input, _repeated_replicaIds_codec); + break; + } + } + } + } + #endif + + } + + /// + /// Describes the source target pair in the collective permute op. + /// + public sealed partial class SourceTarget : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SourceTarget()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[25]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public SourceTarget() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public SourceTarget(SourceTarget other) : this() { + source_ = other.source_; + target_ = other.target_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public SourceTarget Clone() { + return new SourceTarget(this); + } + + /// Field number for the "source" field. + public const int SourceFieldNumber = 1; + private long source_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Source { + get { return source_; } + set { + source_ = value; + } + } + + /// Field number for the "target" field. + public const int TargetFieldNumber = 2; + private long target_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Target { + get { return target_; } + set { + target_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as SourceTarget); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(SourceTarget other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Source != other.Source) return false; + if (Target != other.Target) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Source != 0L) hash ^= Source.GetHashCode(); + if (Target != 0L) hash ^= Target.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Source != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Source); + } + if (Target != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Target); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Source != 0L) { + output.WriteRawTag(8); + output.WriteInt64(Source); + } + if (Target != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Target); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Source != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Source); + } + if (Target != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Target); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(SourceTarget other) { + if (other == null) { + return; + } + if (other.Source != 0L) { + Source = other.Source; + } + if (other.Target != 0L) { + Target = other.Target; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + Source = input.ReadInt64(); + break; + } + case 16: { + Target = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + Source = input.ReadInt64(); + break; + } + case 16: { + Target = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + /// + /// Used to indicate the precision configuration. It has backend specific + /// meaning. + /// + public sealed partial class PrecisionConfig : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PrecisionConfig()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[26]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PrecisionConfig() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PrecisionConfig(PrecisionConfig other) : this() { + operandPrecision_ = other.operandPrecision_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PrecisionConfig Clone() { + return new PrecisionConfig(this); + } + + /// Field number for the "operand_precision" field. + public const int OperandPrecisionFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_operandPrecision_codec + = pb::FieldCodec.ForEnum(10, x => (int) x, x => (global::Xla.PrecisionConfig.Types.Precision) x); + private readonly pbc::RepeatedField operandPrecision_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField OperandPrecision { + get { return operandPrecision_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as PrecisionConfig); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(PrecisionConfig other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!operandPrecision_.Equals(other.operandPrecision_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= operandPrecision_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + operandPrecision_.WriteTo(output, _repeated_operandPrecision_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + operandPrecision_.WriteTo(ref output, _repeated_operandPrecision_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += operandPrecision_.CalculateSize(_repeated_operandPrecision_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(PrecisionConfig other) { + if (other == null) { + return; + } + operandPrecision_.Add(other.operandPrecision_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: + case 8: { + operandPrecision_.AddEntriesFrom(input, _repeated_operandPrecision_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: + case 8: { + operandPrecision_.AddEntriesFrom(ref input, _repeated_operandPrecision_codec); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the PrecisionConfig message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + public enum Precision { + [pbr::OriginalName("DEFAULT")] Default = 0, + [pbr::OriginalName("HIGH")] High = 1, + [pbr::OriginalName("HIGHEST")] Highest = 2, + /// + /// Each U8/S8 value in a tensor actually represents 2 nibble values. + /// + [pbr::OriginalName("PACKED_NIBBLE")] PackedNibble = 3, + } + + } + #endregion + + } + + /// + /// Describes whether all data-parallelism replicas will receive the same + /// parameter data at each buffer. + /// + public sealed partial class ParameterReplication : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ParameterReplication()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[27]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ParameterReplication() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ParameterReplication(ParameterReplication other) : this() { + replicatedAtLeafBuffers_ = other.replicatedAtLeafBuffers_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public ParameterReplication Clone() { + return new ParameterReplication(this); + } + + /// Field number for the "replicated_at_leaf_buffers" field. + public const int ReplicatedAtLeafBuffersFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_replicatedAtLeafBuffers_codec + = pb::FieldCodec.ForBool(10); + private readonly pbc::RepeatedField replicatedAtLeafBuffers_ = new pbc::RepeatedField(); + /// + /// A list of boolean values for the flattened leaf buffers. Each value + /// indicates whether the corresponding leaf buffer is replicated. + /// + /// If this field is empty, it means no buffer is replicated. Otherwise, the + /// number of elements in this field must match the number of leaf buffers in + /// the HLO instruction's shape. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField ReplicatedAtLeafBuffers { + get { return replicatedAtLeafBuffers_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as ParameterReplication); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(ParameterReplication other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!replicatedAtLeafBuffers_.Equals(other.replicatedAtLeafBuffers_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= replicatedAtLeafBuffers_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + replicatedAtLeafBuffers_.WriteTo(output, _repeated_replicatedAtLeafBuffers_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + replicatedAtLeafBuffers_.WriteTo(ref output, _repeated_replicatedAtLeafBuffers_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += replicatedAtLeafBuffers_.CalculateSize(_repeated_replicatedAtLeafBuffers_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(ParameterReplication other) { + if (other == null) { + return; + } + replicatedAtLeafBuffers_.Add(other.replicatedAtLeafBuffers_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: + case 8: { + replicatedAtLeafBuffers_.AddEntriesFrom(input, _repeated_replicatedAtLeafBuffers_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: + case 8: { + replicatedAtLeafBuffers_.AddEntriesFrom(ref input, _repeated_replicatedAtLeafBuffers_codec); + break; + } + } + } + } + #endif + + } + + /// + /// A backend-config for kWhile loops that stores the loop's trip count, if it is + /// known. + /// + /// This is useful for backends that can implement a `for i in 0..N` loop more + /// efficiently than a `while` loop. For example, on GPUs, we can implement a + /// `for i in 0..N` loop by enqueueing the kernels for the loop body N times, + /// whereas implementing a `while` loop requires a host-device sync on each + /// iteration. + /// + public sealed partial class WhileLoopBackendConfig : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WhileLoopBackendConfig()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[28]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WhileLoopBackendConfig() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WhileLoopBackendConfig(WhileLoopBackendConfig other) : this() { + knownTripCount_ = other.knownTripCount_ != null ? other.knownTripCount_.Clone() : null; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public WhileLoopBackendConfig Clone() { + return new WhileLoopBackendConfig(this); + } + + /// Field number for the "known_trip_count" field. + public const int KnownTripCountFieldNumber = 1; + private global::Xla.WhileLoopBackendConfig.Types.KnownTripCount knownTripCount_; + /// + /// This indirection lets us distinguish between known-trip-count == 0 and + /// unknown-trip-count. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Xla.WhileLoopBackendConfig.Types.KnownTripCount KnownTripCount { + get { return knownTripCount_; } + set { + knownTripCount_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as WhileLoopBackendConfig); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(WhileLoopBackendConfig other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(KnownTripCount, other.KnownTripCount)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (knownTripCount_ != null) hash ^= KnownTripCount.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (knownTripCount_ != null) { + output.WriteRawTag(10); + output.WriteMessage(KnownTripCount); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (knownTripCount_ != null) { + output.WriteRawTag(10); + output.WriteMessage(KnownTripCount); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (knownTripCount_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(KnownTripCount); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(WhileLoopBackendConfig other) { + if (other == null) { + return; + } + if (other.knownTripCount_ != null) { + if (knownTripCount_ == null) { + KnownTripCount = new global::Xla.WhileLoopBackendConfig.Types.KnownTripCount(); + } + KnownTripCount.MergeFrom(other.KnownTripCount); + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (knownTripCount_ == null) { + KnownTripCount = new global::Xla.WhileLoopBackendConfig.Types.KnownTripCount(); + } + input.ReadMessage(KnownTripCount); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (knownTripCount_ == null) { + KnownTripCount = new global::Xla.WhileLoopBackendConfig.Types.KnownTripCount(); + } + input.ReadMessage(KnownTripCount); + break; + } + } + } + } + #endif + + #region Nested types + /// Container for nested types declared in the WhileLoopBackendConfig message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static partial class Types { + public sealed partial class KnownTripCount : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new KnownTripCount()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.WhileLoopBackendConfig.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public KnownTripCount() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public KnownTripCount(KnownTripCount other) : this() { + n_ = other.n_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public KnownTripCount Clone() { + return new KnownTripCount(this); + } + + /// Field number for the "n" field. + public const int NFieldNumber = 1; + private long n_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long N { + get { return n_; } + set { + n_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as KnownTripCount); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(KnownTripCount other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (N != other.N) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (N != 0L) hash ^= N.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (N != 0L) { + output.WriteRawTag(8); + output.WriteInt64(N); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (N != 0L) { + output.WriteRawTag(8); + output.WriteInt64(N); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (N != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(N); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(KnownTripCount other) { + if (other == null) { + return; + } + if (other.N != 0L) { + N = other.N; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + N = input.ReadInt64(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + N = input.ReadInt64(); + break; + } + } + } + } + #endif + + } + + } + #endregion + + } + + /// + /// Specifies a pair of output/operand buffers for kCustomCall that alias each + /// other. + /// + public sealed partial class CustomCallOutputOperandAliasing : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomCallOutputOperandAliasing()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.XlaDataReflection.Descriptor.MessageTypes[29]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CustomCallOutputOperandAliasing() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CustomCallOutputOperandAliasing(CustomCallOutputOperandAliasing other) : this() { + outputShapeIndex_ = other.outputShapeIndex_.Clone(); + operandIndex_ = other.operandIndex_; + operandShapeIndex_ = other.operandShapeIndex_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public CustomCallOutputOperandAliasing Clone() { + return new CustomCallOutputOperandAliasing(this); + } + + /// Field number for the "output_shape_index" field. + public const int OutputShapeIndexFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_outputShapeIndex_codec + = pb::FieldCodec.ForInt64(10); + private readonly pbc::RepeatedField outputShapeIndex_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField OutputShapeIndex { + get { return outputShapeIndex_; } + } + + /// Field number for the "operand_index" field. + public const int OperandIndexFieldNumber = 2; + private long operandIndex_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long OperandIndex { + get { return operandIndex_; } + set { + operandIndex_ = value; + } + } + + /// Field number for the "operand_shape_index" field. + public const int OperandShapeIndexFieldNumber = 3; + private static readonly pb::FieldCodec _repeated_operandShapeIndex_codec + = pb::FieldCodec.ForInt64(26); + private readonly pbc::RepeatedField operandShapeIndex_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField OperandShapeIndex { + get { return operandShapeIndex_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as CustomCallOutputOperandAliasing); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(CustomCallOutputOperandAliasing other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!outputShapeIndex_.Equals(other.outputShapeIndex_)) return false; + if (OperandIndex != other.OperandIndex) return false; + if(!operandShapeIndex_.Equals(other.operandShapeIndex_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= outputShapeIndex_.GetHashCode(); + if (OperandIndex != 0L) hash ^= OperandIndex.GetHashCode(); + hash ^= operandShapeIndex_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + outputShapeIndex_.WriteTo(output, _repeated_outputShapeIndex_codec); + if (OperandIndex != 0L) { + output.WriteRawTag(16); + output.WriteInt64(OperandIndex); + } + operandShapeIndex_.WriteTo(output, _repeated_operandShapeIndex_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + outputShapeIndex_.WriteTo(ref output, _repeated_outputShapeIndex_codec); + if (OperandIndex != 0L) { + output.WriteRawTag(16); + output.WriteInt64(OperandIndex); + } + operandShapeIndex_.WriteTo(ref output, _repeated_operandShapeIndex_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += outputShapeIndex_.CalculateSize(_repeated_outputShapeIndex_codec); + if (OperandIndex != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(OperandIndex); + } + size += operandShapeIndex_.CalculateSize(_repeated_operandShapeIndex_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(CustomCallOutputOperandAliasing other) { + if (other == null) { + return; + } + outputShapeIndex_.Add(other.outputShapeIndex_); + if (other.OperandIndex != 0L) { + OperandIndex = other.OperandIndex; + } + operandShapeIndex_.Add(other.operandShapeIndex_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: + case 8: { + outputShapeIndex_.AddEntriesFrom(input, _repeated_outputShapeIndex_codec); + break; + } + case 16: { + OperandIndex = input.ReadInt64(); + break; + } + case 26: + case 24: { + operandShapeIndex_.AddEntriesFrom(input, _repeated_operandShapeIndex_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: + case 8: { + outputShapeIndex_.AddEntriesFrom(ref input, _repeated_outputShapeIndex_codec); + break; + } + case 16: { + OperandIndex = input.ReadInt64(); + break; + } + case 26: + case 24: { + operandShapeIndex_.AddEntriesFrom(ref input, _repeated_operandShapeIndex_codec); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/TensorFlowNET.Core/Protobuf/XlaFramework.cs b/src/TensorFlowNET.Core/Protobuf/XlaFramework.cs new file mode 100644 index 000000000..1cad3ef3b --- /dev/null +++ b/src/TensorFlowNET.Core/Protobuf/XlaFramework.cs @@ -0,0 +1,360 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tensorflow/compiler/xla/service/cpu/xla_framework.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Xla.Cpu { + + /// Holder for reflection information generated from tensorflow/compiler/xla/service/cpu/xla_framework.proto + public static partial class XlaFrameworkReflection { + + #region Descriptor + /// File descriptor for tensorflow/compiler/xla/service/cpu/xla_framework.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static XlaFrameworkReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Cjd0ZW5zb3JmbG93L2NvbXBpbGVyL3hsYS9zZXJ2aWNlL2NwdS94bGFfZnJh", + "bWV3b3JrLnByb3RvEgd4bGEuY3B1InoKGFhsYUZyYW1ld29ya01hcHBpbmdQ", + "cm90bxISCgZpbnB1dHMYASADKANCAhABEh0KEWZsYXR0ZW5lZF9vdXRwdXRz", + "GAIgAygDQgIQARISCgZyZXN1bHQYAyABKAM6Ai0xEhcKD291dHB1dF9pc190", + "dXBsZRgEIAEoCA==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Xla.Cpu.XlaFrameworkMappingProto), global::Xla.Cpu.XlaFrameworkMappingProto.Parser, new[]{ "Inputs", "FlattenedOutputs", "Result", "OutputIsTuple" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class XlaFrameworkMappingProto : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new XlaFrameworkMappingProto()); + private pb::UnknownFieldSet _unknownFields; + private int _hasBits0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Xla.Cpu.XlaFrameworkReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public XlaFrameworkMappingProto() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public XlaFrameworkMappingProto(XlaFrameworkMappingProto other) : this() { + _hasBits0 = other._hasBits0; + inputs_ = other.inputs_.Clone(); + flattenedOutputs_ = other.flattenedOutputs_.Clone(); + result_ = other.result_; + outputIsTuple_ = other.outputIsTuple_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public XlaFrameworkMappingProto Clone() { + return new XlaFrameworkMappingProto(this); + } + + /// Field number for the "inputs" field. + public const int InputsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_inputs_codec + = pb::FieldCodec.ForInt64(10); + private readonly pbc::RepeatedField inputs_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField Inputs { + get { return inputs_; } + } + + /// Field number for the "flattened_outputs" field. + public const int FlattenedOutputsFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_flattenedOutputs_codec + = pb::FieldCodec.ForInt64(18); + private readonly pbc::RepeatedField flattenedOutputs_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField FlattenedOutputs { + get { return flattenedOutputs_; } + } + + /// Field number for the "result" field. + public const int ResultFieldNumber = 3; + private readonly static long ResultDefaultValue = -1L; + + private long result_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public long Result { + get { if ((_hasBits0 & 1) != 0) { return result_; } else { return ResultDefaultValue; } } + set { + _hasBits0 |= 1; + result_ = value; + } + } + /// Gets whether the "result" field is set + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool HasResult { + get { return (_hasBits0 & 1) != 0; } + } + /// Clears the value of the "result" field + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void ClearResult() { + _hasBits0 &= ~1; + } + + /// Field number for the "output_is_tuple" field. + public const int OutputIsTupleFieldNumber = 4; + private readonly static bool OutputIsTupleDefaultValue = false; + + private bool outputIsTuple_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool OutputIsTuple { + get { if ((_hasBits0 & 2) != 0) { return outputIsTuple_; } else { return OutputIsTupleDefaultValue; } } + set { + _hasBits0 |= 2; + outputIsTuple_ = value; + } + } + /// Gets whether the "output_is_tuple" field is set + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool HasOutputIsTuple { + get { return (_hasBits0 & 2) != 0; } + } + /// Clears the value of the "output_is_tuple" field + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void ClearOutputIsTuple() { + _hasBits0 &= ~2; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as XlaFrameworkMappingProto); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(XlaFrameworkMappingProto other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!inputs_.Equals(other.inputs_)) return false; + if(!flattenedOutputs_.Equals(other.flattenedOutputs_)) return false; + if (Result != other.Result) return false; + if (OutputIsTuple != other.OutputIsTuple) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= inputs_.GetHashCode(); + hash ^= flattenedOutputs_.GetHashCode(); + if (HasResult) hash ^= Result.GetHashCode(); + if (HasOutputIsTuple) hash ^= OutputIsTuple.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + inputs_.WriteTo(output, _repeated_inputs_codec); + flattenedOutputs_.WriteTo(output, _repeated_flattenedOutputs_codec); + if (HasResult) { + output.WriteRawTag(24); + output.WriteInt64(Result); + } + if (HasOutputIsTuple) { + output.WriteRawTag(32); + output.WriteBool(OutputIsTuple); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + inputs_.WriteTo(ref output, _repeated_inputs_codec); + flattenedOutputs_.WriteTo(ref output, _repeated_flattenedOutputs_codec); + if (HasResult) { + output.WriteRawTag(24); + output.WriteInt64(Result); + } + if (HasOutputIsTuple) { + output.WriteRawTag(32); + output.WriteBool(OutputIsTuple); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += inputs_.CalculateSize(_repeated_inputs_codec); + size += flattenedOutputs_.CalculateSize(_repeated_flattenedOutputs_codec); + if (HasResult) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Result); + } + if (HasOutputIsTuple) { + size += 1 + 1; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(XlaFrameworkMappingProto other) { + if (other == null) { + return; + } + inputs_.Add(other.inputs_); + flattenedOutputs_.Add(other.flattenedOutputs_); + if (other.HasResult) { + Result = other.Result; + } + if (other.HasOutputIsTuple) { + OutputIsTuple = other.OutputIsTuple; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: + case 8: { + inputs_.AddEntriesFrom(input, _repeated_inputs_codec); + break; + } + case 18: + case 16: { + flattenedOutputs_.AddEntriesFrom(input, _repeated_flattenedOutputs_codec); + break; + } + case 24: { + Result = input.ReadInt64(); + break; + } + case 32: { + OutputIsTuple = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: + case 8: { + inputs_.AddEntriesFrom(ref input, _repeated_inputs_codec); + break; + } + case 18: + case 16: { + flattenedOutputs_.AddEntriesFrom(ref input, _repeated_flattenedOutputs_codec); + break; + } + case 24: { + Result = input.ReadInt64(); + break; + } + case 32: { + OutputIsTuple = input.ReadBool(); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/src/TensorFlowNET.Core/Sessions/BaseSession.cs b/src/TensorFlowNET.Core/Sessions/BaseSession.cs index 4e131b365..0a9cfc2eb 100644 --- a/src/TensorFlowNET.Core/Sessions/BaseSession.cs +++ b/src/TensorFlowNET.Core/Sessions/BaseSession.cs @@ -14,281 +14,272 @@ You may obtain a copy of the License at limitations under the License. ******************************************************************************/ -using Google.Protobuf; using Tensorflow.NumPy; -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Numerics; -using System.Text; -using Tensorflow.Util; using static Tensorflow.Binding; -namespace Tensorflow +namespace Tensorflow; + +public class BaseSession : IDisposable { - public class BaseSession : DisposableObject + protected SafeSessionHandle _handle; + protected Graph _graph; + protected Status _status; + public Graph graph => _graph; + + public BaseSession(SafeSessionHandle handle, Graph g) { - protected Graph _graph; - protected Status _status; - public Graph graph => _graph; + _handle = handle; + _graph = g ?? ops.get_default_graph(); + } - public BaseSession(IntPtr handle, Graph g) + public BaseSession(string target = "", Graph g = null, ConfigProto config = null, Status status = null) + { + _graph = g ?? ops.get_default_graph(); + if (!_graph.building_function) { - _handle = handle; - _graph = g ?? ops.get_default_graph(); + if (ops.get_default_graph() != _graph) + _graph.as_default(); } + + var opts = new SessionOptions(target, config); + _status = status ?? tf.Status; + _handle = c_api.TF_NewSession(_graph, opts, _status); + _status.Check(true); + } - public BaseSession(string target = "", Graph g = null, ConfigProto config = null, Status status = null) - { - _graph = g ?? ops.get_default_graph(); - if (!_graph.building_function) - { - if (ops.get_default_graph() != _graph) - _graph.as_default(); - } - - using var opts = new SessionOptions(target, config); - _status = status ?? tf.Status; - _handle = c_api.TF_NewSession(_graph, opts.Handle, _status.Handle); - _status.Check(true); - } + public virtual void run(Operation op, params FeedItem[] feed_dict) + { + _run(op, feed_dict); + } - public virtual void run(Operation op, params FeedItem[] feed_dict) - { - _run(op, feed_dict); - } + public virtual NDArray run(Tensor fetche, params FeedItem[] feed_dict) + { + return _run(fetche, feed_dict)[0]; + } - public virtual NDArray run(Tensor fetche, params FeedItem[] feed_dict) - { - return _run(fetche, feed_dict)[0]; - } + public virtual NDArray run(ITensorOrOperation fetche, params FeedItem[] feed_dict) + { + var results = _run(fetche, feed_dict); + return fetche is Tensor ? results[0] : null; + } - public virtual NDArray run(ITensorOrOperation fetche, params FeedItem[] feed_dict) - { - var results = _run(fetche, feed_dict); - return fetche is Tensor ? results[0] : null; - } + public virtual (NDArray, NDArray, NDArray, NDArray, NDArray) run( + (ITensorOrOperation, ITensorOrOperation, ITensorOrOperation, ITensorOrOperation, ITensorOrOperation) fetches, + params FeedItem[] feed_dict) + { + var results = _run(new object[] { fetches.Item1, fetches.Item2, fetches.Item3, fetches.Item4, fetches.Item5 }, feed_dict); + return (results[0], results[1], results[2], results[3], results[4]); + } - public virtual (NDArray, NDArray, NDArray, NDArray, NDArray) run( - (ITensorOrOperation, ITensorOrOperation, ITensorOrOperation, ITensorOrOperation, ITensorOrOperation) fetches, - params FeedItem[] feed_dict) - { - var results = _run(new object[] { fetches.Item1, fetches.Item2, fetches.Item3, fetches.Item4, fetches.Item5 }, feed_dict); - return (results[0], results[1], results[2], results[3], results[4]); - } + public virtual (NDArray, NDArray, NDArray, NDArray) run((ITensorOrOperation, ITensorOrOperation, ITensorOrOperation, ITensorOrOperation) fetches, params FeedItem[] feed_dict) + { + var results = _run(new object[] { fetches.Item1, fetches.Item2, fetches.Item3, fetches.Item4 }, feed_dict); + return (results[0], results[1], results[2], results[3]); + } - public virtual (NDArray, NDArray, NDArray, NDArray) run((ITensorOrOperation, ITensorOrOperation, ITensorOrOperation, ITensorOrOperation) fetches, params FeedItem[] feed_dict) - { - var results = _run(new object[] { fetches.Item1, fetches.Item2, fetches.Item3, fetches.Item4 }, feed_dict); - return (results[0], results[1], results[2], results[3]); - } + public virtual (NDArray, NDArray, NDArray) run((ITensorOrOperation, ITensorOrOperation, ITensorOrOperation) fetches, params FeedItem[] feed_dict) + { + var results = _run(new object[] { fetches.Item1, fetches.Item2, fetches.Item3 }, feed_dict); + return (results[0], results[1], results[2]); + } - public virtual (NDArray, NDArray, NDArray) run((ITensorOrOperation, ITensorOrOperation, ITensorOrOperation) fetches, params FeedItem[] feed_dict) - { - var results = _run(new object[] { fetches.Item1, fetches.Item2, fetches.Item3 }, feed_dict); - return (results[0], results[1], results[2]); - } + public virtual (NDArray, NDArray) run((ITensorOrOperation, ITensorOrOperation) fetches, params FeedItem[] feed_dict) + { + var results = _run(new object[] { fetches.Item1, fetches.Item2 }, feed_dict); + return (results[0], results[1]); + } - public virtual (NDArray, NDArray) run((ITensorOrOperation, ITensorOrOperation) fetches, params FeedItem[] feed_dict) - { - var results = _run(new object[] { fetches.Item1, fetches.Item2 }, feed_dict); - return (results[0], results[1]); - } + public virtual NDArray[] run(object fetches, params FeedItem[] feed_dict) + { + return _run(fetches, feed_dict); + } - public virtual NDArray[] run(object fetches, params FeedItem[] feed_dict) - { - return _run(fetches, feed_dict); - } + public virtual NDArray[] run(object fetches, Hashtable feed_dict = null) + { + var feed_items = feed_dict == null ? new FeedItem[0] : feed_dict.Keys.OfType().Select(key => new FeedItem(key, feed_dict[key])).ToArray(); + return _run(fetches, feed_items); + } - public virtual NDArray[] run(object fetches, Hashtable feed_dict = null) - { - var feed_items = feed_dict == null ? new FeedItem[0] : feed_dict.Keys.OfType().Select(key => new FeedItem(key, feed_dict[key])).ToArray(); - return _run(fetches, feed_items); - } + private NDArray[] _run(object fetches, FeedItem[] feed_dict = null) + { + var feed_dict_tensor = new Dictionary(); + //var feed_map = new Dictionary(); - private NDArray[] _run(object fetches, FeedItem[] feed_dict = null) + // Validate and process feed_dict. + if (feed_dict != null) { - var feed_dict_tensor = new Dictionary(); - //var feed_map = new Dictionary(); - - // Validate and process feed_dict. - if (feed_dict != null) + foreach (var subfeed in feed_dict) { - foreach (var subfeed in feed_dict) - { - var subfeed_t = _graph.as_graph_element(subfeed.Key, allow_tensor: true, allow_operation: false); - //var target_dtype = subfeed_t.dtype.as_numpy_typecode(); // subfeed_dtype was never used - feed_dict_tensor[subfeed_t] = subfeed.Value; - //feed_map[subfeed_t.name] = (subfeed_t, subfeed.Value); - } + var subfeed_t = _graph.as_graph_element(subfeed.Key, allow_tensor: true, allow_operation: false); + //var target_dtype = subfeed_t.dtype.as_numpy_typecode(); // subfeed_dtype was never used + feed_dict_tensor[subfeed_t] = subfeed.Value; + //feed_map[subfeed_t.name] = (subfeed_t, subfeed.Value); } + } - // Create a fetch handler to take care of the structure of fetches. - var fetch_handler = new _FetchHandler(_graph, fetches, feed_dict_tensor); + // Create a fetch handler to take care of the structure of fetches. + var fetch_handler = new _FetchHandler(_graph, fetches, feed_dict_tensor); - // Run request and get response. - // We need to keep the returned movers alive for the following _do_run(). - // These movers are no longer needed when _do_run() completes, and - // are deleted when `movers` goes out of scope when this _run() ends. - var _ = _update_with_movers(); - var final_fetches = fetch_handler.fetches(); - var final_targets = fetch_handler.targets(); + // Run request and get response. + // We need to keep the returned movers alive for the following _do_run(). + // These movers are no longer needed when _do_run() completes, and + // are deleted when `movers` goes out of scope when this _run() ends. + var _ = _update_with_movers(); + var final_fetches = fetch_handler.fetches(); + var final_targets = fetch_handler.targets(); - // We only want to really perform the run if fetches or targets are provided, - // or if the call is a partial run that specifies feeds. - var results = _do_run(final_targets.Select(x => (Operation)x).ToList(), final_fetches, feed_dict_tensor); + // We only want to really perform the run if fetches or targets are provided, + // or if the call is a partial run that specifies feeds. + var results = _do_run(final_targets.Select(x => (Operation)x).ToList(), final_fetches, feed_dict_tensor); - return fetch_handler.build_results(this, results); - } + return fetch_handler.build_results(this, results); + } - /// - /// Runs a step based on the given fetches and feeds. - /// - /// A list of operations to be run, but not fetched. - /// - /// - /// - /// A list of numpy ndarrays, corresponding to the elements of - /// `fetch_list`. If the ith element of `fetch_list` contains the - /// name of an operation, the first Tensor output of that operation - /// will be returned for that element. - /// - private NDArray[] _do_run(List target_list, List fetch_list, Dictionary feed_dict) + /// + /// Runs a step based on the given fetches and feeds. + /// + /// A list of operations to be run, but not fetched. + /// + /// + /// + /// A list of numpy ndarrays, corresponding to the elements of + /// `fetch_list`. If the ith element of `fetch_list` contains the + /// name of an operation, the first Tensor output of that operation + /// will be returned for that element. + /// + private NDArray[] _do_run(List target_list, List fetch_list, Dictionary feed_dict) + { + var feeds = new KeyValuePair[feed_dict.Count]; + int i = 0; + foreach (var x in feed_dict) { - var feeds = new KeyValuePair[feed_dict.Count]; - int i = 0; - foreach (var x in feed_dict) + if (x.Key is Tensor key) { - if (x.Key is Tensor key) + switch (x.Value) { - switch (x.Value) - { - case Tensor v: - if (v.dtype != key.dtype) - throw new ValueError($"Tensor {v} does not match the expected dtype {key.dtype}, actual dtype: {v.dtype}"); - feeds[i++] = new KeyValuePair(key._as_tf_output(), v); - break; - case SafeTensorHandle v: - var tensor = new Tensor(v); - if (tensor.dtype != key.dtype) - throw new ValueError($"Tensor {v} does not match the expected dtype {key.dtype}, actual dtype: {tensor.dtype}"); - feeds[i++] = new KeyValuePair(key._as_tf_output(), tensor); - break; - case bool v: - feeds[i++] = new KeyValuePair(key._as_tf_output(), new Tensor(v)); - break; - case byte v: - feeds[i++] = new KeyValuePair(key._as_tf_output(), new Tensor(v)); - break; - case int v: - feeds[i++] = new KeyValuePair(key._as_tf_output(), new Tensor(v)); - break; - case long v: - feeds[i++] = new KeyValuePair(key._as_tf_output(), new Tensor(v)); - break; - case float v: - feeds[i++] = new KeyValuePair(key._as_tf_output(), new Tensor(v)); - break; - case double v: - feeds[i++] = new KeyValuePair(key._as_tf_output(), new Tensor(v)); - break; - case string v: - feeds[i++] = new KeyValuePair(key._as_tf_output(), new Tensor(v)); - break; - case Array v: - feeds[i++] = new KeyValuePair(key._as_tf_output(), new Tensor(v, v.GetShape())); - break; - default: - throw new NotImplementedException(""); - } + case Tensor v: + if (v.dtype != key.dtype) + throw new ValueError($"Tensor {v} does not match the expected dtype {key.dtype}, actual dtype: {v.dtype}"); + feeds[i++] = new KeyValuePair(key._as_tf_output(), v); + break; + case SafeTensorHandle v: + var tensor = new Tensor(v); + if (tensor.dtype != key.dtype) + throw new ValueError($"Tensor {v} does not match the expected dtype {key.dtype}, actual dtype: {tensor.dtype}"); + feeds[i++] = new KeyValuePair(key._as_tf_output(), tensor); + break; + case bool v: + feeds[i++] = new KeyValuePair(key._as_tf_output(), new Tensor(v)); + break; + case byte v: + feeds[i++] = new KeyValuePair(key._as_tf_output(), new Tensor(v)); + break; + case int v: + feeds[i++] = new KeyValuePair(key._as_tf_output(), new Tensor(v)); + break; + case long v: + feeds[i++] = new KeyValuePair(key._as_tf_output(), new Tensor(v)); + break; + case float v: + feeds[i++] = new KeyValuePair(key._as_tf_output(), new Tensor(v)); + break; + case double v: + feeds[i++] = new KeyValuePair(key._as_tf_output(), new Tensor(v)); + break; + case string v: + feeds[i++] = new KeyValuePair(key._as_tf_output(), new Tensor(v)); + break; + case Array v: + feeds[i++] = new KeyValuePair(key._as_tf_output(), new Tensor(v, v.GetShape())); + break; + default: + throw new NotImplementedException(""); } - else - throw new NotImplementedException(""); } - - var fetches = fetch_list.Select(x => x._as_tf_output()).ToArray(); - //var targets = target_list; - return _call_tf_sessionrun(feeds, fetches, target_list); + else + throw new NotImplementedException(""); } + var fetches = fetch_list.Select(x => x._as_tf_output()).ToArray(); + //var targets = target_list; + return _call_tf_sessionrun(feeds, fetches, target_list); + } - private unsafe NDArray[] _call_tf_sessionrun(KeyValuePair[] feed_dict, TF_Output[] fetch_list, List target_list) - { - // Ensure any changes to the graph are reflected in the runtime. - _extend_graph(); - var output_values = fetch_list.Select(x => IntPtr.Zero).ToArray(); + private unsafe NDArray[] _call_tf_sessionrun(KeyValuePair[] feed_dict, TF_Output[] fetch_list, List target_list) + { + // Ensure any changes to the graph are reflected in the runtime. + _extend_graph(); - c_api.TF_SessionRun(_handle, - run_options: null, - inputs: feed_dict.Select(f => f.Key).ToArray(), - input_values: feed_dict.Select(f => f.Value.Handle.DangerousGetHandle()).ToArray(), - ninputs: feed_dict.Length, - outputs: fetch_list, - output_values: output_values, - noutputs: fetch_list.Length, - target_opers: target_list.Select(f => (IntPtr)f).ToArray(), - ntargets: target_list.Count, - run_metadata: IntPtr.Zero, - status: _status.Handle); + var output_values = fetch_list.Select(x => IntPtr.Zero).ToArray(); - _status.Check(true); + c_api.TF_SessionRun(_handle, + run_options: null, + inputs: feed_dict.Select(f => f.Key).ToArray(), + input_values: feed_dict.Select(f => f.Value.Handle.DangerousGetHandle()).ToArray(), + ninputs: feed_dict.Length, + outputs: fetch_list, + output_values: output_values, + noutputs: fetch_list.Length, + target_opers: target_list.Select(f => (IntPtr)f).ToArray(), + ntargets: target_list.Count, + run_metadata: IntPtr.Zero, + status: _status); - var result = new NDArray[fetch_list.Length]; + _status.Check(true); - for (int i = 0; i < fetch_list.Length; i++) - result[i] = fetchValue(new SafeTensorHandle(output_values[i])); + var result = new NDArray[fetch_list.Length]; - return result; - } + for (int i = 0; i < fetch_list.Length; i++) + result[i] = fetchValue(new SafeTensorHandle(output_values[i])); - public unsafe Tensor eval(Tensor tensor) - { - var output_values = new IntPtr[1]; - var fetch_list = new[] { tensor._as_tf_output() }; - - c_api.TF_SessionRun(_handle, - run_options: null, - inputs: new TF_Output[0], - input_values: new IntPtr[0], - ninputs: 0, - outputs: fetch_list, - output_values: output_values, - noutputs: 1, - target_opers: new IntPtr[0], - ntargets: 0, - run_metadata: IntPtr.Zero, - status: _status.Handle); - - _status.Check(true); - - return new Tensor(new SafeTensorHandle(output_values[0])); - } + return result; + } - private static unsafe NDArray fetchValue(SafeTensorHandle output) - { - var tensor = new Tensor(output); - return tensor.numpy(); - } + public unsafe Tensor eval(Tensor tensor) + { + var output_values = new IntPtr[1]; + var fetch_list = new[] { tensor._as_tf_output() }; + + c_api.TF_SessionRun(_handle, + run_options: null, + inputs: new TF_Output[0], + input_values: new IntPtr[0], + ninputs: 0, + outputs: fetch_list, + output_values: output_values, + noutputs: 1, + target_opers: new IntPtr[0], + ntargets: 0, + run_metadata: IntPtr.Zero, + status: _status); + + _status.Check(true); + + return new Tensor(new SafeTensorHandle(output_values[0])); + } - /// - /// If a tensor handle that is fed to a device incompatible placeholder, - /// we move the tensor to the right device, generate a new tensor handle, - /// and update feed_dict to use the new handle. - /// - private List _update_with_movers() - { - return new List { }; - } + private static unsafe NDArray fetchValue(SafeTensorHandle output) + { + var tensor = new Tensor(output); + return tensor.numpy(); + } - private void _extend_graph() - { } + /// + /// If a tensor handle that is fed to a device incompatible placeholder, + /// we move the tensor to the right device, generate a new tensor handle, + /// and update feed_dict to use the new handle. + /// + private List _update_with_movers() + { + return new List { }; + } - protected override void DisposeUnmanagedResources(IntPtr handle) - { - // c_api.TF_CloseSession(handle, tf.Status.Handle); - c_api.TF_DeleteSession(handle, _status.Handle); - } + private void _extend_graph() + { } + + public void Dispose() + { + } } diff --git a/src/TensorFlowNET.Core/Sessions/SafeSessionHandle.cs b/src/TensorFlowNET.Core/Sessions/SafeSessionHandle.cs new file mode 100644 index 000000000..4e4b013c1 --- /dev/null +++ b/src/TensorFlowNET.Core/Sessions/SafeSessionHandle.cs @@ -0,0 +1,46 @@ +/***************************************************************************** + Copyright 2018 The TensorFlow.NET Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +******************************************************************************/ + +using System; +using System.Net.NetworkInformation; +using Tensorflow.Util; + +namespace Tensorflow +{ + public sealed class SafeSessionHandle : SafeTensorflowHandle + { + private SafeSessionHandle() + { + } + + public SafeSessionHandle(IntPtr handle) + : base(handle) + { + } + + public override string ToString() + => $"0x{handle:x16}"; + + protected override bool ReleaseHandle() + { + var status = new Status(); + // c_api.TF_CloseSession(handle, tf.Status.Handle); + c_api.TF_DeleteSession(handle, status); + SetHandle(IntPtr.Zero); + return true; + } + } +} diff --git a/src/TensorFlowNET.Core/Sessions/Session.cs b/src/TensorFlowNET.Core/Sessions/Session.cs index 05178fb85..3b91b4898 100644 --- a/src/TensorFlowNET.Core/Sessions/Session.cs +++ b/src/TensorFlowNET.Core/Sessions/Session.cs @@ -14,75 +14,49 @@ You may obtain a copy of the License at limitations under the License. ******************************************************************************/ -using System; -using System.IO; -using System.Runtime.CompilerServices; -using Tensorflow.Util; +namespace Tensorflow; -namespace Tensorflow +public class Session : BaseSession { - public class Session : BaseSession - { - public Session(string target = "", Graph g = null) : base(target, g, null) - { } - - public Session(IntPtr handle, Graph g = null) : base(handle, g) - { } - - public Session(Graph g, ConfigProto config = null, Status s = null) : base("", g, config, s) - { } - - public Session as_default() - { - return ops.set_default_session(this); - } - - public static Session LoadFromSavedModel(string path) - { - var graph = new Graph(); - using var status = new Status(); - using var opt = c_api.TF_NewSessionOptions(); - - var tags = new string[] { "serve" }; - - var sess = c_api.TF_LoadSessionFromSavedModel(opt, - IntPtr.Zero, - path, - tags, - tags.Length, - graph, - IntPtr.Zero, - status.Handle); - status.Check(true); - - // load graph bytes - // var data = new byte[buffer.length]; - // Marshal.Copy(buffer.data, data, 0, (int)buffer.length); - // var meta_graph = MetaGraphDef.Parser.ParseFrom(data);*/ - return new Session(sess, g: graph); - } - - public static implicit operator IntPtr(Session session) => session._handle; - public static implicit operator Session(IntPtr handle) => new Session(handle); + public Session(string target = "", Graph g = null) : base(target, g, null) + { } - public void __enter__() - { + public Session(SafeSessionHandle handle, Graph g = null) : base(handle, g) + { } - } + public Session(Graph g, ConfigProto config = null, Status s = null) : base("", g, config, s) + { } - public void __exit__() - { - - } - - public void __init__() - { - - } - - public void __del__() - { + public Session as_default() + { + return ops.set_default_session(this); + } - } + public static Session LoadFromSavedModel(string path) + { + var graph = new Graph(); + var status = new Status(); + using var opt = c_api.TF_NewSessionOptions(); + + var tags = new string[] { "serve" }; + + var sess = c_api.TF_LoadSessionFromSavedModel(opt, + IntPtr.Zero, + path, + tags, + tags.Length, + graph, + IntPtr.Zero, + status); + status.Check(true); + + // load graph bytes + // var data = new byte[buffer.length]; + // Marshal.Copy(buffer.data, data, 0, (int)buffer.length); + // var meta_graph = MetaGraphDef.Parser.ParseFrom(data);*/ + return new Session(sess, g: graph); } + + public static implicit operator SafeSessionHandle(Session session) => session._handle; + public static implicit operator Session(SafeSessionHandle handle) => new Session(handle); } diff --git a/src/TensorFlowNET.Core/Sessions/SessionOptions.cs b/src/TensorFlowNET.Core/Sessions/SessionOptions.cs index 00923d143..4a11a7f91 100644 --- a/src/TensorFlowNET.Core/Sessions/SessionOptions.cs +++ b/src/TensorFlowNET.Core/Sessions/SessionOptions.cs @@ -19,33 +19,33 @@ limitations under the License. namespace Tensorflow { - internal sealed class SessionOptions : IDisposable + internal sealed class SessionOptions { - public SafeSessionOptionsHandle Handle { get; } + SafeSessionOptionsHandle _handle { get; } public SessionOptions(string target = "", ConfigProto config = null) { - Handle = c_api.TF_NewSessionOptions(); - c_api.TF_SetTarget(Handle, target); + _handle = c_api.TF_NewSessionOptions(); + c_api.TF_SetTarget(_handle, target); if (config != null) SetConfig(config); } - public void Dispose() - => Handle.Dispose(); - private unsafe void SetConfig(ConfigProto config) { var bytes = config.ToByteArray(); fixed (byte* proto2 = bytes) { - using (var status = new Status()) - { - c_api.TF_SetConfig(Handle, (IntPtr)proto2, (ulong)bytes.Length, status.Handle); - status.Check(false); - } + var status = new Status(); + c_api.TF_SetConfig(_handle, (IntPtr)proto2, (ulong)bytes.Length, status); + status.Check(false); } } + + public static implicit operator SafeSessionOptionsHandle(SessionOptions opt) + { + return opt._handle; + } } } diff --git a/src/TensorFlowNET.Core/Sessions/c_api.session.cs b/src/TensorFlowNET.Core/Sessions/c_api.session.cs index 548d79e77..a26ab56d7 100644 --- a/src/TensorFlowNET.Core/Sessions/c_api.session.cs +++ b/src/TensorFlowNET.Core/Sessions/c_api.session.cs @@ -62,7 +62,7 @@ public partial class c_api /// TF_Status* /// TF_Session* [DllImport(TensorFlowLibName)] - public static extern IntPtr TF_NewSession(IntPtr graph, SafeSessionOptionsHandle opts, SafeStatusHandle status); + public static extern SafeSessionHandle TF_NewSession(SafeGraphHandle graph, SafeSessionOptionsHandle opts, SafeStatusHandle status); /// /// Return a new options object. @@ -110,7 +110,7 @@ public partial class c_api /// TF_Buffer* /// TF_Status* [DllImport(TensorFlowLibName)] - public static extern unsafe void TF_SessionRun(IntPtr session, TF_Buffer* run_options, + public static extern unsafe void TF_SessionRun(SafeSessionHandle session, TF_Buffer* run_options, TF_Output[] inputs, IntPtr[] input_values, int ninputs, TF_Output[] outputs, IntPtr[] output_values, int noutputs, IntPtr[] target_opers, int ntargets, diff --git a/src/TensorFlowNET.Core/Status/Status.cs b/src/TensorFlowNET.Core/Status/Status.cs index 288297fb5..a890c2aef 100644 --- a/src/TensorFlowNET.Core/Status/Status.cs +++ b/src/TensorFlowNET.Core/Status/Status.cs @@ -26,7 +26,7 @@ namespace Tensorflow /// TF_Status holds error information. It either has an OK code, or /// else an error code with an associated error message. /// - public sealed class Status : IDisposable + public sealed class Status { /// /// Error message @@ -35,9 +35,9 @@ public string Message { get { - using (Handle.Lease()) + using (_handle.Lease()) { - return StringPiece(TF_Message(Handle)); + return StringPiece(TF_Message(_handle)); } } } @@ -45,23 +45,23 @@ public string Message /// /// Error code /// - public TF_Code Code => TF_GetCode(Handle); + public TF_Code Code => TF_GetCode(_handle); - public SafeStatusHandle Handle { get; } + SafeStatusHandle _handle { get; } public Status() { - Handle = TF_NewStatus(); + _handle = TF_NewStatus(); } public Status(SafeStatusHandle handle) { - Handle = handle ?? throw new ArgumentNullException(nameof(handle)); + _handle = handle ?? throw new ArgumentNullException(nameof(handle)); } public void SetStatus(TF_Code code, string msg) { - TF_SetStatus(Handle, code, msg); + TF_SetStatus(_handle, code, msg); } public bool ok() => Code == TF_Code.TF_OK; @@ -94,10 +94,12 @@ public void Check(bool throwException = false) } } - public void Dispose() - => Handle.Dispose(); - public override string ToString() - => $"{Code} 0x{Handle.DangerousGetHandle():x16}"; + => $"{Code} 0x{_handle.DangerousGetHandle():x16}"; + + public static implicit operator SafeStatusHandle(Status status) + { + return status._handle; + } } } \ No newline at end of file diff --git a/src/TensorFlowNET.Core/Tensorflow.Binding.csproj b/src/TensorFlowNET.Core/Tensorflow.Binding.csproj index 8925228dc..09f5b0770 100644 --- a/src/TensorFlowNET.Core/Tensorflow.Binding.csproj +++ b/src/TensorFlowNET.Core/Tensorflow.Binding.csproj @@ -5,7 +5,7 @@ Tensorflow.Binding Tensorflow 2.10.0 - 0.100.4 + 0.100.5 10.0 enable Haiping Chen, Meinrad Recheis, Eli Belash @@ -20,7 +20,7 @@ Google's TensorFlow full binding in .NET Standard. Building, training and infering deep learning models. https://tensorflownet.readthedocs.io - 0.100.4.0 + 0.100.5.0 tf.net 0.100.x and above are based on tensorflow native 2.10.0 @@ -38,9 +38,10 @@ https://tensorflownet.readthedocs.io tf.net 0.7x.x aligns with TensorFlow v2.7.x native library. tf.net 0.10x.x aligns with TensorFlow v2.10.x native library. - 0.100.4.0 + 0.100.5.0 LICENSE true + packages true Open.snk AnyCPU;x64 @@ -108,8 +109,9 @@ https://tensorflownet.readthedocs.io - - + + + diff --git a/src/TensorFlowNET.Core/Tensors/TF_DataType.cs b/src/TensorFlowNET.Core/Tensors/TF_DataType.cs index 0f514b429..2a6f71147 100644 --- a/src/TensorFlowNET.Core/Tensors/TF_DataType.cs +++ b/src/TensorFlowNET.Core/Tensors/TF_DataType.cs @@ -1,5 +1,5 @@ using Newtonsoft.Json; -using Tensorflow.Keras.Common; +using Tensorflow.Keras.Saving.Common; namespace Tensorflow { diff --git a/src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs b/src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs index 79b8d2c5b..498ffda76 100644 --- a/src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs +++ b/src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs @@ -30,7 +30,7 @@ public partial class Tensor { public virtual IntPtr TensorDataPointer => _handle == null ? IntPtr.Zero : TF_TensorData(_handle); - public Tensor() + protected Tensor() { } @@ -101,12 +101,14 @@ public Tensor(Operation op, int value_index, TF_DataType dtype) _op = op; _value_index = value_index; _override_dtype = dtype; + _tf_output = null; _id = ops.uid(); } protected unsafe void InitTensor(Shape shape, TF_DataType dtype) { _handle = TF_NewTensor(shape, dtype, null); + _id = ops.uid(); } protected unsafe void InitTensor(Shape shape, byte[] bytes, TF_DataType dtype) @@ -115,6 +117,7 @@ protected unsafe void InitTensor(Shape shape, byte[] bytes, TF_DataType dtype) _handle = StringTensor(new byte[][] { bytes }, Shape.Scalar); else _handle = TF_NewTensor(bytes, shape, dtype); + _id = ops.uid(); } protected unsafe void InitTensor(Array array, Shape? shape = null) @@ -165,6 +168,8 @@ protected unsafe void InitTensor(Array array, Shape? shape = null) string[] val => StringTensor(val, shape), _ => throw new NotImplementedException("") }; + + _id = ops.uid(); } unsafe SafeTensorHandle InitTensor(T[] array, Shape shape, TF_DataType dtype) where T : unmanaged diff --git a/src/TensorFlowNET.Core/Tensors/Tensor.cs b/src/TensorFlowNET.Core/Tensors/Tensor.cs index e9ab81a71..c0e5d4357 100644 --- a/src/TensorFlowNET.Core/Tensors/Tensor.cs +++ b/src/TensorFlowNET.Core/Tensors/Tensor.cs @@ -87,6 +87,7 @@ public partial class Tensor : DisposableObject, public object Tag { get; set; } protected new SafeTensorHandle _handle; public virtual SafeTensorHandle Handle => _handle; + public Tensorflow.CppShapeInferenceResult.Types.HandleData HandleData { get; internal set; } protected SafeEagerTensorHandle _eagerTensorHandle; /// @@ -121,7 +122,7 @@ protected virtual Shape GetShapeInternal() if (_handle == null) { - c_api.TF_GraphGetTensorShape(op.graph, _as_tf_output(), dims, rank, tf.Status.Handle); + c_api.TF_GraphGetTensorShape(op.graph, _as_tf_output(), dims, rank, tf.Status); } else { @@ -134,10 +135,10 @@ protected virtual Shape GetShapeInternal() protected virtual void SetShapeInternal(Shape value) { - if (value == null) - c_api.TF_GraphSetTensorShape(graph, _as_tf_output(), null, -1, tf.Status.Handle); + if (value is null || value.ndim == 0 || value.ndim == -1) + c_api.TF_GraphSetTensorShape(op.graph.c_graph, _as_tf_output(), null, -1, tf.Status); else - c_api.TF_GraphSetTensorShape(graph, _as_tf_output(), value.dims, value.ndim, tf.Status.Handle); + c_api.TF_GraphSetTensorShape(op.graph.c_graph, _as_tf_output(), value.dims, value.ndim, tf.Status); } public int[] _shape_tuple() @@ -176,7 +177,9 @@ public virtual int rank if (_handle == null) { var output = _as_tf_output(); - int ndim = c_api.TF_GraphGetTensorNumDims(op.graph, output, tf.Status.Handle); + Status status = new(); + int ndim = c_api.TF_GraphGetTensorNumDims(op.graph, output, status); + status.Check(true); return ndim; } @@ -198,7 +201,7 @@ public Operation[] consumers() public TF_Output _as_tf_output() { if (!_tf_output.HasValue) - _tf_output = new TF_Output(op, value_index); + _tf_output = new TF_Output(op, _value_index); return _tf_output.Value; } diff --git a/src/TensorFlowNET.Core/Tensors/Tensors.cs b/src/TensorFlowNET.Core/Tensors/Tensors.cs index ecd844d1f..b98495a32 100644 --- a/src/TensorFlowNET.Core/Tensors/Tensors.cs +++ b/src/TensorFlowNET.Core/Tensors/Tensors.cs @@ -56,7 +56,7 @@ public IEnumerator GetEnumerator() public void Add(Tensor tensor) => items.Add(tensor); - public void AddRange(Tensor[] tensors) + public void AddRange(IEnumerable tensors) => items.AddRange(tensors); public void Insert(int index, Tensor tensor) @@ -65,6 +65,105 @@ public void Insert(int index, Tensor tensor) IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + public string[] StringData() + { + EnsureSingleTensor(this, "nnumpy"); + return this[0].StringData(); + } + + public string StringData(int index) + { + EnsureSingleTensor(this, "nnumpy"); + return this[0].StringData(index); + } + + public NDArray numpy() + { + EnsureSingleTensor(this, "nnumpy"); + return this[0].numpy(); + } + + public T[] ToArray() where T: unmanaged + { + EnsureSingleTensor(this, $"ToArray<{typeof(T)}>"); + return this[0].ToArray(); + } + + #region Explicit Conversions + public unsafe static explicit operator bool(Tensors tensor) + { + EnsureSingleTensor(tensor, "explicit conversion to bool"); + return (bool)tensor[0]; + } + + public unsafe static explicit operator sbyte(Tensors tensor) + { + EnsureSingleTensor(tensor, "explicit conversion to sbyte"); + return (sbyte)tensor[0]; + } + + public unsafe static explicit operator byte(Tensors tensor) + { + EnsureSingleTensor(tensor, "explicit conversion to byte"); + return (byte)tensor[0]; + } + + public unsafe static explicit operator ushort(Tensors tensor) + { + EnsureSingleTensor(tensor, "explicit conversion to ushort"); + return (ushort)tensor[0]; + } + + public unsafe static explicit operator short(Tensors tensor) + { + EnsureSingleTensor(tensor, "explicit conversion to short"); + return (short)tensor[0]; + } + + public unsafe static explicit operator int(Tensors tensor) + { + EnsureSingleTensor(tensor, "explicit conversion to int"); + return (int)tensor[0]; + } + + public unsafe static explicit operator uint(Tensors tensor) + { + EnsureSingleTensor(tensor, "explicit conversion to uint"); + return (uint)tensor[0]; + } + + public unsafe static explicit operator long(Tensors tensor) + { + EnsureSingleTensor(tensor, "explicit conversion to long"); + return (long)tensor[0]; + } + + public unsafe static explicit operator ulong(Tensors tensor) + { + EnsureSingleTensor(tensor, "explicit conversion to ulong"); + return (ulong)tensor[0]; + } + + public unsafe static explicit operator float(Tensors tensor) + { + EnsureSingleTensor(tensor, "explicit conversion to byte"); + return (byte)tensor[0]; + } + + public unsafe static explicit operator double(Tensors tensor) + { + EnsureSingleTensor(tensor, "explicit conversion to double"); + return (double)tensor[0]; + } + + public unsafe static explicit operator string(Tensors tensor) + { + EnsureSingleTensor(tensor, "explicit conversion to string"); + return (string)tensor[0]; + } + #endregion + + #region Implicit Conversions public static implicit operator Tensors(Tensor tensor) => new Tensors(tensor); @@ -87,16 +186,45 @@ public static implicit operator Tensor(Tensors tensors) public static implicit operator Tensor[](Tensors tensors) => tensors.items.ToArray(); + #endregion + public void Deconstruct(out Tensor a, out Tensor b) { a = items[0]; b = items[1]; } + private static void EnsureSingleTensor(Tensors tensors, string methodnName) + { + if(tensors.Length == 0) + { + throw new ValueError($"Method `{methodnName}` of `Tensors` cannot be used when `Tensors` contains no Tensor."); + } + else if(tensors.Length > 1) + { + throw new ValueError($"Method `{methodnName}` of `Tensors` cannot be used when `Tensors` contains more than one Tensor."); + } + } + public override string ToString() - => items.Count() == 1 - ? items.First().ToString() - : items.Count() + " Tensors" + ". " + string.Join(", ", items.Select(x => x.name)); + { + if(items.Count == 1) + { + return items[0].ToString(); + } + else + { + StringBuilder sb = new StringBuilder(); + sb.Append($"Totally {items.Count} tensors, which are {string.Join(", ", items.Select(x => x.name))}\n[\n"); + for(int i = 0; i < items.Count; i++) + { + var tensor = items[i]; + sb.Append($"Tensor {i}({tensor.name}): {tensor.ToString()}\n"); + } + sb.Append("]\n"); + return sb.ToString(); + } + } public void Dispose() { diff --git a/src/TensorFlowNET.Core/Tensors/c_api.tensor.cs b/src/TensorFlowNET.Core/Tensors/c_api.tensor.cs index 2e7edc66d..3779ddcfd 100644 --- a/src/TensorFlowNET.Core/Tensors/c_api.tensor.cs +++ b/src/TensorFlowNET.Core/Tensors/c_api.tensor.cs @@ -71,7 +71,7 @@ public partial class c_api /// /// [DllImport(TensorFlowLibName)] - public static extern SafeTensorHandle TF_NewTensor(TF_DataType dataType, long[] dims, int num_dims, IntPtr data, ulong len, Deallocator deallocator, IntPtr deallocator_arg); + public static extern SafeTensorHandle TF_NewTensor(TF_DataType dataType, long[] dims, int num_dims, IntPtr data, ulong len, DeallocatorV2 deallocator, IntPtr deallocator_arg); public static unsafe SafeTensorHandle TF_NewTensor(byte[] data, Shape shape, TF_DataType dtype) { @@ -147,6 +147,15 @@ public static unsafe SafeTensorHandle TF_NewTensor(T value) [DllImport(TensorFlowLibName)] public static extern TF_DataType TF_TensorType(SafeTensorHandle tensor); + /// + /// Set a new shape for the Tensor. Note that this API only works after tf2.11. + /// + /// + /// + /// + [DllImport(TensorFlowLibName)] + public static extern void TF_SetShape(SafeTensorHandle tensor, long[] dims, int num_dims); + /// /// Return the size in bytes required to encode a string `len` bytes long into a /// TF_STRING tensor. diff --git a/src/TensorFlowNET.Core/Tensors/dtypes.cs b/src/TensorFlowNET.Core/Tensors/dtypes.cs index 3563f91a0..5b4db53b9 100644 --- a/src/TensorFlowNET.Core/Tensors/dtypes.cs +++ b/src/TensorFlowNET.Core/Tensors/dtypes.cs @@ -301,6 +301,17 @@ public static bool is_integer(this TF_DataType type) type == TF_DataType.DtInt32Ref || type == TF_DataType.DtInt64Ref; } + public static bool is_unsigned(this TF_DataType type) + { + return type == TF_DataType.TF_UINT8 || type == TF_DataType.TF_UINT16 || type == TF_DataType.TF_UINT32 || + type == TF_DataType.TF_UINT64; + } + + public static bool is_bool(this TF_DataType type) + { + return type == TF_DataType.TF_BOOL; + } + public static bool is_floating(this TF_DataType type) { return type == TF_DataType.TF_HALF || type == TF_DataType.TF_FLOAT || type == TF_DataType.TF_DOUBLE; diff --git a/src/TensorFlowNET.Core/Tensors/tensor_util.cs b/src/TensorFlowNET.Core/Tensors/tensor_util.cs index 7af89f137..e65c4850d 100644 --- a/src/TensorFlowNET.Core/Tensors/tensor_util.cs +++ b/src/TensorFlowNET.Core/Tensors/tensor_util.cs @@ -22,6 +22,7 @@ limitations under the License. using Tensorflow.Eager; using Tensorflow.Graphs; using static Tensorflow.Binding; +using System.Diagnostics; namespace Tensorflow { @@ -64,28 +65,68 @@ public static NDArray MakeNdarray(TensorProto tensor) var num_elements = shape.size; var tensor_dtype = tensor.Dtype.as_tf_dtype(); + T[] ExpandArrayToSize(IList src) + { + if(src.Count == 0) + { + return new T[0]; + } + var pad_count = num_elements - src.Count; + var pre = pad_count / 2; + var after = pad_count - pre; + var first_elem = src[0]; + var last_elem = src[src.Count - 1]; + T[] res = new T[num_elements]; + for(long i = 0; i < num_elements; i++) + { + if (i < pre) res[i] = first_elem; + else if (i >= num_elements - after) res[i] = last_elem; + else res[i] = src[(int)(i - pre)]; + } + return res; + } + if (shape.ndim > 0 && tensor.TensorContent.Length > 0) { return np.frombuffer(tensor.TensorContent.ToByteArray(), shape, tensor_dtype); } - else if (tensor.Dtype == DataType.DtHalf || tensor.Dtype == DataType.DtBfloat16) + NDArray values; + if (tensor.Dtype == DataType.DtHalf || tensor.Dtype == DataType.DtBfloat16) { - return np.array(tensor.HalfVal.ToArray()).reshape(shape); + values = np.array(ExpandArrayToSize(tensor.HalfVal)); } else if (tensor.Dtype == DataType.DtFloat) { - return np.array(tensor.FloatVal.ToArray()).reshape(shape); + values = np.array(ExpandArrayToSize(tensor.FloatVal)); } else if (new DataType[] { DataType.DtInt32, DataType.DtUint8 }.Contains(tensor.Dtype)) { - return np.array(tensor.IntVal.ToArray()).reshape(shape); + values = np.array(ExpandArrayToSize(tensor.IntVal)); + } + else if (new DataType[] { DataType.DtInt64 }.Contains(tensor.Dtype)) + { + values = np.array(ExpandArrayToSize(tensor.Int64Val)); + } + else if (new DataType[] { DataType.DtUint64 }.Contains(tensor.Dtype)) + { + values = np.array(ExpandArrayToSize(tensor.Uint64Val)); } else if (tensor.Dtype == DataType.DtBool) { - return np.array(tensor.BoolVal.ToArray()).reshape(shape); + values = np.array(ExpandArrayToSize(tensor.BoolVal)); + } + else + { + throw new TypeError($"Unsupported tensor type: {tensor.Dtype}. See " + + $"https://www.tensorflow.org/api_docs/python/tf/dtypes for supported TF dtypes."); + } + + if(values.size == 0) + { + return np.zeros(shape, tensor_dtype); } - throw new NotImplementedException("MakeNdarray"); + return values.reshape(shape); } private static readonly TF_DataType[] quantized_types = new TF_DataType[] @@ -609,5 +650,24 @@ public static ParsedSliceArgs ParseSlices(Tensor start, Tensor stop = null, Tens NewAxisMask = new_axis_mask }; } + + /// + /// Warning: this method is an extremely dangerous method. It directly changes the dtype inside the tensor + /// and security is not guaranteed at all. Currently this method is only used for some conditions to reuse + /// the existing memory. Any other usage should be prevented. If you are sure you want to use it when + /// developing tensorflow.net, please ask @Oceanic2018 or @AsakusaRinne first. + /// + /// + /// + internal static unsafe void DangerousManuallySetTensorDType(SafeTensorHandle handle, TF_DataType dtype) + { + long tf_tensor_address = handle.DangerousGetHandle().ToInt64(); + long interface_address = *(long*)(tf_tensor_address); + long tensor_shape_address = interface_address + 8; + long tensor_dtype_address = tensor_shape_address + 13; + byte* dtype_pointer = (byte*)tensor_dtype_address; + *dtype_pointer = (byte)dtype; + Debug.Assert(c_api.TF_TensorType(handle) == dtype); + } } } diff --git a/src/TensorFlowNET.Core/Trackables/AssetResource.cs b/src/TensorFlowNET.Core/Trackables/AssetResource.cs new file mode 100644 index 000000000..6e8d05a8c --- /dev/null +++ b/src/TensorFlowNET.Core/Trackables/AssetResource.cs @@ -0,0 +1,18 @@ +using Google.Protobuf.Collections; +using System.IO; +using Tensorflow.Train; + +namespace Tensorflow.Trackables; + +public class AssetResource : Trackable +{ + public static (Trackable, Action) deserialize_from_proto(SavedObject object_proto, + string export_dir, + RepeatedField asset_file_def, + Dictionary> operation_attributes) + { + var proto = object_proto.Asset; + var filename = Path.Combine(export_dir, asset_file_def[proto.AssetFileDefIndex].Filename); + return (new AssetResource(), null); + } +} diff --git a/src/TensorFlowNET.Core/Trackables/CapturableResource.cs b/src/TensorFlowNET.Core/Trackables/CapturableResource.cs new file mode 100644 index 000000000..d93f786dc --- /dev/null +++ b/src/TensorFlowNET.Core/Trackables/CapturableResource.cs @@ -0,0 +1,7 @@ +using Tensorflow.Train; + +namespace Tensorflow.Trackables; + +public class CapturableResource : Trackable +{ +} diff --git a/src/TensorFlowNET.Core/Trackables/RestoredResource.cs b/src/TensorFlowNET.Core/Trackables/RestoredResource.cs new file mode 100644 index 000000000..cb9f6aa0b --- /dev/null +++ b/src/TensorFlowNET.Core/Trackables/RestoredResource.cs @@ -0,0 +1,13 @@ +using Google.Protobuf.Collections; +using Tensorflow.Train; + +namespace Tensorflow.Trackables; + +public class RestoredResource : TrackableResource +{ + public static (Trackable, Action) deserialize_from_proto(SavedObject object_proto, + Dictionary> operation_attributes) + { + return (new RestoredResource(), null); + } +} diff --git a/src/TensorFlowNET.Core/Trackables/TrackableConstant.cs b/src/TensorFlowNET.Core/Trackables/TrackableConstant.cs new file mode 100644 index 000000000..d65446f3d --- /dev/null +++ b/src/TensorFlowNET.Core/Trackables/TrackableConstant.cs @@ -0,0 +1,34 @@ +using Google.Protobuf.Collections; +using Tensorflow.Train; +using static Tensorflow.Binding; + +namespace Tensorflow.Trackables; + +public class TrackableConstant : Trackable +{ + Tensor _constant; + public TrackableConstant(Tensor constant) + { + _constant = constant; + } + + public static (Tensor, Action) deserialize_from_proto(SavedObject object_proto, + Dictionary> operation_attributes) + { + var tensor_proto = operation_attributes[object_proto.Constant.Operation]["value"].Tensor; + var ndarray = tensor_util.MakeNdarray(tensor_proto); + Tensor imported_constant; + if (tensor_proto.Dtype == DataType.DtString) + { + imported_constant = tf_with(ops.device("CPU"), _ => + { + return constant_op.constant(ndarray); + }); + } + else + { + imported_constant = constant_op.constant(ndarray); + } + return (imported_constant, null); + } +} diff --git a/src/TensorFlowNET.Core/Trackables/TrackableResource.cs b/src/TensorFlowNET.Core/Trackables/TrackableResource.cs new file mode 100644 index 000000000..43cbc5a20 --- /dev/null +++ b/src/TensorFlowNET.Core/Trackables/TrackableResource.cs @@ -0,0 +1,5 @@ +namespace Tensorflow.Trackables; + +public class TrackableResource : CapturableResource +{ +} diff --git a/src/TensorFlowNET.Core/Training/AutoTrackable.cs b/src/TensorFlowNET.Core/Training/AutoTrackable.cs index 4ba3e4074..20631ce82 100644 --- a/src/TensorFlowNET.Core/Training/AutoTrackable.cs +++ b/src/TensorFlowNET.Core/Training/AutoTrackable.cs @@ -3,6 +3,7 @@ using Tensorflow.Functions; using Tensorflow.Keras.Saving.SavedModel; using Tensorflow.Operations.Activation; +using Tensorflow.Training; using static Tensorflow.Binding; namespace Tensorflow.Train @@ -25,6 +26,13 @@ public void _delete_tracking(string name) } } + public override void SetAttr(string name, object value) + { + // TODO(Rinne): deal with `self_setattr_tracking`. + value = TrackableDataStructure.sticky_attribute_assignment(this, name, value); + base.SetAttr(name, value); + } + public override IDictionary _trackable_children(SaveType save_type, IDictionary>? cache = null) { if(save_type != SaveType.SAVEDMODEL) @@ -34,6 +42,7 @@ public override IDictionary _trackable_children(SaveType save Dictionary functions = new(); // TODO: process of logs. + // TODO(Rinne): deal with members. var properties = this.GetType().GetProperties(); foreach ( var property in properties ) { @@ -45,6 +54,16 @@ public override IDictionary _trackable_children(SaveType save } } + foreach(var item in CustomizedFields) + { + var name = item.Key; + var value = item.Value; + if (value is Function or ConcreteFunction) + { + functions[name] = (Trackable)value; + } + } + // TODO: process the type `core_types.GenericFunction`. Dictionary children = new(); diff --git a/src/TensorFlowNET.Core/Training/Saving/ResourceVariableSaveable.cs b/src/TensorFlowNET.Core/Training/Saving/ResourceVariableSaveable.cs index 2d23a325f..587dede40 100644 --- a/src/TensorFlowNET.Core/Training/Saving/ResourceVariableSaveable.cs +++ b/src/TensorFlowNET.Core/Training/Saving/ResourceVariableSaveable.cs @@ -42,22 +42,29 @@ public ResourceVariableSaveable(BaseResourceVariable var, string slice_spec, str _var_device = var.Device; _var_shape = var.shape; - Tensor _read_variable_closure(BaseResourceVariable v) + Func _read_variable_closure(BaseResourceVariable v) { - tf.device(v.Device); - if(tf.Context.executing_eagerly() && !((bool)v.is_initialized().numpy())) + return () => { - return null; - } - var x = v.read_value_no_copy(); - tf.device("/device:CPU:0"); - return array_ops.identity(x); + return tf_with(ops.device(v.Device), _ => + { + if (tf.Context.executing_eagerly() && !((bool)v.is_initialized().numpy())) + { + return null; + } + var x = v.read_value_no_copy(); + return tf_with(ops.device("/device:CPU:0"), _ => + { + return array_ops.identity(x); + }); + }); + }; } this.handle_op = var.Handle; - var tensor = _read_variable_closure(var); + var tensor_creator = _read_variable_closure(var); - var spec = new SaveSpec(tensor, slice_spec, name, dtype: var.dtype); + var spec = new SaveSpec(tensor_creator, slice_spec, name, dtype: var.dtype, device: var.Device); _op = var; specs = new SaveSpec[] { spec }; this.name = name; @@ -66,9 +73,12 @@ Tensor _read_variable_closure(BaseResourceVariable v) public override Operation restore(Tensor[] restored_tensors, Shape[] restored_shapes = null) { var restored_tensor = restored_tensors[0]; - restored_tensor = array_ops.identity(restored_tensor); - return resource_variable_ops.shape_safe_assign_variable_handle( + return tf_with(ops.device(_var_device), _ => + { + restored_tensor = array_ops.identity(restored_tensor); + return resource_variable_ops.shape_safe_assign_variable_handle( handle_op, _var_shape, restored_tensor); + }); } } } diff --git a/src/TensorFlowNET.Core/Training/Saving/SaveSpec.cs b/src/TensorFlowNET.Core/Training/Saving/SaveSpec.cs index 393a6a981..2b300c2a9 100644 --- a/src/TensorFlowNET.Core/Training/Saving/SaveSpec.cs +++ b/src/TensorFlowNET.Core/Training/Saving/SaveSpec.cs @@ -14,6 +14,8 @@ You may obtain a copy of the License at limitations under the License. ******************************************************************************/ +using Tensorflow.Exceptions; + namespace Tensorflow { /// @@ -21,8 +23,24 @@ namespace Tensorflow /// public class SaveSpec { - private Tensor _tensor; - public Tensor tensor => _tensor; + private Tensor _tensor = null; + private Func _tensor_creator = null; + public Tensor tensor + { + get + { + if(_tensor is not null || _tensor_creator is null) + { + return _tensor; + } + else + { + return _tensor_creator(); + } + } + } + + internal Func TensorCreator => _tensor_creator; private string _slice_spec; public string slice_spec => _slice_spec; @@ -32,13 +50,36 @@ public class SaveSpec private TF_DataType _dtype; public TF_DataType dtype => _dtype; + private string _device; + public string device => _device; - public SaveSpec(Tensor tensor, string slice_spec, string name, TF_DataType dtype = TF_DataType.DtInvalid) + public SaveSpec(Tensor tensor, string slice_spec, string name, TF_DataType dtype = TF_DataType.DtInvalid, string device = null) { _tensor = tensor; _slice_spec = slice_spec; _name = name; _dtype = dtype; + if(device is not null) + { + _device = device; + } + else + { + _device = tensor.Device; + } + } + + public SaveSpec(Func tensor_creator, string slice_spec, string name, TF_DataType dtype = TF_DataType.DtInvalid, string device = null) + { + _tensor_creator = tensor_creator; + _slice_spec = slice_spec; + _name = name; + if(dtype == TF_DataType.DtInvalid || device is null) + { + throw new AssertionError("When passing a callable `tensor` to a SaveSpec, an explicit dtype and device must be provided."); + } + _dtype = dtype; + _device = device; } } } diff --git a/src/TensorFlowNET.Core/Training/Saving/SaveableObject.cs b/src/TensorFlowNET.Core/Training/Saving/SaveableObject.cs index 2fd0d1d83..f8c979757 100644 --- a/src/TensorFlowNET.Core/Training/Saving/SaveableObject.cs +++ b/src/TensorFlowNET.Core/Training/Saving/SaveableObject.cs @@ -14,18 +14,19 @@ You may obtain a copy of the License at limitations under the License. ******************************************************************************/ +using OneOf; using Tensorflow.Checkpoint; namespace Tensorflow { public class MySaveableObject { - protected Maybe _op; + protected OneOf _op; public Tensor op { get { - if(_op.TryGet(out var tensor)) + if(_op.TryPickT0(out var tensor, out var _)) { return tensor; } @@ -43,7 +44,7 @@ public BaseResourceVariable variable { get { - if (_op.TryGet(out var v)) + if (_op.TryPickT1(out var v, out var _)) { return v; } diff --git a/src/TensorFlowNET.Core/Training/Saving/SavedModel/RevivedTypes.cs b/src/TensorFlowNET.Core/Training/Saving/SavedModel/RevivedTypes.cs index 601882930..ab6adc30f 100644 --- a/src/TensorFlowNET.Core/Training/Saving/SavedModel/RevivedTypes.cs +++ b/src/TensorFlowNET.Core/Training/Saving/SavedModel/RevivedTypes.cs @@ -1,10 +1,20 @@ using System; +using System.Diagnostics; using Tensorflow.Train; +using Tensorflow.Training; namespace Tensorflow; public class RevivedTypes { + private static Dictionary _registered_revived_creator = new(); + static RevivedTypes() + { + var list_wrapper = new ListWrapper(new Trackable[] { }); + _registered_revived_creator[list_wrapper.Identifier] = list_wrapper; + var dict_wrapper = new DictWrapper(new Dictionary()); + _registered_revived_creator[dict_wrapper.Identifier] = dict_wrapper; + } /// /// Create a SavedUserObject from a trackable object. /// @@ -12,13 +22,33 @@ public class RevivedTypes /// public static SavedUserObject? serialize(Trackable obj) { - // TODO: complete the implementation. + // TODO(Rinne): complete the implementation. return null; } - public static Tuple> deserialize(object proto) + public static (Trackable, Action) deserialize(SavedUserObject proto) { - // TODO: complete the implementation. - return null; + if(_registered_revived_creator.TryGetValue(proto.Identifier, out var wrapper)) + { + return (wrapper.FromProto(proto), (x, y, z) => + { + if (x is not ITrackableWrapper trackable) + { + throw new TypeError($"The type is expected to be `ITrackableWrapper`, but got {x.GetType()}."); + } + Debug.Assert(y is string); + trackable.SetValue(y, z); + } + ); + } + else + { + return (null, null); + } + } + + public static void RegisterRevivedTypeCreator(string identifier, ITrackableWrapper obj) + { + _registered_revived_creator[identifier] = obj; } } diff --git a/src/TensorFlowNET.Core/Training/Saving/SavedModel/SaveableView.cs b/src/TensorFlowNET.Core/Training/Saving/SavedModel/SaveableView.cs index 5752d7284..44a627b67 100644 --- a/src/TensorFlowNET.Core/Training/Saving/SavedModel/SaveableView.cs +++ b/src/TensorFlowNET.Core/Training/Saving/SavedModel/SaveableView.cs @@ -93,13 +93,14 @@ private void initialize_nodes_and_concrete_functions() // // } - foreach (var obj in _nodes) - { - if (obj is ConcreteFunction) - { - _concrete_functions.Add((ConcreteFunction)obj); - } - } + //_concrete_functions = new(); + //foreach (var obj in _nodes) + //{ + // if (obj is ConcreteFunction) + // { + // _concrete_functions.Add((ConcreteFunction)obj); + // } + //} } public List get_concrete_resource_initializers() @@ -137,7 +138,7 @@ public List get_concrete_resource_initializers() /// public List dependency_sorted_node_ids() { - Dictionary> dependency_map = new(); + Dictionary> dependency_map = new(); foreach (var node in _nodes) { var node_id = _node_ids[node]; @@ -225,8 +226,8 @@ private static void write_object_proto(Trackable obj, SavedObject proto, } else if (obj is ConcreteFunction) { - // TODO: complete it. - throw new NotImplementedException(); + // TODO(Rinne): complete it. + // throw new NotImplementedException(); } // skip the process of type `_CapturedTensor` and `CapturableResource`. else diff --git a/src/TensorFlowNET.Core/Training/Saving/SavedModel/WrapperFunction.cs b/src/TensorFlowNET.Core/Training/Saving/SavedModel/WrapperFunction.cs index 341a12ab9..695eadfd3 100644 --- a/src/TensorFlowNET.Core/Training/Saving/SavedModel/WrapperFunction.cs +++ b/src/TensorFlowNET.Core/Training/Saving/SavedModel/WrapperFunction.cs @@ -12,11 +12,12 @@ internal class WrapperFunction: ConcreteFunction { public WrapperFunction(ConcreteFunction concrete_function): base(concrete_function.func_graph) { - this.forward_backward = concrete_function.forward_backward; - this.Outputs = concrete_function.Outputs; - this.ReturnType = concrete_function.ReturnType; - this.OutputStructure = concrete_function.OutputStructure; - this.ArgKeywords = concrete_function.ArgKeywords; + throw new NotImplementedException(); + //this.forward_backward = concrete_function.forward_backward; + //this.Outputs = concrete_function.Outputs; + //this.ReturnType = concrete_function.ReturnType; + //this.OutputStructure = concrete_function.OutputStructure; + //this.ArgKeywords = concrete_function.ArgKeywords; } } } diff --git a/src/TensorFlowNET.Core/Training/Saving/SavedModel/function_deserialization.cs b/src/TensorFlowNET.Core/Training/Saving/SavedModel/function_deserialization.cs index 5b482872d..77b115a46 100644 --- a/src/TensorFlowNET.Core/Training/Saving/SavedModel/function_deserialization.cs +++ b/src/TensorFlowNET.Core/Training/Saving/SavedModel/function_deserialization.cs @@ -1,14 +1,432 @@ -using System; +using Google.Protobuf; +using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; +using System.Runtime.CompilerServices; using System.Text; +using System.Text.RegularExpressions; +using Tensorflow.Framework; using Tensorflow.Functions; +using Tensorflow.Gradients; +using Tensorflow.Graphs; using Tensorflow.Util; +using static Tensorflow.Binding; namespace Tensorflow.Training.Saving.SavedModel { public static class function_deserialization { + private static string _INFERENCE_PREFIX = "__inference_"; + private static string _FUNCTION_WRAPPER_NAME_REGEX = $@"^{_INFERENCE_PREFIX}(.*)_\d+$"; + /// + /// Creates a `Function` from a `SavedFunction`. + /// + /// + /// + /// + public static Function recreate_function(SavedFunction saved_function, + IDictionary concrete_functions) + { + var function_spec = _deserialize_function_spec_as_nonmethod(saved_function.FunctionSpec); + + Tensor[] restored_function_body(Tensor[] inputs) + { + if(saved_function.ConcreteFunctions is null || saved_function.ConcreteFunctions.Count == 0) + { + throw new ValueError("Found zero restored functions for caller function."); + } + foreach(var function_name in saved_function.ConcreteFunctions) + { + var function = concrete_functions[function_name]; + if(function.CapturedInputs.Any(x => x is null)) + { + throw new ValueError("Looks like you are trying to run a loaded " + + "non-Keras model that was trained using tf.distribute.experimental.ParameterServerStrategy " + + "with variable partitioning, which is not currently supported. Try using Keras to define your model " + + "if possible."); + } + if(_concrete_function_callable_with(function, inputs, false)) + { + return _call_concrete_function(function, inputs); + } + } + throw new ValueError("Unexpected runtime behavior, please submit an issue to " + + "https://github.com/SciSharp/TensorFlow.NET/issues"); + } + + List concrete_function_objects = new(); + foreach(var concrete_function_name in saved_function.ConcreteFunctions) + { + concrete_function_objects.Add(concrete_functions[concrete_function_name]); + } + foreach(var cf in concrete_function_objects) + { + cf._set_function_spec(function_spec); + } + + var restored_function = new RestoredFunction(restored_function_body, nameof(restored_function_body), + function_spec, concrete_function_objects); + + return restored_function; + } + + public static Dictionary load_function_def_library(FunctionDefLibrary library, + SavedObjectGraph saved_object_graph = null, string load_shared_name_suffix = null, object? wrapper_function = null) + { + var library_function_names = library.Function.Select(x => x.Signature.Name).Distinct(); + Dictionary functions = new(); + Dictionary renamed_functions = new(); + + Graph graph; + if (ops.executing_eagerly_outside_functions()) + { + graph = new Graph(); + } + else + { + graph = ops.get_default_graph(); + } + + if(load_shared_name_suffix is null) + { + load_shared_name_suffix = $"_load_{ops.uid()}"; + } + + Dictionary library_gradient_names = new(); + Dictionary new_gradient_op_types = new(); + Dictionary gradients_to_register = new(); + foreach (var gdef in library.RegisteredGradients) + { + if(gdef.RegisteredOpType is not null) + { + var new_op_type = custom_gradient.generate_name(); + var old_op_type = tf.compat.as_bytes(gdef.RegisteredOpType); + + library_gradient_names[old_op_type] = gdef.GradientFunc; + new_gradient_op_types[old_op_type] = new_op_type; + gradients_to_register[gdef.GradientFunc] = new_op_type; + } + } + + Dictionary> function_deps = new(); + foreach(var fdef in library.Function) + { + function_deps[fdef.Signature.Name] = _list_function_deps(fdef, library_function_names, library_gradient_names); + } + + Dictionary loaded_gradients = new(); + foreach (var fdef in _sort_function_defs(library, function_deps)) + { + var orig_name = _fix_fdef_in_place(fdef, functions, load_shared_name_suffix, new_gradient_op_types); + + object structured_input_signature = null; + object structured_outputs = null; + if (saved_object_graph is not null && saved_object_graph.ConcreteFunctions.ContainsKey(orig_name)) + { + // TODO(Rinne): deal with structured_input_signature and structured_outputs. + + //var proto = saved_object_graph.ConcreteFunctions[orig_name]; + //structured_input_signature = nested_structure_coder.decode_proto(proto.CanonicalizedInputSignature); + //structured_outputs = nested_structure_coder.decode_proto(proto.OutputSignature); + } + + graph.as_default(); + var func_graph = function_def_lib.function_def_to_graph(fdef, structured_input_signature, structured_outputs); + graph.Exit(); + + _restore_gradient_functions(func_graph, renamed_functions, loaded_gradients); + + foreach(var dep in function_deps[orig_name]) + { + functions[dep].AddTograph(func_graph); + } + + if (fdef.Attr.ContainsKey("_input_shapes")) + { + fdef.Attr.Remove("_input_shapes"); + } + var func = new ConcreteFunction(func_graph, fdef.Attr.ToDictionary(x => x.Key, x => x.Value)); + if(wrapper_function is not null) + { + throw new NotImplementedException(); + } + func.AddTograph(graph); + + functions[orig_name] = func; + renamed_functions[func.Name] = func; + if(func_graph.get_operations().Any(op => op.op.type == "TRTEngineOp")) + { + func.AddTograph(ops.get_default_graph()); + } + + if (gradients_to_register.ContainsKey(orig_name)) + { + var gradient_op_type = gradients_to_register[orig_name]; + loaded_gradients[gradient_op_type] = func; + ops.RegisterGradientFunction(gradient_op_type, _gen_gradient_func(func)); + } + } + return functions; + } + + public static void fix_node_def(NodeDef node_def, IDictionary functions, string shared_name_suffix) + { + if (functions.ContainsKey(node_def.Op)) + { + node_def.Op = functions[node_def.Op].Name; + } + foreach(var attr_value in node_def.Attr.Values) + { + if(attr_value.ValueCase == AttrValue.ValueOneofCase.Func) + { + attr_value.Func.Name = functions[attr_value.Func.Name].Name; + } + else if(attr_value.ValueCase == AttrValue.ValueOneofCase.List) + { + foreach(var fn in attr_value.List.Func) + { + fn.Name = functions[fn.Name].Name; + } + } + } + + if(node_def.Op == "HashTableV2") + { + if(!node_def.Attr.ContainsKey("use_node_name_sharing") || !node_def.Attr["use_node_name_sharing"].B) + { + node_def.Attr["use_node_name_sharing"].B = true; + shared_name_suffix += $"_{ops.uid()}"; + } + } + + var op_def = op_def_registry.GetOpDef(node_def.Op); + if(op_def is not null) + { + var attr = op_def.Attr.Where(x => x.Name == "shared_name").FirstOrDefault(); + if(attr is not null) + { + ByteString shared_name = null; + if(node_def.Attr.ContainsKey("shared_name") && node_def.Attr["shared_name"].S is not null) + { + shared_name = node_def.Attr["shared_name"].S; + } + else if(attr.DefaultValue.S is not null) + { + shared_name = tf.compat.as_bytes(attr.DefaultValue.S); + } + if(shared_name is null) + { + shared_name = tf.compat.as_bytes(node_def.Name); + } + node_def.Attr["shared_name"].S = ByteString.CopyFrom(shared_name.Concat(tf.compat.as_bytes(node_def.Name)).ToArray()); + } + } + } + + private static Func _gen_gradient_func(ConcreteFunction func) + { + return (unused_op, result_grads) => + { + result_grads = zip(result_grads, func.func_graph.Inputs) + .Select((item) => item.Item1 is null ? default_gradient.zeros_like(item.Item2) : item.Item1).ToArray(); + return func.CallFlat(result_grads, func.CapturedInputs); + }; + } + + private static void _restore_gradient_functions(FuncGraph func_graph, Dictionary renamed_functions, Dictionary loaded_gradients) + { + if(loaded_gradients is null || loaded_gradients.Count == 0) + { + foreach (var op in func_graph.get_operations()) + { + if (op.op.type == "StatefulPartitionedCall" || op.op.type == "PartitionedCall") + { + var function = renamed_functions[op.op.node_def.Attr["f"].Func.Name]; + op.op._gradient_function = function._get_gradient_function(); + } + } + } + else + { + foreach (var op in func_graph.get_operations()) + { + if (op.op.type == "StatefulPartitionedCall" || op.op.type == "PartitionedCall") + { + var function = renamed_functions[op.op.node_def.Attr["f"].Func.Name]; + op.op._gradient_function = function._get_gradient_function(); + } + string gradient_op_type = null; + try + { + gradient_op_type = op.op.get_attr("_gradient_op_type") as string; + } + catch (InvalidArgumentError) + { + continue; + } + if (loaded_gradients.ContainsKey(gradient_op_type)) + { + var grad_fn = loaded_gradients[gradient_op_type]; + grad_fn.NumPositionArgs = op.op.inputs.Length; + grad_fn.ArgKeywords = op.op.inputs._inputs.Select(x => x.name); + } + } + } + } + + private static string _fix_fdef_in_place(FunctionDef fdef, IDictionary functions, string shared_name_suffix, + IDictionary new_gradient_op_types) + { + var orig_name = fdef.Signature.Name; + bool contains_unsaved_custom_gradients = false; + + foreach(var node_def in fdef.NodeDef) + { + fix_node_def(node_def, functions, shared_name_suffix); + var op_type = _get_gradient_op_type(node_def); + if(op_type is not null) + { + if (new_gradient_op_types.ContainsKey(op_type)) + { + node_def.Attr["_gradient_op_type"].S = tf.compat.as_bytes(new_gradient_op_types[op_type]); + } + else + { + contains_unsaved_custom_gradients = true; + } + } + } + if (contains_unsaved_custom_gradients) + { + // TODO(Rinne): log warnings. + } + + fdef.Signature.Name = _clean_function_name(fdef.Signature.Name); + return orig_name; + } + + private static string _clean_function_name(string name) + { + var match = Regex.Match(name, _FUNCTION_WRAPPER_NAME_REGEX); + if(match.Success) + { + return match.Groups[1].Value; + } + else + { + return name; + } + } + + /// + /// Return a topologic sort of FunctionDefs in a library. + /// + /// + /// + private static IEnumerable _sort_function_defs(FunctionDefLibrary library, Dictionary> function_deps) + { + Dictionary> edges = new(); + Dictionary in_count = new(); + foreach(var item in function_deps) + { + var fname = item.Key; + var deps = item.Value; + if(deps is null || deps.Count() == 0) + { + in_count[fname] = 0; + continue; + } + foreach(var dep in deps) + { + edges.SetDefault(dep, new List()).Add(fname); + if (in_count.ContainsKey(fname)) + { + in_count[fname]++; + } + else + { + in_count[fname] = 1; + } + } + } + var ready = new Stack(library.Function. + Where(x => in_count[x.Signature.Name] == 0) + .Select(x => x.Signature.Name).ToList()); + List output = new(); + while(ready.Count > 0) + { + var node = ready.Pop(); + output.Add(node); + if (!edges.ContainsKey(node)) + { + continue; + } + foreach(var dest in edges[node]) + { + in_count[dest] -= 1; + if (in_count[dest] == 0) + { + ready.Push(dest); + } + } + } + + if(output.Count != library.Function.Count) + { + var failed_to_resolve = in_count.Keys.Except(output); + throw new ValueError($"There is a cyclic dependency between functions. " + + $"Could not resolve ({string.Join(", ", failed_to_resolve)})."); + } + + var reverse = library.Function.ToDictionary(x => x.Signature.Name, x => x); + return output.Select(x => reverse[x]); + } + + private static IEnumerable _list_function_deps(FunctionDef fdef, IEnumerable library_function_names, IDictionary library_gradient_names) + { + HashSet deps = new HashSet(); + foreach(var node_def in fdef.NodeDef) + { + var grad_op_type = _get_gradient_op_type(node_def); + if (library_function_names.Contains(node_def.Op)) + { + deps.Add(node_def.Op); + } + else if(grad_op_type is not null && library_gradient_names.TryGetValue(grad_op_type, out var gradient_name)) + { + deps.Add(gradient_name); + } + else + { + foreach(var attr_value in node_def.Attr.Values) + { + if(attr_value.ValueCase == AttrValue.ValueOneofCase.Func) + { + deps.Add(attr_value.Func.Name); + } + else if(attr_value.ValueCase == AttrValue.ValueOneofCase.List) + { + foreach(var fn in attr_value.List.Func) + { + deps.Add(fn.Name); + } + } + } + } + } + return deps.AsEnumerable(); + } + + private static ByteString _get_gradient_op_type(NodeDef node_def) + { + if(node_def.Attr.ContainsKey("_gradient_op_type") && node_def.Op != "StatefulPartitionedCall" && node_def.Op != "PartitionedCall") + { + return node_def.Attr["_gradient_op_type"].S; + } + return null; + } + public static ConcreteFunction setup_bare_concrete_function(SavedBareConcreteFunction saved_bare_concrete_function, IDictionary concrete_functions) { @@ -16,7 +434,8 @@ public static ConcreteFunction setup_bare_concrete_function(SavedBareConcreteFun concrete_function.ArgKeywords = saved_bare_concrete_function.ArgumentKeywords.ToList(); concrete_function.NumPositionArgs = saved_bare_concrete_function.AllowedPositionalArguments; - var function_spec = _deserialize_function_spec_as_nonmethod(saved_bare_concrete_function.FunctionSpec); + //var function_spec = _deserialize_function_spec_as_nonmethod(saved_bare_concrete_function.FunctionSpec); + // TODO(Rinne): set the functiona spec. concrete_function.AddTograph(); return concrete_function; } @@ -32,5 +451,44 @@ private static FunctionSpec _deserialize_function_spec_as_nonmethod(FunctionSpec JitCompile = function_spec_proto.JitCompile }; } + + private static Tensors _call_concrete_function(ConcreteFunction function, Tensors inputs) + { + // TODO(Rinne): var expected_structure = function.func_graph.structured_input_signature + return function.CallFlat(inputs, function.CapturedInputs); + } + + private static bool _concrete_function_callable_with(ConcreteFunction function, Tensor[] inputs, bool allow_conversion) + { + // TODO(Rinne): revise it. + return function.CapturedInputs.Length + inputs.Length == function.Inputs.Length; + //var expected_inputs = function.func_graph.Inputs; + //foreach(var (arg, expected) in zip(inputs, expected_inputs)) + //{ + // if(arg.Id != expected.Id) + // { + // return false; + // } + //} + //return true; + } + } + + public class RestoredFunction : Function + { + IEnumerable _concrete_functions; + FunctionSpec _function_spec; + public IEnumerable ConcreteFunctions => _concrete_functions; + public RestoredFunction(Func function, string name, FunctionSpec function_spec, + IEnumerable concrete_functions): base(function, name, auto_graph: false) + { + _concrete_functions = concrete_functions; + _function_spec = function_spec; + } + + protected override bool _run_functions_eagerly() + { + return false; + } } } diff --git a/src/TensorFlowNET.Core/Training/Saving/SavedModel/loader.cs b/src/TensorFlowNET.Core/Training/Saving/SavedModel/loader.cs index da999b376..727d18a81 100644 --- a/src/TensorFlowNET.Core/Training/Saving/SavedModel/loader.cs +++ b/src/TensorFlowNET.Core/Training/Saving/SavedModel/loader.cs @@ -13,6 +13,9 @@ using Tensorflow.Variables; using Tensorflow.Functions; using Tensorflow.Training.Saving.SavedModel; +using Tensorflow.Trackables; +using OneOf; +using Tensorflow.Keras.Engine; namespace Tensorflow { @@ -32,8 +35,10 @@ public partial class Loader private List? _filtered_nodes; private List _ordered_node_ids; private Dictionary)> _loaded_nodes; - private List _nodes; + private List _nodes; private Dictionary> _node_setters; + private Dictionary _concrete_functions; + private HashSet _restored_concrete_functions; public Loader(SavedObjectGraph object_graph_proto, SavedModel saved_model_proto, string export_dir, CheckpointOptions ckpt_options, LoadOptions save_options, IDictionary)> filters) { @@ -42,7 +47,10 @@ public Loader(SavedObjectGraph object_graph_proto, SavedModel saved_model_proto, _operation_attributes = meta_graph.GraphDef.Node.ToDictionary(x => x.Name, x => x.Attr); _proto = object_graph_proto; _export_dir = export_dir; - // TODO: `this._concrete_functions` and `this._restored_concrete_functions` + // TODO(Rinne): This method is a bit slow (especially under debug mode), may need to be accelareted. + _concrete_functions = function_deserialization.load_function_def_library( + meta_graph.GraphDef.Library, _proto); + _restored_concrete_functions = new HashSet(); _checkpoint_options = ckpt_options; _save_options = save_options; @@ -51,9 +59,13 @@ public Loader(SavedObjectGraph object_graph_proto, SavedModel saved_model_proto, _node_filters = filters; _node_path_to_id = _convert_node_paths_to_ints(); _loaded_nodes = new Dictionary)>(); - foreach(var filter in filters) + + if (filters != null) { - _loaded_nodes[_node_path_to_id[filter.Key]] = filter.Value; + foreach (var filter in filters) + { + _loaded_nodes[_node_path_to_id[filter.Key]] = filter.Value; + } } _filtered_nodes = _retrieve_all_filtered_nodes(); @@ -202,7 +214,7 @@ private List _generate_ordered_node_ids() continue; } var proto = _proto.Nodes[node_id]; - foreach(var dep in _get_node_dependencies(proto).Values.Distinct()) + foreach (var dep in _get_node_dependencies(proto).Values.Distinct()) { deps.Add(dep); if(_filtered_nodes is not null && !_filtered_nodes.Contains(dep)) @@ -221,7 +233,7 @@ private List _generate_ordered_node_ids() // The optimizer and original variable must be created before the slot // variable, since the slot variable is generated using the Optimizer's // add_slot API. - var slot_deps = dependency_map[slot_variable_node_id]; + var slot_deps = dependency_map.SetDefault(slot_variable_node_id, new List()); slot_deps.Add(node_id); slot_deps.Add(slot_variable_proto.OriginalVariableNodeId); @@ -234,7 +246,12 @@ private List _generate_ordered_node_ids() } try { - return TrackableUtils.order_by_dependency(dependency_map.ToDictionary(x => x.Key, x => x.Value as IEnumerable)); + int total = 0; + foreach(var v in dependency_map.Values) + { + total += v.Count; + } + return TrackableUtils.order_by_dependency(dependency_map); } catch (TrackableUtils.CyclicDependencyError ex) { @@ -249,9 +266,9 @@ private List _generate_ordered_node_ids() /// /// /// - private Dictionary, int> _get_node_dependencies(SavedObject proto) + private Dictionary, int> _get_node_dependencies(SavedObject proto) { - Dictionary, int> dependencies = new(); + Dictionary, int> dependencies = new(); foreach(var refer in proto.Dependencies) { dependencies[refer.LocalName] = refer.NodeId; @@ -308,11 +325,6 @@ private void _load_checkpoint_save_and_restore_functions() foreach(var (node_id, proto) in _iter_all_nodes()) { var node = get(node_id); - if(node is null) - { - // skip it because now we skip the restoration of `Function` and `ConcreteFunction`. - continue; - } if(proto.SaveableObjects.Keys.Count == 1 && proto.SaveableObjects.First().Key == TrackableUtils.SERIALIZE_TO_TENSORS_NAME) { // Restore Trackable serialize- and restore-from-tensor functions. @@ -333,9 +345,20 @@ private void _load_checkpoint_save_and_restore_functions() var saveable_object_proto = item.Value; var save_fn_id = saveable_object_proto.SaveFunction; var restore_fn_id = saveable_object_proto.RestoreFunction; - saveable_fn_by_name[name] = (get(save_fn_id), get(restore_fn_id)); + saveable_fn_by_name[name] = ((Trackable)get(save_fn_id), (Trackable)get(restore_fn_id)); + } + var saveable_objects = saveable_object_util.recreate_saveable_objects(saveable_fn_by_name, null); + if (saveable_objects is not null && saveable_objects.Count > 0) + { + if(node is Trackable trackable) + { + trackable.SelfSaveableObjectFactories = saveable_objects; + } + else + { + throw new TypeError(); + } } - node.SelfSaveableObjectFactories = saveable_object_util.recreate_saveable_objects(saveable_fn_by_name, null); } } } @@ -373,22 +396,15 @@ private void _load_nodes() { // Use the public Optimizer interface when creating slot variables. var (optimizer_node_id, slot_variable_proto) = slot_variable_node_ids[node_id]; - var optimizer_object = nodes[optimizer_node_id]; + var optimizer_object = nodes[optimizer_node_id] as IOptimizer; var optimizer_variable = nodes[slot_variable_proto.OriginalVariableNodeId]; - // TODO: implement it. - throw new NotImplementedException("The model loading of SavedModel still has some incompleted part." + - " Please submit an issue to https://github.com/SciSharp/TensorFlow.NET/issues."); + var slot_variable = optimizer_object.add_slot(optimizer_variable as IVariableV1, slot_variable_proto.SlotName); + nodes[slot_variable_proto.SlotVariableNodeId] = slot_variable as Trackable; + node_setters[slot_variable_proto.SlotVariableNodeId] = setattr; } else { - // skip the function and concrete function. - if(proto.KindCase == SavedObject.KindOneofCase.BareConcreteFunction || proto.KindCase == SavedObject.KindOneofCase.Function) - { - nodes[node_id] = null; - node_setters[node_id] = null; - continue; - } var (node, setter) = _recreate(proto, node_id, nodes); nodes[node_id] = node; node_setters[node_id] = setter; @@ -399,7 +415,7 @@ private void _load_nodes() { nodes[0] = _recreate_base_user_object().Item1; } - _nodes = new List(); + _nodes = new List(); for(int i = 0; i < _proto.Nodes.Count; i++) { _nodes.Add(nodes[i]); @@ -413,9 +429,11 @@ private void _load_nodes() private void _restore_checkpoint() { var variables_path = SavedModelUtils.get_variables_path(_export_dir); - var saver = new TrackableSaver(new ObjectGraphView(get(0))); - tf.device("CPU"); - saver.FilePrefixPlaceHolder = constant_op.constant(variables_path); + var saver = new TrackableSaver(new ObjectGraphView((Trackable)get(0))); + tf_with(ops.device("CPU"), _ => + { + saver.FilePrefixPlaceHolder = constant_op.constant(variables_path); + }); LoadStatus load_status; if (_save_options.allow_partial_checkpoint) { @@ -466,17 +484,30 @@ private void _load_edges() } } + private void _setup_function_captures(string concrete_function_name, IDictionary, object> nodes) + { + if (_restored_concrete_functions.Contains(concrete_function_name)) + { + return; + } + _restored_concrete_functions.Add(concrete_function_name); + var concrete_function = _concrete_functions[concrete_function_name]; + var proto = _proto.ConcreteFunctions[concrete_function_name]; + var inputs = proto.BoundInputs.Select(x => nodes[x]); + function_saved_model_utils.restore_captures(concrete_function, inputs); + } + private void _setup_remaining_functions() { // TODO: implement it with concrete functions. } - public Trackable get(int node_id) + public object get(int node_id) { return _nodes[node_id]; } - public Trackable get(string node_id) + public object get(string node_id) { return get(_node_path_to_id[node_id]); } @@ -493,19 +524,14 @@ private void _add_object_graph_edges(SavedObject proto, int node_id) foreach(var refer in proto.Children) { - if(obj is null) - { - // skip it because now we skip the restoration of `Function` and `ConcreteFunction`. - continue; - } setter.Invoke(obj, refer.LocalName, _nodes[refer.NodeId]); - // skip the process of "__call__" + // TODO(Rinne): deal with "__call__" } } - private (Dictionary, Dictionary>) _initialize_loaded_nodes() + private (Dictionary, Dictionary>) _initialize_loaded_nodes() { - Dictionary nodes = new(); + Dictionary nodes = new(); Dictionary> node_setters = new(); foreach(var item in _loaded_nodes) { @@ -525,17 +551,22 @@ private void _add_object_graph_edges(SavedObject proto, int node_id) } } - private (Trackable, Action) _recreate(SavedObject proto, int node_id, IDictionary nodes) + private (object, Action) _recreate(SavedObject proto, int node_id, IDictionary nodes) { // skip the registered classes. - - Dictionary, Trackable> dependencies = new(); + Dictionary, object> dependencies = new(); foreach(var item in _get_node_dependencies(proto)) { dependencies[item.Key] = nodes[item.Value]; } - return _recreate_default(proto, node_id, dependencies); + return proto.KindCase switch + { + SavedObject.KindOneofCase.Resource => RestoredResource.deserialize_from_proto(proto, _operation_attributes), + SavedObject.KindOneofCase.Asset => AssetResource.deserialize_from_proto(proto, _export_dir, _asset_file_def, _operation_attributes), + SavedObject.KindOneofCase.Constant => TrackableConstant.deserialize_from_proto(proto, _operation_attributes), + _ => _recreate_default(proto, node_id, dependencies) + }; } /// @@ -544,28 +575,28 @@ private void _add_object_graph_edges(SavedObject proto, int node_id) /// /// /// - private (Trackable, Action) _recreate_default(SavedObject proto, int node_id, IDictionary, Trackable> dependencies) + private (Trackable, Action) _recreate_default(SavedObject proto, int node_id, IDictionary, object> dependencies) { return proto.KindCase switch { SavedObject.KindOneofCase.UserObject => _recreate_user_object(proto.UserObject, node_id), - SavedObject.KindOneofCase.Function => throw new NotImplementedException(), - SavedObject.KindOneofCase.BareConcreteFunction => throw new NotImplementedException(), + SavedObject.KindOneofCase.Function => _recreate_function(proto.Function, dependencies), + SavedObject.KindOneofCase.BareConcreteFunction => _recreate_bare_concrete_function(proto.BareConcreteFunction, dependencies), SavedObject.KindOneofCase.Variable => _recreate_variable(proto.Variable), - SavedObject.KindOneofCase.CapturedTensor => throw new NotImplementedException() + SavedObject.KindOneofCase.CapturedTensor => throw new NotImplementedException(), + _ => throw new NotImplementedException() }; } private (Trackable, Action) _recreate_user_object(SavedUserObject? proto, int node_id) { // skip the check of proto identifier because of lack of property. - - var looked_up = RevivedTypes.deserialize(proto); - if(looked_up is null) + var (trackable, setter) = RevivedTypes.deserialize(proto); + if(trackable is null) { return _recreate_base_user_object(proto, node_id); } - return (looked_up.Item1, looked_up.Item2); + return (trackable, setter); } private (Trackable, Action) _recreate_base_user_object(SavedUserObject? proto = null, int? node_id = null) @@ -588,14 +619,16 @@ private void _add_object_graph_edges(SavedObject proto, int node_id) if (load_with_device) { - tf.device(saved_device); - return (new UninitializedVariable( - shape: new Shape(proto.Shape.Dim.Select(x => (int)x.Size).ToArray()), - dtype: (TF_DataType)proto.Dtype, - name: name, - trainable: trainable, - aggregation: aggregation - ), setattr); + return tf_with(ops.device(saved_device), _ => + { + return (new UninitializedVariable( + shape: new Shape(proto.Shape.Dim.Select(x => (int)x.Size).ToArray()), + dtype: (TF_DataType)proto.Dtype, + name: name, + trainable: trainable, + aggregation: aggregation + ), setattr); + }); } else { @@ -609,24 +642,50 @@ private void _add_object_graph_edges(SavedObject proto, int node_id) } } + private (Function, Action) _recreate_function(SavedFunction proto, + IDictionary, object> dependencies) + { + var fn = function_deserialization.recreate_function(proto, _concrete_functions); + foreach (var name in proto.ConcreteFunctions) + { + _setup_function_captures(name, dependencies); + } + return (fn, setattr); + } + private (ConcreteFunction, Action) _recreate_bare_concrete_function(SavedBareConcreteFunction proto, - Dictionary, Trackable> dependencies) + IDictionary, object> dependencies) + { + var fn = function_deserialization.setup_bare_concrete_function(proto, _concrete_functions); + _setup_function_captures(proto.ConcreteFunctionName, dependencies); + return (fn, setattr); + } + + private (Tensor, Action) _get_tensor_from_fn(CapturedTensor proto) { - throw new NotImplementedException(); - //var fn = function_deserialization.setup_bare_concrete_function(proto, ) + var outer_graph = _concrete_functions[proto.ConcreteFunction].func_graph; + var captured_tensor = outer_graph.get_tensor_by_name(proto.Name); + return (captured_tensor, setattr); } // TODO: remove this to a common class. public static Action setattr = (x, y, z) => { Debug.Assert(y is string); - var properties = x.GetType().GetProperties(); - foreach(var p in properties) + if(x is Trackable trackable) + { + trackable.SetAttr(y as string, z); + } + else { - if((string)y == p.Name) + var properties = x.GetType().GetProperties(); + foreach (var p in properties) { - p.SetValue(x, z); - return; + if ((string)y == p.Name) + { + p.SetValue(x, z); + return; + } } } // TODO(Rinne): check if the property has been set successfully. diff --git a/src/TensorFlowNET.Core/Training/Saving/SavedModel/loader.static.cs b/src/TensorFlowNET.Core/Training/Saving/SavedModel/loader.static.cs index a92cb5509..d1c0170c8 100644 --- a/src/TensorFlowNET.Core/Training/Saving/SavedModel/loader.static.cs +++ b/src/TensorFlowNET.Core/Training/Saving/SavedModel/loader.static.cs @@ -78,7 +78,7 @@ public static IDictionary load_partial(string export_dir, IDi tf_with(ops.init_scope(), x => { loader = new Loader(object_graph_proto, saved_model_proto, export_dir, ckpt_options, options, filters); - root = loader.get(0); + root = (Trackable)loader.get(0); // skip the assignment of `graph_debug_info`. }); // skip the assignment of `tensorflow_version` @@ -99,7 +99,7 @@ public static IDictionary load_partial(string export_dir, IDi } if(filters != null && filters.Count > 0) { - return filters.Keys.ToDictionary(x => x, x => loader.get(x)); + return filters.Keys.ToDictionary(x => x, x => (Trackable)loader.get(x)); } else { diff --git a/src/TensorFlowNET.Core/Training/Saving/SavedModel/nested_structure_coder.cs b/src/TensorFlowNET.Core/Training/Saving/SavedModel/nested_structure_coder.cs new file mode 100644 index 000000000..c81dc29eb --- /dev/null +++ b/src/TensorFlowNET.Core/Training/Saving/SavedModel/nested_structure_coder.cs @@ -0,0 +1,268 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Text; +using Tensorflow.Util; +using static Tensorflow.Binding; + +namespace Tensorflow.Training.Saving.SavedModel +{ + internal interface ICodec + { + //bool CanEncode(StructuredValue value); + bool CanDecode(StructuredValue value); + //StructuredValue DoEecode(object value, Func encode_fn); + object DoDecode(StructuredValue value, Func decode_fn); + } + public class nested_structure_coder + { + private static Dictionary _codecs = null; + public static object decode_proto(StructuredValue proto) + { + if(_codecs is null) + { + _codecs = new Dictionary(); + _codecs[StructuredValue.KindOneofCase.ListValue] = new ListCodec(); + _codecs[StructuredValue.KindOneofCase.TupleValue] = new TupleCodec(); + _codecs[StructuredValue.KindOneofCase.DictValue] = new DictCodec(); + _codecs[StructuredValue.KindOneofCase.NamedTupleValue] = new NamedTupleCodec(); + _codecs[StructuredValue.KindOneofCase.Float64Value] = new Float64Codec(); + _codecs[StructuredValue.KindOneofCase.Int64Value] = new Int64Codec(); + _codecs[StructuredValue.KindOneofCase.StringValue] = new StringCodec(); + _codecs[StructuredValue.KindOneofCase.NoneValue] = new NoneCodec(); + _codecs[StructuredValue.KindOneofCase.BoolValue] = new BoolCodec(); + _codecs[StructuredValue.KindOneofCase.TensorShapeValue] = new TensorShapeCodec(); + _codecs[StructuredValue.KindOneofCase.TensorDtypeValue] = new TensorTypeCodec(); + _codecs[StructuredValue.KindOneofCase.TensorSpecValue] = new TensorSpecCodec(); + _codecs[StructuredValue.KindOneofCase.BoundedTensorSpecValue] = new BoundedTensorSpecCodec(); + _codecs[StructuredValue.KindOneofCase.TypeSpecValue] = new TypeSpecCodec(); + } + + return decode_proto_internal(proto, x => decode_proto(x)); + } + + public static object decode_proto_internal(StructuredValue proto, Func encode_fn) + { + Debug.Assert(_codecs[proto.KindCase].CanDecode(proto)); + return _codecs[proto.KindCase].DoDecode(proto, encode_fn); + } + } + + internal class ListCodec : ICodec + { + public bool CanDecode(StructuredValue value) + { + return value.ListValue is not null; + } + + public object DoDecode(StructuredValue value, Func decode_fn) + { + return value.ListValue.Values.Select(x => decode_fn(x)).ToList(); + } + } + + internal class TupleCodec: ICodec + { + public bool CanDecode(StructuredValue value) + { + return value.TupleValue is not null; + } + + public object DoDecode(StructuredValue value, Func decode_fn) + { + return value.TupleValue.Values.Select(x => decode_fn(x)).ToArray(); + } + } + + internal class DictCodec : ICodec + { + public bool CanDecode(StructuredValue value) + { + return value.DictValue is not null; + } + + public object DoDecode(StructuredValue value, Func decode_fn) + { + return value.DictValue.Fields.ToDictionary(x => x.Key, x => decode_fn(x.Value)); + } + } + + internal class NamedTupleCodec : ICodec + { + public bool CanDecode(StructuredValue value) + { + return value.NamedTupleValue is not null; + } + + public object DoDecode(StructuredValue value, Func decode_fn) + { + var key_value_pairs = value.NamedTupleValue.Values; + var items = key_value_pairs.ToDictionary(x => x.Key, x => decode_fn(x.Value)); + return new Common.Types.NamedTuple() + { + Name = value.NamedTupleValue.Name, + ValueDict = items + }; + } + } + + internal class Float64Codec : ICodec + { + public bool CanDecode(StructuredValue value) + { + return value.KindCase == StructuredValue.KindOneofCase.Float64Value; + } + + public object DoDecode(StructuredValue value, Func decode_fn) + { + return value.Float64Value; + } + } + + internal class Int64Codec : ICodec + { + public bool CanDecode(StructuredValue value) + { + return value.KindCase == StructuredValue.KindOneofCase.Int64Value; + } + + public object DoDecode(StructuredValue value, Func decode_fn) + { + return (int)value.Int64Value; + } + } + + internal class StringCodec : ICodec + { + public bool CanDecode(StructuredValue value) + { + return value.StringValue is not null; + } + + public object DoDecode(StructuredValue value, Func decode_fn) + { + return tf.compat.as_str(value.StringValue); + } + } + + internal class NoneCodec : ICodec + { + public bool CanDecode(StructuredValue value) + { + return value.NoneValue is not null; + } + + public object DoDecode(StructuredValue value, Func decode_fn) + { + return null; + } + } + + internal class BoolCodec : ICodec + { + public bool CanDecode(StructuredValue value) + { + return value.KindCase == StructuredValue.KindOneofCase.BoolValue; + } + + public object DoDecode(StructuredValue value, Func decode_fn) + { + return value.BoolValue; + } + } + + internal class TensorShapeCodec : ICodec + { + public bool CanDecode(StructuredValue value) + { + return value.TensorShapeValue is not null; + } + + public object DoDecode(StructuredValue value, Func decode_fn) + { + return new Shape(value.TensorShapeValue); + } + } + + internal class TensorTypeCodec : ICodec + { + public bool CanDecode(StructuredValue value) + { + return value.KindCase == StructuredValue.KindOneofCase.TensorDtypeValue; + } + + public object DoDecode(StructuredValue value, Func decode_fn) + { + return value.TensorDtypeValue.as_tf_dtype(); + } + } + + internal class TensorSpecCodec : ICodec + { + public bool CanDecode(StructuredValue value) + { + return value.TensorSpecValue is not null; + } + + public object DoDecode(StructuredValue value, Func decode_fn) + { + var name = value.TensorSpecValue.Name; + var shape = decode_fn(new StructuredValue() + { + TensorShapeValue = value.TensorSpecValue.Shape + }); + Debug.Assert(shape is Shape); + var dtype = decode_fn(new StructuredValue() + { + TensorDtypeValue = value.TensorSpecValue.Dtype + }); + Debug.Assert(dtype is TF_DataType); + return new Framework.Models.TensorSpec(shape as Shape, (TF_DataType)dtype, + string.IsNullOrEmpty(name) ? null : name); + } + } + + internal class BoundedTensorSpecCodec : ICodec + { + public bool CanDecode(StructuredValue value) + { + return value.BoundedTensorSpecValue is not null; + } + + public object DoDecode(StructuredValue value, Func decode_fn) + { + var btsv = value.BoundedTensorSpecValue; + var name = btsv.Name; + var shape = decode_fn(new StructuredValue() + { + TensorShapeValue = btsv.Shape + }); + Debug.Assert(shape is Shape); + var dtype = decode_fn(new StructuredValue() + { + TensorDtypeValue = btsv.Dtype + }); + Debug.Assert(dtype is TF_DataType); + throw new NotImplementedException("The `BoundedTensorSpec` has not been supported, " + + "please submit an issue to https://github.com/SciSharp/TensorFlow.NET/issues"); + } + } + + internal class TypeSpecCodec : ICodec + { + public bool CanDecode(StructuredValue value) + { + return value.TypeSpecValue is not null; + } + + public object DoDecode(StructuredValue value, Func decode_fn) + { + var type_spec_proto = value.TypeSpecValue; + var type_spec_class_enum = type_spec_proto.TypeSpecClass; + var class_name = type_spec_proto.TypeSpecClassName; + + throw new NotImplementedException("The `TypeSpec` analysis has not been supported, " + + "please submit an issue to https://github.com/SciSharp/TensorFlow.NET/issues"); + } + } +} diff --git a/src/TensorFlowNET.Core/Training/Saving/SavedModel/signature_serialization.cs b/src/TensorFlowNET.Core/Training/Saving/SavedModel/signature_serialization.cs index 4a0d3b002..d3ffebc9f 100644 --- a/src/TensorFlowNET.Core/Training/Saving/SavedModel/signature_serialization.cs +++ b/src/TensorFlowNET.Core/Training/Saving/SavedModel/signature_serialization.cs @@ -102,6 +102,6 @@ public override IDictionary _trackable_children(SaveType save return new Dictionary(); } - return _signatures.TakeWhile(x => x.Value is Function or ConcreteFunction).ToDictionary(x => x.Key, x => x.Value); + return _signatures.Where(x => x.Value is Function or ConcreteFunction).ToDictionary(x => x.Key, x => x.Value); } } diff --git a/src/TensorFlowNET.Core/Training/Saving/saveable_object_util.py.cs b/src/TensorFlowNET.Core/Training/Saving/saveable_object_util.py.cs index 208311229..5f198a4f8 100644 --- a/src/TensorFlowNET.Core/Training/Saving/saveable_object_util.py.cs +++ b/src/TensorFlowNET.Core/Training/Saving/saveable_object_util.py.cs @@ -14,11 +14,14 @@ You may obtain a copy of the License at limitations under the License. ******************************************************************************/ +using OneOf; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using Tensorflow.Checkpoint; +using Tensorflow.Contexts; +using Tensorflow.Device; using Tensorflow.Operations.Activation; using Tensorflow.Train; using Tensorflow.Training; @@ -49,6 +52,10 @@ public TrackableSaveable(Trackable obj, IEnumerable specs, string name } public static class saveable_object_util { + public static string NO_SLICE_SPEC_KEY = ""; + private static HashSet _VARIABLE_OPS = new HashSet(new string[] { + "Variable", "VariableV2", "AutoReloadVariable", "VarHandleOp", "ReadVariableOp" + }); /// /// Returns the variables and names that will be used for a Saver. /// @@ -122,19 +129,12 @@ private static void _add_saveable(List saveables, List public static IEnumerable saveable_objects_for_op(Tensor op, string name) { - if (false) - { - - } + ops.init_scope(); + var variable = ops.convert_to_tensor(op, as_ref: true); + if (variable.dtype.is_ref_dtype()) + yield return new ReferenceVariableSaveable(variable, "", name); else - { - ops.init_scope(); - var variable = ops.convert_to_tensor(op, as_ref: true); - if (variable.dtype.is_ref_dtype()) - yield return new ReferenceVariableSaveable(variable, "", name); - else - yield return new ResourceVariableSaveable(variable, "", name); - } + yield return new ResourceVariableSaveable(variable, "", name); } /// @@ -158,7 +158,7 @@ public static IEnumerable saveable_objects_for_op(Trackable ob yield return new ResourceVariableSaveable(variable, "", name); } } - else + else if(obj is not IVariableV1) { foreach(var pair in saveable_objects_from_trackable(obj)) { @@ -174,7 +174,7 @@ public static IEnumerable saveable_objects_for_op(Trackable ob full_name = name + "_" + attr; } var op = factory(full_name); - if(op.TryGet(out var variable)) + if(op.TryPickT0(out var variable, out var saveable)) { foreach (var v in saveable_objects_for_op(variable as Trackable, variable.Name)) { @@ -183,7 +183,6 @@ public static IEnumerable saveable_objects_for_op(Trackable ob } else { - var saveable = op.GetValue(); foreach (var v in saveable_objects_for_op(saveable, saveable.name)) { yield return v; @@ -191,6 +190,30 @@ public static IEnumerable saveable_objects_for_op(Trackable ob } } } + else + { + // Variable + if (tf.Context.executing_eagerly()) + { + throw new ValueError($"Can only save/restore ResourceVariables when " + + $"executing eagerly, got type: {obj.GetType()}."); + } + var variable = ops.convert_to_tensor(obj, as_ref: true); + if (!_tensor_comes_from_variable(variable)) + { + throw new TypeError($"names_to_saveables must be a dict mapping string " + + $"names to Tensors/Variables. Not a variable: {variable}"); + } + if(variable.op.type == "Variable" || variable.op.type == "VariableV2" || + variable.op.type == "AutoReloadVariable") + { + yield return new ReferenceVariableSaveable(variable, "", name); + } + else + { + yield return new ResourceVariableSaveable(variable, "", name); + } + } } /// @@ -252,11 +275,11 @@ public static Dictionary op_list_to_dict(IVariableV1[] op_list, return names_to_saveables; } - public static IDictionary>> saveable_objects_from_trackable(Trackable obj) + public static IDictionary>> saveable_objects_from_trackable(Trackable obj) { // skip the process of type `PythonState` - Maybe create_saveable(string name = "") + OneOf create_saveable(string name = "") { // skip the case that `obj._serialize_to_tensors` is `ConcreteFunction`. var tensor_dict = obj.serialize_to_tensors(); @@ -267,24 +290,14 @@ Maybe create_saveable(string name = "") foreach (var pair in tensor_dict) { var tensor_name = pair.Key; - var maybe_tensor = pair.Value; + var internal_dict = pair.Value; local_names.Add(tensor_name); string spec_name = name + TrackableUtils.escape_local_name(tensor_name); - IDictionary internal_dict; - if (maybe_tensor.TryGet(out var tensor)) - { - internal_dict = new Dictionary(); - internal_dict[""] = tensor; - } - else - { - internal_dict = maybe_tensor.GetValue>(); - } - foreach (var item in internal_dict) { - specs.Add(new SaveSpec(item.Value, item.Key, spec_name)); + Debug.Assert(item.Value.IsT0); + specs.Add(new SaveSpec(item.Value.AsT0, item.Key, spec_name)); } } return new TrackableSaveable(obj, specs, name, local_names, prefix); @@ -292,7 +305,7 @@ Maybe create_saveable(string name = "") if (trackable_has_serialize_to_tensor(obj)) { - Dictionary>> res = new(); + Dictionary>> res = new(); res[TrackableUtils.SERIALIZE_TO_TENSORS_NAME] = create_saveable; return res; } @@ -316,9 +329,9 @@ internal static string convert_to_string(string x) /// Converts a list of SaveableObjects to a tensor dictionary. /// /// - public static Dictionary>> saveable_object_to_tensor_dict(IList saveables) + public static Dictionary>> saveable_object_to_tensor_dict(IList saveables) { - Dictionary>> tensor_dict = new(); + Dictionary>> tensor_dict = new(); foreach (var saveable in saveables) { foreach (var spec in saveable.specs) @@ -326,14 +339,11 @@ public static Dictionary>> sav // skip the check that if `spec` is callable. var name = convert_to_string(spec.name); var slice_spec = convert_to_string(spec.slice_spec); - if (!string.IsNullOrEmpty(slice_spec)) - { - tensor_dict.SetDefault(name, new Dictionary()).GetValue>()[slice_spec] = spec.tensor; - } - else + if (string.IsNullOrEmpty(slice_spec)) { - tensor_dict[name] = spec.tensor; + slice_spec = NO_SLICE_SPEC_KEY; } + tensor_dict.SetDefault(name, new Dictionary>())[slice_spec] = spec.TensorCreator is null ? spec.tensor : spec; } } return tensor_dict; @@ -343,7 +353,7 @@ public static Dictionary>> sav /// Generates `Trackable._restore_from_tensors` from SaveableObjects. /// /// - public static Func>>, IDictionary> saveable_object_to_restore_fn(IList saveables) + public static Func>>, IDictionary> saveable_object_to_restore_fn(IList saveables) { return (restored_tensors) => { @@ -359,14 +369,14 @@ public static Func var maybe_tensor = restored_tensors[name]; IDictionary dict; - if(maybe_tensor.TryGet(out var tensor)) + if(maybe_tensor.TryPickT0(out var tensor, out var dic)) { dict = new Dictionary(); dict[""] = tensor; } else { - dict = maybe_tensor.GetValue>(); + dict = dic; } saveable_restored_tensors.Add(dict[slice_spec]); } @@ -381,22 +391,38 @@ public static Func /// /// /// - public static IDictionary>> recreate_saveable_objects( + public static IDictionary>> recreate_saveable_objects( IDictionary saveable_fn_by_name, IEnumerable? temp_session) { if (saveable_fn_by_name.Count > 0) { throw new NotImplementedException("Not implemented, please submit an issue to https://github.com/SciSharp/TensorFlow.NET/issues"); } - var res = new Dictionary>>(); + var res = new Dictionary>>(); return res; } - public static Maybe create_saveable_object(string name, string key, Func> factory, + public static OneOf create_saveable_object(string name, string key, Func> factory, bool call_with_mapped_captures = false) { return factory(key); } + + public static string set_cpu0(string device_string) + { + if (tf.Context.is_custom_device(device_string)) + { + return device_string; + } + var parsed_device = DeviceSpec.from_string(device_string); + parsed_device = parsed_device.replace(device_type: "CPU", device_index: 0); + return parsed_device.ToString(); + } + + private static bool _tensor_comes_from_variable(object v) + { + return v is Tensor tensor && _VARIABLE_OPS.Contains(tensor.op.type); + } } public class SaveableCompatibilityConverter: Trackable @@ -412,7 +438,7 @@ public SaveableCompatibilityConverter(object obj, IList saveab public object Obj => _obj; public IList mySaveables=> _saveables; - public override IDictionary>> serialize_to_tensors() + public override IDictionary>> serialize_to_tensors() { return saveable_object_util.saveable_object_to_tensor_dict(_saveables); } @@ -422,7 +448,7 @@ public override IDictionary>> /// /// /// - public override IDictionary _restore_from_tensors(IDictionary>> restored_tensors) + public override IDictionary _restore_from_tensors(IDictionary>> restored_tensors) { List expected_keys = new(); foreach(var saveable in _saveables) diff --git a/src/TensorFlowNET.Core/Training/Saving/saver.py.cs b/src/TensorFlowNET.Core/Training/Saving/saver.py.cs index 4f583600f..f94f98940 100644 --- a/src/TensorFlowNET.Core/Training/Saving/saver.py.cs +++ b/src/TensorFlowNET.Core/Training/Saving/saver.py.cs @@ -94,18 +94,16 @@ public static string freeze_graph(string checkpoint_dir, string output_pb = Path.GetFullPath(Path.Combine(checkpoint_dir, "../", $"{output_pb_name}.pb")); - using (var graph = tf.Graph()) - using (var sess = tf.Session(graph)) - { - var saver = tf.train.import_meta_graph($"{checkpoint}.meta", clear_devices: true); - saver.restore(sess, checkpoint); - var output_graph_def = tf.graph_util.convert_variables_to_constants(sess, - graph.as_graph_def(), - output_node_names); - Binding.tf_output_redirect.WriteLine($"Froze {output_graph_def.Node.Count} nodes."); - File.WriteAllBytes(output_pb, output_graph_def.ToByteArray()); - return output_pb; - } + var graph = tf.Graph(); + var sess = tf.Session(graph); + var saver = tf.train.import_meta_graph($"{checkpoint}.meta", clear_devices: true); + saver.restore(sess, checkpoint); + var output_graph_def = tf.graph_util.convert_variables_to_constants(sess, + graph.as_graph_def(), + output_node_names); + Binding.tf_output_redirect.WriteLine($"Froze {output_graph_def.Node.Count} nodes."); + File.WriteAllBytes(output_pb, output_graph_def.ToByteArray()); + return output_pb; } public static Graph load_graph(string freeze_graph_pb, string name = "") diff --git a/src/TensorFlowNET.Core/Training/Trackable.cs b/src/TensorFlowNET.Core/Training/Trackable.cs index 7c86a5802..2b5bf2a72 100644 --- a/src/TensorFlowNET.Core/Training/Trackable.cs +++ b/src/TensorFlowNET.Core/Training/Trackable.cs @@ -14,6 +14,7 @@ You may obtain a copy of the License at limitations under the License. ******************************************************************************/ +using OneOf; using System; using System.Collections.Generic; using System.Diagnostics; @@ -43,8 +44,8 @@ public static class Constants protected IList _unconditional_checkpoint_dependencies; protected Dictionary> _unconditional_deferred_dependencies; - protected IDictionary>> _self_saveable_object_factories = - new Dictionary>>(); + protected IDictionary>> _self_saveable_object_factories = + new Dictionary>>(); private bool _manual_tracking = true; private static Trackable _none = new AutoTrackable(); @@ -73,7 +74,7 @@ public virtual string ObjectIdentifier public IDictionary UnconditionalDependencyNames { get => _unconditional_dependency_names; } public IList CheckpointDependencies { get => UnconditionalCheckpointDependencies; } public Dictionary> DeferredDependencies => _unconditional_deferred_dependencies; - public IDictionary>> SelfSaveableObjectFactories + public IDictionary>> SelfSaveableObjectFactories { get { @@ -84,6 +85,72 @@ public IDictionary CustomizedFields { get; set; } = new Dictionary(); + + public virtual void SetAttr(string name, object value) + { + var t = this.GetType(); + var field_info = t.GetField(name); + if(field_info is not null) + { + field_info.SetValue(this, value); + } + else + { + CustomizedFields[name] = value; + } + + // On account of performance, we don't use reflection to set the attribute if it exists in `Trackable`. + // When adding new members or properties to this class, please add corresponding process to this method. + //switch (name) + //{ + // case "_manual_tracking": + // { + // _manual_tracking = (bool)value; + // break; + // } + // case "_self_saveable_object_factories": + // { + // _self_saveable_object_factories = (IDictionary>>)value; + // break; + // } + // case "_self_update_uid": + // { + // _self_update_uid = (int)value; + // break; + // } + // case "_unconditional_checkpoint_dependencies": + // { + // _unconditional_checkpoint_dependencies = (IList)value; + // break; + // } + // case "_unconditional_deferred_dependencies": + // { + // _unconditional_deferred_dependencies = (Dictionary>)value; + // break; + // } + // case "_unconditional_dependency_names": + // { + // _unconditional_dependency_names = (IDictionary)value; + // break; + // } + // case "SelfSaveableObjectFactories": + // { + // SelfSaveableObjectFactories = (IDictionary>>)value; + // break; + // } + // case "UpdateUid": + // { + // UpdateUid = (int)value; + // break; + // } + // default: + // { + // CustomizedAttributes[name] = value; + // break; + // } + // } + } /// /// Restore-on-create for a variable be saved with this `Checkpointable`. @@ -249,9 +316,9 @@ public virtual List export_to_saved_model_graph(IDictionary>> gather_saveables_for_checkpoint() + public virtual IDictionary>> gather_saveables_for_checkpoint() { - Maybe create_saveable(string name = "") + OneOf create_saveable(string name = "") { throw new NotImplementedException(); //return new TrackableSaveable(this, null, name, null, null); @@ -259,7 +326,7 @@ Maybe create_saveable(string name = "") if (saveable_object_util.trackable_has_serialize_to_tensor(this)) { // TODO: complete the implementation (need to complete the class `saveable_object_util.TrackableSaveable`). - Dictionary>> res = new(); + Dictionary>> res = new(); res[""] = create_saveable; return res; } @@ -278,12 +345,12 @@ Maybe create_saveable(string name = "") /// /// /// - public virtual IDictionary>> serialize_to_tensors() + public virtual IDictionary>> serialize_to_tensors() { throw new NotImplementedException(); } - public virtual IDictionary _restore_from_tensors(IDictionary>> restored_tensors) + public virtual IDictionary _restore_from_tensors(IDictionary>> restored_tensors) { throw new NotImplementedException(); } diff --git a/src/TensorFlowNET.Core/Training/TrackableUtils.cs b/src/TensorFlowNET.Core/Training/TrackableUtils.cs index 05c513a83..89bb614d2 100644 --- a/src/TensorFlowNET.Core/Training/TrackableUtils.cs +++ b/src/TensorFlowNET.Core/Training/TrackableUtils.cs @@ -52,7 +52,7 @@ public static string checkpoint_key(string object_path, string local_name) /// /// /// - public static List order_by_dependency(IDictionary> dependency_map) + public static List order_by_dependency(IDictionary> dependency_map) { Dictionary> reverse_dependency_map = new(); foreach (var pair in dependency_map) @@ -102,7 +102,7 @@ public static List order_by_dependency(IDictionary> d edges.Remove(x); if (edges.Count == 0) { - to_visit.Enqueue(dep); + to_visit.Enqueue(dep); if (!reverse_dependency_map.Remove(dep)) { throw new KeyError($"Cannot find the key {dep} in reverse_dependency_map"); diff --git a/src/TensorFlowNET.Core/Training/data_structures.cs b/src/TensorFlowNET.Core/Training/data_structures.cs index 6e3336c90..6b607e853 100644 --- a/src/TensorFlowNET.Core/Training/data_structures.cs +++ b/src/TensorFlowNET.Core/Training/data_structures.cs @@ -2,6 +2,8 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.IO.Compression; using System.Linq; using System.Linq.Expressions; @@ -25,6 +27,48 @@ public NoDependency(Trackable value) } } + static class TrackableWrapperUtils + { + internal static bool ShouldLoad(ITrackableWrapper wrapper, SavedUserObject proto) + { + if (proto.Identifier != wrapper.Identifier) + { + return false; + } + if (wrapper.Version < proto.Version.MinConsumer) + { + return false; + } + if (proto.Version.Producer < wrapper.MinProducerVersion) + { + return false; + } + foreach (var bad_version in proto.Version.BadConsumers) + { + if (bad_version == wrapper.Version) + { + return false; + } + } + return true; + } + + internal static bool is_function(Trackable x) + { + return x is Function or ConcreteFunction; + } + } + + public interface ITrackableWrapper + { + void SetValue(object name, object value); + String Identifier { get; } + int Version { get; } + int MinConsumerVersion { get; } + int MinProducerVersion { get; } + Trackable FromProto(SavedUserObject proto); + } + public abstract class TrackableDataStructure : Trackable { private bool _self_trainable; @@ -36,7 +80,7 @@ public TrackableDataStructure() _self_extra_variables = new List(); } - public abstract IEnumerable Values { get; } + public abstract ICollection Values { get; } public bool Trainable { get => _self_trainable; set => _self_trainable = value; } public IEnumerable Layers { @@ -88,8 +132,8 @@ public IEnumerable NonTrainableWeights { get { - var trainable_extra_variables = _self_extra_variables.TakeWhile(x => x.Trainable).ToList(); - var non_trainable_extra_variables = _self_extra_variables.TakeWhile(x => !x.Trainable).ToList(); + var trainable_extra_variables = _self_extra_variables.Where(x => x.Trainable).ToList(); + var non_trainable_extra_variables = _self_extra_variables.Where(x => !x.Trainable).ToList(); List non_trainable_variables = new(); foreach(var obj in Values) { @@ -134,7 +178,7 @@ public IEnumerable NonTrainableWeights /// protected virtual Trackable _track_value(Trackable value, string name) { - value = sticky_attribute_assignment(this, name, value); + value = (Trackable)sticky_attribute_assignment(this, name, value); if(value is IVariableV1) { _self_extra_variables.Add(value as IVariableV1); @@ -148,44 +192,273 @@ public static Trackable wrap_or_unwrap(NoDependency value) return value.Value; } - public static Trackable wrap_or_unwrap(Trackable value) + public static object wrap_or_unwrap(object value) { + if(value is NoDependency dependency) + { + return dependency.Value; + } + if(value is Trackable trackable) + { + return trackable; + } + else if(value is IDictionary obj_dict) + { + return new DictWrapper(obj_dict); + } + else if(value is IList list) + { + return new ListWrapper(list); + } + else + { + return value; + } + } + + public static object sticky_attribute_assignment(Trackable trackable, string name, object value) + { + bool add_dependency = value is not NoDependency; + value = wrap_or_unwrap(value); + if (!add_dependency) + { + return value; + } + if(value is Trackable trackable_obj) + { + trackable._track_trackable(trackable_obj, name, true); + } return value; } + } + // TODO(Rinne): Add Dict wrapper and Tuple wrapper + + public class DictWrapper : TrackableDataStructure, IDictionary, ICloneable, ITrackableWrapper + { + private IDictionary _storage; + private bool _non_string_key; + private bool _external_modification; + private IDictionary _last_wrapped_dict_snapshot; + + public DictWrapper(IDictionary wrapped_dict = null) + { + if(wrapped_dict is not null) + { + _storage = new Dictionary(wrapped_dict); + } + else + { + _storage = new Dictionary(); + } + _update_snapshot(); + } - public static Trackable wrap_or_unwrap(IList value) + public void SetValue(object name, object value) { - return new ListWrapper(value); + Debug.Assert(value is Trackable); + this[name] = value as Trackable; + } + public String Identifier => "trackable_dict_wrapper"; + public int Version => 1; + public int MinConsumerVersion => 1; + public int MinProducerVersion => 1; + public Trackable FromProto(SavedUserObject proto) + { + return new DictWrapper(new Dictionary()); } - public static Trackable wrap_or_unwrap(IEnumerable value) + public Trackable this[object key] { - return new ListWrapper(value.ToList()); + get + { + return _storage[key]; + } + set + { + _check_self_external_modification(); + _maybe_initialize_trackable(); + bool no_dep = value is NoDependency; + if(key is string) + { + value = _track_value(value, key); + } + else + { + value = (Trackable)wrap_or_unwrap(value); + if(!no_dep && value is Trackable) + { + _non_string_key = true; + } + } + _storage[key] = value; + _update_snapshot(); + } } - protected static Trackable sticky_attribute_assignment(Trackable trackable, string name, Trackable value) + public ICollection Keys => _storage.Keys; + + public override ICollection Values => _storage.OrderBy(x => x.Key).Select(x => x.Value).ToArray(); + + public void Add(object key, Trackable value) { - value = wrap_or_unwrap(value); - trackable._track_trackable(value, name, true); - return value; + _storage[key] = value; } - protected static Trackable sticky_attribute_assignment(Trackable trackable, string name, NoDependency value) + public bool ContainsKey(object key) { - var wrapped_value = wrap_or_unwrap(value); - trackable._track_trackable(wrapped_value, name, true); - return wrapped_value; + return _storage.ContainsKey(key); } - protected static Trackable sticky_attribute_assignment(Trackable trackable, string name, IList value) + public bool Remove(object key) { - var wrapped_value = wrap_or_unwrap(value); - trackable._track_trackable(wrapped_value, name, true); - return wrapped_value; + _check_self_external_modification(); + var res = _storage.Remove(key); + _update_snapshot(); + return res; } - } - public class ListWrapper : TrackableDataStructure, IList, ICloneable + public bool TryGetValue(object key, out Trackable value) + { + return _storage.TryGetValue(key, out value); + } + + public int Count => _storage.Count; + + public bool IsReadOnly => _storage.IsReadOnly; + + public void Add(KeyValuePair item) + { + Add(item.Key, item.Value); + } + + public void Clear() + { + _storage.Clear(); + _update_snapshot(); + } + + public bool Contains(KeyValuePair item) + { + return _storage.Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int arrayIndex) + { + _storage.CopyTo(array, arrayIndex); + } + + public bool Remove(KeyValuePair item) + { + _check_self_external_modification(); + var res = Remove(item); + _update_snapshot(); + return res; + } + + public IEnumerator> GetEnumerator() + { + return _storage.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() => _storage.GetEnumerator(); + + public object Clone() + { + var copied = new DictWrapper(_storage); + copied._external_modification = _external_modification; + copied._non_string_key = _non_string_key; + return copied; + } + + public override IDictionary _trackable_children(SaveType save_type = SaveType.CHECKPOINT, IDictionary>? cache = null) + { + _check_self_external_modification(); + if (_non_string_key) + { + throw new ValueError($"Unable to save the object {this} (a dictionary wrapper constructed \"" + + $"automatically on attribute assignment). The wrapped dictionary " + + $"contains a non-string key which maps to a trackable object or " + + $"mutable data structure.\n\nIf you don't need this dictionary " + + $"checkpointed, wrap it in a non-trackable " + + $"object; it will be subsequently ignored."); + } + if (_external_modification) + { + throw new ValueError($"Unable to save the object {this} (a dictionary wrapper constructed " + + $"automatically on attribute assignment). The wrapped dictionary was " + + $"modified outside the wrapper (its final value was {this}, its value" + + $" when a checkpoint dependency was added was " + + $"{this._last_wrapped_dict_snapshot}), which breaks " + + $"restoration on object creation.\n\nIf you don't need this " + + $"dictionary checkpointed, wrap it in a " + + $"non-trackable object; it will be subsequently ignored."); + } + Debug.Assert(!Dirty); + var children = base._trackable_children(save_type, cache); + + if(save_type == SaveType.SAVEDMODEL) + { + foreach(var item in _storage) + { + var key = item.Key; + var value = item.Value; + if (TrackableWrapperUtils.is_function(value)) + { + Debug.Assert(key is string); + children[key as string] = value; + } + } + } + + return children; + } + + protected Trackable _track_value(Trackable value, object name) + { + bool string_key = name is string; + if (!string_key) + { + name = "-non_string_key"; + } + try + { + bool no_dependency = value is NoDependency; + value = base._track_value(value, name as string); + if(!(string_key || no_dependency)) + { + _non_string_key = true; + } + return value; + } + catch (ValueError) + { + return (Trackable)sticky_attribute_assignment(this, name as string, value); + } + } + + private bool Dirty => _external_modification || _non_string_key; + + private void _check_self_external_modification() + { + if (Dirty) + { + return; + } + if(!this._storage.SequenceEqual(_last_wrapped_dict_snapshot)) + { + _external_modification = true; + _last_wrapped_dict_snapshot = null; + } + } + + private void _update_snapshot() + { + // TODO(Rinne): deal with attribute_sentinel. + if (Dirty) return; + _last_wrapped_dict_snapshot = new Dictionary(_storage); + } + } + public class ListWrapper : TrackableDataStructure, IList, ICloneable, ITrackableWrapper { private IList _storage; private bool _non_append_mutation_value; @@ -198,11 +471,51 @@ public class ListWrapper : TrackableDataStructure, IList, ICloneable /// modified directly after constructing the `ListWrapper`, and if changes are detected the `ListWrapper` will throw an exception on save. public ListWrapper(IList wrapped_list) { - _storage = wrapped_list; + _storage = new List(wrapped_list); _non_append_mutation_value = _external_modification_value = false; _last_wrapped_list_snapshot = new List(_storage); } + public string Identifier => "trackable_list_wrapper"; + public int Version => 1; + public int MinConsumerVersion => 1; + public int MinProducerVersion => 1; + public Trackable FromProto(SavedUserObject proto) + { + if(TrackableWrapperUtils.ShouldLoad(this, proto)) + { + return new ListWrapper(new Trackable[] { }); + } + else + { + return null; + } + } + public void SetValue(object name, object value) + { + Debug.Assert(name is string); + if(int.TryParse(name as string, out var index)) + { + if(value is not Trackable trackable) + { + throw new TypeError("Cannot set an object which is not trackable to ListWrapper."); + } + if(Count <= index) + { + Add(trackable); + } + else + { + this[index] = trackable; + } + } + else + { + throw new NotImplementedException("Encounter an unexpected behavior in , please " + + "submit an issue to https://github.com/SciSharp/TensorFlow.NET/issues"); + } + } + protected bool NonAppendMuation { get => _non_append_mutation_value; set @@ -222,7 +535,7 @@ protected bool ExternalModification } } - public override IEnumerable Values => this; + public override ICollection Values => this; public bool IsReadOnly { get => _storage.IsReadOnly; } /// @@ -239,7 +552,7 @@ private void check_external_modification() private void update_snapshot() { - // TODO: deal with `attribute_sentinel`. + // TODO(Rinne): deal with `attribute_sentinel`. if (_external_modification_value || _non_append_mutation_value) return; _last_wrapped_list_snapshot = new List(_storage); } @@ -263,7 +576,7 @@ public override IDictionary _trackable_children(SaveType save if(save_type == SaveType.SAVEDMODEL) { - children = children.Concat(this.TakeWhile(x => x is Function or ConcreteFunction).Select((x, idx) => new KeyValuePair(idx.ToString(), x))).ToDictionary(x => x.Key, x => x.Value); + children = children.Concat(this.Where(x => x is Function or ConcreteFunction).Select((x, idx) => new KeyValuePair(idx.ToString(), x))).ToDictionary(x => x.Key, x => x.Value); } return children; @@ -286,9 +599,9 @@ protected override Trackable _track_value(Trackable value, string name) { base._track_value(value, name); } - catch(ValueError ex) + catch(ValueError) { - value = sticky_attribute_assignment(this, name, value); + value = (Trackable)sticky_attribute_assignment(this, name, value); } return value; } @@ -343,7 +656,11 @@ public void Add(Trackable item) update_snapshot(); } - public void Clear() => _storage.Clear(); + public void Clear() + { + _storage.Clear(); + update_snapshot(); + } public bool Contains(Trackable item) => _storage.Contains(item); diff --git a/src/TensorFlowNET.Core/Util/ProtoUtils.cs b/src/TensorFlowNET.Core/Util/ProtoUtils.cs new file mode 100644 index 000000000..c1557da42 --- /dev/null +++ b/src/TensorFlowNET.Core/Util/ProtoUtils.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow.Util +{ + internal static class ProtoUtils + { + public static object GetSingleAttrValue(AttrValue value, AttrValue.ValueOneofCase valueCase) + { + return valueCase switch + { + AttrValue.ValueOneofCase.S => value.S.ToStringUtf8(), + AttrValue.ValueOneofCase.I => value.I, + AttrValue.ValueOneofCase.F => value.F, + AttrValue.ValueOneofCase.B => value.B, + AttrValue.ValueOneofCase.Type => value.Type, + AttrValue.ValueOneofCase.Shape => value.Shape, + AttrValue.ValueOneofCase.Tensor => value.Tensor, + AttrValue.ValueOneofCase.Func => value.Func, + }; + } + } +} diff --git a/src/TensorFlowNET.Core/Util/UnorderedMap.cs b/src/TensorFlowNET.Core/Util/UnorderedMap.cs index fa2b91fee..219a3c140 100644 --- a/src/TensorFlowNET.Core/Util/UnorderedMap.cs +++ b/src/TensorFlowNET.Core/Util/UnorderedMap.cs @@ -25,6 +25,19 @@ public class UnorderedMap : Dictionary } } + public Tv SetDefault(Tk key, Tv default_value) + { + if(TryGetValue(key, out var res)) + { + return res; + } + else + { + base[key] = default_value; + return base[key]; + } + } + public void push_back(Tk key, Tv value) => this[key] = value; diff --git a/src/TensorFlowNET.Core/Util/function_utils.cs b/src/TensorFlowNET.Core/Util/function_utils.cs new file mode 100644 index 000000000..d4ba44237 --- /dev/null +++ b/src/TensorFlowNET.Core/Util/function_utils.cs @@ -0,0 +1,23 @@ +using Google.Protobuf; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow.Util +{ + internal static class function_utils + { + private static ByteString _rewriter_config_optimizer_disabled; + public static ByteString get_disabled_rewriter_config() + { + if(_rewriter_config_optimizer_disabled is null) + { + var config = new ConfigProto(); + var rewriter_config = config.GraphOptions.RewriteOptions; + rewriter_config.DisableMetaOptimizer = true; + _rewriter_config_optimizer_disabled = config.ToByteString(); + } + return _rewriter_config_optimizer_disabled; + } + } +} diff --git a/src/TensorFlowNET.Core/Util/nest.py.cs b/src/TensorFlowNET.Core/Util/nest.py.cs index d04e6bff6..eb94f4d05 100644 --- a/src/TensorFlowNET.Core/Util/nest.py.cs +++ b/src/TensorFlowNET.Core/Util/nest.py.cs @@ -137,10 +137,12 @@ private static object _sequence_like(object instance, IEnumerable args) switch (instance) { case Hashtable hash: - var result = new Hashtable(); - foreach ((object key, object value) in zip(_sorted(hash), args)) - result[key] = value; - return result; + { + var result = new Hashtable(); + foreach ((object key, object value) in zip(_sorted(hash), args)) + result[key] = value; + return result; + } } } //else if( _is_namedtuple(instance) || _is_attrs(instance)) @@ -221,6 +223,16 @@ public static List flatten(T structure) return list; } + public static List flatten(IEnumerable structure) + { + var list = new List(); + foreach(var item in structure) + { + _flatten_recursive(item, list); + } + return list; + } + public static object[] flatten2(ICanBeFlattened structure) => structure.Flatten(); @@ -519,6 +531,22 @@ public static Tensor map_structure(Func func, T structure) return pack_sequence_as(structure, mapped_flat_structure) as Tensor; } + public static T2 map_structure(Func func, T1 structure) where T2: class + { + var flat_structure = flatten(structure); + var mapped_flat_structure = flat_structure.Select(func).Select(x => (object)x); + + return pack_sequence_as(structure, mapped_flat_structure) as T2; + } + + public static IEnumerable map_structure(Func func, IEnumerable structure) where T2 : class + { + var flat_structure = flatten(structure); + var mapped_flat_structure = flat_structure.Select(func).Select(x => (object)x); + + return pack_sequence_as(structure, mapped_flat_structure) as IEnumerable; + } + /// /// Same as map_structure, but with only one structure (no combining of multiple structures) /// diff --git a/src/TensorFlowNET.Core/Util/variable_utils.cs b/src/TensorFlowNET.Core/Util/variable_utils.cs new file mode 100644 index 000000000..13237f9d4 --- /dev/null +++ b/src/TensorFlowNET.Core/Util/variable_utils.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Tensorflow.Framework; + +namespace Tensorflow.Util +{ + internal static class variable_utils + { + public static Tensor[] convert_variables_to_tensors(object[] values) + { + return values.Select(x => + { + if (resource_variable_ops.is_resource_variable(x)) + { + return ops.convert_to_tensor(x); + } + else if (x is CompositeTensor) + { + throw new NotImplementedException("The composite tensor has not been fully supported."); + } + else if(x is Tensor tensor) + { + return tensor; + } + else + { + throw new TypeError("Currently the output of function to be traced must be `Tensor`."); + } + }).ToArray(); + } + } +} diff --git a/src/TensorFlowNET.Core/Variables/BaseResourceVariable.cs b/src/TensorFlowNET.Core/Variables/BaseResourceVariable.cs index 9b8cfcb5f..b9a7022a2 100644 --- a/src/TensorFlowNET.Core/Variables/BaseResourceVariable.cs +++ b/src/TensorFlowNET.Core/Variables/BaseResourceVariable.cs @@ -8,6 +8,8 @@ using System.Diagnostics; using Tensorflow.Checkpoint; using Tensorflow.Training.Saving.SavedModel; +using OneOf; +using Tensorflow.Graphs; namespace Tensorflow { @@ -15,7 +17,14 @@ public class BaseResourceVariable : DisposableTrackableObject { protected string _name; public virtual string Name => _handle_name; - public virtual string SharedName => _name; + public virtual string SharedName + { + get + { + // TODO(Rinne): optimize the implementation with refactor of variable. + return _handle_name.Substring(0, _handle_name.IndexOf(':') + 1); + } + } protected TF_DataType _dtype; public TF_DataType dtype => _dtype; protected string _handle_name; @@ -64,6 +73,8 @@ public BaseResourceVariable() } public void __init__(bool trainable = true, + Shape shape = null, + TF_DataType dtype = TF_DataType.DtInvalid, Tensor handle = null, string name = null, string unique_id = null, @@ -74,6 +85,14 @@ public void __init__(bool trainable = true, _unique_id = unique_id; this.handle = handle; _name = name; + if(shape is not null) + { + _shape = shape; + } + if(dtype != TF_DataType.DtInvalid) + { + _dtype = dtype; + } // After the handle has been created, set up a way to clean it up when // executing eagerly. We'll hold the only reference to the deleter, so that @@ -83,7 +102,7 @@ public void __init__(bool trainable = true, if (handle is EagerTensor) { _handle = handle.EagerTensorHandle.DangerousGetHandle(); - eager_resource_deleter = new EagerResourceDeleter(handle, handle.Device); + // eager_resource_deleter = new EagerResourceDeleter(handle, handle.Device); } else if(handle is null) { @@ -155,7 +174,7 @@ protected Tensor _read_variable_op() { variable_accessed(this); var result = gen_resource_variable_ops.read_variable_op(handle, _dtype); - // _maybe_set_handle_data(_dtype, _handle, result); + resource_variable_ops._maybe_set_handle_data(_dtype, handle, result); // have to set shape when converting to substituent placeholder if (result.shape.ndim == -1) @@ -164,7 +183,7 @@ protected Tensor _read_variable_op() result._as_tf_output(), shape.dims, shape.ndim, - tf.Status.Handle); + tf.Status); tf.Status.Check(true); } @@ -182,6 +201,10 @@ IVariableV1 _lazy_read(Operation op, Tensor value) /// void variable_accessed(BaseResourceVariable variable) { + if(ops.get_default_graph() is FuncGraph func_graph) + { + func_graph.watch_variable(variable as IVariableV1); + } if (variable.Trainable) { foreach (var tape in tf.GetTapeSet()) @@ -266,9 +289,11 @@ public override (IDictionary, IDictionary) BaseResourceVariable new_variable; if (save_options.experimental_variable_policy.save_variable_devices()) { - tf.device(this.Device); Debug.Assert(this is ResourceVariable); - new_variable = resource_variable_ops.copy_to_graph_uninitialized((ResourceVariable)this); + new_variable = tf_with(ops.device(this.Device), _ => + { + return resource_variable_ops.copy_to_graph_uninitialized((ResourceVariable)this); + }); } else { @@ -293,9 +318,9 @@ public virtual void write_object_proto(SavedObject proto, SaveOptions options) resource_variable_ops.write_object_proto_for_resource_variable(this, proto, options); } - public override IDictionary>> gather_saveables_for_checkpoint() + public override IDictionary>> gather_saveables_for_checkpoint() { - var res = new Dictionary>>(); + var res = new Dictionary>>(); res[Trackable.Constants.VARIABLE_VALUE_KEY] = x => this; return res; } @@ -315,5 +340,23 @@ public Tensor read_value_no_copy() }); return array_ops.identity(value); } + + //public static Tensor operator +(BaseResourceVariable x, int y) => x.value() + y; + //public static Tensor operator +(BaseResourceVariable x, float y) => x.value() + y; + //public static Tensor operator +(BaseResourceVariable x, double y) => x.value() + y; + //public static Tensor operator +(BaseResourceVariable x, BaseResourceVariable y) => x.value() + y.value(); + //public static Tensor operator -(BaseResourceVariable x, int y) => x.value() - y; + //public static Tensor operator -(BaseResourceVariable x, float y) => x.value() - y; + //public static Tensor operator -(BaseResourceVariable x, double y) => x.value() - y; + //public static Tensor operator -(BaseResourceVariable x, Tensor y) => x.value() - y; + //public static Tensor operator -(BaseResourceVariable x, BaseResourceVariable y) => x.value() - y.value(); + + //public static Tensor operator *(BaseResourceVariable x, BaseResourceVariable y) => x.value() * y.value(); + //public static Tensor operator *(BaseResourceVariable x, Tensor y) => x.value() * y; + //public static Tensor operator *(BaseResourceVariable x, NDArray y) => x.value() * y; + + //public static Tensor operator <(BaseResourceVariable x, Tensor y) => x.value() < y; + + //public static Tensor operator >(BaseResourceVariable x, Tensor y) => x.value() > y; } } diff --git a/src/TensorFlowNET.Core/Variables/EagerResourceDeleter.cs b/src/TensorFlowNET.Core/Variables/EagerResourceDeleter.cs index 8f3685cc6..77bf471b0 100644 --- a/src/TensorFlowNET.Core/Variables/EagerResourceDeleter.cs +++ b/src/TensorFlowNET.Core/Variables/EagerResourceDeleter.cs @@ -14,9 +14,6 @@ public EagerResourceDeleter(Tensor handle, string handle_device) _tensor = handle; _handle = handle.EagerTensorHandle.DangerousGetHandle(); _handle_device = handle_device; - - bool success = false; - handle.EagerTensorHandle.DangerousAddRef(ref success); } protected override void DisposeUnmanagedResources(IntPtr handle) @@ -27,8 +24,6 @@ protected override void DisposeUnmanagedResources(IntPtr handle) tf.Runner.TFE_Execute(tf.Context, _handle_device, "DestroyResourceOp", new[] { _tensor }, new object[] { "ignore_lookup_error", true }, 0); - - _tensor.EagerTensorHandle.DangerousRelease(); } } } diff --git a/src/TensorFlowNET.Core/Variables/ResourceVariable.Operators.cs b/src/TensorFlowNET.Core/Variables/ResourceVariable.Operators.cs index 29d6106b5..2737a2191 100644 --- a/src/TensorFlowNET.Core/Variables/ResourceVariable.Operators.cs +++ b/src/TensorFlowNET.Core/Variables/ResourceVariable.Operators.cs @@ -1,19 +1,6 @@ -/***************************************************************************** - Copyright 2018 The TensorFlow.NET Authors. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -******************************************************************************/ - +using System; +using System.Collections.Generic; +using System.Text; using Tensorflow.NumPy; namespace Tensorflow diff --git a/src/TensorFlowNET.Core/Variables/ResourceVariable.cs b/src/TensorFlowNET.Core/Variables/ResourceVariable.cs index 3b1f1e968..bc23df3ed 100644 --- a/src/TensorFlowNET.Core/Variables/ResourceVariable.cs +++ b/src/TensorFlowNET.Core/Variables/ResourceVariable.cs @@ -97,7 +97,7 @@ private void _init_from_args(object initial_value = null, else { unique_id = $"{handle_name}_{ops.uid()}"; - shared_name = tf.Context.shared_name(); + shared_name = null; } var attr = new AttrValue(); @@ -116,24 +116,43 @@ private void _init_from_args(object initial_value = null, } }); - _shape = shape ?? _initial_value.shape; + if(shape is null) + { + shape = _initial_value.shape; + } + dtype = _initial_value.dtype; if (_in_graph_mode) { + // TODO(Rinne): deal with initializer_op. + //if(initial_value is not null) + //{ + // tf_with(ops.name_scope("Assign"), n => + // { + // tf_with(ops.device(handle.Device), _ => + // { + + // }); + // }); + //} handle = state_ops.variable_op_v2(_initial_value.shape, _initial_value.dtype.as_base_dtype(), name: name); initializer_op = gen_state_ops.assign(handle, _initial_value, true).op; ops.colocate_with(initializer_op); - - _graph_element = gen_array_ops.identity(handle, name = "read"); - ops.add_to_collections(collections, this); - _dtype = handle.dtype; + tf_with(ops.device(handle.Device), _ => + { + var value = gen_resource_variable_ops.read_variable_op(handle, dtype); + resource_variable_ops._maybe_set_handle_data(dtype, handle, value); + _graph_element = gen_array_ops.identity(handle, name = "read"); + ops.add_to_collections(collections, this); + _dtype = handle.dtype; + }); } else { handle = resource_variable_ops.eager_safe_variable_handle( initial_value: _initial_value, - shape: _shape, + shape: shape, shared_name: shared_name, name: name, graph_mode: _in_graph_mode); @@ -141,11 +160,21 @@ private void _init_from_args(object initial_value = null, gen_resource_variable_ops.assign_variable_op(handle, _initial_value); initializer_op = null; _graph_element = null; + if (!string.IsNullOrEmpty(caching_device)) + { + tf_with(ops.device(caching_device), _ => + { + var value = gen_resource_variable_ops.read_variable_op(handle, dtype); + resource_variable_ops._maybe_set_handle_data(dtype, handle, value); + }); + } _dtype = _initial_value.dtype.as_base_dtype(); // initial_value = _in_graph_mode ? initial_value : null; } base.__init__(trainable: trainable, + shape: shape, + dtype: _dtype, handle: handle, name: name, unique_id: unique_id, diff --git a/src/TensorFlowNET.Core/Variables/UninitializedVariable.cs b/src/TensorFlowNET.Core/Variables/UninitializedVariable.cs index 6c0349950..e26312447 100644 --- a/src/TensorFlowNET.Core/Variables/UninitializedVariable.cs +++ b/src/TensorFlowNET.Core/Variables/UninitializedVariable.cs @@ -9,7 +9,7 @@ namespace Tensorflow.Variables /// /// A variable with no initializer. /// - public sealed class UninitializedVariable: BaseResourceVariable + public sealed class UninitializedVariable : BaseResourceVariable, IVariableV1 { // TODO: complete the arg list. public UninitializedVariable( @@ -19,10 +19,11 @@ public UninitializedVariable( TF_DataType dtype = TF_DataType.DtInvalid, VariableAggregation aggregation = VariableAggregation.None, Shape shape = null, - Tensor extra_handle_data = null) + Tensor extra_handle_data = null) { string unique_id = ""; string handle_name = ""; + Tensor created_handle = null; tf_with(ops.init_scope(), (x) => { _in_graph_mode = !tf.Context.executing_eagerly(); @@ -40,7 +41,7 @@ public UninitializedVariable( unique_id = $"{handle_name}-{ops.uid()}"; shared_name = null; } - var handle = resource_variable_ops.variable_handle_from_shape_and_dtype( + created_handle = resource_variable_ops.variable_handle_from_shape_and_dtype( shape, dtype, shared_name, name, _in_graph_mode, extra_handle_data); // skip the assignment of `handle._parent_trackable` because of lack of API. // skip the assignment of `handle._name` and `handle._unique_id` because of accessability. @@ -49,9 +50,12 @@ public UninitializedVariable( { tf_with(ops.name_scope("Read"), _ => { - tf.device(handle.Device); - var value = gen_resource_variable_ops.read_variable_op(handle, dtype); - // _maybe_set_handle_data(dtype, handle, value) + var value = tf_with(ops.device(created_handle.Device), _ => + { + var result = gen_resource_variable_ops.read_variable_op(created_handle, dtype); + resource_variable_ops._maybe_set_handle_data(dtype, created_handle, result); + return result; + }); _graph_element = value; }); ops.add_to_collection(ops.GraphKeys.GLOBAL_VARIABLES_, this); @@ -62,9 +66,7 @@ public UninitializedVariable( } }); }); - _shape = shape; - _dtype = dtype; - base.__init__(trainable, handle, unique_id: unique_id, handle_name: handle_name); + base.__init__(trainable, shape, dtype, created_handle, unique_id: unique_id, handle_name: handle_name); } } } diff --git a/src/TensorFlowNET.Core/ops.cs b/src/TensorFlowNET.Core/ops.cs index bf5ae7bee..6d1385ca4 100644 --- a/src/TensorFlowNET.Core/ops.cs +++ b/src/TensorFlowNET.Core/ops.cs @@ -26,6 +26,7 @@ limitations under the License. using Tensorflow.Graphs; using Tensorflow.Util; using static Tensorflow.Binding; +using static Tensorflow.CppShapeInferenceResult.Types; namespace Tensorflow { @@ -247,7 +248,7 @@ public static (IntPtr, OperationDescription) _create_c_op(Graph graph, NodeDef n foreach (var attr in node_def.Attr) { var bytes = attr.Value.ToByteArray(); - c_api.TF_SetAttrValueProto(op_desc, attr.Key, bytes, proto_len: bytes.Length, status: status.Handle); + c_api.TF_SetAttrValueProto(op_desc, attr.Key, bytes, proto_len: (ulong)bytes.Length, status: status); status.Check(true); } @@ -572,11 +573,34 @@ public static bool inside_function() return get_default_graph().building_function; } + public static HandleData get_resource_handle_data(Tensor graph_op) + { + var handle_data = c_api.TFC_GetHandleShapeAndType(graph_op.graph.c_graph, graph_op._as_tf_output()); + return HandleData.Parser.ParseFrom(tf.compat.as_bytes(c_api.StringPiece(handle_data))); + } + public static void dismantle_graph(Graph graph) { } + public static ITensorFlowObject device(string device_name) + { + if (tf.Context.executing_eagerly()) + { + return tf.Context.device(device_name); + } + //else if (ops.executing_eagerly_outside_functions()) + //{ + // throw new NotImplementedException(); + //} + else + { + return get_default_graph().device(device_name); + } + // TODO(Rinne): deal with `ops.executing_eagerly_outside_functions()`. + } + public class NullContextManager: IDisposable { public void Dispose() diff --git a/src/TensorFlowNET.Core/tensorflow.cs b/src/TensorFlowNET.Core/tensorflow.cs index 6e655a196..67530ddbd 100644 --- a/src/TensorFlowNET.Core/tensorflow.cs +++ b/src/TensorFlowNET.Core/tensorflow.cs @@ -16,6 +16,7 @@ limitations under the License. using Serilog; using Serilog.Core; +using System.Reflection; using System.Threading; using Tensorflow.Contexts; using Tensorflow.Eager; @@ -52,7 +53,29 @@ public partial class tensorflow ThreadLocal _runner = new ThreadLocal(() => new EagerRunner()); public IEagerRunner Runner => _runner.Value; - public IKerasApi keras { get; set; } + private IKerasApi _keras; + public IKerasApi keras + { + get + { + if (_keras != null) + { + return _keras; + } + + var k = Assembly.Load("Tensorflow.Keras"); + var cls = k.GetTypes().FirstOrDefault(x => x.GetInterfaces().Contains(typeof(IKerasApi))); + if (cls != null) + { + _keras = Activator.CreateInstance(cls) as IKerasApi; + return _keras; + } + else + { + throw new Exception("Can't find keras library."); + } + } + } public tensorflow() { @@ -65,14 +88,6 @@ public tensorflow() InitGradientEnvironment(); } - public void UseKeras() where T : IKerasApi, new() - { - if (keras == null) - { - keras = new T(); - } - } - public string VERSION => c_api.StringPiece(c_api.TF_Version()); private void InitGradientEnvironment() diff --git a/src/TensorFlowNET.Keras/Activations.cs b/src/TensorFlowNET.Keras/Activations.cs index 37bddac76..00de728f2 100644 --- a/src/TensorFlowNET.Keras/Activations.cs +++ b/src/TensorFlowNET.Keras/Activations.cs @@ -6,45 +6,61 @@ namespace Tensorflow.Keras { - public class Activations + public class Activations: IActivationsApi { private static Dictionary _nameActivationMap; - private static Dictionary _activationNameMap; - private static Activation _linear = (features, name) => features; - private static Activation _relu = (features, name) - => tf.Context.ExecuteOp("Relu", name, new ExecuteOpArgs(features)); - private static Activation _sigmoid = (features, name) - => tf.Context.ExecuteOp("Sigmoid", name, new ExecuteOpArgs(features)); - private static Activation _softmax = (features, name) - => tf.Context.ExecuteOp("Softmax", name, new ExecuteOpArgs(features)); - private static Activation _tanh = (features, name) - => tf.Context.ExecuteOp("Tanh", name, new ExecuteOpArgs(features)); - private static Activation _mish = (features, name) - => features * tf.math.tanh(tf.math.softplus(features)); + private static Activation _linear = new Activation() + { + Name = "linear", + ActivationFunction = (features, name) => features + }; + private static Activation _relu = new Activation() + { + Name = "relu", + ActivationFunction = (features, name) => tf.Context.ExecuteOp("Relu", name, new ExecuteOpArgs(features)) + }; + private static Activation _sigmoid = new Activation() + { + Name = "sigmoid", + ActivationFunction = (features, name) => tf.Context.ExecuteOp("Sigmoid", name, new ExecuteOpArgs(features)) + }; + private static Activation _softmax = new Activation() + { + Name = "softmax", + ActivationFunction = (features, name) => tf.Context.ExecuteOp("Softmax", name, new ExecuteOpArgs(features)) + }; + private static Activation _tanh = new Activation() + { + Name = "tanh", + ActivationFunction = (features, name) => tf.Context.ExecuteOp("Tanh", name, new ExecuteOpArgs(features)) + }; + private static Activation _mish = new Activation() + { + Name = "mish", + ActivationFunction = (features, name) => features * tf.math.tanh(tf.math.softplus(features)) + }; /// /// Register the name-activation mapping in this static class. /// /// /// - private static void RegisterActivation(string name, Activation activation) + private static void RegisterActivation(Activation activation) { - _nameActivationMap[name] = activation; - _activationNameMap[activation] = name; + _nameActivationMap[activation.Name] = activation; } static Activations() { _nameActivationMap = new Dictionary(); - _activationNameMap= new Dictionary(); - RegisterActivation("relu", _relu); - RegisterActivation("linear", _linear); - RegisterActivation("sigmoid", _sigmoid); - RegisterActivation("softmax", _softmax); - RegisterActivation("tanh", _tanh); - RegisterActivation("mish", _mish); + RegisterActivation(_relu); + RegisterActivation(_linear); + RegisterActivation(_sigmoid); + RegisterActivation(_softmax); + RegisterActivation(_tanh); + RegisterActivation(_mish); } public Activation Linear => _linear; @@ -59,7 +75,7 @@ static Activations() public Activation Mish => _mish; - public static Activation GetActivationByName(string name) + public Activation GetActivationFromName(string name) { if (!_nameActivationMap.TryGetValue(name, out var res)) { @@ -70,17 +86,5 @@ public static Activation GetActivationByName(string name) return res; } } - - public static string GetNameByActivation(Activation activation) - { - if(!_activationNameMap.TryGetValue(activation, out var name)) - { - throw new Exception($"Activation {activation} not found"); - } - else - { - return name; - } - } } } diff --git a/src/TensorFlowNET.Keras/BackendImpl.cs b/src/TensorFlowNET.Keras/BackendImpl.cs index 01aa59b9a..80403ad6a 100644 --- a/src/TensorFlowNET.Keras/BackendImpl.cs +++ b/src/TensorFlowNET.Keras/BackendImpl.cs @@ -60,7 +60,15 @@ public BackendImpl() public void track_variable(IVariableV1 v) { + if (tf.Context.executing_eagerly()) + { + return; + } var graph = v.Graph; + if(graph is null) + { + graph = get_graph(); + } _GRAPH_VARIABLES[graph.graph_key] = v; } @@ -161,6 +169,12 @@ public void set_learning_phase(bool value) _GRAPH_LEARNING_PHASES[tf.get_default_graph()] = (GraphLearningPhase)((value) ? 1 : 0); } + public void set_value(IVariableV1 x, object value) + { + // TODO(Rinne): check the implementation. + x.assign(value); + } + public void batch_set_value(List<(IVariableV1, NDArray)> tuples) { if (ops.executing_eagerly_outside_functions()) diff --git a/src/TensorFlowNET.Keras/Callbacks/CallbackList.cs b/src/TensorFlowNET.Keras/Callbacks/CallbackList.cs index 54e3780a7..362f2280c 100644 --- a/src/TensorFlowNET.Keras/Callbacks/CallbackList.cs +++ b/src/TensorFlowNET.Keras/Callbacks/CallbackList.cs @@ -1,63 +1,76 @@ using System; using System.Collections.Generic; using System.Text; +using Tensorflow.Keras.Engine; -namespace Tensorflow.Keras.Callbacks +namespace Tensorflow.Keras.Callbacks; + +public class CallbackList { - public class CallbackList - { - List callbacks = new List(); - public History History => callbacks[0] as History; - - public CallbackList(CallbackParams parameters) - { - callbacks.Add(new History(parameters)); - callbacks.Add(new ProgbarLogger(parameters)); - } - - public void on_train_begin() - { - callbacks.ForEach(x => x.on_train_begin()); - } - - public void on_epoch_begin(int epoch) - { - callbacks.ForEach(x => x.on_epoch_begin(epoch)); - } - - public void on_train_batch_begin(long step) - { - callbacks.ForEach(x => x.on_train_batch_begin(step)); - } - - public void on_train_batch_end(long end_step, Dictionary logs) - { - callbacks.ForEach(x => x.on_train_batch_end(end_step, logs)); - } - - public void on_epoch_end(int epoch, Dictionary epoch_logs) - { - callbacks.ForEach(x => x.on_epoch_end(epoch, epoch_logs)); - } - - public void on_predict_begin() - { - callbacks.ForEach(x => x.on_predict_begin()); - } - - public void on_predict_batch_begin(long step) - { - callbacks.ForEach(x => x.on_predict_batch_begin(step)); - } - - public void on_predict_batch_end(long end_step, Dictionary logs) - { - callbacks.ForEach(x => x.on_predict_batch_end(end_step, logs)); - } - - public void on_predict_end() - { - callbacks.ForEach(x => x.on_predict_end()); - } + // 改成public使得新定义的callback可以加入到callbacks里 + public List callbacks = new List(); + public History History => callbacks[0] as History; + + public CallbackList(CallbackParams parameters) + { + callbacks.Add(new History(parameters)); + callbacks.Add(new ProgbarLogger(parameters)); + } + + public void on_train_begin() + { + callbacks.ForEach(x => x.on_train_begin()); + } + public void on_test_begin() + { + callbacks.ForEach(x => x.on_test_begin()); + } + public void on_epoch_begin(int epoch) + { + callbacks.ForEach(x => x.on_epoch_begin(epoch)); + } + + public void on_train_batch_begin(long step) + { + callbacks.ForEach(x => x.on_train_batch_begin(step)); + } + + public void on_train_batch_end(long end_step, Dictionary logs) + { + callbacks.ForEach(x => x.on_train_batch_end(end_step, logs)); + } + + public void on_epoch_end(int epoch, Dictionary epoch_logs) + { + callbacks.ForEach(x => x.on_epoch_end(epoch, epoch_logs)); + } + + public void on_predict_begin() + { + callbacks.ForEach(x => x.on_predict_begin()); + } + + public void on_predict_batch_begin(long step) + { + callbacks.ForEach(x => x.on_predict_batch_begin(step)); + } + + public void on_predict_batch_end(long end_step, Dictionary logs) + { + callbacks.ForEach(x => x.on_predict_batch_end(end_step, logs)); + } + + public void on_predict_end() + { + callbacks.ForEach(x => x.on_predict_end()); + } + + public void on_test_batch_begin(long step) + { + callbacks.ForEach(x => x.on_test_batch_begin(step)); + } + public void on_test_batch_end(long end_step, Dictionary logs) + { + callbacks.ForEach(x => x.on_test_batch_end(end_step, logs)); } } diff --git a/src/TensorFlowNET.Keras/Callbacks/Earlystopping.cs b/src/TensorFlowNET.Keras/Callbacks/Earlystopping.cs new file mode 100644 index 000000000..73ccc87b0 --- /dev/null +++ b/src/TensorFlowNET.Keras/Callbacks/Earlystopping.cs @@ -0,0 +1,153 @@ +using Tensorflow.Keras.Engine; +namespace Tensorflow.Keras.Callbacks; + + +/// +/// Stop training when a monitored metric has stopped improving. +/// +/// +/// + +public class EarlyStopping: ICallback +{ + int _paitence; + int _min_delta; + int _verbose; + int _stopped_epoch; + int _wait; + int _best_epoch; + int _start_from_epoch; + float _best; + float _baseline; + string _monitor; + string _mode; + bool _restore_best_weights; + List? _best_weights; + CallbackParams _parameters; + public Dictionary>? history { get; set; } + // user need to pass a CallbackParams to EarlyStopping, CallbackParams at least need the model + public EarlyStopping(CallbackParams parameters,string monitor = "val_loss", int min_delta = 0, int patience = 0, + int verbose = 1, string mode = "auto", float baseline = 0f, bool restore_best_weights = false, + int start_from_epoch = 0) + { + _parameters = parameters; + _stopped_epoch = 0; + _wait = 0; + _monitor = monitor; + _paitence = patience; + _verbose = verbose; + _baseline = baseline; + _start_from_epoch = start_from_epoch; + _min_delta = Math.Abs(min_delta); + _restore_best_weights = restore_best_weights; + _mode = mode; + if (mode != "auto" && mode != "min" && mode != "max") + { + Console.WriteLine("EarlyStopping mode %s is unknown, fallback to auto mode.", mode); + } + } + public void on_train_begin() + { + _wait = 0; + _stopped_epoch = 0; + _best_epoch = 0; + _best = (float)np.Inf; + } + + public void on_epoch_begin(int epoch) + { + + } + + public void on_train_batch_begin(long step) + { + + } + + public void on_train_batch_end(long end_step, Dictionary logs) + { + } + + public void on_epoch_end(int epoch, Dictionary epoch_logs) + { + var current = get_monitor_value(epoch_logs); + // If no monitor value exists or still in initial warm-up stage. + if (current == 0f || epoch < _start_from_epoch) + return; + // Restore the weights after first epoch if no progress is ever made. + if (_restore_best_weights && _best_weights == null) + { + _best_weights = _parameters.Model.Weights; + } + _wait += 1; + + if (_is_improvement(current, _best)) + { + _best = current; + _best_epoch = epoch; + if (_restore_best_weights) + _best_weights = _parameters.Model.TrainableWeights; + // Only restart wait if we beat both the baseline and our previous best. + if (_baseline == 0f || _is_improvement(current, _baseline)) + _wait = 0; + } + // Only check after the first epoch. + if (_wait >= _paitence && epoch > 0) + { + _stopped_epoch = epoch; + _parameters.Model.Stop_training = true; + if (_restore_best_weights && _best_weights != null) + { + if (_verbose > 0) + { + Console.WriteLine($"Restoring model weights from the end of the best epoch: {_best_epoch + 1}"); + } + _parameters.Model.Weights = _best_weights; + } + } + } + public void on_train_end() + { + if (_stopped_epoch > 0 && _verbose > 0) + { + Console.WriteLine($"Epoch {_stopped_epoch + 1}: early stopping"); + } + } + public void on_predict_begin() { } + public void on_predict_batch_begin(long step) { } + public void on_predict_batch_end(long end_step, Dictionary logs) { } + public void on_predict_end() { } + public void on_test_begin() { } + public void on_test_batch_begin(long step) { } + public void on_test_batch_end(long end_step, Dictionary logs) { } + + float get_monitor_value(Dictionary logs) + { + logs = logs ?? new Dictionary(); + float monitor_value = logs[_monitor]; + if (monitor_value == 0f) + { + Console.WriteLine($"Early stopping conditioned on metric {_monitor} " + + $"which is not available. Available metrics are: {string.Join(", ", logs.Keys)}"); + } + return monitor_value; + } + public bool _is_improvement(float monitor_value, float reference_value) + { + bool less_op = (monitor_value - _min_delta) < reference_value; + bool greater_op = (monitor_value - _min_delta) >= reference_value; + if (_mode == "min") + return less_op; + else if (_mode == "max") + return greater_op; + else + { + if (_monitor.EndsWith("acc") || _monitor.EndsWith("accuracy") || _monitor.EndsWith("auc")) + { + return greater_op; + } + else + return less_op; + } + } +} diff --git a/src/TensorFlowNET.Keras/Callbacks/History.cs b/src/TensorFlowNET.Keras/Callbacks/History.cs index 89e1834bc..c34f253d1 100644 --- a/src/TensorFlowNET.Keras/Callbacks/History.cs +++ b/src/TensorFlowNET.Keras/Callbacks/History.cs @@ -1,73 +1,84 @@ -using System; -using System.Collections.Generic; -using System.Text; +using Tensorflow.Keras.Engine; -namespace Tensorflow.Keras.Callbacks +namespace Tensorflow.Keras.Callbacks; + +public class History : ICallback { - public class History : ICallback + List epochs; + CallbackParams _parameters; + public Dictionary> history { get; set; } + + public History(CallbackParams parameters) { - List epochs; - CallbackParams _parameters; - public Dictionary> history { get; set; } + _parameters = parameters; + } - public History(CallbackParams parameters) - { - _parameters = parameters; - } + public void on_train_begin() + { + epochs = new List(); + history = new Dictionary>(); + } + public void on_test_begin() + { + epochs = new List(); + history = new Dictionary>(); + } + public void on_train_end() { } + public void on_epoch_begin(int epoch) + { - public void on_train_begin() - { - epochs = new List(); - history = new Dictionary>(); - } + } - public void on_epoch_begin(int epoch) - { + public void on_train_batch_begin(long step) + { - } + } - public void on_train_batch_begin(long step) - { - - } + public void on_train_batch_end(long end_step, Dictionary logs) + { + } - public void on_train_batch_end(long end_step, Dictionary logs) - { - } + public void on_epoch_end(int epoch, Dictionary epoch_logs) + { + epochs.Add(epoch); - public void on_epoch_end(int epoch, Dictionary epoch_logs) + foreach (var log in epoch_logs) { - epochs.Add(epoch); - - foreach (var log in epoch_logs) + if (!history.ContainsKey(log.Key)) { - if (!history.ContainsKey(log.Key)) - { - history[log.Key] = new List(); - } - history[log.Key].Add((float)log.Value); + history[log.Key] = new List(); } + history[log.Key].Add(log.Value); } + } - public void on_predict_begin() - { - epochs = new List(); - history = new Dictionary>(); - } + public void on_predict_begin() + { + epochs = new List(); + history = new Dictionary>(); + } - public void on_predict_batch_begin(long step) - { - - } + public void on_predict_batch_begin(long step) + { - public void on_predict_batch_end(long end_step, Dictionary logs) - { - - } + } - public void on_predict_end() - { - - } + public void on_predict_batch_end(long end_step, Dictionary logs) + { + + } + + public void on_predict_end() + { + + } + + public void on_test_batch_begin(long step) + { + + } + + public void on_test_batch_end(long end_step, Dictionary logs) + { } } diff --git a/src/TensorFlowNET.Keras/Callbacks/ICallback.cs b/src/TensorFlowNET.Keras/Callbacks/ICallback.cs deleted file mode 100644 index 7d71ccace..000000000 --- a/src/TensorFlowNET.Keras/Callbacks/ICallback.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Tensorflow.Keras.Callbacks -{ - public interface ICallback - { - void on_train_begin(); - void on_epoch_begin(int epoch); - void on_train_batch_begin(long step); - void on_train_batch_end(long end_step, Dictionary logs); - void on_epoch_end(int epoch, Dictionary epoch_logs); - void on_predict_begin(); - void on_predict_batch_begin(long step); - void on_predict_batch_end(long end_step, Dictionary logs); - void on_predict_end(); - } -} diff --git a/src/TensorFlowNET.Keras/Callbacks/ProgbarLogger.cs b/src/TensorFlowNET.Keras/Callbacks/ProgbarLogger.cs index bb18b2cb3..9f2b1eb31 100644 --- a/src/TensorFlowNET.Keras/Callbacks/ProgbarLogger.cs +++ b/src/TensorFlowNET.Keras/Callbacks/ProgbarLogger.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; +using System.Diagnostics; +using Tensorflow.Keras.Engine; namespace Tensorflow.Keras.Callbacks { @@ -13,6 +10,8 @@ public class ProgbarLogger : ICallback CallbackParams _parameters; Stopwatch _sw; + public Dictionary> history { get; set; } + public ProgbarLogger(CallbackParams parameters) { _parameters = parameters; @@ -23,7 +22,11 @@ public void on_train_begin() _called_in_fit = true; _sw = new Stopwatch(); } - + public void on_train_end() { } + public void on_test_begin() + { + _sw = new Stopwatch(); + } public void on_epoch_begin(int epoch) { _reset_progbar(); @@ -45,7 +48,7 @@ public void on_train_batch_end(long end_step, Dictionary logs) var progress = ""; var length = 30.0 / _parameters.Steps; for (int i = 0; i < Math.Floor(end_step * length - 1); i++) - progress += "="; + progress += "="; if (progress.Length < 28) progress += ">"; else @@ -85,17 +88,35 @@ public void on_predict_begin() public void on_predict_batch_begin(long step) { - + } public void on_predict_batch_end(long end_step, Dictionary logs) { - + } public void on_predict_end() { - + } + + public void on_test_batch_begin(long step) + { + _sw.Restart(); + } + public void on_test_batch_end(long end_step, Dictionary logs) + { + _sw.Stop(); + var elapse = _sw.ElapsedMilliseconds; + var results = string.Join(" - ", logs.Select(x => $"{x.Key}: {x.Value:F6}")); + + Binding.tf_output_redirect.Write($"{end_step + 1:D4}/{_parameters.Steps:D4} - {elapse}ms/step - {results}"); + if (!Console.IsOutputRedirected) + { + Console.CursorLeft = 0; + } + } + } } diff --git a/src/TensorFlowNET.Keras/Engine/DataAdapters/DataAdapter.cs b/src/TensorFlowNET.Keras/Engine/DataAdapters/DataAdapter.cs index 3314f5c40..6c7d53b2f 100644 --- a/src/TensorFlowNET.Keras/Engine/DataAdapters/DataAdapter.cs +++ b/src/TensorFlowNET.Keras/Engine/DataAdapters/DataAdapter.cs @@ -10,7 +10,7 @@ public abstract class DataAdapter protected DataAdapterArgs args; protected IDatasetV2 dataset; - public virtual bool CanHandle(Tensor x, Tensor y = null) + public virtual bool CanHandle(Tensors x, Tensors y = null) => throw new NotImplementedException(); public virtual IDatasetV2 GetDataset() @@ -19,12 +19,18 @@ public virtual IDatasetV2 GetDataset() public virtual int GetSize() => throw new NotImplementedException(""); - public virtual (Tensor, Tensor) Expand1d(Tensor x, Tensor y) + public virtual (Tensors, Tensors) Expand1d(Tensors x, Tensors y) { - if (x.shape.ndim == 1) - x = array_ops.expand_dims(x, axis: -1); - if (y.shape.ndim == 1) - y = array_ops.expand_dims(y, axis: -1); + for(int i = 0; i < x.Length; i++) + { + if (x[i].shape.ndim == 1) + x[i] = array_ops.expand_dims(x[i], axis: -1); + } + for (int i = 0; i < y.Length; i++) + { + if (y[i].shape.ndim == 1) + y[i] = array_ops.expand_dims(y[i], axis: -1); + } return (x, y); } diff --git a/src/TensorFlowNET.Keras/Engine/DataAdapters/DataHandler.cs b/src/TensorFlowNET.Keras/Engine/DataAdapters/DataHandler.cs index 1ddddd111..4723222f2 100644 --- a/src/TensorFlowNET.Keras/Engine/DataAdapters/DataHandler.cs +++ b/src/TensorFlowNET.Keras/Engine/DataAdapters/DataHandler.cs @@ -93,11 +93,15 @@ long _infer_steps(int steps_per_epoch, IDatasetV2 dataset) public IEnumerable<(int, OwnedIterator)> enumerate_epochs() { + var data_iterator = new OwnedIterator(_dataset); foreach (var epoch in range(_initial_epoch, _epochs)) { if (_insufficient_data) break; - using var data_iterator = new OwnedIterator(_dataset); + if (_adapter.ShouldRecreateIterator()) + { + data_iterator = new OwnedIterator(_dataset); + } yield return (epoch, data_iterator); } // _adapter.on_epoch_end() diff --git a/src/TensorFlowNET.Keras/Engine/DataAdapters/IDataAdapter.cs b/src/TensorFlowNET.Keras/Engine/DataAdapters/IDataAdapter.cs index df414b9fd..4bdc49795 100644 --- a/src/TensorFlowNET.Keras/Engine/DataAdapters/IDataAdapter.cs +++ b/src/TensorFlowNET.Keras/Engine/DataAdapters/IDataAdapter.cs @@ -13,10 +13,10 @@ public interface IDataAdapter /// input features /// target labels /// - bool CanHandle(Tensor x, Tensor y = null); + bool CanHandle(Tensors x, Tensors y = null); IDatasetV2 GetDataset(); int GetSize(); - (Tensor, Tensor) Expand1d(Tensor x, Tensor y); + (Tensors, Tensors) Expand1d(Tensors x, Tensors y); bool ShouldRecreateIterator(); } } diff --git a/src/TensorFlowNET.Keras/Engine/DataAdapters/TensorLikeDataAdapter.cs b/src/TensorFlowNET.Keras/Engine/DataAdapters/TensorLikeDataAdapter.cs index fc61aa715..a7e1d7e34 100644 --- a/src/TensorFlowNET.Keras/Engine/DataAdapters/TensorLikeDataAdapter.cs +++ b/src/TensorFlowNET.Keras/Engine/DataAdapters/TensorLikeDataAdapter.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Linq; using Tensorflow.Keras.ArgsDefinition; using static Tensorflow.Binding; @@ -33,10 +34,11 @@ public TensorLikeDataAdapter(DataAdapterArgs args) indices_dataset = indices_dataset.flat_map(slice_batch_indices); var inputs = new Tensors(); if (args.X != null) - inputs.Add(args.X); + inputs.AddRange(args.X); if (args.Y != null) - inputs.Add(args.Y); + inputs.AddRange(args.Y); dataset = slice_inputs(indices_dataset, inputs); + dataset.FirstInputTensorCount = args.X.Length; } Tensors permutation(Tensors tensor) @@ -87,8 +89,9 @@ IDatasetV2 slice_inputs(IDatasetV2 indices_dataset, Tensors elements) return dataset.with_options(new DatasetOptions { }); } - public override int GetSize() - => _size; + public override int GetSize() => _size; + + public override bool ShouldRecreateIterator() => false; void _process_tensorlike() { diff --git a/src/TensorFlowNET.Keras/Engine/Functional.FromConfig.cs b/src/TensorFlowNET.Keras/Engine/Functional.FromConfig.cs index f4407265c..7b826af8e 100644 --- a/src/TensorFlowNET.Keras/Engine/Functional.FromConfig.cs +++ b/src/TensorFlowNET.Keras/Engine/Functional.FromConfig.cs @@ -11,7 +11,7 @@ namespace Tensorflow.Keras.Engine { public partial class Functional { - public static Functional from_config(ModelConfig config) + public static Functional from_config(FunctionalConfig config) { var (input_tensors, output_tensors, created_layers) = reconstruct_from_config(config); var model = new Functional(input_tensors, output_tensors, name: config.Name); @@ -24,7 +24,7 @@ public static Functional from_config(ModelConfig config) /// /// /// - public static (Tensors, Tensors, Dictionary) reconstruct_from_config(ModelConfig config, Dictionary? created_layers = null) + public static (Tensors, Tensors, Dictionary) reconstruct_from_config(FunctionalConfig config, Dictionary? created_layers = null) { // Layer instances created during the graph reconstruction process. created_layers = created_layers ?? new Dictionary(); diff --git a/src/TensorFlowNET.Keras/Engine/Functional.GetConfig.cs b/src/TensorFlowNET.Keras/Engine/Functional.GetConfig.cs index 3aeb3200d..df77e5969 100644 --- a/src/TensorFlowNET.Keras/Engine/Functional.GetConfig.cs +++ b/src/TensorFlowNET.Keras/Engine/Functional.GetConfig.cs @@ -19,9 +19,9 @@ public override IKerasConfig get_config() /// /// Builds the config, which consists of the node graph and serialized layers. /// - ModelConfig get_network_config() + FunctionalConfig get_network_config() { - var config = new ModelConfig + var config = new FunctionalConfig { Name = name }; diff --git a/src/TensorFlowNET.Keras/Engine/Functional.cs b/src/TensorFlowNET.Keras/Engine/Functional.cs index 33320101b..e768bd0bd 100644 --- a/src/TensorFlowNET.Keras/Engine/Functional.cs +++ b/src/TensorFlowNET.Keras/Engine/Functional.cs @@ -348,7 +348,7 @@ protected override Tensors Call(Tensors inputs, Tensor state = null, bool? train var layer_inputs = node.MapArguments(tensor_dict); tf.Logger.Debug($"Depth {depth}: {node.Layer}: {node.Layer.Name}"); - var outputs = node.Layer.Apply(layer_inputs, is_training: training ?? false); + var outputs = node.Layer.Apply(layer_inputs, training: training ?? false); foreach (var output in outputs.Where(x => x != null)) tf.Logger.Information($"Depth {depth}: {node.Layer}: {node.Layer.Name} {output.shape}"); // Update tensor_dict for next or later input diff --git a/src/TensorFlowNET.Keras/Engine/Layer.AddWeights.cs b/src/TensorFlowNET.Keras/Engine/Layer.AddWeights.cs index 703e7f23b..2925739bc 100644 --- a/src/TensorFlowNET.Keras/Engine/Layer.AddWeights.cs +++ b/src/TensorFlowNET.Keras/Engine/Layer.AddWeights.cs @@ -22,9 +22,9 @@ protected virtual IVariableV1 add_weight(string name, // If dtype is DT_FLOAT, provide a uniform unit scaling initializer if (dtype.is_floating()) initializer = tf.glorot_uniform_initializer; - else if (dtype.is_integer()) + else if (dtype.is_integer() || dtype.is_unsigned() || dtype.is_bool()) initializer = tf.zeros_initializer; - else + else if(getter is null) throw new ValueError($"An initializer for variable {name} of type {dtype.as_base_dtype()} is required for layer {name}"); } diff --git a/src/TensorFlowNET.Keras/Engine/Layer.cs b/src/TensorFlowNET.Keras/Engine/Layer.cs index 3934950bd..7462b1367 100644 --- a/src/TensorFlowNET.Keras/Engine/Layer.cs +++ b/src/TensorFlowNET.Keras/Engine/Layer.cs @@ -21,11 +21,18 @@ limitations under the License. using System.Threading; using Tensorflow.Eager; using Tensorflow.Keras.ArgsDefinition; +using Tensorflow.Keras.Metrics; using Tensorflow.Keras.Saving; using Tensorflow.Keras.Utils; using Tensorflow.NumPy; using Tensorflow.Train; +using Tensorflow.Training; +using Tensorflow.Training.Saving.SavedModel; +using Tensorflow.Util; using static Tensorflow.Binding; +using Tensorflow.Framework; +using Tensorflow.Sessions; + namespace Tensorflow.Keras.Engine { @@ -40,14 +47,24 @@ public abstract partial class Layer : AutoTrackable, ILayer /// /// Arguments initialize layer. /// - LayerArgs args; + internal LayerArgs args; /// /// Indicates whether `build` needs to be called upon layer call, to create /// the layer's weights. /// protected bool built; - public bool Built => built; + public bool Built + { + get + { + return built; + } + internal set + { + built = value; + } + } public bool Trainable => args.Trainable; public TF_DataType DType => args.DType; public bool AutoCast => args.Autocast; @@ -120,6 +137,62 @@ public virtual List Weights } } + public virtual void set_weights(IEnumerable weights) + { + if (Weights.Count() != weights.Count()) throw new ValueError( + $"You called `set_weights` on layer \"{this.name}\"" + + $"with a weight list of length {len(weights)}, but the layer was " + + $"expecting {len(Weights)} weights."); + + + + // check if the shapes are compatible + var weight_index = 0; + foreach(var w in weights) + { + if (!Weights[weight_index].AsTensor().is_compatible_with(w)) + { + throw new ValueError($"Layer weight shape {w.shape} not compatible with provided weight shape {Weights[weight_index].shape}"); + } + weight_index++; + } + + if (tf.executing_eagerly()) + { + foreach (var (this_w, v_w) in zip(Weights, weights)) + this_w.assign(v_w, read_value: true); + } + else + { + // TODO(Wanglongzhi2001):seems like there exist some bug in graph mode when define model, so uncomment the following when it fixed. + + //Tensors assign_ops = new Tensors(); + //var feed_dict = new FeedDict(); + + //Graph g = tf.Graph().as_default(); + //foreach (var (this_w, v_w) in zip(Weights, weights)) + //{ + // var tf_dtype = this_w.dtype; + // var placeholder_shape = v_w.shape; + // var assign_placeholder = tf.placeholder(tf_dtype, placeholder_shape); + // var assign_op = this_w.assign(assign_placeholder); + // assign_ops.Add(assign_op); + // feed_dict.Add(assign_placeholder, v_w); + //} + //var sess = tf.Session().as_default(); + //sess.run(assign_ops, feed_dict); + + //g.Exit(); + } + } + + public List get_weights() + { + List weights = new List(); + weights.AddRange(Weights.ConvertAll(x => x.numpy())); + return weights; + } + protected int id; public int Id => id; protected string name; @@ -138,16 +211,16 @@ public string Name protected bool computePreviousMask; protected List updates; - public Shape BatchInputShape => args.BatchInputShape; - protected TensorShapeConfig _buildInputShape = null; - public TensorShapeConfig BuildInputShape => _buildInputShape; + public KerasShapesWrapper BatchInputShape => args.BatchInputShape; + protected KerasShapesWrapper _buildInputShape = null; + public KerasShapesWrapper BuildInputShape => _buildInputShape; List inboundNodes; public List InboundNodes => inboundNodes; List outboundNodes; public List OutboundNodes => outboundNodes; - public JObject SerializedAttributes { get; set; } + public Dictionary SerializedAttributes { get; set; } ThreadLocal callContext = new ThreadLocal(); public CallContext CallContext => callContext.Value; @@ -176,6 +249,11 @@ public Shape OutputShape } protected List _self_tracked_trackables; + /// + /// If this value is set, the behavior of layer call will be changed to directly calling this function. + /// + public Func? ReplacedCall { get; set; } = null; + public Layer(LayerArgs args) { Initialize(args); @@ -206,7 +284,7 @@ internal virtual void Initialize(LayerArgs args) // Manage input shape information if passed. if (args.BatchInputShape == null && args.InputShape != null) { - args.BatchInputShape = new long[] { args.BatchSize }.Concat(args.InputShape.dims).ToArray(); + args.BatchInputShape = new KerasShapesWrapper(new long[] { args.BatchSize }.Concat(args.InputShape.dims).ToArray()); } } @@ -256,6 +334,10 @@ private Tensor compute_mask(Tensor inputs, Tensor mask = null) /// protected virtual Tensors Call(Tensors inputs, Tensor state = null, bool? training = null) { + if(ReplacedCall is not null) + { + return ReplacedCall(inputs); + } return inputs; } @@ -281,7 +363,7 @@ protected void MaybeBuild(Tensors inputs) tf.Context.eager_mode(isFunc: tf.Context.is_build_function()); } - build(inputs.shape); + build(new KerasShapesWrapper(inputs.shape)); if (need_restore_mode) tf.Context.restore_mode(); @@ -289,7 +371,7 @@ protected void MaybeBuild(Tensors inputs) built = true; } - public virtual void build(Shape input_shape) + public virtual void build(KerasShapesWrapper input_shape) { _buildInputShape = input_shape; built = true; @@ -344,5 +426,64 @@ public int count_params() public virtual IKerasConfig get_config() => args; + + public virtual void adapt(Tensor data, int? batch_size = null, int? steps = null) + { + + } + + public override void SetAttr(string name, object value) + { + // TODO(Rinne): deal with "_self_setattr_tracking". + + value = TrackableDataStructure.sticky_attribute_assignment(this, name, value); + + foreach(var val in nest.flatten(value)) + { + if(val is Metric) + { + // TODO(Rinne): deal with metrics. + } + } + + // TODO(Rinne): deal with "_auto_track_sub_layers". + + foreach(var val in nest.flatten(value)) + { + if(val is not IVariableV1 variable) + { + continue; + } + if (variable.Trainable) + { + if (_trainable_weights.Contains(variable)) + { + continue; + } + _trainable_weights.Add(variable); + } + else + { + if (_non_trainable_weights.Contains(variable)) + { + continue; + } + _non_trainable_weights.Add(variable); + } + keras.backend.track_variable(variable); + } + + // Directly use the implementation of `Trackable`. + var t = this.GetType(); + var field_info = t.GetField(name); + if (field_info is not null) + { + field_info.SetValue(this, value); + } + else + { + CustomizedFields[name] = value; + } + } } } diff --git a/src/TensorFlowNET.Keras/Engine/Model.Build.cs b/src/TensorFlowNET.Keras/Engine/Model.Build.cs index a51b94348..69afdef90 100644 --- a/src/TensorFlowNET.Keras/Engine/Model.Build.cs +++ b/src/TensorFlowNET.Keras/Engine/Model.Build.cs @@ -1,6 +1,8 @@ using System; using System.Linq; using Tensorflow.Graphs; +using Tensorflow.Keras.Saving; +using Tensorflow.Keras.Utils; using static Tensorflow.Binding; using static Tensorflow.KerasApi; @@ -8,22 +10,40 @@ namespace Tensorflow.Keras.Engine { public partial class Model { - public override void build(Shape input_shape) + public override void build(KerasShapesWrapper input_shape) { - if (this is Functional || this is Sequential) + if (_is_graph_network || this is Functional || this is Sequential) { base.build(input_shape); return; } - var graph = tf.executing_eagerly() ? new FuncGraph("build_graph") : keras.backend.get_graph(); - - graph.as_default(); - - var x = tf.placeholder(DType, input_shape); - Call(x, training: false); - - graph.Exit(); + if(input_shape is not null && this.inputs is null) + { + var graph = tf.executing_eagerly() ? new FuncGraph("build_graph") : keras.backend.get_graph(); + graph.as_default(); + var shapes = input_shape.ToShapeArray(); + var x = new Tensors(shapes.Select(x => base_layer_utils.generate_placeholders_from_shape(x))); + try + { + Call(x, training: false); + } + catch (InvalidArgumentError) + { + throw new ValueError("You cannot build your model by calling `build` " + + "if your layers do not support float type inputs. " + + "Instead, in order to instantiate and build your " + + "model, `call` your model on real tensor data (of the correct dtype)."); + } + catch (TypeError) + { + throw new ValueError("You cannot build your model by calling `build` " + + "if your layers do not support float type inputs. " + + "Instead, in order to instantiate and build your " + + "model, `call` your model on real tensor data (of the correct dtype)."); + } + graph.Exit(); + } base.build(input_shape); } diff --git a/src/TensorFlowNET.Keras/Engine/Model.Compile.cs b/src/TensorFlowNET.Keras/Engine/Model.Compile.cs index 3d99129b0..dabdccf9d 100644 --- a/src/TensorFlowNET.Keras/Engine/Model.Compile.cs +++ b/src/TensorFlowNET.Keras/Engine/Model.Compile.cs @@ -1,5 +1,4 @@ -using System; -using Tensorflow.Keras.ArgsDefinition; +using Tensorflow.Keras.ArgsDefinition; using Tensorflow.Keras.Losses; using Tensorflow.Keras.Metrics; using Tensorflow.Keras.Optimizers; @@ -11,9 +10,8 @@ public partial class Model LossesContainer compiled_loss; MetricsContainer compiled_metrics; - public void compile(OptimizerV2 optimizer = null, - ILossFunc loss = null, - string[] metrics = null) + public void compile(IOptimizer optimizer, + ILossFunc loss) { this.optimizer = optimizer ?? new RMSprop(new RMSpropArgs { @@ -21,8 +19,8 @@ public void compile(OptimizerV2 optimizer = null, this.loss = loss ?? new MeanSquaredError(); - compiled_loss = new LossesContainer(loss, output_names: output_names); - compiled_metrics = new MetricsContainer(metrics, output_names: output_names); + compiled_loss = new LossesContainer(this.loss, output_names: output_names); + compiled_metrics = new MetricsContainer(new string[0], output_names: output_names); int experimental_steps_per_execution = 1; _configure_steps_per_execution(experimental_steps_per_execution); @@ -32,9 +30,9 @@ public void compile(OptimizerV2 optimizer = null, _is_compiled = true; } - public void compile(OptimizerV2 optimizer = null, - ILossFunc loss = null, - IMetricFunc[] metrics = null) + public void compile(IOptimizer optimizer, + ILossFunc loss, + string[] metrics) { this.optimizer = optimizer ?? new RMSprop(new RMSpropArgs { @@ -42,7 +40,7 @@ public void compile(OptimizerV2 optimizer = null, this.loss = loss ?? new MeanSquaredError(); - compiled_loss = new LossesContainer(loss, output_names: output_names); + compiled_loss = new LossesContainer(this.loss, output_names: output_names); compiled_metrics = new MetricsContainer(metrics, output_names: output_names); int experimental_steps_per_execution = 1; @@ -53,25 +51,58 @@ public void compile(OptimizerV2 optimizer = null, _is_compiled = true; } - public void compile(string optimizer, string loss, string[] metrics) + public void compile(string optimizer, + string loss, + string[] metrics) { - var _optimizer = optimizer switch + this.optimizer = optimizer switch { "rmsprop" => new RMSprop(new RMSpropArgs { }), - _ => throw new NotImplementedException("") + _ => new RMSprop(new RMSpropArgs + { + }) }; - ILossFunc _loss = loss switch + this.loss = loss switch { "mse" => new MeanSquaredError(), "mae" => new MeanAbsoluteError(), - _ => throw new NotImplementedException("") + _ => new MeanSquaredError() }; - compile(optimizer: _optimizer, loss: _loss, metrics: metrics); + compiled_loss = new LossesContainer(this.loss, output_names: output_names); + compiled_metrics = new MetricsContainer(metrics, output_names: output_names); + + int experimental_steps_per_execution = 1; + _configure_steps_per_execution(experimental_steps_per_execution); + + // Initialize cache attrs. + _reset_compile_cache(); + _is_compiled = true; + } + + public void compile(IOptimizer optimizer, + ILossFunc loss, + IMetricFunc[] metrics) + { + this.optimizer = optimizer ?? new RMSprop(new RMSpropArgs + { + }); + + this.loss = loss ?? new MeanSquaredError(); + + compiled_loss = new LossesContainer(this.loss, output_names: output_names); + compiled_metrics = new MetricsContainer(metrics, output_names: output_names); + + int experimental_steps_per_execution = 1; + _configure_steps_per_execution(experimental_steps_per_execution); + + // Initialize cache attrs. + _reset_compile_cache(); + _is_compiled = true; } } } diff --git a/src/TensorFlowNET.Keras/Engine/Model.Evaluate.cs b/src/TensorFlowNET.Keras/Engine/Model.Evaluate.cs index c9d398339..185de4f48 100644 --- a/src/TensorFlowNET.Keras/Engine/Model.Evaluate.cs +++ b/src/TensorFlowNET.Keras/Engine/Model.Evaluate.cs @@ -5,6 +5,10 @@ using Tensorflow.Keras.ArgsDefinition; using Tensorflow.Keras.Engine.DataAdapters; using static Tensorflow.Binding; +using Tensorflow.Keras.Layers; +using Tensorflow.Keras.Utils; +using Tensorflow; +using Tensorflow.Keras.Callbacks; namespace Tensorflow.Keras.Engine { @@ -22,15 +26,23 @@ public partial class Model /// /// /// - public void evaluate(NDArray x, NDArray y, + /// + public Dictionary evaluate(NDArray x, NDArray y, int batch_size = -1, int verbose = 1, int steps = -1, int max_queue_size = 10, int workers = 1, bool use_multiprocessing = false, - bool return_dict = false) + bool return_dict = false, + bool is_val = false + ) { + if (x.dims[0] != y.dims[0]) + { + throw new InvalidArgumentError( + $"The array x and y should have same value at dim 0, but got {x.dims[0]} and {y.dims[0]}"); + } var data_handler = new DataHandler(new DataHandlerArgs { X = x, @@ -46,21 +58,84 @@ public void evaluate(NDArray x, NDArray y, StepsPerExecution = _steps_per_execution }); + var callbacks = new CallbackList(new CallbackParams + { + Model = this, + Verbose = verbose, + Steps = data_handler.Inferredsteps + }); + callbacks.on_test_begin(); + + //Dictionary? logs = null; + var logs = new Dictionary(); foreach (var (epoch, iterator) in data_handler.enumerate_epochs()) { reset_metrics(); - // callbacks.on_epoch_begin(epoch) // data_handler.catch_stop_iteration(); - IEnumerable<(string, Tensor)> results = null; + foreach (var step in data_handler.steps()) { - // callbacks.on_train_batch_begin(step) - results = test_function(data_handler, iterator); + callbacks.on_test_batch_begin(step); + logs = test_function(data_handler, iterator); + var end_step = step + data_handler.StepIncrement; + if (is_val == false) + callbacks.on_test_batch_end(end_step, logs); } } + + var results = new Dictionary(); + foreach (var log in logs) + { + results[log.Key] = log.Value; + } + return results; } - public KeyValuePair[] evaluate(IDatasetV2 x) + public Dictionary evaluate(IEnumerable x, NDArray y, int verbose = 1, bool is_val = false) + { + var data_handler = new DataHandler(new DataHandlerArgs + { + X = new Tensors(x), + Y = y, + Model = this, + StepsPerExecution = _steps_per_execution + }); + + var callbacks = new CallbackList(new CallbackParams + { + Model = this, + Verbose = verbose, + Steps = data_handler.Inferredsteps + }); + callbacks.on_test_begin(); + + Dictionary logs = null; + foreach (var (epoch, iterator) in data_handler.enumerate_epochs()) + { + reset_metrics(); + callbacks.on_epoch_begin(epoch); + // data_handler.catch_stop_iteration(); + + foreach (var step in data_handler.steps()) + { + callbacks.on_test_batch_begin(step); + logs = test_step_multi_inputs_function(data_handler, iterator); + var end_step = step + data_handler.StepIncrement; + if (is_val == false) + callbacks.on_test_batch_end(end_step, logs); + } + } + + var results = new Dictionary(); + foreach (var log in logs) + { + results[log.Key] = log.Value; + } + return results; + } + + + public Dictionary evaluate(IDatasetV2 x, int verbose = 1, bool is_val = false) { var data_handler = new DataHandler(new DataHandlerArgs { @@ -69,31 +144,55 @@ public KeyValuePair[] evaluate(IDatasetV2 x) StepsPerExecution = _steps_per_execution }); - IEnumerable<(string, Tensor)> logs = null; + var callbacks = new CallbackList(new CallbackParams + { + Model = this, + Verbose = verbose, + Steps = data_handler.Inferredsteps + }); + callbacks.on_test_begin(); + + Dictionary logs = null; foreach (var (epoch, iterator) in data_handler.enumerate_epochs()) { reset_metrics(); - // callbacks.on_epoch_begin(epoch) + callbacks.on_epoch_begin(epoch); // data_handler.catch_stop_iteration(); - + foreach (var step in data_handler.steps()) { - // callbacks.on_train_batch_begin(step) + callbacks.on_test_batch_begin(step); logs = test_function(data_handler, iterator); + var end_step = step + data_handler.StepIncrement; + if (is_val == false) + callbacks.on_test_batch_end(end_step, logs); } } - return logs.Select(x => new KeyValuePair(x.Item1, (float)x.Item2)).ToArray(); + + var results = new Dictionary(); + foreach (var log in logs) + { + results[log.Key] = log.Value; + } + return results; } - IEnumerable<(string, Tensor)> test_function(DataHandler data_handler, OwnedIterator iterator) + Dictionary test_function(DataHandler data_handler, OwnedIterator iterator) { var data = iterator.next(); var outputs = test_step(data_handler, data[0], data[1]); tf_with(ops.control_dependencies(new object[0]), ctl => _test_counter.assign_add(1)); return outputs; } - - List<(string, Tensor)> test_step(DataHandler data_handler, Tensor x, Tensor y) + Dictionary test_step_multi_inputs_function(DataHandler data_handler, OwnedIterator iterator) + { + var data = iterator.next(); + var x_size = data_handler.DataAdapter.GetDataset().FirstInputTensorCount; + var outputs = train_step(data_handler, new Tensors(data.Take(x_size)), new Tensors(data.Skip(x_size))); + tf_with(ops.control_dependencies(new object[0]), ctl => _train_counter.assign_add(1)); + return outputs; + } + Dictionary test_step(DataHandler data_handler, Tensor x, Tensor y) { (x, y) = data_handler.DataAdapter.Expand1d(x, y); var y_pred = Apply(x, training: false); @@ -101,7 +200,7 @@ public KeyValuePair[] evaluate(IDatasetV2 x) compiled_metrics.update_state(y, y_pred); - return metrics.Select(x => (x.Name, x.result())).ToList(); + return metrics.Select(x => (x.Name, x.result())).ToDictionary(x=>x.Item1, x=>(float)x.Item2); } } } diff --git a/src/TensorFlowNET.Keras/Engine/Model.Fit.cs b/src/TensorFlowNET.Keras/Engine/Model.Fit.cs index 966853809..bb8e18ccf 100644 --- a/src/TensorFlowNET.Keras/Engine/Model.Fit.cs +++ b/src/TensorFlowNET.Keras/Engine/Model.Fit.cs @@ -19,14 +19,18 @@ public partial class Model /// /// /// + /// /// /// + /// /// - public History fit(NDArray x, NDArray y, + public ICallback fit(NDArray x, NDArray y, int batch_size = -1, int epochs = 1, int verbose = 1, + List callbacks = null, float validation_split = 0f, + (NDArray val_x, NDArray val_y)? validation_data = null, bool shuffle = true, int initial_epoch = 0, int max_queue_size = 10, @@ -38,11 +42,17 @@ public History fit(NDArray x, NDArray y, throw new InvalidArgumentError( $"The array x and y should have same value at dim 0, but got {x.dims[0]} and {y.dims[0]}"); } - int train_count = Convert.ToInt32(x.dims[0] * (1 - validation_split)); - var train_x = x[new Slice(0, train_count)]; - var train_y = y[new Slice(0, train_count)]; - var val_x = x[new Slice(train_count)]; - var val_y = y[new Slice(train_count)]; + + var train_x = x; + var train_y = y; + + if (validation_split != 0f && validation_data == null) + { + int train_count = Convert.ToInt32(x.dims[0] * (1 - validation_split)); + train_x = x[new Slice(0, train_count)]; + train_y = y[new Slice(0, train_count)]; + validation_data = (val_x: x[new Slice(train_count)], val_y: y[new Slice(train_count)]); + } var data_handler = new DataHandler(new DataHandlerArgs { @@ -59,21 +69,86 @@ public History fit(NDArray x, NDArray y, StepsPerExecution = _steps_per_execution }); - return FitInternal(data_handler, epochs, verbose); + return FitInternal(data_handler, epochs, verbose, callbackList: callbacks, validation_data: validation_data, + train_step_func: train_step_function); } - public History fit(IDatasetV2 dataset, - IDatasetV2 validation_data = null, + public ICallback fit(IEnumerable x, NDArray y, int batch_size = -1, int epochs = 1, int verbose = 1, + List callbacks = null, float validation_split = 0f, + (IEnumerable val_x, NDArray val_y)? validation_data = null, + bool shuffle = true, + int initial_epoch = 0, + int max_queue_size = 10, + int workers = 1, + bool use_multiprocessing = false) + { + foreach(var tx in x) + { + if (tx.dims[0] != y.dims[0]) + { + throw new InvalidArgumentError( + $"The array x and y should have same value at dim 0, but got {tx.dims[0]} and {y.dims[0]}"); + } + } + + var train_x = x; + var train_y = y; + if (validation_split != 0f && validation_data == null) + { + int train_count = Convert.ToInt32(y.dims[0] * (1 - validation_split)); + train_x = x.Select(x => x[new Slice(0, train_count)] as NDArray); + train_y = y[new Slice(0, train_count)]; + var val_x = x.Select(x => x[new Slice(train_count)] as NDArray); + var val_y = y[new Slice(train_count)]; + validation_data = (val_x, val_y); + } + + + var data_handler = new DataHandler(new DataHandlerArgs + { + X = new Tensors(train_x), + Y = train_y, + BatchSize = batch_size, + InitialEpoch = initial_epoch, + Epochs = epochs, + Shuffle = shuffle, + MaxQueueSize = max_queue_size, + Workers = workers, + UseMultiprocessing = use_multiprocessing, + Model = this, + StepsPerExecution = _steps_per_execution + }); + + if (data_handler.DataAdapter.GetDataset().structure.Length > 2 || + data_handler.DataAdapter.GetDataset().FirstInputTensorCount > 1) + { + return FitInternal(data_handler, epochs, verbose, callbackList: callbacks, validation_data: validation_data, + train_step_func: train_step_multi_inputs_function); + } + else + { + return FitInternal(data_handler, epochs, verbose, callbackList: callbacks, validation_data: validation_data, + train_step_func: train_step_function); + } + } + + public History fit(IDatasetV2 dataset, + int batch_size = -1, + int epochs = 1, + int verbose = 1, + List callbacks = null, + IDatasetV2 validation_data = null, bool shuffle = true, int initial_epoch = 0, int max_queue_size = 10, int workers = 1, bool use_multiprocessing = false) { + var data_handler = new DataHandler(new DataHandlerArgs { Dataset = dataset, @@ -88,10 +163,13 @@ public History fit(IDatasetV2 dataset, StepsPerExecution = _steps_per_execution }); - return FitInternal(data_handler, epochs, verbose, validation_data: validation_data); + + return FitInternal(data_handler, epochs, verbose, callbacks, validation_data: validation_data, + train_step_func: train_step_function); } - History FitInternal(DataHandler data_handler, int epochs, int verbose, IDatasetV2 validation_data = null) + History FitInternal(DataHandler data_handler, int epochs, int verbose, List callbackList, IDatasetV2 validation_data, + Func> train_step_func) { stop_training = false; _train_counter.assign(0); @@ -102,6 +180,13 @@ History FitInternal(DataHandler data_handler, int epochs, int verbose, IDatasetV Epochs = epochs, Steps = data_handler.Inferredsteps }); + + if (callbackList != null) + { + foreach(var callback in callbackList) + callbacks.callbacks.add(callback); + } + callbacks.on_train_begin(); foreach (var (epoch, iterator) in data_handler.enumerate_epochs()) @@ -110,11 +195,13 @@ History FitInternal(DataHandler data_handler, int epochs, int verbose, IDatasetV callbacks.on_epoch_begin(epoch); // data_handler.catch_stop_iteration(); var logs = new Dictionary(); + long End_step = 0; foreach (var step in data_handler.steps()) { callbacks.on_train_batch_begin(step); - logs = train_step_function(data_handler, iterator); + logs = train_step_func(data_handler, iterator); var end_step = step + data_handler.StepIncrement; + End_step = end_step; callbacks.on_train_batch_end(end_step, logs); } @@ -125,6 +212,123 @@ History FitInternal(DataHandler data_handler, int epochs, int verbose, IDatasetV { logs["val_" + log.Key] = log.Value; } + callbacks.on_train_batch_end(End_step, logs); + } + + + callbacks.on_epoch_end(epoch, logs); + + GC.Collect(); + GC.WaitForPendingFinalizers(); + } + + return callbacks.History; + } + + History FitInternal(DataHandler data_handler, int epochs, int verbose, List callbackList, (NDArray, NDArray)? validation_data, + Func> train_step_func) + { + stop_training = false; + _train_counter.assign(0); + var callbacks = new CallbackList(new CallbackParams + { + Model = this, + Verbose = verbose, + Epochs = epochs, + Steps = data_handler.Inferredsteps + }); + + if (callbackList != null) + { + foreach (var callback in callbackList) + callbacks.callbacks.add(callback); + } + + callbacks.on_train_begin(); + + foreach (var (epoch, iterator) in data_handler.enumerate_epochs()) + { + reset_metrics(); + callbacks.on_epoch_begin(epoch); + // data_handler.catch_stop_iteration(); + var logs = new Dictionary(); + long End_step = 0; + foreach (var step in data_handler.steps()) + { + callbacks.on_train_batch_begin(step); + logs = train_step_func(data_handler, iterator); + var end_step = step + data_handler.StepIncrement; + End_step = end_step; + callbacks.on_train_batch_end(end_step, logs); + } + + if (validation_data != null) + { + // Because evaluate calls call_test_batch_end, this interferes with our output on the screen + // so we need to pass a is_val parameter to stop on_test_batch_end + var val_logs = evaluate(validation_data.Value.Item1, validation_data.Value.Item2, is_val:true); + foreach (var log in val_logs) + { + logs["val_" + log.Key] = log.Value; + } + // because after evaluate, logs add some new log which we need to print + callbacks.on_train_batch_end(End_step, logs); + } + + callbacks.on_epoch_end(epoch, logs); + + GC.Collect(); + GC.WaitForPendingFinalizers(); + } + + return callbacks.History; + } + + History FitInternal(DataHandler data_handler, int epochs, int verbose, List callbackList, (IEnumerable, NDArray)? validation_data, + Func> train_step_func) + { + stop_training = false; + _train_counter.assign(0); + var callbacks = new CallbackList(new CallbackParams + { + Model = this, + Verbose = verbose, + Epochs = epochs, + Steps = data_handler.Inferredsteps + }); + + if (callbackList != null) + { + foreach (var callback in callbackList) + callbacks.callbacks.add(callback); + } + + callbacks.on_train_begin(); + + foreach (var (epoch, iterator) in data_handler.enumerate_epochs()) + { + reset_metrics(); + callbacks.on_epoch_begin(epoch); + // data_handler.catch_stop_iteration(); + var logs = new Dictionary(); + long End_step = 0; + foreach (var step in data_handler.steps()) + { + callbacks.on_train_batch_begin(step); + logs = train_step_func(data_handler, iterator); + var end_step = step + data_handler.StepIncrement; + End_step = end_step; + callbacks.on_train_batch_end(end_step, logs); + } + + if (validation_data != null) + { + var val_logs = evaluate(validation_data.Value.Item1, validation_data.Value.Item2); + foreach (var log in val_logs) + { + logs["val_" + log.Key] = log.Value; + callbacks.on_train_batch_end(End_step, logs); + } } callbacks.on_epoch_end(epoch, logs); diff --git a/src/TensorFlowNET.Keras/Engine/Model.Predict.cs b/src/TensorFlowNET.Keras/Engine/Model.Predict.cs index c27ea9090..984bcb5dc 100644 --- a/src/TensorFlowNET.Keras/Engine/Model.Predict.cs +++ b/src/TensorFlowNET.Keras/Engine/Model.Predict.cs @@ -49,7 +49,7 @@ public Tensors predict(IDatasetV2 dataset, /// /// /// - public Tensors predict(Tensor x, + public Tensors predict(Tensors x, int batch_size = -1, int verbose = 0, int steps = -1, @@ -115,12 +115,12 @@ Tensors PredictInternal(DataHandler data_handler, int verbose) Tensors run_predict_step(OwnedIterator iterator) { var data = iterator.next(); - var outputs = predict_step(data[0]); + var outputs = predict_step(data); tf_with(ops.control_dependencies(new object[0]), ctl => _predict_counter.assign_add(1)); return outputs; } - Tensors predict_step(Tensor data) + Tensors predict_step(Tensors data) { return Apply(data, training: false); } diff --git a/src/TensorFlowNET.Keras/Engine/Model.Train.cs b/src/TensorFlowNET.Keras/Engine/Model.Train.cs index 0151d5436..905ea453a 100644 --- a/src/TensorFlowNET.Keras/Engine/Model.Train.cs +++ b/src/TensorFlowNET.Keras/Engine/Model.Train.cs @@ -17,12 +17,21 @@ Dictionary train_step_function(DataHandler data_handler, OwnedIte return outputs; } + Dictionary train_step_multi_inputs_function(DataHandler data_handler, OwnedIterator iterator) + { + var data = iterator.next(); + var x_size = data_handler.DataAdapter.GetDataset().FirstInputTensorCount; + var outputs = train_step(data_handler, new Tensors(data.Take(x_size)), new Tensors(data.Skip(x_size))); + tf_with(ops.control_dependencies(new object[0]), ctl => _train_counter.assign_add(1)); + return outputs; + } + /// /// The logic for one training step. /// /// /// - Dictionary train_step(DataHandler data_handler, Tensor x, Tensor y) + Dictionary train_step(DataHandler data_handler, Tensors x, Tensors y) { (x, y) = data_handler.DataAdapter.Expand1d(x, y); using var tape = tf.GradientTape(); @@ -51,13 +60,13 @@ Dictionary train_step(DataHandler data_handler, Tensor x, Tensor return dict; } - void _minimize(GradientTape tape, OptimizerV2 optimizer, Tensor loss, List trainable_variables) + void _minimize(GradientTape tape, IOptimizer optimizer, Tensor loss, List trainable_variables) { var gradients = tape.gradient(loss, trainable_variables); - gradients = optimizer._aggregate_gradients(zip(gradients, trainable_variables)); - gradients = optimizer._clip_gradients(gradients); + gradients = optimizer.aggregate_gradients(zip(gradients, trainable_variables)); + gradients = optimizer.clip_gradients(gradients); - optimizer.apply_gradients(zip(gradients, trainable_variables.Select(x => x as ResourceVariable)), + optimizer.apply_gradients(zip(gradients, trainable_variables), experimental_aggregate_gradients: false); } } diff --git a/src/TensorFlowNET.Keras/Engine/Model.cs b/src/TensorFlowNET.Keras/Engine/Model.cs index bbc6e8293..83702b23a 100644 --- a/src/TensorFlowNET.Keras/Engine/Model.cs +++ b/src/TensorFlowNET.Keras/Engine/Model.cs @@ -1,13 +1,12 @@ -using System.Collections.Generic; -using System.Linq; +using System.Diagnostics; +using Tensorflow.Framework.Models; using Tensorflow.Keras.ArgsDefinition; -using Tensorflow.Keras.Engine.DataAdapters; using Tensorflow.Keras.Losses; -using Tensorflow.Keras.Optimizers; +using Tensorflow.Keras.Saving; using Tensorflow.Keras.Saving.SavedModel; +using Tensorflow.Keras.Utils; using Tensorflow.Train; -using static Tensorflow.Binding; -using static Tensorflow.KerasApi; +using Tensorflow.Util; namespace Tensorflow.Keras.Engine { @@ -25,32 +24,72 @@ public partial class Model : Layer, IModel #pragma warning restore CS0414 // The field 'Model._is_compiled' is assigned but its value is never used #pragma warning restore CS0108 // Member hides inherited member; missing new keyword ILossFunc loss; - OptimizerV2 optimizer; + IOptimizer optimizer; IVariableV1 _steps_per_execution; protected bool _is_graph_network; - protected Tensors inputs; + public Tensors inputs; protected Tensors outputs; + protected List input_names; public string[] output_names; IVariableV1 _train_counter; IVariableV1 _test_counter; IVariableV1 _predict_counter; bool _base_model_initialized; bool stop_training; + TensorSpec _saved_model_inputs_spec; public bool IsGraphNetwork => _is_graph_network; - public OptimizerV2 Optimizer + public IOptimizer Optimizer { get => optimizer; set => optimizer = value; } + public bool Stop_training + { + get => stop_training; + set => stop_training = value; + } + public Model(ModelArgs args) : base(args) { _init_batch_counters(); } + public void _set_inputs(TensorSpec inputs) + { + _set_save_spec(inputs); + } + + internal void _set_save_spec(TensorSpec inputs) + { + if(_saved_model_inputs_spec is not null) + { + return; + } + var input_names = this.input_names; + if(input_names is null || input_names.Count == 0) + { + input_names = compile_utils.create_pseudo_input_names(inputs); + } + + var flat_inputs = nest.flatten(inputs); + List specs = new(); + foreach(var (name, tensor) in zip(input_names, flat_inputs)) + { + specs.Add(tf_utils.get_tensor_spec(tensor, dynamic_batch: false, name: name)); + } + var packed_specs = nest.pack_sequence_as(inputs, specs) as TensorSpec; + Debug.Assert(specs is not null); + _saved_model_inputs_spec = packed_specs; + if(this is Sequential && _buildInputShape is null) + { + _buildInputShape = nest.map_structure(x => x is null ? null : x.shape, packed_specs); + } + } + internal override void Initialize(LayerArgs args) { _init_batch_counters(); @@ -150,5 +189,15 @@ public override IDictionary _trackable_children(SaveType save var children = base._trackable_children(save_type, cache); return children; } + + public override void SetAttr(string name, object value) + { + // TODO(Rinne): deal with "_self_setattr_tracking". + //if(nest.flatten(value).All(v => v is Layer or IVariableV1 || base_layer_utils.has_weights(v))) + //{ + // this._base_model_initialized; + //} + base.SetAttr(name, value); + } } } diff --git a/src/TensorFlowNET.Keras/Engine/Sequential.cs b/src/TensorFlowNET.Keras/Engine/Sequential.cs index 69665388b..90167a9d9 100644 --- a/src/TensorFlowNET.Keras/Engine/Sequential.cs +++ b/src/TensorFlowNET.Keras/Engine/Sequential.cs @@ -92,7 +92,7 @@ public void add(ILayer layer) { // Instantiate an input layer. var x = keras.Input( - batch_input_shape: layer.BatchInputShape, + batch_input_shape: layer.BatchInputShape.ToSingleShape(), dtype: layer.DType, name: layer.Name + "_input"); @@ -124,11 +124,12 @@ public void add(ILayer layer) if (set_inputs || _is_graph_network) { _init_graph_network(inputs, outputs); - _is_graph_network = true; + _graph_initialized = true; } else { _self_tracked_trackables.add(layer); + // TODO(Rinne): self._handle_deferred_layer_dependencies([layer]) } } diff --git a/src/TensorFlowNET.Keras/InitializersApi.cs b/src/TensorFlowNET.Keras/InitializersApi.cs index 6bade1720..d6dfa51be 100644 --- a/src/TensorFlowNET.Keras/InitializersApi.cs +++ b/src/TensorFlowNET.Keras/InitializersApi.cs @@ -27,7 +27,7 @@ public partial class InitializersApi : IInitializersApi /// public IInitializer HeNormal(int? seed = null) { - return new VarianceScaling(factor: 2.0f, mode: "fan_in", seed: seed); + return new VarianceScaling(scale: 2.0f, mode: "fan_in", seed: seed); } public IInitializer Orthogonal(float gain = 1.0f, int? seed = null) diff --git a/src/TensorFlowNET.Keras/KerasApi.cs b/src/TensorFlowNET.Keras/KerasApi.cs index f79c2b5f2..69c59ab82 100644 --- a/src/TensorFlowNET.Keras/KerasApi.cs +++ b/src/TensorFlowNET.Keras/KerasApi.cs @@ -7,6 +7,6 @@ namespace Tensorflow /// public static class KerasApi { - public static KerasInterface keras { get; } = new KerasInterface(); + public static KerasInterface keras { get; } = KerasInterface.Instance; } } diff --git a/src/TensorFlowNET.Keras/KerasInterface.cs b/src/TensorFlowNET.Keras/KerasInterface.cs index 2bde713c0..159564aac 100644 --- a/src/TensorFlowNET.Keras/KerasInterface.cs +++ b/src/TensorFlowNET.Keras/KerasInterface.cs @@ -18,18 +18,41 @@ namespace Tensorflow.Keras { public class KerasInterface : IKerasApi { + private static KerasInterface _instance = null; + private static readonly object _lock = new object(); + + public static KerasInterface Instance + { + get + { + lock (_lock) + { + if (_instance is null) + { + _instance = new KerasInterface(); + } + return _instance; + } + } + } + + static KerasInterface() + { + RevivedTypes.RegisterRevivedTypeCreator("optimizer", new RestoredOptimizer()); + } + public KerasDataset datasets { get; } = new KerasDataset(); public IInitializersApi initializers { get; } = new InitializersApi(); public Regularizers regularizers { get; } = new Regularizers(); public ILayersApi layers { get; } = new LayersApi(); public ILossesApi losses { get; } = new LossesApi(); - public Activations activations { get; } = new Activations(); + public IActivationsApi activations { get; } = new Activations(); public Preprocessing preprocessing { get; } = new Preprocessing(); ThreadLocal _backend = new ThreadLocal(() => new BackendImpl()); public BackendImpl backend => _backend.Value; - public OptimizerApi optimizers { get; } = new OptimizerApi(); + public IOptimizerApi optimizers { get; } = new OptimizerApi(); public IMetricsApi metrics { get; } = new MetricsApi(); - public ModelsApi models { get; } = new ModelsApi(); + public IModelsApi models { get; } = new ModelsApi(); public KerasUtils utils { get; } = new KerasUtils(); public Sequential Sequential(List layers = null, @@ -40,13 +63,19 @@ public Sequential Sequential(List layers = null, Name = name }); + public Sequential Sequential(params ILayer[] layers) + => new Sequential(new SequentialArgs + { + Layers = layers.ToList() + }); + /// /// `Model` groups layers into an object with training and inference features. /// /// /// /// - public Functional Model(Tensors inputs, Tensors outputs, string name = null) + public IModel Model(Tensors inputs, Tensors outputs, string name = null) => new Functional(inputs, outputs, name: name); /// diff --git a/src/TensorFlowNET.Keras/Layers/Activation/ELU.cs b/src/TensorFlowNET.Keras/Layers/Activation/ELU.cs index 9cb5b7565..739c0d56f 100644 --- a/src/TensorFlowNET.Keras/Layers/Activation/ELU.cs +++ b/src/TensorFlowNET.Keras/Layers/Activation/ELU.cs @@ -3,6 +3,7 @@ using System.Text; using Tensorflow.Keras.ArgsDefinition; using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Saving; using static Tensorflow.Binding; namespace Tensorflow.Keras.Layers { @@ -19,7 +20,7 @@ public ELU(ELUArgs args) : base(args) this.args = args; } - public override void build(Shape input_shape) + public override void build(KerasShapesWrapper input_shape) { if (alpha < 0f) { diff --git a/src/TensorFlowNET.Keras/Layers/Activation/Exponential.cs b/src/TensorFlowNET.Keras/Layers/Activation/Exponential.cs index 981f96f0b..17636302f 100644 --- a/src/TensorFlowNET.Keras/Layers/Activation/Exponential.cs +++ b/src/TensorFlowNET.Keras/Layers/Activation/Exponential.cs @@ -3,6 +3,7 @@ using System.Text; using Tensorflow.Keras.ArgsDefinition; using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Saving; using static Tensorflow.Binding; namespace Tensorflow.Keras.Layers { @@ -12,7 +13,7 @@ public Exponential(LayerArgs args) : base(args) { // Exponential has no args } - public override void build(Shape input_shape) + public override void build(KerasShapesWrapper input_shape) { base.build(input_shape); } diff --git a/src/TensorFlowNET.Keras/Layers/Activation/SELU.cs b/src/TensorFlowNET.Keras/Layers/Activation/SELU.cs index 9b5bc0e66..53101fbb4 100644 --- a/src/TensorFlowNET.Keras/Layers/Activation/SELU.cs +++ b/src/TensorFlowNET.Keras/Layers/Activation/SELU.cs @@ -3,6 +3,7 @@ using System.Text; using Tensorflow.Keras.ArgsDefinition; using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Saving; using static Tensorflow.Binding; namespace Tensorflow.Keras.Layers { @@ -15,7 +16,7 @@ public class SELU : Layer { public SELU ( LayerArgs args ) : base(args) { // SELU has no arguments } - public override void build(Shape input_shape) { + public override void build(KerasShapesWrapper input_shape) { if ( alpha < 0f ) { throw new ValueError("Alpha must be a number greater than 0."); } diff --git a/src/TensorFlowNET.Keras/Layers/Attention/Attention.cs b/src/TensorFlowNET.Keras/Layers/Attention/Attention.cs index c51316308..e6a8e1a63 100644 --- a/src/TensorFlowNET.Keras/Layers/Attention/Attention.cs +++ b/src/TensorFlowNET.Keras/Layers/Attention/Attention.cs @@ -93,7 +93,7 @@ public Attention(AttentionArgs args) : base(args) } // Creates variable when `use_scale` is True or `score_mode` is `concat`. - public override void build(Shape input_shape) + public override void build(KerasShapesWrapper input_shape) { if (this.use_scale) this.scale = this.add_weight(name: "scale", diff --git a/src/TensorFlowNET.Keras/Layers/Convolution/Conv1D.cs b/src/TensorFlowNET.Keras/Layers/Convolution/Conv1D.cs index d62b33a58..3ee61253c 100644 --- a/src/TensorFlowNET.Keras/Layers/Convolution/Conv1D.cs +++ b/src/TensorFlowNET.Keras/Layers/Convolution/Conv1D.cs @@ -20,9 +20,46 @@ namespace Tensorflow.Keras.Layers { public class Conv1D : Convolutional { - public Conv1D(Conv1DArgs args) : base(args) + public Conv1D(Conv1DArgs args) : base(InitializeUndefinedArgs(args)) { } + + private static Conv1DArgs InitializeUndefinedArgs(Conv1DArgs args) + { + if(args.Rank == 0) + { + args.Rank = 1; + } + if(args.Strides is null) + { + args.Strides = 1; + } + if (string.IsNullOrEmpty(args.Padding)) + { + args.Padding = "valid"; + } + if (string.IsNullOrEmpty(args.DataFormat)) + { + args.DataFormat = "channels_last"; + } + if(args.DilationRate == 0) + { + args.DilationRate = 1; + } + if(args.Groups == 0) + { + args.Groups = 1; + } + if(args.KernelInitializer is null) + { + args.KernelInitializer = tf.glorot_uniform_initializer; + } + if(args.BiasInitializer is null) + { + args.BiasInitializer = tf.zeros_initializer; + } + return args; + } } } diff --git a/src/TensorFlowNET.Keras/Layers/Convolution/Conv2D.cs b/src/TensorFlowNET.Keras/Layers/Convolution/Conv2D.cs index c5c210152..a6963e307 100644 --- a/src/TensorFlowNET.Keras/Layers/Convolution/Conv2D.cs +++ b/src/TensorFlowNET.Keras/Layers/Convolution/Conv2D.cs @@ -20,9 +20,42 @@ namespace Tensorflow.Keras.Layers { public class Conv2D : Convolutional { - public Conv2D(Conv2DArgs args) : base(args) + public Conv2D(Conv2DArgs args) : base(InitializeUndefinedArgs(args)) { } + + private static Conv2DArgs InitializeUndefinedArgs(Conv2DArgs args) + { + if(args.Rank == 0) + { + args.Rank = 2; + } + if (args.Strides is null) + { + args.Strides = (1, 1); + } + if (string.IsNullOrEmpty(args.Padding)) + { + args.Padding = "valid"; + } + if (args.DilationRate == 0) + { + args.DilationRate = (1, 1); + } + if (args.Groups == 0) + { + args.Groups = 1; + } + if (args.KernelInitializer is null) + { + args.KernelInitializer = tf.glorot_uniform_initializer; + } + if (args.BiasInitializer is null) + { + args.BiasInitializer = tf.zeros_initializer; + } + return args; + } } } diff --git a/src/TensorFlowNET.Keras/Layers/Convolution/Conv2DTranspose.cs b/src/TensorFlowNET.Keras/Layers/Convolution/Conv2DTranspose.cs index b8286be67..13bea627e 100644 --- a/src/TensorFlowNET.Keras/Layers/Convolution/Conv2DTranspose.cs +++ b/src/TensorFlowNET.Keras/Layers/Convolution/Conv2DTranspose.cs @@ -19,23 +19,54 @@ limitations under the License. using Tensorflow.Keras.ArgsDefinition; using Tensorflow.Keras.Utils; using static Tensorflow.KerasApi; +using Tensorflow.Keras.Saving; namespace Tensorflow.Keras.Layers { public class Conv2DTranspose : Conv2D { - public Conv2DTranspose(Conv2DArgs args) : base(args) + public Conv2DTranspose(Conv2DArgs args) : base(InitializeUndefinedArgs(args)) { } - public override void build(Shape input_shape) + private static Conv2DArgs InitializeUndefinedArgs(Conv2DArgs args) { + if (args.Strides is null) + { + args.Strides = (1, 1); + } + if (string.IsNullOrEmpty(args.Padding)) + { + args.Padding = "valid"; + } + if (args.DilationRate == 0) + { + args.DilationRate = (1, 1); + } + if (args.Groups == 0) + { + args.Groups = 1; + } + if (args.KernelInitializer is null) + { + args.KernelInitializer = tf.glorot_uniform_initializer; + } + if (args.BiasInitializer is null) + { + args.BiasInitializer = tf.zeros_initializer; + } + return args; + } + + public override void build(KerasShapesWrapper input_shape) + { + var single_shape = input_shape.ToSingleShape(); if (len(input_shape) != 4) throw new ValueError($"Inputs should have rank 4. Received input shape: {input_shape}"); var channel_axis = _get_channel_axis(); - var input_dim = input_shape[-1]; + var input_dim = single_shape[-1]; var kernel_shape = new Shape(kernel_size[0], kernel_size[1], filters, input_dim); kernel = add_weight(name: "kernel", @@ -110,7 +141,7 @@ protected override Tensors Call(Tensors inputs, Tensor state = null, bool? train throw new NotImplementedException(""); if (activation != null) - return activation(outputs); + return activation.Apply(outputs); return outputs; } diff --git a/src/TensorFlowNET.Keras/Layers/Convolution/Convolutional.cs b/src/TensorFlowNET.Keras/Layers/Convolution/Convolutional.cs index 933aa9cf1..c575362c0 100644 --- a/src/TensorFlowNET.Keras/Layers/Convolution/Convolutional.cs +++ b/src/TensorFlowNET.Keras/Layers/Convolution/Convolutional.cs @@ -19,6 +19,7 @@ limitations under the License. using System.Linq; using Tensorflow.Keras.ArgsDefinition; using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Saving; using Tensorflow.Keras.Utils; using Tensorflow.Operations; using static Tensorflow.Binding; @@ -57,12 +58,13 @@ public Convolutional(ConvolutionalArgs args) : base(args) _tf_data_format = conv_utils.convert_data_format(data_format, rank + 2); } - public override void build(Shape input_shape) + public override void build(KerasShapesWrapper input_shape) { int channel_axis = data_format == "channels_first" ? 1 : -1; + var single_shape = input_shape.ToSingleShape(); var input_channel = channel_axis < 0 ? - input_shape.dims[input_shape.ndim + channel_axis] : - input_shape.dims[channel_axis]; + single_shape.dims[single_shape.ndim + channel_axis] : + single_shape.dims[channel_axis]; Shape kernel_shape = kernel_size.dims.concat(new long[] { input_channel / args.Groups, filters }); kernel = add_weight(name: "kernel", shape: kernel_shape, @@ -117,7 +119,7 @@ protected override Tensors Call(Tensors inputs, Tensor state = null, bool? train } if (activation != null) - outputs = activation(outputs); + outputs = activation.Apply(outputs); return outputs; } diff --git a/src/TensorFlowNET.Keras/Layers/Core/Dense.cs b/src/TensorFlowNET.Keras/Layers/Core/Dense.cs index 56fde9f2c..b1cc2446c 100644 --- a/src/TensorFlowNET.Keras/Layers/Core/Dense.cs +++ b/src/TensorFlowNET.Keras/Layers/Core/Dense.cs @@ -16,9 +16,11 @@ limitations under the License. using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using Tensorflow.Keras.ArgsDefinition; using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Saving; using static Tensorflow.Binding; namespace Tensorflow.Keras.Layers @@ -41,10 +43,12 @@ public Dense(DenseArgs args) : this.inputSpec = new InputSpec(min_ndim: 2); } - public override void build(Shape input_shape) + public override void build(KerasShapesWrapper input_shape) { _buildInputShape = input_shape; - var last_dim = input_shape.dims.Last(); + Debug.Assert(input_shape.Shapes.Length <= 1); + var single_shape = input_shape.ToSingleShape(); + var last_dim = single_shape.dims.Last(); var axes = new Dictionary(); axes[-1] = (int)last_dim; inputSpec = new InputSpec(min_ndim: 2, axes: axes); @@ -81,7 +85,7 @@ protected override Tensors Call(Tensors inputs, Tensor state = null, bool? train if (args.UseBias) outputs = tf.nn.bias_add(outputs, bias); if (args.Activation != null) - outputs = activation(outputs); + outputs = activation.Apply(outputs); return outputs; } diff --git a/src/TensorFlowNET.Keras/Layers/Core/EinsumDense.cs b/src/TensorFlowNET.Keras/Layers/Core/EinsumDense.cs index af71ddf9f..fb604f77e 100644 --- a/src/TensorFlowNET.Keras/Layers/Core/EinsumDense.cs +++ b/src/TensorFlowNET.Keras/Layers/Core/EinsumDense.cs @@ -6,6 +6,7 @@ using System.Text.RegularExpressions; using Tensorflow.Keras.Engine; using Tensorflow.Keras.ArgsDefinition.Core; +using Tensorflow.Keras.Saving; namespace Tensorflow.Keras.Layers { @@ -119,9 +120,10 @@ public EinsumDense(EinsumDenseArgs args) : base(args) this.bias_constraint = args.BiasConstraint; } - public override void build(Shape input_shape) + public override void build(KerasShapesWrapper input_shape) { - var shape_data = _analyze_einsum_string(this.equation, this.bias_axes, input_shape, this.partial_output_shape); + var shape_data = _analyze_einsum_string(this.equation, this.bias_axes, + input_shape.ToSingleShape(), this.partial_output_shape); var kernel_shape = shape_data.Item1; var bias_shape = shape_data.Item2; this.full_output_shape = shape_data.Item3; @@ -193,7 +195,7 @@ protected override Tensors Call(Tensors inputs, Tensor state = null, bool? train if (this.bias != null) ret += this.bias.AsTensor(); if (this.activation != null) - ret = this.activation(ret); + ret = this.activation.Apply(ret); return ret; } /// diff --git a/src/TensorFlowNET.Keras/Layers/Core/Embedding.cs b/src/TensorFlowNET.Keras/Layers/Core/Embedding.cs index 606f387bb..9487a7d00 100644 --- a/src/TensorFlowNET.Keras/Layers/Core/Embedding.cs +++ b/src/TensorFlowNET.Keras/Layers/Core/Embedding.cs @@ -17,6 +17,7 @@ limitations under the License. using System.Linq; using Tensorflow.Keras.ArgsDefinition; using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Saving; using static Tensorflow.Binding; namespace Tensorflow.Keras.Layers @@ -48,13 +49,13 @@ public Embedding(EmbeddingArgs args) args.InputShape = args.InputLength; if (args.BatchInputShape == null) - args.BatchInputShape = new long[] { args.BatchSize }.Concat(args.InputShape.dims).ToArray(); + args.BatchInputShape = new KerasShapesWrapper(new long[] { args.BatchSize }.Concat(args.InputShape.dims).ToArray()); embeddings_initializer = args.EmbeddingsInitializer ?? tf.random_uniform_initializer; SupportsMasking = mask_zero; } - public override void build(Shape input_shape) + public override void build(KerasShapesWrapper input_shape) { tf.Context.eager_mode(); embeddings = add_weight(shape: (input_dim, output_dim), diff --git a/src/TensorFlowNET.Keras/Layers/Core/InputLayer.cs b/src/TensorFlowNET.Keras/Layers/Core/InputLayer.cs index a44c0bded..f7385bad5 100644 --- a/src/TensorFlowNET.Keras/Layers/Core/InputLayer.cs +++ b/src/TensorFlowNET.Keras/Layers/Core/InputLayer.cs @@ -40,10 +40,10 @@ public InputLayer(InputLayerArgs args) : built = true; SupportsMasking = true; - if (BatchInputShape != null) + if (BatchInputShape is not null) { - args.BatchSize = (int)BatchInputShape.dims[0]; - args.InputShape = BatchInputShape.dims.Skip(1).ToArray(); + args.BatchSize = (int)(BatchInputShape.ToSingleShape().dims[0]); + args.InputShape = BatchInputShape.ToSingleShape().dims.Skip(1).ToArray(); } // moved to base class @@ -63,9 +63,8 @@ public InputLayer(InputLayerArgs args) : { if (args.InputShape != null) { - args.BatchInputShape = new long[] { args.BatchSize } - .Concat(args.InputShape.dims) - .ToArray(); + args.BatchInputShape = new Saving.KerasShapesWrapper(new long[] { args.BatchSize } + .Concat(args.InputShape.dims).ToArray()); } else { @@ -76,7 +75,7 @@ public InputLayer(InputLayerArgs args) : graph.as_default(); args.InputTensor = keras.backend.placeholder( - shape: BatchInputShape, + shape: BatchInputShape.ToSingleShape(), dtype: DType, name: Name, sparse: args.Sparse, diff --git a/src/TensorFlowNET.Keras/Layers/LayersApi.Activation.cs b/src/TensorFlowNET.Keras/Layers/LayersApi.Activation.cs index 24a568390..280e91e2c 100644 --- a/src/TensorFlowNET.Keras/Layers/LayersApi.Activation.cs +++ b/src/TensorFlowNET.Keras/Layers/LayersApi.Activation.cs @@ -11,6 +11,7 @@ public ILayer ELU ( float alpha = 0.1f ) => new ELU(new ELUArgs { Alpha = alpha }); public ILayer SELU () => new SELU(new LayerArgs { }); + public ILayer Softmax(int axis = -1) => new Softmax(new SoftmaxArgs { axis = axis }); public ILayer Softmax ( Axis axis ) => new Softmax(new SoftmaxArgs { axis = axis }); public ILayer Softplus () => new Softplus(new LayerArgs { }); public ILayer HardSigmoid () => new HardSigmoid(new LayerArgs { }); diff --git a/src/TensorFlowNET.Keras/Layers/LayersApi.cs b/src/TensorFlowNET.Keras/Layers/LayersApi.cs index cf689edf1..3b095bc2a 100644 --- a/src/TensorFlowNET.Keras/Layers/LayersApi.cs +++ b/src/TensorFlowNET.Keras/Layers/LayersApi.cs @@ -109,7 +109,7 @@ public ILayer Conv1D(int filters, DilationRate = dilation_rate, Groups = groups, UseBias = use_bias, - Activation = Activations.GetActivationByName(activation), + Activation = keras.activations.GetActivationFromName(activation), KernelInitializer = GetInitializerByName(kernel_initializer), BiasInitializer = GetInitializerByName(bias_initializer) }); @@ -211,8 +211,7 @@ public ILayer Conv2D(int filters, UseBias = use_bias, KernelInitializer = GetInitializerByName(kernel_initializer), BiasInitializer = GetInitializerByName(bias_initializer), - Activation = Activations.GetActivationByName(activation), - ActivationName = activation + Activation = keras.activations.GetActivationFromName(activation) }); /// @@ -257,7 +256,7 @@ public ILayer Conv2DTranspose(int filters, UseBias = use_bias, KernelInitializer = GetInitializerByName(kernel_initializer), BiasInitializer = GetInitializerByName(bias_initializer), - Activation = Activations.GetActivationByName(activation) + Activation = keras.activations.GetActivationFromName(activation) }); /// @@ -302,8 +301,7 @@ public ILayer Dense(int units) => new Dense(new DenseArgs { Units = units, - Activation = Activations.GetActivationByName("linear"), - ActivationName = "linear" + Activation = keras.activations.GetActivationFromName("linear") }); /// @@ -323,8 +321,7 @@ public ILayer Dense(int units, => new Dense(new DenseArgs { Units = units, - Activation = Activations.GetActivationByName(activation), - ActivationName = activation, + Activation = keras.activations.GetActivationFromName(activation), InputShape = input_shape }); @@ -704,7 +701,7 @@ public ILayer SimpleRNN(int units, => new SimpleRNN(new SimpleRNNArgs { Units = units, - Activation = Activations.GetActivationByName(activation), + Activation = keras.activations.GetActivationFromName(activation), KernelInitializer = GetInitializerByName(kernel_initializer), RecurrentInitializer = GetInitializerByName(recurrent_initializer), BiasInitializer = GetInitializerByName(bias_initializer), @@ -852,7 +849,6 @@ public ILayer GlobalMaxPooling1D(string data_format = "channels_last") public ILayer GlobalMaxPooling2D(string data_format = "channels_last") => new GlobalMaxPooling2D(new Pooling2DArgs { DataFormat = data_format }); - Activation GetActivationByName(string name) => Activations.GetActivationByName(name); /// /// Get an weights initializer from its name. /// @@ -876,5 +872,15 @@ public ILayer CategoryEncoding(int num_tokens, string output_mode = "one_hot", b Sparse = sparse, CountWeights = count_weights }); + + public ILayer Normalization(Shape? input_shape = null, int? axis = -1, float? mean = null, float? variance = null, bool invert = false) + => new Normalization(new NormalizationArgs + { + InputShape = input_shape, + Axis = axis, + Mean = mean, + Variance = variance, + Invert = invert + }); } } diff --git a/src/TensorFlowNET.Keras/Layers/Merging/Concatenate.cs b/src/TensorFlowNET.Keras/Layers/Merging/Concatenate.cs index da7e857a2..a2a8286ba 100644 --- a/src/TensorFlowNET.Keras/Layers/Merging/Concatenate.cs +++ b/src/TensorFlowNET.Keras/Layers/Merging/Concatenate.cs @@ -4,6 +4,7 @@ using System.Text; using Tensorflow.Keras.ArgsDefinition; using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Saving; using Tensorflow.Keras.Utils; using static Tensorflow.Binding; using static Tensorflow.KerasApi; @@ -23,7 +24,7 @@ public Concatenate(MergeArgs args) : base(args) this.args = args; } - public override void build(Shape input_shape) + public override void build(KerasShapesWrapper input_shape) { /*var shape_set = new HashSet(); var reduced_inputs_shapes = inputs.Select(x => x.shape).ToArray(); diff --git a/src/TensorFlowNET.Keras/Layers/Merging/Merge.cs b/src/TensorFlowNET.Keras/Layers/Merging/Merge.cs index 3cd43af92..7df654eeb 100644 --- a/src/TensorFlowNET.Keras/Layers/Merging/Merge.cs +++ b/src/TensorFlowNET.Keras/Layers/Merging/Merge.cs @@ -4,6 +4,7 @@ using static Tensorflow.Binding; using Tensorflow.Keras.ArgsDefinition; using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Saving; namespace Tensorflow.Keras.Layers { @@ -14,7 +15,7 @@ public Merge(MergeArgs args) : base(args) } - public override void build(Shape input_shape) + public override void build(KerasShapesWrapper input_shape) { // output_shape = input_shape.dims[1^]; _buildInputShape = input_shape; diff --git a/src/TensorFlowNET.Keras/Layers/Normalization/BatchNormalization.cs b/src/TensorFlowNET.Keras/Layers/Normalization/BatchNormalization.cs index 3b8e1ee8d..d02d2509c 100644 --- a/src/TensorFlowNET.Keras/Layers/Normalization/BatchNormalization.cs +++ b/src/TensorFlowNET.Keras/Layers/Normalization/BatchNormalization.cs @@ -19,6 +19,7 @@ limitations under the License. using System.Linq; using Tensorflow.Keras.ArgsDefinition; using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Saving; using Tensorflow.Keras.Utils; using static Tensorflow.Binding; @@ -53,9 +54,10 @@ public BatchNormalization(BatchNormalizationArgs args) : base(args) axis = args.Axis.dims.Select(x => (int)x).ToArray(); } - public override void build(Shape input_shape) + public override void build(KerasShapesWrapper input_shape) { - var ndims = input_shape.ndim; + var single_shape = input_shape.ToSingleShape(); + var ndims = single_shape.ndim; foreach (var (idx, x) in enumerate(axis)) if (x < 0) args.Axis.dims[idx] = axis[idx] = ndims + x; @@ -74,7 +76,7 @@ public override void build(Shape input_shape) var axis_to_dim = new Dictionary(); foreach (var x in axis) - axis_to_dim[x] = (int)input_shape[x]; + axis_to_dim[x] = (int)single_shape[x]; inputSpec = new InputSpec(ndim: ndims, axes: axis_to_dim); var param_dtype = DType == TF_DataType.DtInvalid ? TF_DataType.TF_FLOAT : DType; diff --git a/src/TensorFlowNET.Keras/Layers/Normalization/LayerNormalization.cs b/src/TensorFlowNET.Keras/Layers/Normalization/LayerNormalization.cs index e19b9c30e..e90c04029 100644 --- a/src/TensorFlowNET.Keras/Layers/Normalization/LayerNormalization.cs +++ b/src/TensorFlowNET.Keras/Layers/Normalization/LayerNormalization.cs @@ -19,6 +19,7 @@ limitations under the License. using System.Linq; using Tensorflow.Keras.ArgsDefinition; using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Saving; using Tensorflow.Keras.Utils; using static Tensorflow.Binding; @@ -49,16 +50,17 @@ public LayerNormalization(LayerNormalizationArgs args) : base(args) axis = args.Axis.axis; } - public override void build(Shape input_shape) + public override void build(KerasShapesWrapper input_shape) { - var ndims = input_shape.ndim; + var single_shape = input_shape.ToSingleShape(); + var ndims = single_shape.ndim; foreach (var (idx, x) in enumerate(axis)) if (x < 0) axis[idx] = ndims + x; var axis_to_dim = new Dictionary(); foreach (var x in axis) - axis_to_dim[x] = (int)input_shape[x]; + axis_to_dim[x] = (int)single_shape[x]; inputSpec = new InputSpec(ndim: ndims, axes: axis_to_dim); var param_dtype = DType == TF_DataType.DtInvalid ? TF_DataType.TF_FLOAT : DType; diff --git a/src/TensorFlowNET.Keras/Layers/Normalization/Normalization.cs b/src/TensorFlowNET.Keras/Layers/Normalization/Normalization.cs new file mode 100644 index 000000000..a65154bf4 --- /dev/null +++ b/src/TensorFlowNET.Keras/Layers/Normalization/Normalization.cs @@ -0,0 +1,175 @@ +/***************************************************************************** + Copyright 2023 Haiping Chen. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +******************************************************************************/ + +using Tensorflow.Keras.ArgsDefinition; +using Tensorflow.Keras.Saving; + +namespace Tensorflow.Keras.Layers +{ + public class Normalization : PreprocessingLayer + { + NormalizationArgs _args; + + int[] axis; + int[] _reduce_axis; + IVariableV1 adapt_mean, adapt_variance, count; + Tensor mean, variance; + Shape _broadcast_shape; + float? input_mean, input_variance; + TF_DataType compute_dtype = tf.float32; + + public Normalization(NormalizationArgs args) : base(args) + { + _args = args; + if (args.Axis == null) + { + axis = new int[0]; + } + else + { + axis = args.Axis.axis; + } + input_mean = args.Mean; + input_variance = args.Variance; + } + + public override void build(KerasShapesWrapper input_shape) + { + base.build(input_shape); + var single_shape = input_shape.ToSingleShape(); + var ndim = single_shape.ndim; + foreach (var (idx, x) in enumerate(axis)) + if (x < 0) + axis[idx] = ndim + x; + + var _keep_axis = axis.Select(d => d >= 0 ? d : d + ndim).ToArray(); + _reduce_axis = range(ndim).Where(d => !_keep_axis.Contains(d)).ToArray(); + var _reduce_axis_mask = range(ndim).Select(d => _keep_axis.Contains(d) ? 0 : 1).ToArray(); + // Broadcast any reduced axes. + _broadcast_shape = new Shape(range(ndim).Select(d => _keep_axis.Contains(d) ? single_shape.dims[d] : 1).ToArray()); + var mean_and_var_shape = _keep_axis.Select(d => single_shape.dims[d]).ToArray(); + + var param_dtype = DType == TF_DataType.DtInvalid ? TF_DataType.TF_FLOAT : DType; + var param_shape = input_shape; + + if(input_mean == null) + { + adapt_mean = add_weight("mean", + mean_and_var_shape, + dtype: tf.float32, + initializer: tf.zeros_initializer, + trainable: false); + + adapt_variance = add_weight("variance", + mean_and_var_shape, + dtype: tf.float32, + initializer: tf.ones_initializer, + trainable: false); + + count = add_weight("count", + Shape.Scalar, + dtype: tf.int64, + initializer: tf.zeros_initializer, + trainable: false); + + finalize_state(); + } + else + { + mean = input_mean * np.ones(mean_and_var_shape); + variance = input_variance * np.ones(mean_and_var_shape); + mean = tf.reshape(mean, _broadcast_shape); + variance = tf.reshape(variance, _broadcast_shape); + mean = tf.cast(mean, compute_dtype); + variance = tf.cast(variance, compute_dtype); + } + } + + public override void reset_state() + { + if (input_mean != null && !built) + { + return; + } + adapt_mean.assign(tf.zeros_like(adapt_mean.AsTensor())); + adapt_variance.assign(tf.ones_like(adapt_variance.AsTensor())); + count.assign(tf.zeros_like(count.AsTensor())); + } + + public override void finalize_state() + { + if (input_mean != null && !built) + { + return; + } + mean = tf.reshape(adapt_mean.AsTensor(), _broadcast_shape); + variance = tf.reshape(adapt_variance.AsTensor(), _broadcast_shape); + } + + public override void update_state(Tensor data) + { + data = tf.cast(data, adapt_mean.dtype); + var (batch_mean, batch_variance) = tf.nn.moments(data, axes: _reduce_axis); + var batch_shape = tf.shape(data, out_type: count.dtype); + + var batch_count = constant_op.constant(1L); + if (_reduce_axis != null) + { + var batch_reduce_shape = tf.gather(batch_shape, constant_op.constant(_reduce_axis)); + batch_count = tf.reduce_prod(batch_reduce_shape); + } + var total_count = batch_count + count.AsTensor(); + var batch_weight = tf.cast(batch_count, dtype: compute_dtype) / tf.cast( + total_count, dtype: compute_dtype); + var existing_weight = 1.0 - batch_weight; + var total_mean = adapt_mean.AsTensor() * existing_weight + batch_mean * batch_weight; + + var total_variance = ( + adapt_variance.AsTensor() + tf.square(adapt_mean.AsTensor() - total_mean) + ) * existing_weight + ( + batch_variance + tf.square(batch_mean - total_mean) + ) * batch_weight; + adapt_mean.assign(total_mean); + adapt_variance.assign(total_variance); + count.assign(total_count); + } + + public override Shape ComputeOutputShape(Shape input_shape) + { + return input_shape; + } + + public override void adapt(Tensor data, int? batch_size = null, int? steps = null) + { + base.adapt(data, batch_size: batch_size, steps: steps); + } + + protected override Tensors Call(Tensors inputs, Tensor state = null, bool? training = null) + { + if (_args.Invert) + { + return mean + ( + inputs * tf.maximum(tf.sqrt(variance), keras.backend.epsilon()) + ); + } + else + { + return (inputs - mean) / tf.maximum( + tf.sqrt(variance), keras.backend.epsilon()); + } + } + } +} diff --git a/src/TensorFlowNET.Keras/Layers/Preprocessing/PreprocessingLayer.cs b/src/TensorFlowNET.Keras/Layers/Preprocessing/PreprocessingLayer.cs index bd86874b2..a032dcd09 100644 --- a/src/TensorFlowNET.Keras/Layers/Preprocessing/PreprocessingLayer.cs +++ b/src/TensorFlowNET.Keras/Layers/Preprocessing/PreprocessingLayer.cs @@ -3,14 +3,95 @@ using System.Text; using Tensorflow.Keras.ArgsDefinition; using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Engine.DataAdapters; namespace Tensorflow.Keras.Layers { public class PreprocessingLayer : Layer { + bool _is_compiled; + bool _is_adapted; + IVariableV1 _steps_per_execution; + PreprocessingLayerArgs _args; public PreprocessingLayer(PreprocessingLayerArgs args) : base(args) { + _args = args; + } + + public override void adapt(Tensor data, int? batch_size = null, int? steps = null) + { + if (!_is_compiled) + { + compile(); + } + + if (built) + { + reset_state(); + } + + var data_handler = new DataHandler(new DataHandlerArgs + { + X = new Tensors(data), + BatchSize = _args.BatchSize, + Epochs = 1, + StepsPerExecution = _steps_per_execution + }); + + foreach (var (epoch, iterator) in data_handler.enumerate_epochs()) + { + foreach (var _ in data_handler.steps()) + { + run_step(iterator); + } + } + finalize_state(); + _is_adapted = true; + } + + private void run_step(OwnedIterator iterator) + { + var data = iterator.next(); + _adapt_maybe_build(data[0]); + update_state(data[0]); + } + + public virtual void reset_state() + { + + } + + public virtual void finalize_state() + { + + } + + public virtual void update_state(Tensor data) + { + + } + + private void _adapt_maybe_build(Tensor data) + { + if (!built) + { + var data_shape = data.shape; + var data_shape_nones = Enumerable.Range(0, data.ndim).Select(x => -1).ToArray(); + _args.BatchInputShape = BatchInputShape ?? new Saving.KerasShapesWrapper(new Shape(data_shape_nones)); + build(new Saving.KerasShapesWrapper(data_shape)); + built = true; + } + } + + public void compile(bool run_eagerly = false, int steps_per_execution = 1) + { + _steps_per_execution = tf.Variable( + steps_per_execution, + dtype: tf.int64, + aggregation: VariableAggregation.OnlyFirstReplica + ); + _is_compiled = true; } } } diff --git a/src/TensorFlowNET.Keras/Layers/Preprocessing/TextVectorization.cs b/src/TensorFlowNET.Keras/Layers/Preprocessing/TextVectorization.cs index 4c52af9ba..6c504006a 100644 --- a/src/TensorFlowNET.Keras/Layers/Preprocessing/TextVectorization.cs +++ b/src/TensorFlowNET.Keras/Layers/Preprocessing/TextVectorization.cs @@ -3,6 +3,7 @@ using System.Text; using Tensorflow.Keras.ArgsDefinition; using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Saving; using static Tensorflow.Binding; namespace Tensorflow.Keras.Layers @@ -35,12 +36,12 @@ public override void adapt(IDatasetV2 data, bool reset_state = true) var shape = data.output_shapes[0]; if (shape.ndim == 1) data = data.map(tensor => array_ops.expand_dims(tensor, -1)); - build(data.variant_tensor.shape); + build(new KerasShapesWrapper(data.variant_tensor.shape)); var preprocessed_inputs = data.map(_preprocess); _index_lookup_layer.adapt(preprocessed_inputs); } - public override void build(Shape input_shape) + public override void build(KerasShapesWrapper input_shape) { base.build(input_shape); } diff --git a/src/TensorFlowNET.Keras/Layers/Reshaping/Cropping1D.cs b/src/TensorFlowNET.Keras/Layers/Reshaping/Cropping1D.cs index 10c15b698..9ead15cb5 100644 --- a/src/TensorFlowNET.Keras/Layers/Reshaping/Cropping1D.cs +++ b/src/TensorFlowNET.Keras/Layers/Reshaping/Cropping1D.cs @@ -1,5 +1,6 @@ using Tensorflow.Keras.ArgsDefinition.Reshaping; using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Saving; namespace Tensorflow.Keras.Layers.Reshaping { @@ -11,7 +12,7 @@ public Cropping1D(Cropping1DArgs args) : base(args) this.args = args; } - public override void build(Shape input_shape) + public override void build(KerasShapesWrapper input_shape) { if (args.cropping.rank != 1) { diff --git a/src/TensorFlowNET.Keras/Layers/Reshaping/Cropping2D.cs b/src/TensorFlowNET.Keras/Layers/Reshaping/Cropping2D.cs index a8d7043ed..087d59a14 100644 --- a/src/TensorFlowNET.Keras/Layers/Reshaping/Cropping2D.cs +++ b/src/TensorFlowNET.Keras/Layers/Reshaping/Cropping2D.cs @@ -1,5 +1,6 @@ using Tensorflow.Keras.ArgsDefinition.Reshaping; using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Saving; namespace Tensorflow.Keras.Layers.Reshaping { @@ -15,7 +16,7 @@ public Cropping2D(Cropping2DArgs args) : base(args) { this.args = args; } - public override void build(Shape input_shape) + public override void build(KerasShapesWrapper input_shape) { built = true; _buildInputShape = input_shape; diff --git a/src/TensorFlowNET.Keras/Layers/Reshaping/Cropping3D.cs b/src/TensorFlowNET.Keras/Layers/Reshaping/Cropping3D.cs index 796c2dd33..04a1af600 100644 --- a/src/TensorFlowNET.Keras/Layers/Reshaping/Cropping3D.cs +++ b/src/TensorFlowNET.Keras/Layers/Reshaping/Cropping3D.cs @@ -1,5 +1,6 @@ using Tensorflow.Keras.ArgsDefinition.Reshaping; using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Saving; namespace Tensorflow.Keras.Layers.Reshaping { @@ -14,7 +15,7 @@ public Cropping3D(Cropping3DArgs args) : base(args) this.args = args; } - public override void build(Shape input_shape) + public override void build(KerasShapesWrapper input_shape) { built = true; _buildInputShape = input_shape; diff --git a/src/TensorFlowNET.Keras/Layers/Reshaping/Permute.cs b/src/TensorFlowNET.Keras/Layers/Reshaping/Permute.cs index 8e7a19a9a..e391775c8 100644 --- a/src/TensorFlowNET.Keras/Layers/Reshaping/Permute.cs +++ b/src/TensorFlowNET.Keras/Layers/Reshaping/Permute.cs @@ -5,6 +5,7 @@ using Tensorflow.Keras.Utils; using static Tensorflow.Binding; using Tensorflow.Keras.ArgsDefinition; +using Tensorflow.Keras.Saving; namespace Tensorflow.Keras.Layers { public class Permute : Layer @@ -14,14 +15,15 @@ public Permute(PermuteArgs args) : base(args) { this.dims = args.dims; } - public override void build(Shape input_shape) + public override void build(KerasShapesWrapper input_shape) { - var rank = input_shape.rank; + var single_shape = input_shape.ToSingleShape(); + var rank = single_shape.rank; if (dims.Length != rank - 1) { throw new ValueError("Dimensions must match."); } - permute = new int[input_shape.rank]; + permute = new int[single_shape.rank]; dims.CopyTo(permute, 1); built = true; _buildInputShape = input_shape; diff --git a/src/TensorFlowNET.Keras/Layers/Rnn/RNN.cs b/src/TensorFlowNET.Keras/Layers/Rnn/RNN.cs index 6b755ecee..310e80574 100644 --- a/src/TensorFlowNET.Keras/Layers/Rnn/RNN.cs +++ b/src/TensorFlowNET.Keras/Layers/Rnn/RNN.cs @@ -3,6 +3,7 @@ using Tensorflow.Keras.ArgsDefinition; using Tensorflow.Keras.ArgsDefinition.Rnn; using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Saving; // from tensorflow.python.distribute import distribution_strategy_context as ds_context; namespace Tensorflow.Keras.Layers.Rnn @@ -36,7 +37,7 @@ public RNN(RNNArgs args) : base(PreConstruct(args)) //} } - public override void build(Shape input_shape) + public override void build(KerasShapesWrapper input_shape) { if (!cell.Built) { diff --git a/src/TensorFlowNET.Keras/Layers/Rnn/SimpleRNN.cs b/src/TensorFlowNET.Keras/Layers/Rnn/SimpleRNN.cs index 19669b4b9..2d7aab70e 100644 --- a/src/TensorFlowNET.Keras/Layers/Rnn/SimpleRNN.cs +++ b/src/TensorFlowNET.Keras/Layers/Rnn/SimpleRNN.cs @@ -1,5 +1,6 @@ using System.Data; using Tensorflow.Keras.ArgsDefinition.Rnn; +using Tensorflow.Keras.Saving; using Tensorflow.Operations.Activation; using static HDF.PInvoke.H5Z; using static Tensorflow.ApiDef.Types; @@ -14,12 +15,13 @@ public SimpleRNN(SimpleRNNArgs args) : base(args) this.args = args; } - public override void build(Shape input_shape) + public override void build(KerasShapesWrapper input_shape) { - var input_dim = input_shape[-1]; + var single_shape = input_shape.ToSingleShape(); + var input_dim = single_shape[-1]; _buildInputShape = input_shape; - kernel = add_weight("kernel", (input_shape[-1], args.Units), + kernel = add_weight("kernel", (single_shape[-1], args.Units), initializer: args.KernelInitializer //regularizer = self.kernel_regularizer, //constraint = self.kernel_constraint, diff --git a/src/TensorFlowNET.Keras/Layers/Rnn/SimpleRNNCell.cs b/src/TensorFlowNET.Keras/Layers/Rnn/SimpleRNNCell.cs index 9e5af450b..46061b211 100644 --- a/src/TensorFlowNET.Keras/Layers/Rnn/SimpleRNNCell.cs +++ b/src/TensorFlowNET.Keras/Layers/Rnn/SimpleRNNCell.cs @@ -3,6 +3,7 @@ using System.Text; using Tensorflow.Keras.ArgsDefinition.Rnn; using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Saving; namespace Tensorflow.Keras.Layers.Rnn { @@ -18,11 +19,12 @@ public SimpleRNNCell(SimpleRNNArgs args) : base(args) this.args = args; } - public override void build(Shape input_shape) + public override void build(KerasShapesWrapper input_shape) { - var input_dim = input_shape[-1]; + var single_shape = input_shape.ToSingleShape(); + var input_dim = single_shape[-1]; - kernel = add_weight("kernel", (input_shape[-1], args.Units), + kernel = add_weight("kernel", (single_shape[-1], args.Units), initializer: args.KernelInitializer ); diff --git a/src/TensorFlowNET.Keras/Layers/TensorFlowOpLayer.cs b/src/TensorFlowNET.Keras/Layers/TensorFlowOpLayer.cs index c7b9157bf..1ac4a277c 100644 --- a/src/TensorFlowNET.Keras/Layers/TensorFlowOpLayer.cs +++ b/src/TensorFlowNET.Keras/Layers/TensorFlowOpLayer.cs @@ -84,8 +84,8 @@ Tensors MakOp(Tensors inputs) inputs.Insert(index, value); } - var (c_op, _) = ops._create_c_op(graph, node_def, inputs.ToArray(), new Operation[0]); - var op = graph._create_op_from_tf_operation(c_op); + var (c_op, op_desc) = ops._create_c_op(graph, node_def, inputs.ToArray(), new Operation[0]); + var op = graph._create_op_from_tf_operation(c_op, desc: op_desc); op._control_flow_post_processing(); // Record the gradient because custom-made ops don't go through the diff --git a/src/TensorFlowNET.Keras/Losses/SparseCategoricalCrossentropy.cs b/src/TensorFlowNET.Keras/Losses/SparseCategoricalCrossentropy.cs index b72412265..4e2790ab1 100644 --- a/src/TensorFlowNET.Keras/Losses/SparseCategoricalCrossentropy.cs +++ b/src/TensorFlowNET.Keras/Losses/SparseCategoricalCrossentropy.cs @@ -4,17 +4,21 @@ namespace Tensorflow.Keras.Losses { public class SparseCategoricalCrossentropy : LossFunctionWrapper, ILossFunc { + private bool _from_logits = false; public SparseCategoricalCrossentropy( bool from_logits = false, string reduction = null, string name = null) : - base(reduction: reduction, name: name == null ? "sparse_categorical_crossentropy" : name){ } + base(reduction: reduction, name: name == null ? "sparse_categorical_crossentropy" : name) + { + _from_logits = from_logits; + } public override Tensor Apply(Tensor target, Tensor output, bool from_logits = false, int axis = -1) { target = tf.cast(target, dtype: TF_DataType.TF_INT64); - if (!from_logits) + if (!_from_logits) { var epsilon = tf.constant(KerasApi.keras.backend.epsilon(), output.dtype); output = tf.clip_by_value(output, epsilon, 1 - epsilon); diff --git a/src/TensorFlowNET.Keras/Models/ModelsApi.cs b/src/TensorFlowNET.Keras/Models/ModelsApi.cs index 6597f5cdc..44dca58d0 100644 --- a/src/TensorFlowNET.Keras/Models/ModelsApi.cs +++ b/src/TensorFlowNET.Keras/Models/ModelsApi.cs @@ -9,12 +9,12 @@ namespace Tensorflow.Keras.Models { - public class ModelsApi + public class ModelsApi: IModelsApi { - public Functional from_config(ModelConfig config) + public Functional from_config(FunctionalConfig config) => Functional.from_config(config); - public Model load_model(string filepath, bool compile = true, LoadOptions? options = null) + public IModel load_model(string filepath, bool compile = true, LoadOptions? options = null) { return KerasLoadModelUtils.load_model(filepath, compile: compile, options: options) as Model; } diff --git a/src/TensorFlowNET.Keras/Optimizers/IOptimizer.cs b/src/TensorFlowNET.Keras/Optimizers/IOptimizer.cs deleted file mode 100644 index b6099baf3..000000000 --- a/src/TensorFlowNET.Keras/Optimizers/IOptimizer.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Tensorflow.Keras.Optimizers -{ - public interface IOptimizer - { - } -} diff --git a/src/TensorFlowNET.Keras/Optimizers/OptimizerApi.cs b/src/TensorFlowNET.Keras/Optimizers/OptimizerApi.cs index c8e69bc88..31eb88be7 100644 --- a/src/TensorFlowNET.Keras/Optimizers/OptimizerApi.cs +++ b/src/TensorFlowNET.Keras/Optimizers/OptimizerApi.cs @@ -1,8 +1,9 @@ using Tensorflow.Keras.ArgsDefinition; +using Tensorflow.Keras.Engine; namespace Tensorflow.Keras.Optimizers { - public class OptimizerApi + public class OptimizerApi: IOptimizerApi { /// /// Adam optimization is a stochastic gradient descent method that is based on @@ -15,7 +16,7 @@ public class OptimizerApi /// /// /// - public OptimizerV2 Adam(float learning_rate = 0.001f, + public IOptimizer Adam(float learning_rate = 0.001f, float beta_1 = 0.9f, float beta_2 = 0.999f, float epsilon = 1e-7f, @@ -38,7 +39,7 @@ public OptimizerV2 Adam(float learning_rate = 0.001f, /// /// /// - public OptimizerV2 RMSprop(float learning_rate = 0.001f, + public IOptimizer RMSprop(float learning_rate = 0.001f, float rho = 0.9f, float momentum = 0.0f, float epsilon = 1e-7f, @@ -54,7 +55,7 @@ public OptimizerV2 RMSprop(float learning_rate = 0.001f, Name = name }); - public SGD SGD(float learning_rate) + public IOptimizer SGD(float learning_rate) => new SGD(learning_rate); } } diff --git a/src/TensorFlowNET.Keras/Optimizers/OptimizerV2.cs b/src/TensorFlowNET.Keras/Optimizers/OptimizerV2.cs index a52c5ada5..1e4dbe086 100644 --- a/src/TensorFlowNET.Keras/Optimizers/OptimizerV2.cs +++ b/src/TensorFlowNET.Keras/Optimizers/OptimizerV2.cs @@ -1,10 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Tensorflow.Keras.ArgsDefinition; +using Tensorflow.Keras.ArgsDefinition; +using Tensorflow.Keras.Engine; using Tensorflow.Keras.Utils; using Tensorflow.Train; -using static Tensorflow.Binding; namespace Tensorflow.Keras.Optimizers { @@ -17,11 +14,11 @@ public class OptimizerV2 : Trackable, IOptimizer protected bool _hypers_created; protected virtual string _name { get; } - IVariableV1 _iterations; + protected IVariableV1 _iterations; protected ResourceVariable iterations => _iterations as ResourceVariable; List _weights; - Dictionary _hyper; - Dictionary _hyper_variables; + protected Dictionary _hyper; + protected Dictionary _hyper_variables; protected bool _momentum; protected float _initial_decay = 0.0f; protected bool _use_locking = true; @@ -45,6 +42,42 @@ public OptimizerV2(OptimizerV2Args args) : base() _set_hyper("decay", args.InitialDecay); } + public void apply_gradients((Tensor, IVariableV1) grads_and_vars, + string name = null, + bool experimental_aggregate_gradients = true) + => apply_gradients(new[] { grads_and_vars }, + name: name, + experimental_aggregate_gradients: experimental_aggregate_gradients); + + /// + /// Apply gradients to variables. + /// + /// + /// + /// + public void apply_gradients(IEnumerable<(Tensor, IVariableV1)> grads_and_vars, + string name = null, + bool experimental_aggregate_gradients = true) + { + var var_list = grads_and_vars.Select(x => x.Item2).ToArray(); + tf_with(ops.name_scope(_name), delegate + { + ops.init_scope(); + _create_all_weights(var_list); + if (grads_and_vars == null || grads_and_vars.Count() == 0) + return control_flow_ops.no_op(); + + var apply_state = _prepare(var_list); + // if(experimental_aggregate_gradients) + { + // var reduced_grads = _aggregate_gradients(grads_and_vars); + _distributed_apply(grads_and_vars, name, apply_state); + } + + return null; + }); + } + public void apply_gradients((Tensor, ResourceVariable) grads_and_vars, string name = null, bool experimental_aggregate_gradients = true) @@ -74,14 +107,14 @@ public void apply_gradients(IEnumerable<(Tensor, ResourceVariable)> grads_and_va // if(experimental_aggregate_gradients) { // var reduced_grads = _aggregate_gradients(grads_and_vars); - _distributed_apply(grads_and_vars, name, apply_state); + _distributed_apply(grads_and_vars.Select(x => (x.Item1, (IVariableV1)x.Item2)), name, apply_state); } return null; }); } - void apply_grad_to_update_var(ResourceVariable var, Tensor grad, Dictionary> apply_state) + void apply_grad_to_update_var(IVariableV1 var, Tensor grad, Dictionary> apply_state) { _resource_apply_dense(var, grad, apply_state); // if var.constraint is not None: @@ -96,7 +129,7 @@ protected virtual Operation _resource_apply_dense(IVariableV1 var, throw new NotImplementedException("_resource_apply_dense"); } - void _distributed_apply(IEnumerable<(Tensor, ResourceVariable)> grads_and_vars, + void _distributed_apply(IEnumerable<(Tensor, IVariableV1)> grads_and_vars, string name, Dictionary> _apply_state) { @@ -114,12 +147,12 @@ void _distributed_apply(IEnumerable<(Tensor, ResourceVariable)> grads_and_vars, }); } - public Tensor[] _aggregate_gradients(IEnumerable<(Tensor, IVariableV1)> grads_and_vars) + public Tensor[] aggregate_gradients(IEnumerable<(Tensor, IVariableV1)> grads_and_vars) { return grads_and_vars.Select(x => x.Item1).ToArray(); } - public Tensor[] _clip_gradients(Tensor[] grads) + public Tensor[] clip_gradients(Tensor[] grads) { return grads; } @@ -227,7 +260,7 @@ protected virtual void _create_slots(IVariableV1[] var_list) } } - protected IVariableV1 add_slot(IVariableV1 var, string slot_name, IInitializer initializer = null) + public IVariableV1 add_slot(IVariableV1 var, string slot_name, IInitializer initializer = null) { if (initializer == null) initializer = tf.zeros_initializer; diff --git a/src/TensorFlowNET.Keras/Optimizers/RestoredOptimizer.cs b/src/TensorFlowNET.Keras/Optimizers/RestoredOptimizer.cs new file mode 100644 index 000000000..e5cfd2daa --- /dev/null +++ b/src/TensorFlowNET.Keras/Optimizers/RestoredOptimizer.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Tensorflow.Keras.Saving; +using Tensorflow.Train; +using Tensorflow.Training; + +namespace Tensorflow.Keras.Optimizers +{ + public class RestoredOptimizer: OptimizerV2, ITrackableWrapper, IKerasConfig + { + public String Identifier { get; } = "optimizer"; + public int Version { get; } = 2; + public int MinConsumerVersion { get; } = 1; + public int MinProducerVersion { get; } = 1; + public RestoredOptimizer(): base(new ArgsDefinition.OptimizerV2Args() { Name = "RestoredOptimizer" }) + { + _hypers_created = true; + } + + public IKerasConfig get_config() + { + throw new NotImplementedException("Restoring functional Optimizers from SavedModels is not currently " + + "supported. Please file a feature request if this limitation bothers you."); + } + + public void SetValue(object name, object value) + { + if(name is not String str) + { + throw new TypeError($"The name of value to set must be string, but got {name.GetType()}"); + } + if(value is Trackable trackable) + { + _track_trackable(trackable, str, overwrite: true); + } + if(value is IVariableV1 resource_variable) + { + if (!_hyper_variables.ContainsKey(str)) + { + _hyper_variables[str] = resource_variable; + } + else + { + keras.backend.set_value(resource_variable, value); + } + } + else if (value is float f) + { + _hyper[str] = f; + } + else + { + throw new NotImplementedException(); + } + } + + public Trackable FromProto(SavedUserObject proto) + { + return new RestoredOptimizer(); + } + } +} diff --git a/src/TensorFlowNET.Keras/Saving/KerasMetaData.cs b/src/TensorFlowNET.Keras/Saving/KerasMetaData.cs index e98398503..9c82370a9 100644 --- a/src/TensorFlowNET.Keras/Saving/KerasMetaData.cs +++ b/src/TensorFlowNET.Keras/Saving/KerasMetaData.cs @@ -8,17 +8,37 @@ namespace Tensorflow.Keras.Saving { public class KerasMetaData { + [JsonProperty("name")] public string Name { get; set; } [JsonProperty("class_name")] public string ClassName { get; set; } + [JsonProperty("trainable")] + public bool Trainable { get; set; } + [JsonProperty("dtype")] + public TF_DataType DType { get; set; } = TF_DataType.DtInvalid; [JsonProperty("is_graph_network")] public bool IsGraphNetwork { get; set; } [JsonProperty("shared_object_id")] public int SharedObjectId { get; set; } [JsonProperty("must_restore_from_config")] public bool MustRestoreFromConfig { get; set; } + [JsonProperty("config")] public JObject Config { get; set; } [JsonProperty("build_input_shape")] - public TensorShapeConfig BuildInputShape { get; set; } + public KerasShapesWrapper BuildInputShape { get; set; } + [JsonProperty("batch_input_shape")] + public KerasShapesWrapper BatchInputShape { get; set; } + [JsonProperty("activity_regularizer")] + public IRegularizer ActivityRegularizer { get; set; } + [JsonProperty("input_spec")] + public JToken InputSpec { get; set; } + [JsonProperty("stateful")] + public bool? Stateful { get; set; } + [JsonProperty("model_config")] + public KerasModelConfig? ModelConfig { get; set; } + [JsonProperty("sparse")] + public bool Sparse { get; set; } + [JsonProperty("ragged")] + public bool Ragged { get; set; } } } diff --git a/src/TensorFlowNET.Keras/Saving/KerasModelConfig.cs b/src/TensorFlowNET.Keras/Saving/KerasModelConfig.cs new file mode 100644 index 000000000..256c284a5 --- /dev/null +++ b/src/TensorFlowNET.Keras/Saving/KerasModelConfig.cs @@ -0,0 +1,16 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow.Keras.Saving +{ + public class KerasModelConfig + { + [JsonProperty("class_name")] + public string ClassName { get; set; } + [JsonProperty("config")] + public JObject Config { get; set; } + } +} diff --git a/src/TensorFlowNET.Keras/Saving/KerasObjectLoader.cs b/src/TensorFlowNET.Keras/Saving/KerasObjectLoader.cs index fffc2bac0..a26879e0c 100644 --- a/src/TensorFlowNET.Keras/Saving/KerasObjectLoader.cs +++ b/src/TensorFlowNET.Keras/Saving/KerasObjectLoader.cs @@ -1,12 +1,15 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; +using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Text.RegularExpressions; +using Tensorflow.Extensions; +using Tensorflow.Framework.Models; using Tensorflow.Keras.ArgsDefinition; using Tensorflow.Keras.Engine; using Tensorflow.Keras.Layers; @@ -17,6 +20,8 @@ using Tensorflow.Keras.Utils; using Tensorflow.Train; using Tensorflow.Training; +using Tensorflow.Training.Saving.SavedModel; +using Tensorflow.Util; using ThirdParty.Tensorflow.Python.Keras.Protobuf; using static Tensorflow.ApiDef.Types; using static Tensorflow.Binding; @@ -26,7 +31,7 @@ namespace Tensorflow.Keras.Saving { public class KerasObjectLoader { - private static readonly IDictionary PUBLIC_ATTRIBUTES = new CommonEndPoints().CheckpointableObjects; + internal static readonly IDictionary PUBLIC_ATTRIBUTES; private SavedMetadata _metadata; private SavedObjectGraph _proto; private Dictionary _node_paths = new Dictionary(); @@ -39,7 +44,13 @@ public class KerasObjectLoader static KerasObjectLoader() { - PUBLIC_ATTRIBUTES[Keras.Saving.SavedModel.Constants.KERAS_ATTR] = null; + var endPoints = new CommonEndPoints(); + PUBLIC_ATTRIBUTES = new Dictionary(); + foreach (var key in endPoints._all_checkpointable_objects.Concat(endPoints._all_functions)) + { + PUBLIC_ATTRIBUTES[key] = null; + } + PUBLIC_ATTRIBUTES[SavedModel.Constants.KERAS_ATTR] = null; } public KerasObjectLoader(SavedMetadata metadata, SavedObjectGraph object_graph_def) @@ -125,8 +136,14 @@ public void finalize_objects() continue; } - // TODO: deal with `RevivedLayer` and `RevivedInputLayer`. - layers_revived_from_config.Add(node as Layer); + if(node is RevivedLayer or RevivedInputLayer) + { + layers_revived_from_saved_model.Add(node as Layer); + } + else + { + layers_revived_from_config.Add(node as Layer); + } } _finalize_saved_model_layers(layers_revived_from_saved_model); @@ -135,6 +152,39 @@ public void finalize_objects() _reconstruct_all_models(); } + /// + /// Removes tracked references that are only used when loading the model. + /// Now that the node object has been fully loaded, and the checkpoint has + /// been restored, the object no longer needs to track objects added from + /// SerializedAttributes. (Note that saving a training checkpoint still + /// functions correctly, because layers and variables are tracked + /// separately by the Layer object.) + /// + public void del_tracking() + { + foreach(var (node, _) in loaded_nodes.Values) + { + if(node is not Layer layer) + { + continue; + } + foreach(var name in PUBLIC_ATTRIBUTES.Keys) + { + layer._delete_tracking(name); + } + if(node is Functional functional) + { + foreach(var name in functional.UnconditionalDependencyNames.Keys) + { + if(Regex.Match(name, @"^layer(_with_weights)?-[\d+]").Success) + { + functional._delete_tracking(name); + } + } + } + } + } + private void _reconstruct_all_models() { HashSet all_initialized_models = new(); @@ -171,16 +221,17 @@ private void _reconstruct_model(int model_id, Model model, List layers) // TODO(Rinne): implement it } } - - // `model.__init__(layers, config["name"])` - s.InitLayers(layers); + + // `model.__init__(layers, config["name"])`InitLayers(layers); + s.InitLayers(layers.Select(x => x as ILayer)); s.Name = config["name"].ToObject(); - if(s.input is null || s.input.Length == 0) + if(s.inputs is null || s.inputs.Length == 0) { var first_layer = _get_child_layer_node_ids(model_id)[0]; var input_specs = _infer_inputs(first_layer); - var input_shapes = _infer_inputs(first_layer, true); + var input_shapes = _infer_input_shapes(first_layer); // `model._set_inputs(input_specs)` + s._set_inputs(input_specs); // skip the check of input_specs is Dictionary if (!s.Built) @@ -205,7 +256,12 @@ private void _reconstruct_model(int model_id, Model model, List layers) private void _set_network_attributes_from_metadata(Model revived_object) { - // TODO: implement it. + var metadata = revived_object.SerializedAttributes["metadata"] as KerasMetaData; + if (metadata.DType != TF_DataType.DtInvalid) + { + // TODO(Rinne): set_dtype_policy. + } + revived_object.args.Trainable = metadata.Trainable; } /// @@ -233,6 +289,25 @@ private void _finalize_config_layers(List layers) /// private void _finalize_saved_model_layers(List layers) { + foreach(var layer in layers) + { + layer.Built = true; + var keras_attr = _get_keras_attr(layer); + if(keras_attr is not Trackable trackable) + { + continue; + } + if (trackable.CustomizedFields.TryGetValue("call_and_return_conditional_losses", out var layer_call)) + { + Debug.Assert(layer_call is RestoredFunction); + var concrete_functions = ((RestoredFunction)layer_call).ConcreteFunctions; + if (concrete_functions is not null && concrete_functions.Count() > 0) + { + layer.ReplacedCall = use_wrapped_call(layer, ((RestoredFunction)layer_call).Apply); + } + } + } + foreach(var layer in layers) { // TODO(Rinne): deal with `RevivedNetwork`. @@ -243,6 +318,12 @@ private void _finalize_saved_model_layers(List layers) } } + private Func use_wrapped_call(Layer layer, Func call) + { + // TODO(Rinne): revise it. + return call; + } + private void _restore_layer_unconditional_losses(Layer layer) { // TODO(Rinne): implement it. @@ -309,7 +390,11 @@ private void _unblock_model_reconstruction(int layer_id, Layer layer) var (obj, setter) = _revive_from_config(identifier, metadata, node_id); if (obj is null) { - (obj, setter) = _revive_custom_object(identifier, metadata); + (obj, setter) = revive_custom_object(identifier, metadata); + } + if(obj is null) + { + throw new ValueError($"Cannot revive {metadata.Name} from the config or customized object."); } Debug.Assert(obj is Layer); _maybe_add_serialized_attributes(obj as Layer, metadata); @@ -326,7 +411,7 @@ private void _unblock_model_reconstruction(int layer_id, Layer layer) private (Trackable, Action) _revive_from_config(string identifier, KerasMetaData metadata, int node_id) { Trackable obj; - if(identifier == Keras.Saving.SavedModel.Constants.METRIC_IDENTIFIER) + if(identifier == SavedModel.Constants.METRIC_IDENTIFIER) { // TODO(Rinne): implement it. return (null, null); @@ -347,10 +432,25 @@ private void _unblock_model_reconstruction(int layer_id, Layer layer) return (obj, setter); } - private (Trackable, Action) _revive_custom_object(string identifier, KerasMetaData metadata) + private (Trackable, Action) revive_custom_object(string identifier, KerasMetaData metadata) { - // TODO(Rinne): implement it. - throw new NotImplementedException(); + if (identifier == SavedModel.Constants.LAYER_IDENTIFIER) + { + return RevivedLayer.init_from_metadata(metadata); + } + else if(identifier == SavedModel.Constants.MODEL_IDENTIFIER || identifier == SavedModel.Constants.SEQUENTIAL_IDENTIFIER + || identifier == SavedModel.Constants.NETWORK_IDENTIFIER) + { + return RevivedNetwork.init_from_metadata(metadata); + } + else if(identifier == SavedModel.Constants.INPUT_LAYER_IDENTIFIER) + { + return RevivedInputLayer.init_from_metadata(metadata); + } + else + { + throw new ValueError($"Cannot revive the layer {identifier}."); + } } Model _revive_graph_network(string identifier, KerasMetaData metadata, int node_id) @@ -380,7 +480,7 @@ Model _revive_graph_network(string identifier, KerasMetaData metadata, int node_ } else { - model = new Functional(new Tensors(), new Tensors(), config["name"].ToObject()); + model = new Functional(new Tensors(), new Tensors(), config.TryGetOrReturnNull("name")); } // Record this model and its layers. This will later be used to reconstruct @@ -403,9 +503,13 @@ Layer _revive_layer_or_model_from_config(KerasMetaData metadata, int node_id) var obj = generic_utils.deserialize_keras_object(class_name, config); + if(obj is null) + { + return null; + } obj.Name = metadata.Name; // TODO(Rinne): add `trainable`, `dtype`, `stateful` and `save_spec` - + var built = _try_build_layer(obj, node_id, metadata.BuildInputShape); if (!built) @@ -415,37 +519,30 @@ Layer _revive_layer_or_model_from_config(KerasMetaData metadata, int node_id) return obj; } - private void _revive_setter(object layer, object name, object value) + private void _revive_setter(object obj, object name, object value) { Debug.Assert(name is string); - Debug.Assert(layer is Layer); + Debug.Assert(obj is Layer); + Layer layer = (Layer)obj; if(PUBLIC_ATTRIBUTES.ContainsKey(name as string)) { if(value is Trackable) { - (layer as Layer)._track_trackable(value as Trackable, name as string); + layer._track_trackable(value as Trackable, name as string); } - if((layer as Layer).SerializedAttributes is null) + if(layer.SerializedAttributes is null) { - (layer as Layer).SerializedAttributes = new JObject(); + layer.SerializedAttributes = new Dictionary(); } - (layer as Layer).SerializedAttributes[name as string] = JToken.FromObject(value); + layer.SerializedAttributes[name as string] = value; } - else if(layer is Functional && Regex.Match(name as string, @"^layer(_with_weights)?-[\d+]").Success) + else if(layer is Functional functional && Regex.Match(name as string, @"^layer(_with_weights)?-[\d+]").Success) { - (layer as Functional)._track_trackable(value as Trackable, name as string, overwrite: true); + functional._track_trackable(value as Trackable, name as string, overwrite: true); } else { - var properties = layer.GetType().GetProperties(); - foreach(var p in properties) - { - if(p.Name == name as string && p.GetValue(layer) is not null) - { - return; - } - } - Loader.setattr(layer, name, value); + layer.SetAttr(name as string, value); } } @@ -507,7 +604,7 @@ void _add_children_recreated_from_config(Trackable obj, SavedObject proto, int n } var metric_list_node_id = _search_for_child_node(node_id, new string[] { - Keras.Saving.SavedModel.Constants.KERAS_ATTR, "layer_metrics" + SavedModel.Constants.KERAS_ATTR, "layer_metrics" }); if(metric_list_node_id is not null && obj is Model model && model.metrics is not null) { @@ -533,7 +630,7 @@ void _add_children_recreated_from_config(Trackable obj, SavedObject proto, int n // skip the check for registered identifier Action setter; - if (Keras.Saving.SavedModel.Constants.KERAS_OBJECT_IDENTIFIERS.Contains(obj_child.ObjectIdentifier)) + if (SavedModel.Constants.KERAS_OBJECT_IDENTIFIERS.Contains(obj_child.ObjectIdentifier)) { setter = _revive_setter; } @@ -565,14 +662,14 @@ void _add_children_recreated_from_config(Trackable obj, SavedObject proto, int n } } - private bool _try_build_layer(Layer obj, int node_id, Shape build_input_shape) + private bool _try_build_layer(Layer obj, int node_id, KerasShapesWrapper build_input_shape) { if (obj.Built) return true; if(build_input_shape is null) { - build_input_shape = _infer_inputs(node_id, convert_to_shapes: true); + build_input_shape = _infer_input_shapes(node_id); } if(build_input_shape is not null) @@ -598,7 +695,7 @@ private bool _try_build_layer(Layer obj, int node_id, Shape build_input_shape) /// /// /// - private Shape _infer_inputs(int layer_node_id, bool convert_to_shapes = false) + private TensorSpec _infer_inputs(int layer_node_id) { var call_fn_id = _search_for_child_node(layer_node_id, new string[] { "call_and_return_all_conditional_losses" }); if(call_fn_id is null) @@ -613,7 +710,22 @@ private Shape _infer_inputs(int layer_node_id, bool convert_to_shapes = false) } var call_fn_name = concrete_functions[0]; var call_fn_proto = _proto.ConcreteFunctions[call_fn_name]; - throw new NotImplementedException("Not implemented, please submit an issue to https://github.com/SciSharp/TensorFlow.NET/issues."); + var structured_input_signature = nested_structure_coder.decode_proto(call_fn_proto.CanonicalizedInputSignature); + Debug.Assert(structured_input_signature is IEnumerable); + var first_enumerator = (structured_input_signature as IEnumerable).GetEnumerator(); + first_enumerator.MoveNext(); + var first = first_enumerator.Current; + Debug.Assert(first is IEnumerable); + var inputs_enumerator = (first as IEnumerable).GetEnumerator(); + inputs_enumerator.MoveNext(); + var inputs = inputs_enumerator.Current as TensorSpec; + return inputs; + } + + private KerasShapesWrapper _infer_input_shapes(int layer_node_id) + { + var inputs = _infer_inputs(layer_node_id); + return new KerasShapesWrapper(nest.map_structure(x => x.shape, inputs)); } private int? _search_for_child_node(int parent_id, IEnumerable path_to_child) @@ -645,7 +757,23 @@ private bool _is_graph_network(Layer layer) private void _maybe_add_serialized_attributes(Layer layer, KerasMetaData metadata) { - // TODO: deal with `RevivedLayer` + if(layer.SerializedAttributes is null || layer.SerializedAttributes.Count == 0) + { + layer.SerializedAttributes = new Dictionary(); + layer.SerializedAttributes["metadata"] = metadata; + } + } + + private static object _get_keras_attr(Layer layer) + { + if((layer.SerializedAttributes ?? new Dictionary()).TryGetValue(SavedModel.Constants.KERAS_ATTR, out var value)) + { + return value; + } + else + { + return null; + } } /// diff --git a/src/TensorFlowNET.Keras/Saving/SavedModel/ReviveUtils.cs b/src/TensorFlowNET.Keras/Saving/SavedModel/ReviveUtils.cs new file mode 100644 index 000000000..6970b04e5 --- /dev/null +++ b/src/TensorFlowNET.Keras/Saving/SavedModel/ReviveUtils.cs @@ -0,0 +1,55 @@ +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Text; +using System.Text.RegularExpressions; +using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Utils; +using Tensorflow.Train; + +namespace Tensorflow.Keras.Saving.SavedModel +{ + internal static class ReviveUtils + { + public static T recursively_deserialize_keras_object(JToken config) + { + throw new NotImplementedException(); + if(config is JObject jobject) + { + if (jobject.ContainsKey("class_name")) + { + + } + } + } + + public static void _revive_setter(object obj, object name, object value) + { + Debug.Assert(name is string); + Debug.Assert(obj is Layer); + Layer layer = (Layer)obj; + if (KerasObjectLoader.PUBLIC_ATTRIBUTES.ContainsKey(name as string)) + { + if (value is Trackable trackable) + { + layer._track_trackable(trackable, name as string); + } + if (layer.SerializedAttributes is null) + { + layer.SerializedAttributes = new Dictionary(); + } + layer.SerializedAttributes[name as string] = value; + } + else if (layer is Functional functional && Regex.Match(name as string, @"^layer(_with_weights)?-[\d+]").Success) + { + Debug.Assert(value is Trackable); + functional._track_trackable(value as Trackable, name as string); + } + else + { + layer.SetAttr(name as string, value); + } + } + } +} diff --git a/src/TensorFlowNET.Keras/Saving/SavedModel/RevivedConfig.cs b/src/TensorFlowNET.Keras/Saving/SavedModel/RevivedConfig.cs new file mode 100644 index 000000000..036d517b1 --- /dev/null +++ b/src/TensorFlowNET.Keras/Saving/SavedModel/RevivedConfig.cs @@ -0,0 +1,37 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow.Keras.Saving.SavedModel +{ + [JsonConverter(typeof(CustomizedRevivedConfigJsonConverter))] + public class RevivedConfig: IKerasConfig + { + public JObject Config { get; set; } + } + + public class CustomizedRevivedConfigJsonConverter : JsonConverter + { + public override bool CanConvert(Type objectType) + { + return objectType == typeof(RevivedConfig); + } + + public override bool CanRead => true; + + public override bool CanWrite => true; + + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) + { + ((RevivedConfig)value).Config.WriteTo(writer); + } + + public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) + { + var config = (JObject)serializer.Deserialize(reader, typeof(JObject)); + return new RevivedConfig() { Config = config }; + } + } +} diff --git a/src/TensorFlowNET.Keras/Saving/SavedModel/RevivedInputLayer.cs b/src/TensorFlowNET.Keras/Saving/SavedModel/RevivedInputLayer.cs new file mode 100644 index 000000000..e2cad8a37 --- /dev/null +++ b/src/TensorFlowNET.Keras/Saving/SavedModel/RevivedInputLayer.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Tensorflow.Keras.ArgsDefinition; +using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Layers; + +namespace Tensorflow.Keras.Saving.SavedModel +{ + public class RevivedInputLayer: InputLayer + { + protected RevivedConfig _config = null; + private RevivedInputLayer(InputLayerArgs args): base(args) + { + + } + + public override IKerasConfig get_config() + { + return _config; + } + + public static (RevivedInputLayer, Action) init_from_metadata(KerasMetaData metadata) + { + InputLayerArgs args = new InputLayerArgs() + { + Name = metadata.Name, + DType = metadata.DType, + Sparse = metadata.Sparse, + Ragged = metadata.Ragged, + BatchInputShape = metadata.BatchInputShape + }; + + RevivedInputLayer revived_obj = new RevivedInputLayer(args); + + revived_obj._config = new RevivedConfig() { Config = metadata.Config }; + + return (revived_obj, Loader.setattr); + } + + public override string ToString() + { + return $"Customized keras input layer: {Name}."; + } + } +} diff --git a/src/TensorFlowNET.Keras/Saving/SavedModel/RevivedLayer.cs b/src/TensorFlowNET.Keras/Saving/SavedModel/RevivedLayer.cs new file mode 100644 index 000000000..51e367ce8 --- /dev/null +++ b/src/TensorFlowNET.Keras/Saving/SavedModel/RevivedLayer.cs @@ -0,0 +1,88 @@ +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Text; +using Tensorflow.Keras.ArgsDefinition; +using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Utils; +using Tensorflow.Keras.Saving.SavedModel; + +namespace Tensorflow.Keras.Saving.SavedModel +{ + public class RevivedLayer: Layer + { + public static (RevivedLayer, Action) init_from_metadata(KerasMetaData metadata) + { + LayerArgs args = new LayerArgs() + { + Name = metadata.Name, + Trainable = metadata.Trainable + }; + if(metadata.DType != TF_DataType.DtInvalid) + { + args.DType = metadata.DType; + } + if(metadata.BatchInputShape is not null) + { + args.BatchInputShape = metadata.BatchInputShape; + } + + RevivedLayer revived_obj = new RevivedLayer(args); + + // TODO(Rinne): implement `expects_training_arg`. + var config = metadata.Config; + if (generic_utils.validate_config(config)) + { + revived_obj._config = new RevivedConfig() { Config = config }; + } + if(metadata.InputSpec is not null) + { + throw new NotImplementedException(); + } + if(metadata.ActivityRegularizer is not null) + { + throw new NotImplementedException(); + } + // TODO(Rinne): `_is_feature_layer` + if(metadata.Stateful is not null) + { + revived_obj.stateful = metadata.Stateful.Value; + } + + return (revived_obj, ReviveUtils._revive_setter); + } + + protected RevivedConfig _config = null; + + public object keras_api + { + get + { + if (SerializedAttributes.TryGetValue(SavedModel.Constants.KERAS_ATTR, out var value)) + { + return value; + } + else + { + return null; + } + } + } + + protected RevivedLayer(LayerArgs args): base(args) + { + + } + + public override string ToString() + { + return $"Customized keras layer: {Name}."; + } + + public override IKerasConfig get_config() + { + return _config; + } + } +} diff --git a/src/TensorFlowNET.Keras/Saving/SavedModel/RevivedNetwork.cs b/src/TensorFlowNET.Keras/Saving/SavedModel/RevivedNetwork.cs new file mode 100644 index 000000000..1860c8c75 --- /dev/null +++ b/src/TensorFlowNET.Keras/Saving/SavedModel/RevivedNetwork.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Tensorflow.Keras.ArgsDefinition; +using Tensorflow.Keras.Utils; + +namespace Tensorflow.Keras.Saving.SavedModel +{ + public class RevivedNetwork: RevivedLayer + { + private RevivedNetwork(LayerArgs args) : base(args) + { + + } + + public static (RevivedNetwork, Action) init_from_metadata(KerasMetaData metadata) + { + RevivedNetwork revived_obj = new(new LayerArgs() { Name = metadata.Name }); + + // TODO(Rinne): with utils.no_automatic_dependency_tracking_scope(revived_obj) + // TODO(Rinne): revived_obj._expects_training_arg + var config = metadata.Config; + if (generic_utils.validate_config(config)) + { + revived_obj._config = new RevivedConfig() { Config = config }; + } + if(metadata.ActivityRegularizer is not null) + { + throw new NotImplementedException(); + } + + return (revived_obj, ReviveUtils._revive_setter); + } + + public override string ToString() + { + return $"Customized keras Network: {Name}."; + } + } +} diff --git a/src/TensorFlowNET.Keras/Saving/SavedModel/Save.cs b/src/TensorFlowNET.Keras/Saving/SavedModel/Save.cs index 220eae4b4..331b283a0 100644 --- a/src/TensorFlowNET.Keras/Saving/SavedModel/Save.cs +++ b/src/TensorFlowNET.Keras/Saving/SavedModel/Save.cs @@ -11,7 +11,7 @@ using ThirdParty.Tensorflow.Python.Keras.Protobuf; using static Tensorflow.Binding; using Tensorflow.Training; - +using System.Diagnostics; namespace Tensorflow.Keras.Saving.SavedModel; @@ -33,7 +33,7 @@ public static void save_model(Model model, string filepath, bool overwrite, bool } } - OptimizerV2? orig_optimizer = null; + IOptimizer? orig_optimizer = null; if (!include_optimizer) { orig_optimizer = model.Optimizer; @@ -124,23 +124,28 @@ public static IDictionary wrap_layer_objects(Layer layer, IDi { if (x is ResourceVariable or RefVariable) return (Trackable)x; else throw new TypeError($"The type{x.GetType()} is not supported for the wrapping of layer."); - })); + }).ToArray()); var trainable_variables = TrackableDataStructure.wrap_or_unwrap(layer.TrainableVariables.Select(x => { if (x is ResourceVariable or RefVariable) return (Trackable)x; else throw new TypeError($"The type{x.GetType()} is not supported for the wrapping of layer."); - })); + }).ToArray()); var non_trainable_variables = TrackableDataStructure.wrap_or_unwrap(layer.NonTrainableVariables.Select(x => { if (x is ResourceVariable or RefVariable) return (Trackable)x; else throw new TypeError($"The type{x.GetType()} is not supported for the wrapping of layer."); - })); + }).ToArray()); + var layers = TrackableDataStructure.wrap_or_unwrap(list_all_layers(layer).Select(x => x.GetTrackable()).ToArray()); Dictionary res = new(); - res["variables"] = variables; - res["trainable_variables"] = trainable_variables; - res["non_trainable_variables"] = non_trainable_variables; - res["layers"] = TrackableDataStructure.wrap_or_unwrap(KerasSavedModelUtils.list_all_layers(layer).Select(x => x.GetTrackable())); + Debug.Assert(variables is Trackable); + Debug.Assert(trainable_variables is Trackable); + Debug.Assert(non_trainable_variables is Trackable); + Debug.Assert(layers is Trackable); + res["variables"] = variables as Trackable; + res["trainable_variables"] = trainable_variables as Trackable; + res["non_trainable_variables"] = non_trainable_variables as Trackable; + res["layers"] = layers as Trackable; return res; } @@ -153,6 +158,8 @@ public static IDictionary wrap_layer_objects(Layer layer, IDi /// public static IDictionary wrap_layer_functions(Layer layer, IDictionary> serialization_cache) { + + // high priority // TODO: deal with type `RevivedLayer` and `Sequential`. // skip the process because of lack of APIs of `Layer`. diff --git a/src/TensorFlowNET.Keras/Saving/SavedModel/load.cs b/src/TensorFlowNET.Keras/Saving/SavedModel/load.cs index abb2012f8..aa763fc2e 100644 --- a/src/TensorFlowNET.Keras/Saving/SavedModel/load.cs +++ b/src/TensorFlowNET.Keras/Saving/SavedModel/load.cs @@ -56,7 +56,8 @@ private static Trackable load(string path, bool compile = true, LoadOptions? opt } else { - throw new NotImplementedException("Not implemented, please submit an issue to https://github.com/SciSharp/TensorFlow.NET/issues."); + throw new NotImplementedException("SavedModel saved prior to TF 2.5 detected when loading Keras model, please" + + " use higher version or submit an issue to https://github.com/SciSharp/TensorFlow.NET/issues. to let us know you need it."); } if (metadata.Nodes is null || metadata.Nodes.Count == 0) @@ -76,7 +77,7 @@ private static Trackable load(string path, bool compile = true, LoadOptions? opt var loaded = Loader.load_partial(path, nodes_to_load, options); keras_loader.finalize_objects(); - // keras_loader.del_tracking(); + keras_loader.del_tracking(); var model = loaded["root"]; diff --git a/src/TensorFlowNET.Keras/Saving/SavedModel/serialized_attributes.cs b/src/TensorFlowNET.Keras/Saving/SavedModel/serialized_attributes.cs index ac194c00f..0ec5d1a8c 100644 --- a/src/TensorFlowNET.Keras/Saving/SavedModel/serialized_attributes.cs +++ b/src/TensorFlowNET.Keras/Saving/SavedModel/serialized_attributes.cs @@ -19,8 +19,8 @@ public abstract class SerializedAttributes: ISerializedAttributes protected IDictionary _object_dict; protected IDictionary _function_dict; protected AutoTrackable _keras_trackable; - protected HashSet _all_functions; - protected HashSet _all_checkpointable_objects; + internal HashSet _all_functions; + internal HashSet _all_checkpointable_objects; private SerializedAttributes() { @@ -51,9 +51,9 @@ protected SerializedAttributes((IEnumerable, IEnumerable) object _all_functions = new HashSet(objects_and_functions.Item2); } - public IDictionary Functions => _function_dict.TakeWhile(x => x.Value is not null).ToDictionary(x => x.Key, x => x.Value!); + public IDictionary Functions => _function_dict.Where(x => x.Value is not null).ToDictionary(x => x.Key, x => x.Value!); - public IDictionary CheckpointableObjects => _object_dict.TakeWhile(x => x.Value is not null).ToDictionary(x => x.Key, x => x.Value!); + public IDictionary CheckpointableObjects => _object_dict.Where(x => x.Value is not null).ToDictionary(x => x.Key, x => x.Value!); /// /// Returns functions to attach to the root object during serialization. @@ -82,7 +82,7 @@ public IDictionary ObjectsToSerialize { get { - var objects = CheckpointableObjects.TakeWhile( x=> _all_checkpointable_objects.Contains(x.Key)).ToDictionary(x => x.Key, x => x.Value); + var objects = CheckpointableObjects.Where( x=> _all_checkpointable_objects.Contains(x.Key)).ToDictionary(x => x.Key, x => x.Value); objects[Constants.KERAS_ATTR] = _keras_trackable; return objects; } @@ -121,7 +121,10 @@ public IDictionary set_and_validate_functions(IDictionary set_and_validate_objects(IDictionary, IEnumerable) get_objects_and_fun public class CommonEndPoints: SerializedAttributes { public CommonEndPoints(IEnumerable checkpointable_objects, IEnumerable functions) : - //base(checkpointable_objects.Concat(new string[] { "variables", "trainable_variables", "regularization_losses" }), - // functions.Concat(new string[] { "__call__", "call_and_return_all_conditional_losses", "_default_save_signature" })) - base(checkpointable_objects.Concat(new string[] { "variables", "trainable_variables"}), - functions.Concat(new string[] { })) + base(checkpointable_objects.Concat(new string[] { "variables", "trainable_variables", "regularization_losses" }), + functions.Concat(new string[] { "__call__", "call_and_return_all_conditional_losses", "_default_save_signature" })) { } public CommonEndPoints() : - //base(new string[] { "variables", "trainable_variables", "regularization_losses" }, - // new string[] { "__call__", "call_and_return_all_conditional_losses", "_default_save_signature" }) - base(new string[] { "variables", "trainable_variables"}, - new string[] {}) + base(new string[] { "variables", "trainable_variables", "regularization_losses" }, + new string[] { "__call__", "call_and_return_all_conditional_losses", "_default_save_signature" }) { } @@ -221,7 +223,7 @@ public LayerAttributes(IEnumerable checkpointable_objects, IEnumerableenable Tensorflow.Keras AnyCPU;x64 - 0.10.4 + 0.10.5 Haiping Chen Keras for .NET Apache 2.0, Haiping Chen 2023 @@ -34,11 +34,12 @@ Keras is an API designed for human beings, not machines. Keras follows best prac true tensorflow, keras, deep learning, machine learning true + packages Git true Open.snk - 0.10.4.0 - 0.10.4.0 + 0.10.5.0 + 0.10.5.0 LICENSE Debug;Release;GPU @@ -72,8 +73,7 @@ Keras is an API designed for human beings, not machines. Keras follows best prac - - + diff --git a/src/TensorFlowNET.Keras/Utils/base_layer_utils.cs b/src/TensorFlowNET.Keras/Utils/base_layer_utils.cs index d845f3ca9..e6c9ed422 100644 --- a/src/TensorFlowNET.Keras/Utils/base_layer_utils.cs +++ b/src/TensorFlowNET.Keras/Utils/base_layer_utils.cs @@ -165,6 +165,19 @@ public static void CreateKerasHistoryHelper(Tensors tensors, List pro } } + public static bool has_weights(object obj) + { + var obj_type = obj.GetType(); + return obj_type.GetField("trainable_weights") is not null && + obj_type.GetField("non_trainable_weights") is not null && + obj is not Type; + } + + public static Tensor generate_placeholders_from_shape(Shape shape) + { + return array_ops.placeholder(keras.backend.floatx(), shape); + } + // recusive static bool uses_keras_history(Tensor op_input) { diff --git a/src/TensorFlowNET.Keras/Utils/compile_utils.cs b/src/TensorFlowNET.Keras/Utils/compile_utils.cs new file mode 100644 index 000000000..cd4112616 --- /dev/null +++ b/src/TensorFlowNET.Keras/Utils/compile_utils.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Tensorflow.Framework.Models; +using Tensorflow.Util; + +namespace Tensorflow.Keras.Utils +{ + internal static class compile_utils + { + public static List create_pseudo_input_names(TensorSpec inputs) + { + return _create_pseudo_names(inputs, "input_"); + } + + private static List _create_pseudo_names(TensorSpec tensors, string prefix) + { + // TODO(Rinne): align with tensorflow + return new List() { $"{prefix}1" }; + } + } +} diff --git a/src/TensorFlowNET.Keras/Utils/generic_utils.cs b/src/TensorFlowNET.Keras/Utils/generic_utils.cs index 03acce0ca..6a59fb880 100644 --- a/src/TensorFlowNET.Keras/Utils/generic_utils.cs +++ b/src/TensorFlowNET.Keras/Utils/generic_utils.cs @@ -23,6 +23,7 @@ limitations under the License. using System.Diagnostics; using System.Linq; using System.Reflection; +using System.Security.AccessControl; using Tensorflow.Keras.ArgsDefinition; using Tensorflow.Keras.Engine; using Tensorflow.Keras.Layers; @@ -60,19 +61,33 @@ public static JObject serialize_keras_object(IKerasConfigable instance) public static Layer deserialize_keras_object(string class_name, JToken config) { var argType = Assembly.Load("Tensorflow.Binding").GetType($"Tensorflow.Keras.ArgsDefinition.{class_name}Args"); + if(argType is null) + { + return null; + } var deserializationMethod = typeof(JToken).GetMethods(BindingFlags.Instance | BindingFlags.Public) .Single(x => x.Name == "ToObject" && x.IsGenericMethodDefinition && x.GetParameters().Count() == 0); var deserializationGenericMethod = deserializationMethod.MakeGenericMethod(argType); var args = deserializationGenericMethod.Invoke(config, null); var layer = Assembly.Load("Tensorflow.Keras").CreateInstance($"Tensorflow.Keras.Layers.{class_name}", true, BindingFlags.Default, null, new object[] { args }, null, null); Debug.Assert(layer is Layer); + + // TODO(Rinne): _shared_object_loading_scope().set(shared_object_id, deserialized_obj) + return layer as Layer; } public static Layer deserialize_keras_object(string class_name, LayerArgs args) { var layer = Assembly.Load("Tensorflow.Keras").CreateInstance($"Tensorflow.Keras.Layers.{class_name}", true, BindingFlags.Default, null, new object[] { args }, null, null); + if (layer is null) + { + return null; + } Debug.Assert(layer is Layer); + + // TODO(Rinne): _shared_object_loading_scope().set(shared_object_id, deserialized_obj) + return layer as Layer; } @@ -87,9 +102,9 @@ public static LayerArgs deserialize_layer_args(string class_name, JToken config) return args as LayerArgs; } - public static ModelConfig deserialize_model_config(JToken json) + public static FunctionalConfig deserialize_model_config(JToken json) { - ModelConfig config = new ModelConfig(); + FunctionalConfig config = new FunctionalConfig(); config.Name = json["name"].ToObject(); config.Layers = new List(); var layersToken = json["layers"]; diff --git a/src/TensorFlowNET.Keras/Utils/tf_utils.cs b/src/TensorFlowNET.Keras/Utils/tf_utils.cs index b144ec9f7..ad31fd7ca 100644 --- a/src/TensorFlowNET.Keras/Utils/tf_utils.cs +++ b/src/TensorFlowNET.Keras/Utils/tf_utils.cs @@ -17,6 +17,7 @@ limitations under the License. using System; using System.Linq; using Tensorflow.Framework; +using Tensorflow.Framework.Models; namespace Tensorflow.Keras.Utils { @@ -69,5 +70,29 @@ public static Tensor smart_cond(bool pred, false_fn: false_fn, name: name); } + + public static TensorSpec get_tensor_spec(Tensor t, bool dynamic_batch = false, string name = null) + { + throw new NotImplementedException("The function is waited to be implemented in the future."); + } + + public static TensorSpec get_tensor_spec(TensorSpec t, bool dynamic_batch = false, string name = null) + { + var spec = t; + if (!dynamic_batch) + { + return spec; + } + var dynamic_batch_spec = new TensorSpec(t.shape, t.dtype, t.name); + var shape = dynamic_batch_spec.shape; + if(shape.rank > 0) + { + var shape_list = shape.as_int_list(); + // TODO(Rinne): check if -1 is equivalent to None in python. + shape_list[0] = -1; + dynamic_batch_spec.shape = new Shape(shape_list); + } + return dynamic_batch_spec; + } } } diff --git a/src/TensorFlowNet.Benchmarks/Leak/SavedModelCleanup.cs b/src/TensorFlowNet.Benchmarks/Leak/SavedModelCleanup.cs index 09e20058e..9231f3a80 100644 --- a/src/TensorFlowNet.Benchmarks/Leak/SavedModelCleanup.cs +++ b/src/TensorFlowNet.Benchmarks/Leak/SavedModelCleanup.cs @@ -23,16 +23,14 @@ public void Run() var ClassifierModelPath = Path.Combine(modelDir, "Leak", "TestModel", "saved_model"); for (var i = 0; i < 1024; i++) - { - using (var sess = Session.LoadFromSavedModel(ClassifierModelPath)) { - using (var g = sess.graph.as_default()) { - var inputOp = g.OperationByName("inference_input"); - var outputOp = g.OperationByName("StatefulPartitionedCall"); + { + var sess = Session.LoadFromSavedModel(ClassifierModelPath); + var g = sess.graph.as_default(); + var inputOp = g.OperationByName("inference_input"); + var outputOp = g.OperationByName("StatefulPartitionedCall"); - var inp = np.zeros(new Shape(new int[] { 1, 2, 96 }), TF_DataType.TF_FLOAT); - sess.run(outputOp.outputs[0], new FeedItem(inputOp.outputs[0], inp)); - } - } + var inp = np.zeros(new Shape(new int[] { 1, 2, 96 }), TF_DataType.TF_FLOAT); + sess.run(outputOp.outputs[0], new FeedItem(inputOp.outputs[0], inp)); } } } diff --git a/src/TensorFlowNet.Benchmarks/TensorBenchmark.cs b/src/TensorFlowNet.Benchmarks/TensorBenchmark.cs index c1aadd469..fa99755e2 100644 --- a/src/TensorFlowNet.Benchmarks/TensorBenchmark.cs +++ b/src/TensorFlowNet.Benchmarks/TensorBenchmark.cs @@ -1,10 +1,8 @@ using BenchmarkDotNet.Attributes; -using Tensorflow; -using Tensorflow.Eager; namespace TensorFlowBenchmark { - [SimpleJob(launchCount: 1, warmupCount: 1, targetCount: 10)] + [SimpleJob(launchCount: 1, warmupCount: 1)] [MinColumn, MaxColumn, MeanColumn, MedianColumn] public class TensorBenchmark { diff --git a/src/TensorFlowNet.Benchmarks/Tensorflow.Benchmark.csproj b/src/TensorFlowNet.Benchmarks/Tensorflow.Benchmark.csproj index ee0c113f2..53261f805 100644 --- a/src/TensorFlowNet.Benchmarks/Tensorflow.Benchmark.csproj +++ b/src/TensorFlowNet.Benchmarks/Tensorflow.Benchmark.csproj @@ -36,8 +36,8 @@ - - + + diff --git a/src/TensorFlowNet.Benchmarks/Unmanaged/StructCastBenchmark.cs b/src/TensorFlowNet.Benchmarks/Unmanaged/StructCastBenchmark.cs index d4b0fee99..6e2b71605 100644 --- a/src/TensorFlowNet.Benchmarks/Unmanaged/StructCastBenchmark.cs +++ b/src/TensorFlowNet.Benchmarks/Unmanaged/StructCastBenchmark.cs @@ -16,7 +16,7 @@ public UnmanagedStruct(int _) } } - [SimpleJob(launchCount: 1, warmupCount: 2, targetCount: 10)] + [SimpleJob(launchCount: 1, warmupCount: 2)] [MinColumn, MaxColumn, MeanColumn, MedianColumn] public unsafe class StructCastBenchmark { diff --git a/src/TensorflowNET.Hub/GcsCompressedFileResolver.cs b/src/TensorflowNET.Hub/GcsCompressedFileResolver.cs new file mode 100644 index 000000000..f3e1b9723 --- /dev/null +++ b/src/TensorflowNET.Hub/GcsCompressedFileResolver.cs @@ -0,0 +1,57 @@ +using System.IO; +using System.Threading.Tasks; + +namespace Tensorflow.Hub +{ + public class GcsCompressedFileResolver : IResolver + { + const int LOCK_FILE_TIMEOUT_SEC = 10 * 60; + public string Call(string handle) + { + var module_dir = _module_dir(handle); + + return resolver.atomic_download_async(handle, download, module_dir, LOCK_FILE_TIMEOUT_SEC) + .GetAwaiter().GetResult(); + } + public bool IsSupported(string handle) + { + return handle.StartsWith("gs://") && _is_tarfile(handle); + } + + private async Task download(string handle, string tmp_dir) + { + new resolver.DownloadManager(handle).download_and_uncompress( + new FileStream(handle, FileMode.Open, FileAccess.Read), tmp_dir); + await Task.Run(() => { }); + } + + private static string _module_dir(string handle) + { + var cache_dir = resolver.tfhub_cache_dir(use_temp: true); + var sha1 = ComputeSha1(handle); + return resolver.create_local_module_dir(cache_dir, sha1); + } + + private static bool _is_tarfile(string filename) + { + return filename.EndsWith(".tar") || filename.EndsWith(".tar.gz") || filename.EndsWith(".tgz"); + } + + private static string ComputeSha1(string s) + { + using (var sha = new System.Security.Cryptography.SHA1Managed()) + { + var bytes = System.Text.Encoding.UTF8.GetBytes(s); + var hash = sha.ComputeHash(bytes); + var stringBuilder = new System.Text.StringBuilder(hash.Length * 2); + + foreach (var b in hash) + { + stringBuilder.Append(b.ToString("x2")); + } + + return stringBuilder.ToString(); + } + } + } +} diff --git a/src/TensorflowNET.Hub/HttpCompressedFileResolver.cs b/src/TensorflowNET.Hub/HttpCompressedFileResolver.cs new file mode 100644 index 000000000..a127b28c0 --- /dev/null +++ b/src/TensorflowNET.Hub/HttpCompressedFileResolver.cs @@ -0,0 +1,78 @@ +using System; +using System.Net.Http; +using System.Threading.Tasks; + +namespace Tensorflow.Hub +{ + public class HttpCompressedFileResolver : HttpResolverBase + { + const int LOCK_FILE_TIMEOUT_SEC = 10 * 60; // 10 minutes + + private static readonly (string, string) _COMPRESSED_FORMAT_QUERY = + ("tf-hub-format", "compressed"); + + private static string _module_dir(string handle) + { + var cache_dir = resolver.tfhub_cache_dir(use_temp: true); + var sha1 = ComputeSha1(handle); + return resolver.create_local_module_dir(cache_dir, sha1); + } + + public override bool IsSupported(string handle) + { + if (!is_http_protocol(handle)) + { + return false; + } + var load_format = resolver.model_load_format(); + return load_format == Enum.GetName(typeof(resolver.ModelLoadFormat), resolver.ModelLoadFormat.COMPRESSED) + || load_format == Enum.GetName(typeof(resolver.ModelLoadFormat), resolver.ModelLoadFormat.AUTO); + } + + public override string Call(string handle) + { + var module_dir = _module_dir(handle); + + return resolver.atomic_download_async( + handle, + download, + module_dir, + LOCK_FILE_TIMEOUT_SEC + ).GetAwaiter().GetResult(); + } + + private async Task download(string handle, string tmp_dir) + { + var client = new HttpClient(); + + var response = await client.GetAsync(_append_compressed_format_query(handle)); + + using (var httpStream = await response.Content.ReadAsStreamAsync()) + { + new resolver.DownloadManager(handle).download_and_uncompress(httpStream, tmp_dir); + } + } + + private string _append_compressed_format_query(string handle) + { + return append_format_query(handle, _COMPRESSED_FORMAT_QUERY); + } + + private static string ComputeSha1(string s) + { + using (var sha = new System.Security.Cryptography.SHA1Managed()) + { + var bytes = System.Text.Encoding.UTF8.GetBytes(s); + var hash = sha.ComputeHash(bytes); + var stringBuilder = new System.Text.StringBuilder(hash.Length * 2); + + foreach (var b in hash) + { + stringBuilder.Append(b.ToString("x2")); + } + + return stringBuilder.ToString(); + } + } + } +} diff --git a/src/TensorflowNET.Hub/HttpUncompressedFileResolver.cs b/src/TensorflowNET.Hub/HttpUncompressedFileResolver.cs new file mode 100644 index 000000000..09a497484 --- /dev/null +++ b/src/TensorflowNET.Hub/HttpUncompressedFileResolver.cs @@ -0,0 +1,65 @@ +using System; +using System.Net; + +namespace Tensorflow.Hub +{ + public class HttpUncompressedFileResolver : HttpResolverBase + { + private readonly PathResolver _pathResolver; + + public HttpUncompressedFileResolver() + { + _pathResolver = new PathResolver(); + } + + public override string Call(string handle) + { + handle = AppendUncompressedFormatQuery(handle); + var gsLocation = RequestGcsLocation(handle); + return _pathResolver.Call(gsLocation); + } + + public override bool IsSupported(string handle) + { + if (!is_http_protocol(handle)) + { + return false; + } + + var load_format = resolver.model_load_format(); + return load_format == Enum.GetName(typeof(resolver.ModelLoadFormat), resolver.ModelLoadFormat.UNCOMPRESSED); + } + + protected virtual string AppendUncompressedFormatQuery(string handle) + { + return append_format_query(handle, ("tf-hub-format", "uncompressed")); + } + + protected virtual string RequestGcsLocation(string handleWithParams) + { + var request = WebRequest.Create(handleWithParams); + var response = request.GetResponse() as HttpWebResponse; + + if (response == null) + { + throw new Exception("Failed to get a response from the server."); + } + + var statusCode = (int)response.StatusCode; + + if (statusCode != 303) + { + throw new Exception($"Expected 303 for GCS location lookup but got HTTP {statusCode} {response.StatusDescription}"); + } + + var location = response.Headers["Location"]; + + if (!location.StartsWith("gs://")) + { + throw new Exception($"Expected Location:GS path but received {location}"); + } + + return location; + } + } +} \ No newline at end of file diff --git a/src/TensorflowNET.Hub/KerasLayer.cs b/src/TensorflowNET.Hub/KerasLayer.cs new file mode 100644 index 000000000..b9ca949bc --- /dev/null +++ b/src/TensorflowNET.Hub/KerasLayer.cs @@ -0,0 +1,157 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Tensorflow.Keras.Engine; +using Tensorflow.Train; +using Tensorflow.Training; +using Tensorflow.Training.Saving.SavedModel; +using static Tensorflow.Binding; + +namespace Tensorflow.Hub +{ + public class KerasLayer : Layer + { + private string _handle; + private LoadOptions? _load_options; + private Trackable _func; + private Func _callable; + + public KerasLayer(string handle, bool trainable = false, LoadOptions? load_options = null) : + base(new Keras.ArgsDefinition.LayerArgs() { Trainable = trainable }) + { + _handle = handle; + _load_options = load_options; + + _func = load_module(_handle, _load_options); + _track_trackable(_func, "_func"); + // TODO(Rinne): deal with _is_hub_module_v1. + + _callable = _get_callable(); + _setup_layer(trainable); + } + + private void _setup_layer(bool trainable = false) + { + HashSet trainable_variables; + if (_func is Layer layer) + { + foreach (var v in layer.TrainableVariables) + { + _add_existing_weight(v, true); + } + trainable_variables = new HashSet(layer.TrainableVariables.Select(v => v.UniqueId)); + } + else if (_func.CustomizedFields.TryGetValue("trainable_variables", out var obj) && obj is IEnumerable trackables) + { + foreach (var trackable in trackables) + { + if (trackable is IVariableV1 v) + { + _add_existing_weight(v, true); + } + } + trainable_variables = new HashSet(trackables.Where(t => t is IVariableV1).Select(t => (t as IVariableV1).UniqueId)); + } + else + { + trainable_variables = new HashSet(); + } + + if (_func is Layer) + { + layer = (Layer)_func; + foreach (var v in layer.Variables) + { + if (!trainable_variables.Contains(v.UniqueId)) + { + _add_existing_weight(v, false); + } + } + } + else if (_func.CustomizedFields.TryGetValue("variables", out var obj) && obj is IEnumerable total_trackables) + { + foreach (var trackable in total_trackables) + { + if (trackable is IVariableV1 v && !trainable_variables.Contains(v.UniqueId)) + { + _add_existing_weight(v, false); + } + } + } + + if (_func.CustomizedFields.ContainsKey("regularization_losses")) + { + if ((_func.CustomizedFields["regularization_losses"] as ListWrapper)?.Count > 0) + { + throw new NotImplementedException("The regularization_losses loading has not been supported yet, " + + "please submit an issue to https://github.com/SciSharp/TensorFlow.NET/issues to let us know and add a feature."); + } + } + } + + protected override Tensors Call(Tensors inputs, Tensor state = null, bool? training = null) + { + _check_trainability(); + + // TODO(Rinne): deal with training_argument + + var result = _callable(inputs); + + return _apply_output_shape_if_set(inputs, result); + } + + private void _check_trainability() + { + if (!Trainable) return; + + // TODO(Rinne): deal with _is_hub_module_v1 and signature + + if (TrainableWeights is null || TrainableWeights.Count == 0) + { + tf.Logger.Error("hub.KerasLayer is trainable but has zero trainable weights."); + } + } + + private Tensors _apply_output_shape_if_set(Tensors inputs, Tensors result) + { + // TODO(Rinne): implement it. + return result; + } + + private void _add_existing_weight(IVariableV1 weight, bool? trainable = null) + { + bool is_trainable; + if (trainable is null) + { + is_trainable = weight.Trainable; + } + else + { + is_trainable = trainable.Value; + } + add_weight(weight.Name, weight.shape, weight.dtype, trainable: is_trainable, getter: x => weight); + } + + private Func _get_callable() + { + if (_func is Layer layer) + { + return x => layer.Apply(x); + } + if (_func.CustomizedFields.ContainsKey("__call__")) + { + if (_func.CustomizedFields["__call__"] is RestoredFunction function) + { + return x => function.Apply(x); + } + } + throw new ValueError("Cannot get the callable from the model."); + } + + private static Trackable load_module(string handle, LoadOptions? load_options = null) + { + //var set_load_options = load_options ?? LoadContext.get_load_option(); + return module_v2.load(handle, load_options); + } + } +} diff --git a/src/TensorflowNET.Hub/Tensorflow.Hub.csproj b/src/TensorflowNET.Hub/Tensorflow.Hub.csproj new file mode 100644 index 000000000..3c09f808e --- /dev/null +++ b/src/TensorflowNET.Hub/Tensorflow.Hub.csproj @@ -0,0 +1,36 @@ + + + + netstandard2.0;net6 + 10 + enable + 1.0.0 + TensorFlow.Hub + Apache2.0 + true + true + Yaohui Liu, Haiping Chen + SciSharp STACK + true + Apache 2.0, Haiping Chen $([System.DateTime]::UtcNow.ToString(yyyy)) + https://github.com/SciSharp/TensorFlow.NET + git + http://scisharpstack.org + https://avatars3.githubusercontent.com/u/44989469?s=200&v=4 + TensorFlow, SciSharp, Machine Learning, Deep Learning, Transfer Learning, TensorFlow Hub, TensorFlow.NET, TF.NET, AI + packages + + Google's TensorFlow Hub full binding in .NET Standard. + A library for transfer learning with TensorFlow.NET. + + + + + + + + + + + + diff --git a/src/TensorflowNET.Hub/file_utils.cs b/src/TensorflowNET.Hub/file_utils.cs new file mode 100644 index 000000000..3e959afef --- /dev/null +++ b/src/TensorflowNET.Hub/file_utils.cs @@ -0,0 +1,74 @@ +using SharpCompress.Common; +using SharpCompress.Readers; +using System; +using System.IO; + +namespace Tensorflow.Hub +{ + internal static class file_utils + { + //public static void extract_file(TarInputStream tgz, TarEntry tarInfo, string dstPath, uint bufferSize = 10 << 20, Action logFunction = null) + //{ + // using (var src = tgz.GetNextEntry() == tarInfo ? tgz : null) + // { + // if (src is null) + // { + // return; + // } + + // using (var dst = File.Create(dstPath)) + // { + // var buffer = new byte[bufferSize]; + // int count; + + // while ((count = src.Read(buffer, 0, buffer.Length)) > 0) + // { + // dst.Write(buffer, 0, count); + // logFunction?.Invoke(count); + // } + // } + // } + //} + + public static void extract_tarfile_to_destination(Stream fileobj, string dst_path, Action logFunction = null) + { + using (IReader reader = ReaderFactory.Open(fileobj)) + { + while (reader.MoveToNextEntry()) + { + if (!reader.Entry.IsDirectory) + { + reader.WriteEntryToDirectory( + dst_path, + new ExtractionOptions() { ExtractFullPath = true, Overwrite = true } + ); + } + } + } + } + + public static string merge_relative_path(string dstPath, string relPath) + { + var cleanRelPath = Path.GetFullPath(relPath).TrimStart('/', '\\'); + + if (cleanRelPath == ".") + { + return dstPath; + } + + if (cleanRelPath.StartsWith("..") || Path.IsPathRooted(cleanRelPath)) + { + throw new InvalidDataException($"Relative path '{relPath}' is invalid."); + } + + var merged = Path.Combine(dstPath, cleanRelPath); + + if (!merged.StartsWith(dstPath)) + { + throw new InvalidDataException($"Relative path '{relPath}' is invalid. Failed to merge with '{dstPath}'."); + } + + return merged; + } + } +} diff --git a/src/TensorflowNET.Hub/hub.cs b/src/TensorflowNET.Hub/hub.cs new file mode 100644 index 000000000..4fefe0cc2 --- /dev/null +++ b/src/TensorflowNET.Hub/hub.cs @@ -0,0 +1,17 @@ +using Tensorflow.Hub; + +namespace Tensorflow +{ + public static class HubAPI + { + public static HubMethods hub { get; } = new HubMethods(); + } + + public class HubMethods + { + public KerasLayer KerasLayer(string handle, bool trainable = false, LoadOptions? load_options = null) + { + return new KerasLayer(handle, trainable, load_options); + } + } +} diff --git a/src/TensorflowNET.Hub/module_v2.cs b/src/TensorflowNET.Hub/module_v2.cs new file mode 100644 index 000000000..a8e67311b --- /dev/null +++ b/src/TensorflowNET.Hub/module_v2.cs @@ -0,0 +1,33 @@ +using System.IO; +using Tensorflow.Train; + +namespace Tensorflow.Hub +{ + internal static class module_v2 + { + public static Trackable load(string handle, LoadOptions? options) + { + var module_path = resolve(handle); + + // TODO(Rinne): deal with is_hub_module_v1 + + var saved_model_path = Path.Combine(module_path, Constants.SAVED_MODEL_FILENAME_PB); + var saved_model_pb_txt_path = Path.Combine(module_path, Constants.SAVED_MODEL_FILENAME_PBTXT); + if (!File.Exists(saved_model_path) && !Directory.Exists(saved_model_path) && !File.Exists(saved_model_pb_txt_path) + && !Directory.Exists(saved_model_pb_txt_path)) + { + throw new ValueError($"Trying to load a model of incompatible/unknown type. " + + $"'{module_path}' contains neither '{Constants.SAVED_MODEL_FILENAME_PB}' " + + $"nor '{Constants.SAVED_MODEL_FILENAME_PBTXT}'."); + } + + var obj = Loader.load(module_path, options: options); + return obj; + } + + public static string resolve(string handle) + { + return MultiImplRegister.GetResolverRegister().Call(handle); + } + } +} diff --git a/src/TensorflowNET.Hub/registry.cs b/src/TensorflowNET.Hub/registry.cs new file mode 100644 index 000000000..cdc4589b2 --- /dev/null +++ b/src/TensorflowNET.Hub/registry.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Tensorflow.Hub +{ + internal class MultiImplRegister + { + private static MultiImplRegister resolver = new MultiImplRegister("resolver", new IResolver[0]); + private static MultiImplRegister loader = new MultiImplRegister("loader", new IResolver[0]); + + static MultiImplRegister() + { + resolver.add_implementation(new PathResolver()); + resolver.add_implementation(new HttpUncompressedFileResolver()); + resolver.add_implementation(new GcsCompressedFileResolver()); + resolver.add_implementation(new HttpCompressedFileResolver()); + } + + string _name; + List _impls; + public MultiImplRegister(string name, IEnumerable impls) + { + _name = name; + _impls = impls.ToList(); + } + + public void add_implementation(IResolver resolver) + { + _impls.Add(resolver); + } + + public string Call(string handle) + { + foreach (var impl in _impls.Reverse()) + { + if (impl.IsSupported(handle)) + { + return impl.Call(handle); + } + } + throw new RuntimeError($"Cannot resolve the handle {handle}"); + } + + public static MultiImplRegister GetResolverRegister() + { + return resolver; + } + + public static MultiImplRegister GetLoaderRegister() + { + return loader; + } + } +} diff --git a/src/TensorflowNET.Hub/resolver.cs b/src/TensorflowNET.Hub/resolver.cs new file mode 100644 index 000000000..2f8c45ba6 --- /dev/null +++ b/src/TensorflowNET.Hub/resolver.cs @@ -0,0 +1,580 @@ +using ICSharpCode.SharpZipLib.Tar; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Security; +using System.Security.Authentication; +using System.Threading.Tasks; +using System.Web; +using static Tensorflow.Binding; + +namespace Tensorflow.Hub +{ + internal static class resolver + { + public enum ModelLoadFormat + { + [Description("COMPRESSED")] + COMPRESSED, + [Description("UNCOMPRESSED")] + UNCOMPRESSED, + [Description("AUTO")] + AUTO + } + public class DownloadManager + { + private readonly string _url; + private double _last_progress_msg_print_time; + private long _total_bytes_downloaded; + private int _max_prog_str; + + private bool _interactive_mode() + { + return !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("_TFHUB_DOWNLOAD_PROGRESS")); + } + + private void _print_download_progress_msg(string msg, bool flush = false) + { + if (_interactive_mode()) + { + // Print progress message to console overwriting previous progress + // message. + _max_prog_str = Math.Max(_max_prog_str, msg.Length); + Console.Write($"\r{msg.PadRight(_max_prog_str)}"); + Console.Out.Flush(); + + //如果flush参数为true,则输出换行符减少干扰交互式界面。 + if (flush) + Console.WriteLine(); + + } + else + { + // Interactive progress tracking is disabled. Print progress to the + // standard TF log. + tf.Logger.Information(msg); + } + } + + private void _log_progress(long bytes_downloaded) + { + // Logs progress information about ongoing module download. + + _total_bytes_downloaded += bytes_downloaded; + var now = DateTime.Now.Ticks / TimeSpan.TicksPerSecond; + if (_interactive_mode() || now - _last_progress_msg_print_time > 15) + { + // Print progress message every 15 secs or if interactive progress + // tracking is enabled. + _print_download_progress_msg($"Downloading {_url}:" + + $"{tf_utils.bytes_to_readable_str(_total_bytes_downloaded, true)}"); + _last_progress_msg_print_time = now; + } + } + + public DownloadManager(string url) + { + _url = url; + _last_progress_msg_print_time = DateTime.Now.Ticks / TimeSpan.TicksPerSecond; + _total_bytes_downloaded = 0; + _max_prog_str = 0; + } + + public void download_and_uncompress(Stream fileobj, string dst_path) + { + // Streams the content for the 'fileobj' and stores the result in dst_path. + + try + { + file_utils.extract_tarfile_to_destination(fileobj, dst_path, _log_progress); + var total_size_str = tf_utils.bytes_to_readable_str(_total_bytes_downloaded, true); + _print_download_progress_msg($"Downloaded {_url}, Total size: {total_size_str}", flush: true); + } + catch (TarException ex) + { + throw new IOException($"{_url} does not appear to be a valid module. Inner message:{ex.Message}", ex); + } + } + } + private static Dictionary _flags = new(); + private static readonly string _TFHUB_CACHE_DIR = "TFHUB_CACHE_DIR"; + private static readonly string _TFHUB_DOWNLOAD_PROGRESS = "TFHUB_DOWNLOAD_PROGRESS"; + private static readonly string _TFHUB_MODEL_LOAD_FORMAT = "TFHUB_MODEL_LOAD_FORMAT"; + private static readonly string _TFHUB_DISABLE_CERT_VALIDATION = "TFHUB_DISABLE_CERT_VALIDATION"; + private static readonly string _TFHUB_DISABLE_CERT_VALIDATION_VALUE = "true"; + + static resolver() + { + set_new_flag("tfhub_model_load_format", "AUTO"); + set_new_flag("tfhub_cache_dir", null); + } + + public static string model_load_format() + { + return get_env_setting(_TFHUB_MODEL_LOAD_FORMAT, "tfhub_model_load_format"); + } + + public static string? get_env_setting(string env_var, string flag_name) + { + string value = System.Environment.GetEnvironmentVariable(env_var); + if (string.IsNullOrEmpty(value)) + { + if (_flags.ContainsKey(flag_name)) + { + return _flags[flag_name]; + } + else + { + return null; + } + } + else + { + return value; + } + } + + public static string tfhub_cache_dir(string default_cache_dir = null, bool use_temp = false) + { + var cache_dir = get_env_setting(_TFHUB_CACHE_DIR, "tfhub_cache_dir") ?? default_cache_dir; + if (string.IsNullOrWhiteSpace(cache_dir) && use_temp) + { + // Place all TF-Hub modules under /tfhub_modules. + cache_dir = Path.Combine(Path.GetTempPath(), "tfhub_modules"); + } + if (!string.IsNullOrWhiteSpace(cache_dir)) + { + Console.WriteLine("Using {0} to cache modules.", cache_dir); + } + return cache_dir; + } + + public static string create_local_module_dir(string cache_dir, string module_name) + { + Directory.CreateDirectory(cache_dir); + return Path.Combine(cache_dir, module_name); + } + + public static void set_new_flag(string name, string value) + { + string[] tokens = new string[] {_TFHUB_CACHE_DIR, _TFHUB_DISABLE_CERT_VALIDATION, + _TFHUB_DISABLE_CERT_VALIDATION_VALUE, _TFHUB_DOWNLOAD_PROGRESS, _TFHUB_MODEL_LOAD_FORMAT}; + if (!tokens.Contains(name)) + { + tf.Logger.Warning($"You are settinng a flag '{name}' that cannot be recognized. The flag you set" + + "may not affect anything in tensorflow.hub."); + } + _flags[name] = value; + } + + public static string _merge_relative_path(string dstPath, string relPath) + { + return file_utils.merge_relative_path(dstPath, relPath); + } + + public static string _module_descriptor_file(string moduleDir) + { + return $"{moduleDir}.descriptor.txt"; + } + + public static void _write_module_descriptor_file(string handle, string moduleDir) + { + var readme = _module_descriptor_file(moduleDir); + var content = $"Module: {handle}\nDownload Time: {DateTime.Now}\nDownloader Hostname: {Environment.MachineName} (PID:{Process.GetCurrentProcess().Id})"; + tf_utils.atomic_write_string_to_file(readme, content, overwrite: true); + } + + public static string _lock_file_contents(string task_uid) + { + return $"{Environment.MachineName}.{Process.GetCurrentProcess().Id}.{task_uid}"; + } + + public static string _lock_filename(string moduleDir) + { + return tf_utils.absolute_path(moduleDir) + ".lock"; + } + + private static string _module_dir(string lockFilename) + { + var path = Path.GetDirectoryName(Path.GetFullPath(lockFilename)); + if (!string.IsNullOrEmpty(path)) + { + return Path.Combine(path, "hub_modules"); + } + + throw new Exception("Unable to resolve hub_modules directory from lock file name."); + } + + private static string _task_uid_from_lock_file(string lockFilename) + { + // Returns task UID of the task that created a given lock file. + var lockstring = File.ReadAllText(lockFilename); + return lockstring.Split('.').Last(); + } + + private static string _temp_download_dir(string moduleDir, string taskUid) + { + // Returns the name of a temporary directory to download module to. + return $"{Path.GetFullPath(moduleDir)}.{taskUid}.tmp"; + } + + private static long _dir_size(string directory) + { + // Returns total size (in bytes) of the given 'directory'. + long size = 0; + foreach (var elem in Directory.EnumerateFileSystemEntries(directory)) + { + var stat = new FileInfo(elem); + size += stat.Length; + if ((stat.Attributes & FileAttributes.Directory) != 0) + size += _dir_size(stat.FullName); + } + return size; + } + + public static long _locked_tmp_dir_size(string lockFilename) + { + //Returns the size of the temp dir pointed to by the given lock file. + var taskUid = _task_uid_from_lock_file(lockFilename); + try + { + return _dir_size(_temp_download_dir(_module_dir(lockFilename), taskUid)); + } + catch (DirectoryNotFoundException) + { + return 0; + } + } + + private static void _wait_for_lock_to_disappear(string handle, string lockFile, double lockFileTimeoutSec) + { + long? lockedTmpDirSize = null; + var lockedTmpDirSizeCheckTime = DateTime.Now; + var lockFileContent = ""; + + while (File.Exists(lockFile)) + { + try + { + Console.WriteLine($"Module '{handle}' already being downloaded by '{File.ReadAllText(lockFile)}'. Waiting."); + + if ((DateTime.Now - lockedTmpDirSizeCheckTime).TotalSeconds > lockFileTimeoutSec) + { + var curLockedTmpDirSize = _locked_tmp_dir_size(lockFile); + var curLockFileContent = File.ReadAllText(lockFile); + + if (curLockedTmpDirSize == lockedTmpDirSize && curLockFileContent == lockFileContent) + { + Console.WriteLine($"Deleting lock file {lockFile} due to inactivity."); + File.Delete(lockFile); + break; + } + + lockedTmpDirSize = curLockedTmpDirSize; + lockedTmpDirSizeCheckTime = DateTime.Now; + lockFileContent = curLockFileContent; + } + } + catch (FileNotFoundException) + { + // Lock file or temp directory were deleted during check. Continue + // to check whether download succeeded or we need to start our own + // download. + } + + System.Threading.Thread.Sleep(5000); + } + } + + public static async Task atomic_download_async( + string handle, + Func downloadFn, + string moduleDir, + int lock_file_timeout_sec = 10 * 60) + { + var lockFile = _lock_filename(moduleDir); + var taskUid = Guid.NewGuid().ToString("N"); + var lockContents = _lock_file_contents(taskUid); + var tmpDir = _temp_download_dir(moduleDir, taskUid); + + // Function to check whether model has already been downloaded. + Func checkModuleExists = () => + Directory.Exists(moduleDir) && + Directory.EnumerateFileSystemEntries(moduleDir).Any(); + + // Check whether the model has already been downloaded before locking + // the destination path. + if (checkModuleExists()) + { + return moduleDir; + } + + // Attempt to protect against cases of processes being cancelled with + // KeyboardInterrupt by using a try/finally clause to remove the lock + // and tmp_dir. + while (true) + { + try + { + tf_utils.atomic_write_string_to_file(lockFile, lockContents, false); + // Must test condition again, since another process could have created + // the module and deleted the old lock file since last test. + if (checkModuleExists()) + { + // Lock file will be deleted in the finally-clause. + return moduleDir; + } + if (Directory.Exists(moduleDir)) + { + Directory.Delete(moduleDir, true); + } + break; // Proceed to downloading the module. + } + // These errors are believed to be permanent problems with the + // module_dir that justify failing the download. + catch (FileNotFoundException) + { + throw; + } + catch (UnauthorizedAccessException) + { + throw; + } + catch (IOException) + { + throw; + } + // All other errors are retried. + // TODO(b/144424849): Retrying an AlreadyExistsError from the atomic write + // should be good enough, but see discussion about misc filesystem types. + // TODO(b/144475403): How atomic is the overwrite=False check? + catch (Exception) + { + } + + // Wait for lock file to disappear. + _wait_for_lock_to_disappear(handle, lockFile, lock_file_timeout_sec); + // At this point we either deleted a lock or a lock got removed by the + // owner or another process. Perform one more iteration of the while-loop, + // we would either terminate due tf.compat.v1.gfile.Exists(module_dir) or + // because we would obtain a lock ourselves, or wait again for the lock to + // disappear. + } + + // Lock file acquired. + tf.Logger.Information($"Downloading TF-Hub Module '{handle}'..."); + Directory.CreateDirectory(tmpDir); + await downloadFn(handle, tmpDir); + // Write module descriptor to capture information about which module was + // downloaded by whom and when. The file stored at the same level as a + // directory in order to keep the content of the 'model_dir' exactly as it + // was define by the module publisher. + // + // Note: The descriptor is written purely to help the end-user to identify + // which directory belongs to which module. The descriptor is not part of the + // module caching protocol and no code in the TF-Hub library reads its + // content. + _write_module_descriptor_file(handle, moduleDir); + try + { + Directory.Move(tmpDir, moduleDir); + Console.WriteLine($"Downloaded TF-Hub Module '{handle}'."); + } + catch (IOException e) + { + Console.WriteLine(e.Message); + Console.WriteLine($"Failed to move {tmpDir} to {moduleDir}"); + // Keep the temp directory so we will retry building vocabulary later. + } + + // Temp directory is owned by the current process, remove it. + try + { + Directory.Delete(tmpDir, true); + } + catch (DirectoryNotFoundException) + { + } + + // Lock file exists and is owned by this process. + try + { + var contents = File.ReadAllText(lockFile); + if (contents == lockContents) + { + File.Delete(lockFile); + } + } + catch (Exception) + { + } + + return moduleDir; + } + } + internal interface IResolver + { + string Call(string handle); + bool IsSupported(string handle); + } + + internal class PathResolver : IResolver + { + public string Call(string handle) + { + if (!File.Exists(handle) && !Directory.Exists(handle)) + { + throw new IOException($"{handle} does not exist in file system."); + } + return handle; + } + public bool IsSupported(string handle) + { + return true; + } + } + + public abstract class HttpResolverBase : IResolver + { + private readonly HttpClient httpClient; + private SslProtocol sslProtocol; + private RemoteCertificateValidationCallback certificateValidator; + + protected HttpResolverBase() + { + httpClient = new HttpClient(); + _maybe_disable_cert_validation(); + } + + public abstract string Call(string handle); + public abstract bool IsSupported(string handle); + + protected async Task GetLocalFileStreamAsync(string filePath) + { + try + { + var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read); + return await Task.FromResult(fs); + } + catch (Exception ex) + { + Console.WriteLine($"Failed to read file stream: {ex.Message}"); + return null; + } + } + + protected async Task GetFileStreamAsync(string filePath) + { + if (!is_http_protocol(filePath)) + { + // If filePath is not an HTTP(S) URL, delegate to a file resolver. + return await GetLocalFileStreamAsync(filePath); + } + + var request = new HttpRequestMessage(HttpMethod.Get, filePath); + var response = await _call_urlopen(request); + + if (response.IsSuccessStatusCode) + { + return await response.Content.ReadAsStreamAsync(); + } + else + { + Console.WriteLine($"Failed to fetch file stream: {response.StatusCode} - {response.ReasonPhrase}"); + return null; + } + } + + protected void SetUrlContext(SslProtocol protocol, RemoteCertificateValidationCallback validator) + { + sslProtocol = protocol; + certificateValidator = validator; + } + + public static string append_format_query(string handle, (string, string) formatQuery) + { + var parsed = new Uri(handle); + + var queryBuilder = HttpUtility.ParseQueryString(parsed.Query); + queryBuilder.Add(formatQuery.Item1, formatQuery.Item2); + + parsed = new UriBuilder(parsed.Scheme, parsed.Host, parsed.Port, parsed.AbsolutePath, + "?" + queryBuilder.ToString()).Uri; + + return parsed.ToString(); + } + + protected bool is_http_protocol(string handle) + { + return handle.StartsWith("http://") || handle.StartsWith("https://"); + } + + protected async Task _call_urlopen(HttpRequestMessage request) + { + if (sslProtocol != null) + { + var handler = new HttpClientHandler() + { + SslProtocols = sslProtocol.AsEnum(), + }; + if (certificateValidator != null) + { + handler.ServerCertificateCustomValidationCallback = (x, y, z, w) => + { + return certificateValidator(x, y, z, w); + }; + } + + var client = new HttpClient(handler); + return await client.SendAsync(request); + } + else + { + return await httpClient.SendAsync(request); + } + } + + protected void _maybe_disable_cert_validation() + { + if (Environment.GetEnvironmentVariable("_TFHUB_DISABLE_CERT_VALIDATION") == "_TFHUB_DISABLE_CERT_VALIDATION_VALUE") + { + ServicePointManager.ServerCertificateValidationCallback = (_, _, _, _) => true; + Console.WriteLine("Disabled certificate validation for resolving handles."); + } + } + } + + public class SslProtocol + { + private readonly string protocolString; + + public static readonly SslProtocol Tls = new SslProtocol("TLS"); + public static readonly SslProtocol Tls11 = new SslProtocol("TLS 1.1"); + public static readonly SslProtocol Tls12 = new SslProtocol("TLS 1.2"); + + private SslProtocol(string protocolString) + { + this.protocolString = protocolString; + } + + public SslProtocols AsEnum() + { + switch (protocolString.ToUpper()) + { + case "TLS": + return SslProtocols.Tls; + case "TLS 1.1": + return SslProtocols.Tls11; + case "TLS 1.2": + return SslProtocols.Tls12; + default: + throw new ArgumentException($"Unknown SSL/TLS protocol: {protocolString}"); + } + } + } +} diff --git a/src/TensorflowNET.Hub/tf_utils.cs b/src/TensorflowNET.Hub/tf_utils.cs new file mode 100644 index 000000000..96d8c92d6 --- /dev/null +++ b/src/TensorflowNET.Hub/tf_utils.cs @@ -0,0 +1,80 @@ +using System; +using System.IO; + +namespace Tensorflow.Hub +{ + internal class tf_utils + { + public static string bytes_to_readable_str(long? numBytes, bool includeB = false) + { + if (numBytes == null) return numBytes.ToString(); + + var num = (double)numBytes; + + if (num < 1024) + { + return $"{(long)num}{(includeB ? "B" : "")}"; + } + + num /= 1 << 10; + if (num < 1024) + { + return $"{num:F2}k{(includeB ? "B" : "")}"; + } + + num /= 1 << 10; + if (num < 1024) + { + return $"{num:F2}M{(includeB ? "B" : "")}"; + } + + num /= 1 << 10; + return $"{num:F2}G{(includeB ? "B" : "")}"; + } + + public static void atomic_write_string_to_file(string filename, string contents, bool overwrite) + { + var tempPath = $"{filename}.tmp.{Guid.NewGuid():N}"; + + using (var fileStream = new FileStream(tempPath, FileMode.Create)) + { + using (var writer = new StreamWriter(fileStream)) + { + writer.Write(contents); + writer.Flush(); + } + } + + try + { + if (File.Exists(filename)) + { + if (overwrite) + { + File.Delete(filename); + File.Move(tempPath, filename); + } + } + else + { + File.Move(tempPath, filename); + } + } + catch + { + File.Delete(tempPath); + throw; + } + } + + public static string absolute_path(string path) + { + if (path.Contains("://")) + { + return path; + } + + return Path.GetFullPath(path); + } + } +} diff --git a/test/TensorFlowNET.Graph.UnitTest/Basics/QueueTest.cs b/test/TensorFlowNET.Graph.UnitTest/Basics/QueueTest.cs index f0a4ea846..21c5fdbfe 100644 --- a/test/TensorFlowNET.Graph.UnitTest/Basics/QueueTest.cs +++ b/test/TensorFlowNET.Graph.UnitTest/Basics/QueueTest.cs @@ -16,18 +16,16 @@ public void PaddingFIFOQueue() var enqueue = queue.enqueue(numbers); var dequeue_many = queue.dequeue_many(n: 3); - using (var sess = tf.Session()) - { - sess.run(enqueue, (numbers, new[] { 1 })); - sess.run(enqueue, (numbers, new[] { 2, 3 })); - sess.run(enqueue, (numbers, new[] { 3, 4, 5 })); - - var result = sess.run(dequeue_many[0]); - - Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 1, 0, 0 }, result[0].ToArray())); - Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 2, 3, 0 }, result[1].ToArray())); - Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 3, 4, 5 }, result[2].ToArray())); - } + var sess = tf.Session(); + sess.run(enqueue, (numbers, new[] { 1 })); + sess.run(enqueue, (numbers, new[] { 2, 3 })); + sess.run(enqueue, (numbers, new[] { 3, 4, 5 })); + + var result = sess.run(dequeue_many[0]); + + Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 1, 0, 0 }, result[0].ToArray())); + Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 2, 3, 0 }, result[1].ToArray())); + Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 3, 4, 5 }, result[2].ToArray())); } [TestMethod] @@ -45,27 +43,25 @@ public void FIFOQueue() // push back into queue var inc = queue.enqueue(y); - using (var sess = tf.Session()) - { - // init queue - init.run(); + var sess = tf.Session(); + // init queue + init.run(); - // pop out first element and push back calculated y - (int dequeued, _) = sess.run((x, inc)); - Assert.AreEqual(10, dequeued); + // pop out first element and push back calculated y + (int dequeued, _) = sess.run((x, inc)); + Assert.AreEqual(10, dequeued); - (dequeued, _) = sess.run((x, inc)); - Assert.AreEqual(20, dequeued); + (dequeued, _) = sess.run((x, inc)); + Assert.AreEqual(20, dequeued); - (dequeued, _) = sess.run((x, inc)); - Assert.AreEqual(11, dequeued); + (dequeued, _) = sess.run((x, inc)); + Assert.AreEqual(11, dequeued); - (dequeued, _) = sess.run((x, inc)); - Assert.AreEqual(21, dequeued); + (dequeued, _) = sess.run((x, inc)); + Assert.AreEqual(21, dequeued); - // thread will hang or block if you run sess.run(x) again - // until queue has more element. - } + // thread will hang or block if you run sess.run(x) again + // until queue has more element. } [TestMethod] @@ -75,19 +71,17 @@ public void PriorityQueue() var init = queue.enqueue_many(new[] { 2L, 4L, 3L }, new[] { "p1", "p2", "p3" }); var x = queue.dequeue(); - using (var sess = tf.Session()) - { - init.run(); + var sess = tf.Session(); + init.run(); - var result = sess.run(x); - Assert.AreEqual(result[0], 2L); + var result = sess.run(x); + Assert.AreEqual(result[0], 2L); - result = sess.run(x); - Assert.AreEqual(result[0], 3L); + result = sess.run(x); + Assert.AreEqual(result[0], 3L); - result = sess.run(x); - Assert.AreEqual(result[0], 4L); - } + result = sess.run(x); + Assert.AreEqual(result[0], 4L); } [TestMethod] @@ -98,16 +92,14 @@ public void RandomShuffleQueue() var x = queue.dequeue(); string results = ""; - using (var sess = tf.Session()) - { - init.run(); + var sess = tf.Session(); + init.run(); - foreach (var i in range(9)) - results += (int)sess.run(x) + "."; + foreach (var i in range(9)) + results += (int)sess.run(x) + "."; - // output in random order - Assert.IsFalse(results == "1.2.3.4.5.6.7.8.9."); - } + // output in random order + Assert.IsFalse(results == "1.2.3.4.5.6.7.8.9."); } } } diff --git a/test/TensorFlowNET.Graph.UnitTest/Basics/SessionTest.cs b/test/TensorFlowNET.Graph.UnitTest/Basics/SessionTest.cs index 823809847..2300b0948 100644 --- a/test/TensorFlowNET.Graph.UnitTest/Basics/SessionTest.cs +++ b/test/TensorFlowNET.Graph.UnitTest/Basics/SessionTest.cs @@ -19,11 +19,9 @@ public void EvalTensor() var a = constant_op.constant(np.array(3.0).reshape((1, 1))); var b = constant_op.constant(np.array(2.0).reshape((1, 1))); var c = math_ops.matmul(a, b, name: "matmul"); - using (var sess = tf.Session()) - { - var result = c.eval(sess); - Assert.AreEqual(result[0], 6.0); - } + var sess = tf.Session(); + var result = c.eval(sess); + Assert.AreEqual(result[0], 6.0); } } @@ -32,11 +30,9 @@ public void Eval_SmallString_Scalar() { var a = constant_op.constant("123 heythere 123 ", TF_DataType.TF_STRING); var c = tf.strings.substr(a, 4, 8); - using (var sess = tf.Session()) - { - var result = c.eval(sess).StringData(); - Assert.AreEqual(result[0], "heythere"); - } + var sess = tf.Session(); + var result = c.eval(sess).StringData(); + Assert.AreEqual(result[0], "heythere"); } [TestMethod] @@ -47,11 +43,9 @@ public void Eval_LargeString_Scalar() const int size = 30_000; var a = constant_op.constant(new string('a', size), TF_DataType.TF_STRING); var c = tf.strings.substr(a, 0, size - 5000); - using (var sess = tf.Session()) - { - var result = UTF8Encoding.UTF8.GetString(c.eval(sess).ToByteArray()); - Console.WriteLine(result); - } + var sess = tf.Session(); + var result = UTF8Encoding.UTF8.GetString(c.eval(sess).ToByteArray()); + Console.WriteLine(result); } } diff --git a/test/TensorFlowNET.Graph.UnitTest/Basics/TensorTest.cs b/test/TensorFlowNET.Graph.UnitTest/Basics/TensorTest.cs index 46fe69d35..90de78743 100644 --- a/test/TensorFlowNET.Graph.UnitTest/Basics/TensorTest.cs +++ b/test/TensorFlowNET.Graph.UnitTest/Basics/TensorTest.cs @@ -16,15 +16,13 @@ public void sparse_to_dense() var labels = tf.expand_dims(tf.constant(new[] { 0, 1, 2, 3, 4 }), 1); var st = tf.concat(values: new[] { indices, labels }, axis: 1); var onehot = tf.sparse_to_dense(st, (5, 5), 1); - using (var sess = tf.Session()) - { - var result = sess.run(onehot); - Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 1, 0, 0, 0, 0 }, result[0].ToArray())); - Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 0, 1, 0, 0, 0 }, result[1].ToArray())); - Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 0, 0, 1, 0, 0 }, result[2].ToArray())); - Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 0, 0, 0, 1, 0 }, result[3].ToArray())); - Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 0, 0, 0, 0, 1 }, result[4].ToArray())); - }; + var sess = tf.Session(); + var result = sess.run(onehot); + Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 1, 0, 0, 0, 0 }, result[0].ToArray())); + Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 0, 1, 0, 0, 0 }, result[1].ToArray())); + Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 0, 0, 1, 0, 0 }, result[2].ToArray())); + Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 0, 0, 0, 1, 0 }, result[3].ToArray())); + Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 0, 0, 0, 0, 1 }, result[4].ToArray())); } [TestMethod, Ignore] @@ -39,13 +37,11 @@ public void sparse_tensor_to_dense() new[] { 3L, 4L }); var onehot = tf.sparse_tensor_to_dense(decoded_list); - using (var sess = tf.Session()) - { - var result = sess.run(onehot); - Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 1, 0, 0, 0 }, result[0].ToArray())); - Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 0, 0, 2, 0 }, result[1].ToArray())); - Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 0, 0, 0, 0 }, result[2].ToArray())); - } + var sess = tf.Session(); + var result = sess.run(onehot); + Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 1, 0, 0, 0 }, result[0].ToArray())); + Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 0, 0, 2, 0 }, result[1].ToArray())); + Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 0, 0, 0, 0 }, result[2].ToArray())); } [TestMethod] @@ -56,14 +52,12 @@ public void batch_to_space_nd() int[,] crops = { { 0, 0 }, { 0, 0 } }; var tensor = tf.batch_to_space_nd(inputs, block_shape, crops); - using (var sess = tf.Session()) - { - var result = sess.run(tensor); - Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 0, 6, 1, 7, 2, 8 }, result[0, 0].ToArray())); - Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 12, 18, 13, 19, 14, 20 }, result[0, 1].ToArray())); - Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 3, 9, 4, 10, 5, 11 }, result[0, 2].ToArray())); - Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 15, 21, 16, 22, 17, 23 }, result[0, 3].ToArray())); - } + var sess = tf.Session(); + var result = sess.run(tensor); + Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 0, 6, 1, 7, 2, 8 }, result[0, 0].ToArray())); + Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 12, 18, 13, 19, 14, 20 }, result[0, 1].ToArray())); + Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 3, 9, 4, 10, 5, 11 }, result[0, 2].ToArray())); + Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 15, 21, 16, 22, 17, 23 }, result[0, 3].ToArray())); } [TestMethod, Ignore] @@ -72,11 +66,9 @@ public void boolean_mask() var tensor = new[] { 0, 1, 2, 3 }; var mask = np.array(new[] { true, false, true, false }); var masked = tf.boolean_mask(tensor, mask); - using (var sess = tf.Session()) - { - var result = sess.run(masked); - Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 0, 2 }, masked.ToArray())); - } + var sess = tf.Session(); + var result = sess.run(masked); + Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 0, 2 }, masked.ToArray())); } } } \ No newline at end of file diff --git a/test/TensorFlowNET.Graph.UnitTest/Basics/VariableTest.cs b/test/TensorFlowNET.Graph.UnitTest/Basics/VariableTest.cs index 35525a1a5..3c95501db 100644 --- a/test/TensorFlowNET.Graph.UnitTest/Basics/VariableTest.cs +++ b/test/TensorFlowNET.Graph.UnitTest/Basics/VariableTest.cs @@ -14,7 +14,7 @@ public void InitVariable() var v = tf.Variable(new[] { 1, 2 }); var init = tf.compat.v1.global_variables_initializer(); - using var sess = tf.compat.v1.Session(); + var sess = tf.compat.v1.Session(); sess.run(init); // Usage passing the session explicitly. print(v.eval(sess)); diff --git a/test/TensorFlowNET.Graph.UnitTest/ComplexTest.cs b/test/TensorFlowNET.Graph.UnitTest/ComplexTest.cs new file mode 100644 index 000000000..abb44eeed --- /dev/null +++ b/test/TensorFlowNET.Graph.UnitTest/ComplexTest.cs @@ -0,0 +1,201 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Tensorflow.NumPy; +using System; +using System.Collections.Generic; +using System.Linq; +using Tensorflow; +using static Tensorflow.Binding; +using Tensorflow.Keras.UnitTest; + +namespace TensorFlowNET.UnitTest.Basics +{ + [TestClass] + public class ComplexTest : EagerModeTestBase + { + // Tests for Complex128 + + [TestMethod] + public void complex128_basic() + { + double[] d_real = new double[] { 1.0, 2.0, 3.0, 4.0 }; + double[] d_imag = new double[] { -1.0, -3.0, 5.0, 7.0 }; + + Tensor t_real = tf.constant(d_real, dtype:TF_DataType.TF_DOUBLE); + Tensor t_imag = tf.constant(d_imag, dtype: TF_DataType.TF_DOUBLE); + + Tensor t_complex = tf.complex(t_real, t_imag); + + Tensor t_real_result = tf.math.real(t_complex); + Tensor t_imag_result = tf.math.imag(t_complex); + + NDArray n_real_result = t_real_result.numpy(); + NDArray n_imag_result = t_imag_result.numpy(); + + double[] d_real_result =n_real_result.ToArray(); + double[] d_imag_result = n_imag_result.ToArray(); + + Assert.IsTrue(base.Equal(d_real_result, d_real)); + Assert.IsTrue(base.Equal(d_imag_result, d_imag)); + } + [TestMethod] + public void complex128_abs() + { + tf.enable_eager_execution(); + + double[] d_real = new double[] { -3.0, -5.0, 8.0, 7.0 }; + double[] d_imag = new double[] { -4.0, 12.0, -15.0, 24.0 }; + + double[] d_abs = new double[] { 5.0, 13.0, 17.0, 25.0 }; + + Tensor t_real = tf.constant(d_real, dtype: TF_DataType.TF_DOUBLE); + Tensor t_imag = tf.constant(d_imag, dtype: TF_DataType.TF_DOUBLE); + + Tensor t_complex = tf.complex(t_real, t_imag); + + Tensor t_abs_result = tf.abs(t_complex); + + double[] d_abs_result = t_abs_result.numpy().ToArray(); + Assert.IsTrue(base.Equal(d_abs_result, d_abs)); + } + [TestMethod] + public void complex128_conj() + { + double[] d_real = new double[] { -3.0, -5.0, 8.0, 7.0 }; + double[] d_imag = new double[] { -4.0, 12.0, -15.0, 24.0 }; + + double[] d_real_expected = new double[] { -3.0, -5.0, 8.0, 7.0 }; + double[] d_imag_expected = new double[] { 4.0, -12.0, 15.0, -24.0 }; + + Tensor t_real = tf.constant(d_real, dtype: TF_DataType.TF_DOUBLE); + Tensor t_imag = tf.constant(d_imag, dtype: TF_DataType.TF_DOUBLE); + + Tensor t_complex = tf.complex(t_real, t_imag, TF_DataType.TF_COMPLEX128); + + Tensor t_result = tf.math.conj(t_complex); + + NDArray n_real_result = tf.math.real(t_result).numpy(); + NDArray n_imag_result = tf.math.imag(t_result).numpy(); + + double[] d_real_result = n_real_result.ToArray(); + double[] d_imag_result = n_imag_result.ToArray(); + + Assert.IsTrue(base.Equal(d_real_result, d_real_expected)); + Assert.IsTrue(base.Equal(d_imag_result, d_imag_expected)); + } + [TestMethod] + public void complex128_angle() + { + double[] d_real = new double[] { 0.0, 1.0, -1.0, 0.0 }; + double[] d_imag = new double[] { 1.0, 0.0, -2.0, -3.0 }; + + double[] d_expected = new double[] { 1.5707963267948966, 0, -2.0344439357957027, -1.5707963267948966 }; + + Tensor t_real = tf.constant(d_real, dtype: TF_DataType.TF_DOUBLE); + Tensor t_imag = tf.constant(d_imag, dtype: TF_DataType.TF_DOUBLE); + + Tensor t_complex = tf.complex(t_real, t_imag, TF_DataType.TF_COMPLEX128); + + Tensor t_result = tf.math.angle(t_complex); + + NDArray n_result = t_result.numpy(); + + double[] d_result = n_result.ToArray(); + + Assert.IsTrue(base.Equal(d_result, d_expected)); + } + + // Tests for Complex64 + [TestMethod] + public void complex64_basic() + { + tf.init_scope(); + float[] d_real = new float[] { 1.0f, 2.0f, 3.0f, 4.0f }; + float[] d_imag = new float[] { -1.0f, -3.0f, 5.0f, 7.0f }; + + Tensor t_real = tf.constant(d_real, dtype: TF_DataType.TF_FLOAT); + Tensor t_imag = tf.constant(d_imag, dtype: TF_DataType.TF_FLOAT); + + Tensor t_complex = tf.complex(t_real, t_imag); + + Tensor t_real_result = tf.math.real(t_complex); + Tensor t_imag_result = tf.math.imag(t_complex); + + // Convert the EagerTensors to NumPy arrays directly + float[] d_real_result = t_real_result.numpy().ToArray(); + float[] d_imag_result = t_imag_result.numpy().ToArray(); + + Assert.IsTrue(base.Equal(d_real_result, d_real)); + Assert.IsTrue(base.Equal(d_imag_result, d_imag)); + } + [TestMethod] + public void complex64_abs() + { + tf.enable_eager_execution(); + + float[] d_real = new float[] { -3.0f, -5.0f, 8.0f, 7.0f }; + float[] d_imag = new float[] { -4.0f, 12.0f, -15.0f, 24.0f }; + + float[] d_abs = new float[] { 5.0f, 13.0f, 17.0f, 25.0f }; + + Tensor t_real = tf.constant(d_real, dtype: TF_DataType.TF_FLOAT); + Tensor t_imag = tf.constant(d_imag, dtype: TF_DataType.TF_FLOAT); + + Tensor t_complex = tf.complex(t_real, t_imag, TF_DataType.TF_COMPLEX64); + + Tensor t_abs_result = tf.abs(t_complex); + + NDArray n_abs_result = t_abs_result.numpy(); + + float[] d_abs_result = n_abs_result.ToArray(); + Assert.IsTrue(base.Equal(d_abs_result, d_abs)); + + } + [TestMethod] + public void complex64_conj() + { + float[] d_real = new float[] { -3.0f, -5.0f, 8.0f, 7.0f }; + float[] d_imag = new float[] { -4.0f, 12.0f, -15.0f, 24.0f }; + + float[] d_real_expected = new float[] { -3.0f, -5.0f, 8.0f, 7.0f }; + float[] d_imag_expected = new float[] { 4.0f, -12.0f, 15.0f, -24.0f }; + + Tensor t_real = tf.constant(d_real, dtype: TF_DataType.TF_FLOAT); + Tensor t_imag = tf.constant(d_imag, dtype: TF_DataType.TF_FLOAT); + + Tensor t_complex = tf.complex(t_real, t_imag, TF_DataType.TF_COMPLEX64); + + Tensor t_result = tf.math.conj(t_complex); + + NDArray n_real_result = tf.math.real(t_result).numpy(); + NDArray n_imag_result = tf.math.imag(t_result).numpy(); + + float[] d_real_result = n_real_result.ToArray(); + float[] d_imag_result = n_imag_result.ToArray(); + + Assert.IsTrue(base.Equal(d_real_result, d_real_expected)); + Assert.IsTrue(base.Equal(d_imag_result, d_imag_expected)); + + } + [TestMethod] + public void complex64_angle() + { + float[] d_real = new float[] { 0.0f, 1.0f, -1.0f, 0.0f }; + float[] d_imag = new float[] { 1.0f, 0.0f, -2.0f, -3.0f }; + + float[] d_expected = new float[] { 1.5707964f, 0f, -2.0344439f, -1.5707964f }; + + Tensor t_real = tf.constant(d_real, dtype: TF_DataType.TF_FLOAT); + Tensor t_imag = tf.constant(d_imag, dtype: TF_DataType.TF_FLOAT); + + Tensor t_complex = tf.complex(t_real, t_imag, TF_DataType.TF_COMPLEX64); + + Tensor t_result = tf.math.angle(t_complex); + + NDArray n_result = t_result.numpy(); + + float[] d_result = n_result.ToArray(); + + Assert.IsTrue(base.Equal(d_result, d_expected)); + } + } +} \ No newline at end of file diff --git a/test/TensorFlowNET.Graph.UnitTest/ControlFlowTest/CondTestCases.cs b/test/TensorFlowNET.Graph.UnitTest/ControlFlowTest/CondTestCases.cs index 917280e49..7063c22cf 100644 --- a/test/TensorFlowNET.Graph.UnitTest/ControlFlowTest/CondTestCases.cs +++ b/test/TensorFlowNET.Graph.UnitTest/ControlFlowTest/CondTestCases.cs @@ -16,18 +16,16 @@ public void testCondTrue_ConstOnly() { var graph = tf.Graph().as_default(); - using (var sess = tf.Session(graph)) - { - var x = tf.constant(2, name: "x"); - var y = tf.constant(5, name: "y"); - - var z = control_flow_ops.cond(tf.less(x, y), - () => tf.constant(22, name: "t22"), - () => tf.constant(55, name: "f55")); - - int result = z.eval(sess); - assertEquals(result, 22); - } + var sess = tf.Session(graph); + var x = tf.constant(2, name: "x"); + var y = tf.constant(5, name: "y"); + + var z = control_flow_ops.cond(tf.less(x, y), + () => tf.constant(22, name: "t22"), + () => tf.constant(55, name: "f55")); + + int result = z.eval(sess); + assertEquals(result, 22); } [TestMethod] @@ -35,18 +33,16 @@ public void testCondFalse_ConstOnly() { var graph = tf.Graph().as_default(); - using (var sess = tf.Session(graph)) - { - var x = tf.constant(2, name: "x"); - var y = tf.constant(1, name: "y"); + var sess = tf.Session(graph); + var x = tf.constant(2, name: "x"); + var y = tf.constant(1, name: "y"); - var z = control_flow_ops.cond(tf.less(x, y), - () => tf.constant(22, name: "t22"), - () => tf.constant(11, name: "f11")); + var z = control_flow_ops.cond(tf.less(x, y), + () => tf.constant(22, name: "t22"), + () => tf.constant(11, name: "f11")); - int result = z.eval(sess); - assertEquals(result, 11); - } + int result = z.eval(sess); + assertEquals(result, 11); } [Ignore("Dependent on UpdateEdge")] diff --git a/test/TensorFlowNET.Graph.UnitTest/ControlFlowTest/WhileContextTestCase.cs b/test/TensorFlowNET.Graph.UnitTest/ControlFlowTest/WhileContextTestCase.cs index 814253585..a31dea7d2 100644 --- a/test/TensorFlowNET.Graph.UnitTest/ControlFlowTest/WhileContextTestCase.cs +++ b/test/TensorFlowNET.Graph.UnitTest/ControlFlowTest/WhileContextTestCase.cs @@ -23,21 +23,19 @@ public void SimpleWhileLoop() private void _testWhileContextHelper(int maximum_iterations) { // TODO: implement missing code dependencies - using (var sess = this.cached_session()) + var sess = this.cached_session(); + var i = constant_op.constant(0, name: "i"); + var c = new Func(x => gen_math_ops.less(x, 10, name: "c")); + var b = new Func(x => gen_math_ops.add(x, 1, name: "c")); + //control_flow_ops.while_loop( + // c, b, i , maximum_iterations: tf.constant(maximum_iterations)); + foreach (Operation op in sess.graph.get_operations()) { - var i = constant_op.constant(0, name: "i"); - var c = new Func(x => gen_math_ops.less(x, 10, name: "c")); - var b = new Func(x => gen_math_ops.add(x, 1, name: "c")); - //control_flow_ops.while_loop( - // c, b, i , maximum_iterations: tf.constant(maximum_iterations)); - foreach (Operation op in sess.graph.get_operations()) - { - var control_flow_context = op._get_control_flow_context(); - /*if (control_flow_context != null) - self.assertProtoEquals(control_flow_context.to_proto(), - WhileContext.from_proto( - control_flow_context.to_proto()).to_proto(), "");*/ - } + var control_flow_context = op._get_control_flow_context(); + /*if (control_flow_context != null) + self.assertProtoEquals(control_flow_context.to_proto(), + WhileContext.from_proto( + control_flow_context.to_proto()).to_proto(), "");*/ } } diff --git a/test/TensorFlowNET.Graph.UnitTest/GradientTest/GradientTest.cs b/test/TensorFlowNET.Graph.UnitTest/GradientTest/GradientTest.cs index f60fe6d91..92afd6a3f 100644 --- a/test/TensorFlowNET.Graph.UnitTest/GradientTest/GradientTest.cs +++ b/test/TensorFlowNET.Graph.UnitTest/GradientTest/GradientTest.cs @@ -18,11 +18,9 @@ public void BroadcastToGrad() var y = tf.broadcast_to(x, (2, 4, 3)); var grad = tf.gradients(y, x); - using (var sess = tf.Session(graph)) - { - float result = sess.run(grad[0]); - Assert.AreEqual(result, 24.0f); - } + var sess = tf.Session(graph); + float result = sess.run(grad[0]); + Assert.AreEqual(result, 24.0f); } [TestMethod] @@ -33,11 +31,9 @@ public void CumsumGrad() var z = tf.cumsum(y, axis: 1); var grad = tf.gradients(z, x); - using (var sess = tf.Session(graph)) - { - float result = sess.run(grad[0]); - Assert.AreEqual(result, 60.0f); - } + var sess = tf.Session(graph); + float result = sess.run(grad[0]); + Assert.AreEqual(result, 60.0f); } [TestMethod, Ignore] @@ -78,14 +74,12 @@ public void testBatchMatMulGradient() 42.0f, 42.0f, 42.0f, 45.0f, 45.0f, 45.0f }; - using (var sess = tf.Session()) - { - var result = sess.run(g); - var resultList = result[0].ToArray().ToList(); - resultList.AddRange(result[1].ToArray()); - Console.WriteLine(result.ToString()); - CollectionAssert.AreEqual(resultList.ToArray(), checkG); - } + var sess = tf.Session(); + var result = sess.run(g); + var resultList = result[0].ToArray().ToList(); + resultList.AddRange(result[1].ToArray()); + Console.WriteLine(result.ToString()); + CollectionAssert.AreEqual(resultList.ToArray(), checkG); } [TestMethod] @@ -97,11 +91,9 @@ public void testSimpleGradients() var y = f(x); var g = tf.gradients(y, x); - using (var session = tf.Session()) - { - var result = session.run(new[] { y, g[0] }); - return (result[0].ToArray()[0], result[1].ToArray()[0]); - } + var session = tf.Session(); + var result = session.run(new[] { y, g[0] }); + return (result[0].ToArray()[0], result[1].ToArray()[0]); } void test(string name, Func tfF, Func targetF, double[] values) @@ -197,13 +189,11 @@ with tf.compat.v1.Session() as sess: var g1 = tf.gradients(tf.reduce_sum(m, axis: 0)[0], x)[0]; var g2 = tf.gradients(tf.reduce_sum(m, axis: 1)[0], x)[0]; - using (var session = tf.Session()) - { - var (r0, r1, r2) = session.run((g0, g1, g2), new FeedItem(x, new[,] { { 1.0 } })); - self.assertFloat64Equal(6.0, r0[0], $"tf.reduce_sum(...)"); - self.assertFloat64Equal(2.0, r1[0], $"tf.reduce_sum(..., axis = 0)"); - self.assertFloat64Equal(3.0, r2[0], $"tf.reduce_sum(..., axis = 1)"); - } + var session = tf.Session(); + var (r0, r1, r2) = session.run((g0, g1, g2), new FeedItem(x, new[,] { { 1.0 } })); + self.assertFloat64Equal(6.0, r0[0], $"tf.reduce_sum(...)"); + self.assertFloat64Equal(2.0, r1[0], $"tf.reduce_sum(..., axis = 0)"); + self.assertFloat64Equal(3.0, r2[0], $"tf.reduce_sum(..., axis = 1)"); } [TestMethod] @@ -212,12 +202,10 @@ public void testTanhGradient() var a = tf.constant(1f); var b = tf.tanh(a); var g = tf.gradients(b, a); - using (var sess = tf.Session()) - { - var result = sess.run(g); - var actual = result[0]; - Assert.AreEqual(actual, 0.41997434127f); - } + var sess = tf.Session(); + var result = sess.run(g); + var actual = result[0]; + Assert.AreEqual(actual, 0.41997434127f); } @@ -227,14 +215,12 @@ public void testLgammaGrad() var a = tf.constant(5f); var b = tf.lgamma(a); var g = tf.gradients(b, a); - using (var sess = tf.Session()) - { - var result = sess.run(new object[] { g, b }); - var actualDeriv = result[0]; - var actual = result[1]; - Assert.AreEqual(actualDeriv, 1.5061177f); - Assert.AreEqual(actual, 3.17805386f); - } + var sess = tf.Session(); + var result = sess.run(new object[] { g, b }); + var actualDeriv = result[0]; + var actual = result[1]; + Assert.AreEqual(actualDeriv, 1.5061177f); + Assert.AreEqual(actual, 3.17805386f); } [TestMethod] @@ -247,14 +233,12 @@ public void testSliceGrad() tf.constant(new[] { 1 }, tf.int32, new[] { 1 }) ); var g = tf.gradients(b, a); - using (var sess = tf.Session()) - { - var result = sess.run(new object[] { g, b }); - var actualDeriv = np.squeeze(result[0]); - var actual = np.squeeze(result[1]); - Assert.AreEqual(actualDeriv, new float[] { 1, 0 }); - Assert.AreEqual(actual, 0.9640276f); - } + var sess = tf.Session(); + var result = sess.run(new object[] { g, b }); + var actualDeriv = np.squeeze(result[0]); + var actual = np.squeeze(result[1]); + Assert.AreEqual(actualDeriv, new float[] { 1, 0 }); + Assert.AreEqual(actual, 0.9640276f); } [TestMethod] @@ -264,14 +248,12 @@ public void testConcatGrad() var a2 = tf.constant(new[] { 3f }, shape: new[] { 1 }); var a = tf.concat(new List(new[] { a1, a2 }), 0); var g = tf.gradients(a, a1); - using (var sess = tf.Session()) - { - var result = sess.run(new object[] { g, a }); - var actualDeriv = result[0][0]; - var actual = result[1][0]; - Assert.AreEqual(actualDeriv, 1f); - Assert.AreEqual(actual, 2f); - } + var sess = tf.Session(); + var result = sess.run(new object[] { g, a }); + var actualDeriv = result[0][0]; + var actual = result[1][0]; + Assert.AreEqual(actualDeriv, 1f); + Assert.AreEqual(actual, 2f); } [TestMethod] @@ -280,13 +262,12 @@ public void testStopGradientFunction() var ap = tf.constant(1f); var b = tf.tanh(ap) + gen_array_ops.stop_gradient(ap); var g = tf.gradients(b, ap); - using (var sess = tf.Session()) - { - var result = sess.run(g); - var actual = result[0]; - Assert.AreEqual(actual, 0.41997434127f); - } + var sess = tf.Session(); + var result = sess.run(g); + var actual = result[0]; + Assert.AreEqual(actual, 0.41997434127f); } + [Ignore("TODO")] [TestMethod] public void testUnusedOutput() diff --git a/test/TensorFlowNET.Graph.UnitTest/ImageTest.cs b/test/TensorFlowNET.Graph.UnitTest/ImageTest.cs index 29ad9ad83..c42445cf1 100644 --- a/test/TensorFlowNET.Graph.UnitTest/ImageTest.cs +++ b/test/TensorFlowNET.Graph.UnitTest/ImageTest.cs @@ -74,23 +74,21 @@ public void TestCropAndResize() var cropSize2_2 = tf.Variable(np.array(4, 4)); var init = tf.global_variables_initializer(); - using (Session sess = tf.Session()) - { - sess.run(init); + var sess = tf.Session(); + sess.run(init); - var cropped = tf.image.crop_and_resize(image, box, boxInd, cropSize1_1); + var cropped = tf.image.crop_and_resize(image, box, boxInd, cropSize1_1); - var result = sess.run(cropped); - // check if cropped to 1x1 center was succesfull - Assert.AreEqual(result.size, 1ul); - Assert.AreEqual(result[0, 0, 0, 0], 4f); + var result = sess.run(cropped); + // check if cropped to 1x1 center was succesfull + Assert.AreEqual(result.size, 1ul); + Assert.AreEqual(result[0, 0, 0, 0], 4f); - cropped = tf.image.crop_and_resize(image2, box, boxInd, cropSize2_2); - result = sess.run(cropped); - // check if flipped and no cropping occured - Assert.AreEqual(result.size, 16ul); - Assert.AreEqual(result[0, 0, 0, 0], 12f); - } + cropped = tf.image.crop_and_resize(image2, box, boxInd, cropSize2_2); + result = sess.run(cropped); + // check if flipped and no cropping occured + Assert.AreEqual(result.size, 16ul); + Assert.AreEqual(result[0, 0, 0, 0], 12f); } } } diff --git a/test/TensorFlowNET.Graph.UnitTest/MultithreadingTests.cs b/test/TensorFlowNET.Graph.UnitTest/MultithreadingTests.cs index f657acc74..4b92d0210 100644 --- a/test/TensorFlowNET.Graph.UnitTest/MultithreadingTests.cs +++ b/test/TensorFlowNET.Graph.UnitTest/MultithreadingTests.cs @@ -24,7 +24,7 @@ void Core(int tid) { Assert.IsNull(tf.peak_default_graph()); - using var sess = tf.Session(); + var sess = tf.Session(); var default_graph = tf.get_default_graph(); var sess_graph = sess.graph; Assert.IsNotNull(default_graph); @@ -45,7 +45,7 @@ void Core(int tid) { Assert.IsNull(tf.peak_default_graph()); //tf.Session created an other graph - using var sess = tf.Session(); + var sess = tf.Session(); var default_graph = tf.get_default_graph(); var sess_graph = sess.graph; Assert.IsNotNull(default_graph); @@ -69,7 +69,7 @@ void Core(int tid) beforehand.as_default(); Assert.IsNotNull(tf.peak_default_graph()); - using var sess = tf.Session(); + var sess = tf.Session(); var default_graph = tf.peak_default_graph(); var sess_graph = sess.graph; Assert.IsNotNull(default_graph); @@ -102,7 +102,7 @@ public void TensorCreation() //the core method void Core(int tid) { - using var sess = tf.Session(); + var sess = tf.Session(); for (int i = 0; i < 100; i++) { var t = new Tensor(1); @@ -119,7 +119,7 @@ public void TensorCreation_Array() void Core(int tid) { //tf.Session created an other graph - using var sess = tf.Session(); + var sess = tf.Session(); for (int i = 0; i < 100; i++) { var t = new Tensor(new int[] { 1, 2, 3 }); @@ -142,7 +142,7 @@ void Core(int tid) var a1 = tf.constant(new[] { 2f }, shape: new[] { 1 }); var a2 = tf.constant(new[] { 3f }, shape: new[] { 1 }); var math = a1 + a2; - using var sess = tf.Session(graph); + var sess = tf.Session(graph); for (int i = 0; i < 100; i++) { var result = sess.run(math); @@ -162,7 +162,7 @@ void Core(int tid) tf.compat.v1.disable_eager_execution(); var graph = tf.Graph().as_default(); - using var sess = tf.Session(graph); + var sess = tf.Session(graph); Assert.IsNotNull(tf.get_default_graph()); //graph is created automatically to perform create these operations var a1 = tf.constant(new[] { 2f }, shape: new[] { 1 }); @@ -182,7 +182,7 @@ public void SessionRun_Initialization() //the core method void Core(int tid) { - using var sess = tf.Session(); + var sess = tf.Session(); Assert.IsNotNull(tf.get_default_graph()); //graph is created automatically to perform create these operations var a1 = tf.constant(new[] { 2f }, shape: new[] { 1 }); diff --git a/test/TensorFlowNET.Graph.UnitTest/OperationsTest.cs b/test/TensorFlowNET.Graph.UnitTest/OperationsTest.cs index 89dce0e18..47887e29c 100644 --- a/test/TensorFlowNET.Graph.UnitTest/OperationsTest.cs +++ b/test/TensorFlowNET.Graph.UnitTest/OperationsTest.cs @@ -20,7 +20,7 @@ public class OperationsTest : GraphModeTestBase public void GetAllOpList() { var handle = c_api.TF_GetAllOpList(); - using var buffer = new Buffer(handle); + var buffer = new Buffer(handle); var op_list = OpList.Parser.ParseFrom(buffer.ToArray()); var _registered_ops = new Dictionary(); @@ -39,13 +39,11 @@ public void addInPlaceholder() var b = tf.placeholder(tf.float32); var c = tf.add(a, b); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, 3.0f), - new FeedItem(b, 2.0f)); - Assert.AreEqual(o, 5.0f); - } + var sess = tf.Session(); + var o = sess.run(c, + new FeedItem(a, 3.0f), + new FeedItem(b, 2.0f)); + Assert.AreEqual(o, 5.0f); } [TestMethod] @@ -55,11 +53,9 @@ public void addInConstant() var b = tf.constant(5.0f); var c = tf.add(a, b); - using (var sess = tf.Session()) - { - var o = sess.run(c); - Assert.AreEqual(o, 9.0f); - } + var sess = tf.Session(); + var o = sess.run(c); + Assert.AreEqual(o, 9.0f); } [TestMethod] @@ -69,11 +65,9 @@ public void isFinite() var b = tf.cast(tf.is_finite(a), tf.float32); var check = np.array(1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f); - using (var sess = tf.Session()) - { - var o = sess.run(b); - Assert.IsTrue(np.array_equal(o, check)); - } + var sess = tf.Session(); + var o = sess.run(b); + Assert.IsTrue(np.array_equal(o, check)); } [TestMethod] @@ -83,11 +77,9 @@ public void isNan() var b = tf.cast(tf.is_nan(a), tf.float32); var check = np.array(0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f); - using (var sess = tf.Session()) - { - var o = sess.run(b); - Assert.IsTrue(np.array_equal(o, check)); - } + var sess = tf.Session(); + var o = sess.run(b); + Assert.IsTrue(np.array_equal(o, check)); } [TestMethod] @@ -97,38 +89,30 @@ public void cumSumTest() var b = tf.cumsum(a); var check = np.array(1, 2, 4, 7, 11, 16); - using (var sess = tf.Session()) - { - var o = sess.run(b); - Assert.IsTrue(np.array_equal(o, check)); - } + var sess = tf.Session(); + var o = sess.run(b); + Assert.IsTrue(np.array_equal(o, check)); b = tf.cumsum(a, exclusive: true); check = np.array(0, 1, 2, 4, 7, 11); - using (var sess = tf.Session()) - { - var o = sess.run(b); - Assert.IsTrue(np.array_equal(o, check)); - } + sess = tf.Session(); + o = sess.run(b); + Assert.IsTrue(np.array_equal(o, check)); b = tf.cumsum(a, reverse: true); check = np.array(16, 15, 14, 12, 9, 5); - using (var sess = tf.Session()) - { - var o = sess.run(b); - Assert.IsTrue(np.array_equal(o, check)); - } + sess = tf.Session(); + o = sess.run(b); + Assert.IsTrue(np.array_equal(o, check)); b = tf.cumsum(a, exclusive: true, reverse: true); check = np.array(15, 14, 12, 9, 5, 0); - using (var sess = tf.Session()) - { - var o = sess.run(b); - Assert.IsTrue(np.array_equal(o, check)); - } + sess = tf.Session(); + o = sess.run(b); + Assert.IsTrue(np.array_equal(o, check)); } [TestMethod] @@ -140,38 +124,30 @@ public void logicalOpsTest() var d = tf.cast(tf.logical_and(b, c), tf.int32); var check = np.array(new[] { 0, 0, 0, 0, 0, 0, 0, 0 }); - using (var sess = tf.Session()) - { - var o = sess.run(d); - Assert.IsTrue(np.array_equal(o, check)); - } + var sess = tf.Session(); + var o = sess.run(d); + Assert.IsTrue(np.array_equal(o, check)); d = tf.cast(tf.logical_not(b), tf.int32); check = np.array(new[] { 1, 1, 1, 1, 0, 0, 0, 0 }); - using (var sess = tf.Session()) - { - var o = sess.run(d); - Assert.IsTrue(np.array_equal(o, check)); - } + sess = tf.Session(); + o = sess.run(d); + Assert.IsTrue(np.array_equal(o, check)); d = tf.cast(tf.logical_or(b, c), tf.int32); check = np.array(new[] { 1, 1, 1, 1, 1, 1, 1, 1 }); - using (var sess = tf.Session()) - { - var o = sess.run(d); - Assert.IsTrue(np.array_equal(o, check)); - } + sess = tf.Session(); + o = sess.run(d); + Assert.IsTrue(np.array_equal(o, check)); d = tf.cast(tf.logical_xor(b, c), tf.int32); check = np.array(new[] { 1, 1, 1, 1, 1, 1, 1, 1 }); - using (var sess = tf.Session()) - { - var o = sess.run(d); - Assert.IsTrue(np.array_equal(o, check)); - } + sess = tf.Session(); + o = sess.run(d); + Assert.IsTrue(np.array_equal(o, check)); } [TestMethod] @@ -192,41 +168,33 @@ public void addOpTests() var b = tf.placeholder(tf.int32, shape: new Shape(rows, cols)); var c = tf.reduce_sum(tf.reduce_sum(tf.add(a, b), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); - Assert.AreEqual(o, intResult); - } + var sess = tf.Session(); + var o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); + Assert.AreEqual(o, intResult); // Testing `operator +(Tensor x, Tensor y)` c = tf.reduce_sum(tf.reduce_sum(a + b, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); - Assert.AreEqual(o, intResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); + Assert.AreEqual(o, intResult); // Testing `operator +(Tensor x, int y)` c = tf.reduce_sum(tf.reduce_sum(a + secondIntVal, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); - Assert.AreEqual(o, intResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); + Assert.AreEqual(o, intResult); // Testing `operator +(int x, Tensor y)` c = tf.reduce_sum(tf.reduce_sum(secondIntVal + a, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); - Assert.AreEqual(o, intResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); + Assert.AreEqual(o, intResult); #endregion #region floatTest @@ -241,41 +209,33 @@ public void addOpTests() b = tf.placeholder(tf.float32, shape: new Shape(rows, cols)); c = tf.reduce_sum(tf.reduce_sum(tf.add(a, b), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual(o, floatResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual(o, floatResult); // Testing `operator +(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(a + b, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual(o, floatResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual(o, floatResult); // Testing `operator +(Tensor x, float y) c = tf.reduce_sum(tf.reduce_sum(a + secondFloatVal, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual(o, floatResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual(o, floatResult); // Testing `operator +(float x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(secondFloatVal + a, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual(o, floatResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual(o, floatResult); #endregion #region doubleTest @@ -290,41 +250,33 @@ public void addOpTests() b = tf.placeholder(tf.float64, shape: new Shape(rows, cols)); c = tf.reduce_sum(tf.reduce_sum(tf.add(a, b), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((double)o, doubleResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((double)o, doubleResult); // Testing `operator +(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(a + b, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual(o, doubleResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual(o, doubleResult); // Testing `operator +(Tensor x, double y) c = tf.reduce_sum(tf.reduce_sum(a + secondDoubleVal, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual(o, doubleResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual(o, doubleResult); // Testing `operator +(double x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(secondDoubleVal + a, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual(o, doubleResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual(o, doubleResult); #endregion } @@ -347,50 +299,40 @@ public void subOpTests() var b = tf.placeholder(tf.int32, shape: new Shape(rows, cols)); var c = tf.reduce_sum(tf.reduce_sum(tf.sub(a, b), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + var sess = tf.Session(); + var o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResult); // Testing `operator -(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(a - b, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResult); // Testing `operator -(Tensor x, int y) c = tf.reduce_sum(tf.reduce_sum(a - secondIntVal, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResult); // Testing `operator -(int x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(secondIntVal - a, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, Math.Abs(intResult)); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, Math.Abs(intResult)); // Testing `operator -(Tensor x) c = tf.reduce_sum(tf.reduce_sum(-a, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResultTwo); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResultTwo); #endregion #region floatTest @@ -406,50 +348,40 @@ public void subOpTests() b = tf.placeholder(tf.float32, shape: new Shape(rows, cols)); c = tf.reduce_sum(tf.reduce_sum(tf.sub(a, b), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((float)o, floatResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual((float)o, floatResult); // Testing `operator -(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(a - b, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((float)o, floatResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual((float)o, floatResult); // Testing `operator -(Tensor x, float y) c = tf.reduce_sum(tf.reduce_sum(a - secondFloatVal, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((float)o, floatResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual((float)o, floatResult); // Testing `operator -(float x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(secondFloatVal - a, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((float)o, Math.Abs(floatResult)); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual((float)o, Math.Abs(floatResult)); // Testing `operator -(Tensor x) c = tf.reduce_sum(tf.reduce_sum(-a, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((float)o, floatResultTwo); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual((float)o, floatResultTwo); #endregion #region doubleTest @@ -465,50 +397,40 @@ public void subOpTests() b = tf.placeholder(tf.float64, shape: new Shape(rows, cols)); c = tf.reduce_sum(tf.reduce_sum(tf.sub(a, b), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((double)o, doubleResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((double)o, doubleResult); // Testing `operator -(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(a - b, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((double)o, doubleResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((double)o, doubleResult); // Testing `operator -(Tensor x, double y) c = tf.reduce_sum(tf.reduce_sum(a - secondDoubleVal, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((double)o, doubleResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((double)o, doubleResult); // Testing `operator -(double x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(secondDoubleVal - a, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((double)o, Math.Abs(doubleResult)); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((double)o, Math.Abs(doubleResult)); // Testing `operator -(Tensor x) c = tf.reduce_sum(tf.reduce_sum(-a, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((double)o, doubleResultTwo); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((double)o, doubleResultTwo); #endregion } @@ -588,41 +510,33 @@ public void mulOpTests() var b = tf.placeholder(tf.int32, shape: new Shape(rows, cols)); var c = tf.reduce_sum(tf.reduce_sum(tf.multiply(a, b), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + var sess = tf.Session(); + var o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResult); // Testing `operator *(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(a * b, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResult); // Testing `operator *(Tensor x, int y) c = tf.reduce_sum(tf.reduce_sum(a * secondIntVal, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResult); // Testing `operator *(int x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(firstIntVal * b, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResult); #endregion #region floatTest @@ -637,41 +551,33 @@ public void mulOpTests() b = tf.placeholder(tf.float32, shape: new Shape(rows, cols)); c = tf.reduce_sum(tf.reduce_sum(tf.multiply(a, b), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((float)o, floatResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual((float)o, floatResult); // Testing `operator *(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(a * b, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((float)o, floatResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual((float)o, floatResult); // Testing `operator *(Tensor x, float y) c = tf.reduce_sum(tf.reduce_sum(a * secondFloatVal, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((float)o, floatResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual((float)o, floatResult); // Testing `operator *(float x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(firstFloatVal * b, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((float)o, floatResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual((float)o, floatResult); #endregion #region doubleTest @@ -686,41 +592,33 @@ public void mulOpTests() b = tf.placeholder(tf.float64, shape: new Shape(rows, cols)); c = tf.reduce_sum(tf.reduce_sum(tf.multiply(a, b), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((double)o, doubleResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((double)o, doubleResult); // Testing `operator *(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(a * b, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((double)o, doubleResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((double)o, doubleResult); // Testing `operator *(Tensor x, double y) c = tf.reduce_sum(tf.reduce_sum(a * secondDoubleVal, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((double)o, doubleResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((double)o, doubleResult); // Testing `operator *(double x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(firstDoubleVal * b, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((double)o, doubleResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((double)o, doubleResult); #endregion } @@ -743,41 +641,33 @@ public void divOpTests() var b = tf.placeholder(tf.int32, shape: new Shape(rows, cols)); var c = tf.reduce_sum(tf.reduce_sum(gen_math_ops.floor_div(a, b), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + var sess = tf.Session(); + var o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResult); // Testing `operator /(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(a / b, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResult); // Testing `operator /(Tensor x, int y) c = tf.reduce_sum(tf.reduce_sum(a / secondIntVal, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResult); // Testing `operator /(int x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(firstIntVal / b, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResult); #endregion #region floatTest @@ -792,41 +682,33 @@ public void divOpTests() b = tf.placeholder(tf.float32, shape: new Shape(rows, cols)); c = tf.reduce_sum(tf.reduce_sum(tf.divide(a, b), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((float)o, floatResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual((float)o, floatResult); // Testing `operator /(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(a / b, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((float)o, floatResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual((float)o, floatResult); // Testing `operator /(Tensor x, float y) c = tf.reduce_sum(tf.reduce_sum(a / secondFloatVal, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((float)o, floatResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual((float)o, floatResult); // Testing `operator /(float x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(firstFloatVal / b, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((float)o, floatResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual((float)o, floatResult); #endregion #region doubleTest @@ -841,41 +723,33 @@ public void divOpTests() b = tf.placeholder(tf.float64, shape: new Shape(rows, cols)); c = tf.reduce_sum(tf.reduce_sum(tf.divide(a, b), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((double)o, doubleResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((double)o, doubleResult); // Testing `operator /(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(a / b, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((double)o, doubleResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((double)o, doubleResult); // Testing `operator /(Tensor x, double y) c = tf.reduce_sum(tf.reduce_sum(a / secondFloatVal, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((double)o, doubleResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((double)o, doubleResult); // Testing `operator /(double x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(firstFloatVal / b, 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((double)o, doubleResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((double)o, doubleResult); #endregion } @@ -897,41 +771,33 @@ public void greaterThanOpTests() var b = tf.placeholder(tf.int32, shape: new Shape(rows, cols)); var c = tf.reduce_sum(tf.reduce_sum(tf.cast(tf.greater(a, b), tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + var sess = tf.Session(); + var o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResult); // Testing `operator >(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a > b, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResult); // Testing `operator >(Tensor x, int y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a > intThreshold, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResult); // Testing `operator >(int x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(intThreshold > a, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResultTwo); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResultTwo); #endregion #region floatTest @@ -946,41 +812,33 @@ public void greaterThanOpTests() b = tf.placeholder(tf.float32, shape: new Shape(rows, cols)); c = tf.reduce_sum(tf.reduce_sum(tf.cast(tf.greater(a, b), tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, floatResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, floatResult); // Testing `operator >(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a > b, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, floatResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, floatResult); // Testing `operator >(Tensor x, float y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a > floatThreshold, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, floatResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, floatResult); // Testing `operator >(float x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(floatThreshold > a, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, floatResultTwo); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, floatResultTwo); #endregion #region doubleTest @@ -995,41 +853,33 @@ public void greaterThanOpTests() b = tf.placeholder(tf.float64, shape: new Shape(rows, cols)); c = tf.reduce_sum(tf.reduce_sum(tf.cast(tf.greater(a, b), tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, doubleResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, doubleResult); // Testing `operator >(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a > b, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, doubleResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, doubleResult); // Testing `operator >(Tensor x, double y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a > doubleThreshold, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, doubleResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, doubleResult); // Testing `operator >(double x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(doubleThreshold > a, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, doubleResultTwo); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, doubleResultTwo); #endregion } @@ -1051,41 +901,33 @@ public void lessThanOpTests() var b = tf.placeholder(tf.int32, shape: new Shape(rows, cols)); var c = tf.reduce_sum(tf.reduce_sum(tf.cast(tf.less(a, b), tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + var sess = tf.Session(); + var o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResult); // Testing `operator <(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a < b, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResult); // Testing `operator <(Tensor x, int y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a < intThreshold, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResult); // Testing `operator <(int x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(intThreshold < a, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResultTwo); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResultTwo); #endregion #region floatTest @@ -1100,41 +942,33 @@ public void lessThanOpTests() b = tf.placeholder(tf.float32, shape: new Shape(rows, cols)); c = tf.reduce_sum(tf.reduce_sum(tf.cast(tf.less(a, b), tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, floatResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, floatResult); // Testing `operator <(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a < b, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, floatResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, floatResult); // Testing `operator <(Tensor x, float y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a < floatThreshold, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, floatResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, floatResult); // Testing `operator <(float x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(floatThreshold < a, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, floatResultTwo); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, floatResultTwo); #endregion #region doubleTest @@ -1149,41 +983,33 @@ public void lessThanOpTests() b = tf.placeholder(tf.float64, shape: new Shape(rows, cols)); c = tf.reduce_sum(tf.reduce_sum(tf.cast(tf.less(a, b), tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, doubleResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, doubleResult); // Testing `operator <(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a < b, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, doubleResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, doubleResult); // Testing `operator <(Tensor x, double y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a < doubleThreshold, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, doubleResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, doubleResult); // Testing `operator <(double x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(doubleThreshold < a, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, doubleResultTwo); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, doubleResultTwo); #endregion } @@ -1205,41 +1031,33 @@ public void greaterOrEqualThanOpTests() var b = tf.placeholder(tf.int32, shape: new Shape(rows, cols)); var c = tf.reduce_sum(tf.reduce_sum(tf.cast(tf.greater_equal(a, b), tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + var sess = tf.Session(); + var o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResult); // Testing `operator >=(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a >= b, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + sess = tf.Session(); + o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResult); // Testing `operator >=(Tensor x, int y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a >= intThreshold, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, + sess = tf.Session(); + o = sess.run(c, new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + Assert.AreEqual((int)o, intResult); // Testing `operator >=(int x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(intThreshold >= a, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, + sess = tf.Session(); + o = sess.run(c, new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResultTwo); - } + Assert.AreEqual((int)o, intResultTwo); #endregion #region floatTest @@ -1254,41 +1072,33 @@ public void greaterOrEqualThanOpTests() b = tf.placeholder(tf.float32, shape: new Shape(rows, cols)); c = tf.reduce_sum(tf.reduce_sum(tf.cast(tf.greater_equal(a, b), tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, + sess = tf.Session(); + o = sess.run(c, new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, floatResult); - } + Assert.AreEqual((int)o, floatResult); // Testing `operator >=(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a >= b, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, + sess = tf.Session(); + o = sess.run(c, new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, floatResult); - } + Assert.AreEqual((int)o, floatResult); // Testing `operator >=(Tensor x, float y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a >= floatThreshold, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, + sess = tf.Session(); + sess.run(c, new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, floatResult); - } + Assert.AreEqual((int)o, floatResult); // Testing `operator >=(float x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(floatThreshold >= a, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, + sess = tf.Session(); + o = sess.run(c, new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, floatResultTwo); - } + Assert.AreEqual((int)o, floatResultTwo); #endregion #region doubleTest @@ -1303,41 +1113,33 @@ public void greaterOrEqualThanOpTests() b = tf.placeholder(tf.float64, shape: new Shape(rows, cols)); c = tf.reduce_sum(tf.reduce_sum(tf.cast(tf.greater_equal(a, b), tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, + sess = tf.Session(); + o = sess.run(c, new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, doubleResult); - } + Assert.AreEqual((int)o, doubleResult); // Testing `operator >=(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a >= b, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, + sess = tf.Session(); + o = sess.run(c, new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, doubleResult); - } + Assert.AreEqual((int)o, doubleResult); // Testing `operator >=(Tensor x, double y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a >= doubleThreshold, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, + sess = tf.Session(); + o = sess.run(c, new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, doubleResult); - } + Assert.AreEqual((int)o, doubleResult); // Testing `operator >=(double x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(doubleThreshold >= a, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, + sess = tf.Session(); + o = sess.run(c, new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, doubleResultTwo); - } + Assert.AreEqual((int)o, doubleResultTwo); #endregion } @@ -1359,41 +1161,33 @@ public void lessOrEqualThanOpTests() var b = tf.placeholder(tf.int32, shape: new Shape(rows, cols)); var c = tf.reduce_sum(tf.reduce_sum(tf.cast(tf.less_equal(a, b), tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, - new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), - new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + var sess = tf.Session(); + var o = sess.run(c, + new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), + new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); + Assert.AreEqual((int)o, intResult); // Testing `operator <=(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a <= b, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, + sess = tf.Session(); + o = sess.run(c, new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols))), new FeedItem(b, new NDArray(secondIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + Assert.AreEqual((int)o, intResult); // Testing `operator <=(Tensor x, int y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a <= intThreshold, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, + sess = tf.Session(); + o = sess.run(c, new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResult); - } + Assert.AreEqual((int)o, intResult); // Testing `operator <=(int x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(intThreshold <= a, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, + sess = tf.Session(); + o = sess.run(c, new FeedItem(a, new NDArray(firstIntFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, intResultTwo); - } + Assert.AreEqual((int)o, intResultTwo); #endregion #region floatTest @@ -1408,41 +1202,33 @@ public void lessOrEqualThanOpTests() b = tf.placeholder(tf.float32, shape: new Shape(rows, cols)); c = tf.reduce_sum(tf.reduce_sum(tf.cast(tf.less_equal(a, b), tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, + sess = tf.Session(); + o = sess.run(c, new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, floatResult); - } + Assert.AreEqual((int)o, floatResult); // Testing `operator <=(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a <= b, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, + sess = tf.Session(); + o = sess.run(c, new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols))), new FeedItem(b, new NDArray(secondFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, floatResult); - } + Assert.AreEqual((int)o, floatResult); // Testing `operator <=(Tensor x, float y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a <= floatThreshold, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, + sess = tf.Session(); + o = sess.run(c, new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, floatResult); - } + Assert.AreEqual((int)o, floatResult); // Testing `operator <=(float x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(floatThreshold <= a, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, + sess = tf.Session(); + o = sess.run(c, new FeedItem(a, new NDArray(firstFloatFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, floatResultTwo); - } + Assert.AreEqual((int)o, floatResultTwo); #endregion #region doubleTest @@ -1457,41 +1243,33 @@ public void lessOrEqualThanOpTests() b = tf.placeholder(tf.float64, shape: new Shape(rows, cols)); c = tf.reduce_sum(tf.reduce_sum(tf.cast(tf.less_equal(a, b), tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, + sess = tf.Session(); + o = sess.run(c, new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, doubleResult); - } + Assert.AreEqual((int)o, doubleResult); // Testing `operator <=(Tensor x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a <= b, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, + sess = tf.Session(); + o = sess.run(c, new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols))), new FeedItem(b, new NDArray(secondDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, doubleResult); - } + Assert.AreEqual((int)o, doubleResult); // Testing `operator <=(Tensor x, double y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(a <= doubleThreshold, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, + sess = tf.Session(); + o = sess.run(c, new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, doubleResult); - } + Assert.AreEqual((int)o, doubleResult); // Testing `operator <=(double x, Tensor y) c = tf.reduce_sum(tf.reduce_sum(tf.cast(doubleThreshold <= a, tf.int32), 1)); - using (var sess = tf.Session()) - { - var o = sess.run(c, + sess = tf.Session(); + o = sess.run(c, new FeedItem(a, new NDArray(firstDoubleFeed, new Shape(rows, cols)))); - Assert.AreEqual((int)o, doubleResultTwo); - } + Assert.AreEqual((int)o, doubleResultTwo); #endregion } diff --git a/test/TensorFlowNET.Graph.UnitTest/PythonTest.cs b/test/TensorFlowNET.Graph.UnitTest/PythonTest.cs index e49103a18..513791933 100644 --- a/test/TensorFlowNET.Graph.UnitTest/PythonTest.cs +++ b/test/TensorFlowNET.Graph.UnitTest/PythonTest.cs @@ -182,23 +182,21 @@ public T evaluate(Tensor tensor) // return self._eval_helper(tensors) // else: { - using (var sess = tf.Session()) + var sess = tf.Session(); + var ndarray = tensor.eval(sess); + if (typeof(T) == typeof(double)) { - var ndarray = tensor.eval(sess); - if (typeof(T) == typeof(double)) - { - double x = ndarray; - result = x; - } - else if (typeof(T) == typeof(int)) - { - int x = ndarray; - result = x; - } - else - { - result = ndarray; - } + double x = ndarray; + result = x; + } + else if (typeof(T) == typeof(int)) + { + int x = ndarray; + result = x; + } + else + { + result = ndarray; } return (T)result; diff --git a/test/TensorFlowNET.Graph.UnitTest/SignalTest.cs b/test/TensorFlowNET.Graph.UnitTest/SignalTest.cs new file mode 100644 index 000000000..cc09b101d --- /dev/null +++ b/test/TensorFlowNET.Graph.UnitTest/SignalTest.cs @@ -0,0 +1,102 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Tensorflow.NumPy; +using System; +using System.Collections.Generic; +using System.Linq; +using Tensorflow; +using static Tensorflow.Binding; +using Tensorflow.Keras.UnitTest; + +namespace TensorFlowNET.UnitTest.Basics +{ + [TestClass] + public class SignalTest : EagerModeTestBase + { + [TestMethod] + public void fft() + { + double[] d_real = new double[] { 1.0, 2.0, 3.0, 4.0 }; + double[] d_imag = new double[] { -1.0, -3.0, 5.0, 7.0 }; + + Tensor t_real = tf.constant(d_real, dtype: TF_DataType.TF_DOUBLE); + Tensor t_imag = tf.constant(d_imag, dtype: TF_DataType.TF_DOUBLE); + + Tensor t_complex = tf.complex(t_real, t_imag); + + Tensor t_frequency_domain = tf.signal.fft(t_complex); + Tensor f_time_domain = tf.signal.ifft(t_frequency_domain); + + Tensor t_real_result = tf.math.real(f_time_domain); + Tensor t_imag_result = tf.math.imag(f_time_domain); + + NDArray n_real_result = t_real_result.numpy(); + NDArray n_imag_result = t_imag_result.numpy(); + + double[] d_real_result = n_real_result.ToArray(); + double[] d_imag_result = n_imag_result.ToArray(); + + Assert.IsTrue(base.Equal(d_real_result, d_real)); + Assert.IsTrue(base.Equal(d_imag_result, d_imag)); + } + [TestMethod] + public void fft2d() + { + double[] d_real = new double[] { 1.0, 2.0, 3.0, 4.0 }; + double[] d_imag = new double[] { -1.0, -3.0, 5.0, 7.0 }; + + Tensor t_real = tf.constant(d_real, dtype: TF_DataType.TF_DOUBLE); + Tensor t_imag = tf.constant(d_imag, dtype: TF_DataType.TF_DOUBLE); + + Tensor t_complex = tf.complex(t_real, t_imag); + + Tensor t_complex_2d = tf.reshape(t_complex,new int[] { 2, 2 }); + + Tensor t_frequency_domain_2d = tf.signal.fft2d(t_complex_2d); + Tensor t_time_domain_2d = tf.signal.ifft2d(t_frequency_domain_2d); + + Tensor t_time_domain = tf.reshape(t_time_domain_2d, new int[] { 4 }); + + Tensor t_real_result = tf.math.real(t_time_domain); + Tensor t_imag_result = tf.math.imag(t_time_domain); + + NDArray n_real_result = t_real_result.numpy(); + NDArray n_imag_result = t_imag_result.numpy(); + + double[] d_real_result = n_real_result.ToArray(); + double[] d_imag_result = n_imag_result.ToArray(); + + Assert.IsTrue(base.Equal(d_real_result, d_real)); + Assert.IsTrue(base.Equal(d_imag_result, d_imag)); + } + [TestMethod] + public void fft3d() + { + double[] d_real = new double[] { 1.0, 2.0, 3.0, 4.0, -3.0, -2.0, -1.0, -4.0 }; + double[] d_imag = new double[] { -1.0, -3.0, 5.0, 7.0, 6.0, 4.0, 2.0, 0.0}; + + Tensor t_real = tf.constant(d_real, dtype: TF_DataType.TF_DOUBLE); + Tensor t_imag = tf.constant(d_imag, dtype: TF_DataType.TF_DOUBLE); + + Tensor t_complex = tf.complex(t_real, t_imag); + + Tensor t_complex_3d = tf.reshape(t_complex, new int[] { 2, 2, 2 }); + + Tensor t_frequency_domain_3d = tf.signal.fft2d(t_complex_3d); + Tensor t_time_domain_3d = tf.signal.ifft2d(t_frequency_domain_3d); + + Tensor t_time_domain = tf.reshape(t_time_domain_3d, new int[] { 8 }); + + Tensor t_real_result = tf.math.real(t_time_domain); + Tensor t_imag_result = tf.math.imag(t_time_domain); + + NDArray n_real_result = t_real_result.numpy(); + NDArray n_imag_result = t_imag_result.numpy(); + + double[] d_real_result = n_real_result.ToArray(); + double[] d_imag_result = n_imag_result.ToArray(); + + Assert.IsTrue(base.Equal(d_real_result, d_real)); + Assert.IsTrue(base.Equal(d_imag_result, d_imag)); + } + } +} \ No newline at end of file diff --git a/test/TensorFlowNET.Graph.UnitTest/TensorFlowNET.Graph.UnitTest.csproj b/test/TensorFlowNET.Graph.UnitTest/TensorFlowNET.Graph.UnitTest.csproj index e05d48bba..1385f8611 100644 --- a/test/TensorFlowNET.Graph.UnitTest/TensorFlowNET.Graph.UnitTest.csproj +++ b/test/TensorFlowNET.Graph.UnitTest/TensorFlowNET.Graph.UnitTest.csproj @@ -27,15 +27,16 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + + diff --git a/test/TensorFlowNET.Keras.UnitTest/Assets/python_func_model/fingerprint.pb b/test/TensorFlowNET.Keras.UnitTest/Assets/python_func_model/fingerprint.pb new file mode 100644 index 000000000..361ca3a8a Binary files /dev/null and b/test/TensorFlowNET.Keras.UnitTest/Assets/python_func_model/fingerprint.pb differ diff --git a/test/TensorFlowNET.Keras.UnitTest/Assets/python_func_model/keras_metadata.pb b/test/TensorFlowNET.Keras.UnitTest/Assets/python_func_model/keras_metadata.pb new file mode 100644 index 000000000..b98e17337 --- /dev/null +++ b/test/TensorFlowNET.Keras.UnitTest/Assets/python_func_model/keras_metadata.pb @@ -0,0 +1,6 @@ + +root"_tf_keras_sequential*{"name": "sequential", "trainable": true, "expects_training_arg": true, "dtype": "float32", "batch_input_shape": null, "must_restore_from_config": false, "preserve_input_structure_in_config": false, "autocast": false, "class_name": "Sequential", "config": {"name": "sequential", "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": {"class_name": "__tuple__", "items": [null, 784]}, "dtype": "float32", "sparse": false, "ragged": false, "name": "input_1"}}, {"class_name": "Transformer", "config": {"name": "transformer", "trainable": true, "dtype": "float32", "a": 784, "b": 10}}, {"class_name": "Softmax", "config": {"name": "softmax", "trainable": true, "dtype": "float32", "axis": -1}}]}, "shared_object_id": 3, "input_spec": [{"class_name": "InputSpec", "config": {"dtype": null, "shape": {"class_name": "__tuple__", "items": [null, 784]}, "ndim": 2, "max_ndim": null, "min_ndim": null, "axes": {}}}], "build_input_shape": {"class_name": "TensorShape", "items": [null, 784]}, "is_graph_network": true, "full_save_spec": {"class_name": "__tuple__", "items": [[{"class_name": "TypeSpec", "type_spec": "tf.TensorSpec", "serialized": [{"class_name": "TensorShape", "items": [null, 784]}, "float32", "input_1"]}], {}]}, "save_spec": {"class_name": "TypeSpec", "type_spec": "tf.TensorSpec", "serialized": [{"class_name": "TensorShape", "items": [null, 784]}, "float32", "input_1"]}, "keras_version": "2.11.0", "backend": "tensorflow", "model_config": {"class_name": "Sequential", "config": {"name": "sequential", "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": {"class_name": "__tuple__", "items": [null, 784]}, "dtype": "float32", "sparse": false, "ragged": false, "name": "input_1"}, "shared_object_id": 0}, {"class_name": "Transformer", "config": {"name": "transformer", "trainable": true, "dtype": "float32", "a": 784, "b": 10}, "shared_object_id": 1}, {"class_name": "Softmax", "config": {"name": "softmax", "trainable": true, "dtype": "float32", "axis": -1}, "shared_object_id": 2}]}}, "training_config": {"loss": "sparse_categorical_crossentropy", "metrics": [[{"class_name": "MeanMetricWrapper", "config": {"name": "accuracy", "dtype": "float32", "fn": "categorical_accuracy"}, "shared_object_id": 5}]], "weighted_metrics": null, "loss_weights": null, "optimizer_config": {"class_name": "Custom>Adam", "config": {"name": "Adam", "weight_decay": null, "clipnorm": null, "global_clipnorm": null, "clipvalue": null, "use_ema": false, "ema_momentum": 0.99, "ema_overwrite_frequency": null, "jit_compile": false, "is_legacy_optimizer": false, "learning_rate": 0.0010000000474974513, "beta_1": 0.9, "beta_2": 0.999, "epsilon": 1e-07, "amsgrad": false}}}}2 +root.layer_with_weights-0"_tf_keras_layer*{"name": "transformer", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "preserve_input_structure_in_config": false, "autocast": true, "class_name": "Transformer", "config": {"name": "transformer", "trainable": true, "dtype": "float32", "a": 784, "b": 10}, "shared_object_id": 1, "build_input_shape": {"class_name": "TensorShape", "items": [null, 784]}}2 + root.layer-1"_tf_keras_layer*{"name": "softmax", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "preserve_input_structure_in_config": false, "autocast": true, "class_name": "Softmax", "config": {"name": "softmax", "trainable": true, "dtype": "float32", "axis": -1}, "shared_object_id": 2, "build_input_shape": {"class_name": "TensorShape", "items": [null, 10]}}2 +9root.keras_api.metrics.0"_tf_keras_metric*{"class_name": "Mean", "name": "loss", "dtype": "float32", "config": {"name": "loss", "dtype": "float32"}, "shared_object_id": 6}2 +:root.keras_api.metrics.1"_tf_keras_metric*{"class_name": "MeanMetricWrapper", "name": "accuracy", "dtype": "float32", "config": {"name": "accuracy", "dtype": "float32", "fn": "categorical_accuracy"}, "shared_object_id": 5}2 \ No newline at end of file diff --git a/test/TensorFlowNET.Keras.UnitTest/Assets/python_func_model/saved_model.pb b/test/TensorFlowNET.Keras.UnitTest/Assets/python_func_model/saved_model.pb new file mode 100644 index 000000000..f22755e07 Binary files /dev/null and b/test/TensorFlowNET.Keras.UnitTest/Assets/python_func_model/saved_model.pb differ diff --git a/test/TensorFlowNET.Keras.UnitTest/Assets/python_func_model/variables/variables.data-00000-of-00001 b/test/TensorFlowNET.Keras.UnitTest/Assets/python_func_model/variables/variables.data-00000-of-00001 new file mode 100644 index 000000000..399265af6 Binary files /dev/null and b/test/TensorFlowNET.Keras.UnitTest/Assets/python_func_model/variables/variables.data-00000-of-00001 differ diff --git a/test/TensorFlowNET.Keras.UnitTest/Assets/python_func_model/variables/variables.index b/test/TensorFlowNET.Keras.UnitTest/Assets/python_func_model/variables/variables.index new file mode 100644 index 000000000..e0b0e800a Binary files /dev/null and b/test/TensorFlowNET.Keras.UnitTest/Assets/python_func_model/variables/variables.index differ diff --git a/test/TensorFlowNET.Keras.UnitTest/Callbacks/EarlystoppingTest.cs b/test/TensorFlowNET.Keras.UnitTest/Callbacks/EarlystoppingTest.cs new file mode 100644 index 000000000..ac5ba15ed --- /dev/null +++ b/test/TensorFlowNET.Keras.UnitTest/Callbacks/EarlystoppingTest.cs @@ -0,0 +1,60 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Collections.Generic; +using Tensorflow.Keras.Callbacks; +using Tensorflow.Keras.Engine; +using static Tensorflow.KerasApi; + + +namespace Tensorflow.Keras.UnitTest.Callbacks +{ + [TestClass] + public class EarlystoppingTest + { + [TestMethod] + // Because loading the weight variable into the model has not yet been implemented, + // so you'd better not set patience too large, because the weights will equal to the last epoch's weights. + public void Earlystopping() + { + var layers = keras.layers; + var model = keras.Sequential(new List + { + layers.Rescaling(1.0f / 255, input_shape: (32, 32, 3)), + layers.Conv2D(32, 3, padding: "same", activation: keras.activations.Relu), + layers.MaxPooling2D(), + layers.Flatten(), + layers.Dense(128, activation: keras.activations.Relu), + layers.Dense(10) + }); + + + model.summary(); + + model.compile(optimizer: keras.optimizers.RMSprop(1e-3f), + loss: keras.losses.SparseCategoricalCrossentropy(from_logits: true), + metrics: new[] { "acc" }); + + var num_epochs = 3; + var batch_size = 8; + + var ((x_train, y_train), (x_test, y_test)) = keras.datasets.cifar10.load_data(); + x_train = x_train / 255.0f; + // define a CallbackParams first, the parameters you pass al least contain Model and Epochs. + CallbackParams callback_parameters = new CallbackParams + { + Model = model, + Epochs = num_epochs, + }; + // define your earlystop + ICallback earlystop = new EarlyStopping(callback_parameters, "accuracy"); + // define a callbcaklist, then add the earlystopping to it. + var callbacks = new List(); + callbacks.add(earlystop); + + model.fit(x_train[new Slice(0, 2000)], y_train[new Slice(0, 2000)], batch_size, num_epochs, callbacks: callbacks); + } + + } + + +} + diff --git a/test/TensorFlowNET.Keras.UnitTest/EagerModeTestBase.cs b/test/TensorFlowNET.Keras.UnitTest/EagerModeTestBase.cs index 04ed3df4d..c7eab364c 100644 --- a/test/TensorFlowNET.Keras.UnitTest/EagerModeTestBase.cs +++ b/test/TensorFlowNET.Keras.UnitTest/EagerModeTestBase.cs @@ -1,17 +1,14 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System; -using Tensorflow.Keras; using static Tensorflow.Binding; -namespace TensorFlowNET.Keras.UnitTest +namespace Tensorflow.Keras.UnitTest { public class EagerModeTestBase { [TestInitialize] public void TestInit() { - tf.UseKeras(); - if (!tf.executing_eagerly()) tf.enable_eager_execution(); tf.Context.ensure_initialized(); diff --git a/test/TensorFlowNET.Keras.UnitTest/Gradient.cs b/test/TensorFlowNET.Keras.UnitTest/GradientTest.cs similarity index 80% rename from test/TensorFlowNET.Keras.UnitTest/Gradient.cs rename to test/TensorFlowNET.Keras.UnitTest/GradientTest.cs index 159800e10..162aa1c5e 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Gradient.cs +++ b/test/TensorFlowNET.Keras.UnitTest/GradientTest.cs @@ -1,27 +1,26 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Linq; -using Tensorflow; using Tensorflow.Keras.Engine; +using Tensorflow.NumPy; using static Tensorflow.Binding; using static Tensorflow.KerasApi; -using Tensorflow.NumPy; -namespace TensorFlowNET.Keras.UnitTest; +namespace Tensorflow.Keras.UnitTest; [TestClass] -public class GradientTest +public class GradientTest : EagerModeTestBase { - public Model get_actor(int num_states) + public IModel get_actor(int num_states) { - var inputs = keras.layers.Input(shape: num_states); - var outputs = keras.layers.Dense(1, activation: keras.activations.Tanh).Apply(inputs); + var inputs = tf.keras.layers.Input(shape: num_states); + var outputs = tf.keras.layers.Dense(1, activation: keras.activations.Tanh).Apply(inputs); - Model model = keras.Model(inputs, outputs); + var model = tf.keras.Model(inputs, outputs); return model; } - public Model get_critic(int num_states, int num_actions) + public IModel get_critic(int num_states, int num_actions) { // State as input var state_input = keras.layers.Input(shape: num_states); @@ -33,14 +32,14 @@ public Model get_critic(int num_states, int num_actions) var outputs = keras.layers.Dense(1).Apply(concat); - Model model = keras.Model(new Tensors(state_input, action_input), outputs); + var model = tf.keras.Model(new Tensors(state_input, action_input), outputs); model.summary(); return model; } [TestMethod] - public void GetGradient_Test() + public void GetGradientTest() { var numStates = 3; var numActions = 1; diff --git a/test/TensorFlowNET.Keras.UnitTest/Helpers/RandomDataset.cs b/test/TensorFlowNET.Keras.UnitTest/Helpers/RandomDataset.cs new file mode 100644 index 000000000..e145ce585 --- /dev/null +++ b/test/TensorFlowNET.Keras.UnitTest/Helpers/RandomDataset.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tensorflow.NumPy; + +namespace Tensorflow.Keras.UnitTest.Helpers +{ + public class RandomDataSet : DataSetBase + { + private Shape _shape; + + public RandomDataSet(Shape shape, int count) + { + _shape = shape; + Debug.Assert(_shape.ndim == 3); + long[] dims = new long[4]; + dims[0] = count; + for (int i = 1; i < 4; i++) + { + dims[i] = _shape[i - 1]; + } + Shape s = new Shape(dims); + Data = np.random.normal(0, 2, s); + Labels = np.random.uniform(0, 1, (count, 1)); + } + } +} diff --git a/test/TensorFlowNET.Keras.UnitTest/InitializerTest.cs b/test/TensorFlowNET.Keras.UnitTest/InitializerTest.cs index 6950e65fc..b26b69309 100644 --- a/test/TensorFlowNET.Keras.UnitTest/InitializerTest.cs +++ b/test/TensorFlowNET.Keras.UnitTest/InitializerTest.cs @@ -1,12 +1,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using TensorFlowNET.Keras.UnitTest; using static Tensorflow.Binding; -namespace TensorFlowNET.Keras.UnitTest; +namespace Tensorflow.Keras.UnitTest; [TestClass] public class InitializerTest : EagerModeTestBase diff --git a/test/TensorFlowNET.Keras.UnitTest/Layers/ActivationTest.cs b/test/TensorFlowNET.Keras.UnitTest/Layers/ActivationTest.cs index 1f45c518f..cc99f4a04 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Layers/ActivationTest.cs +++ b/test/TensorFlowNET.Keras.UnitTest/Layers/ActivationTest.cs @@ -1,12 +1,10 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; -using System.Collections.Generic; -using static Tensorflow.Binding; using Tensorflow.NumPy; +using static Tensorflow.Binding; using static Tensorflow.KerasApi; -using Tensorflow; -namespace TensorFlowNET.Keras.UnitTest { +namespace Tensorflow.Keras.UnitTest.Layers +{ [TestClass] public class ActivationTest : EagerModeTestBase { @@ -51,7 +49,7 @@ public void Softplus() Tensor input = tf.constant(new float[] { -3f, -2f, -1f, 0f, 1f, 2f }); Tensor output = keras.layers.Softplus().Apply(input); NDArray expected = new NDArray(new float[] { 0.04858733f, 0.12692805f, 0.31326166f, 0.6931472f, 1.3132616f, 2.126928f }); - Assert.AreEqual(expected, output.numpy()); + Assert.IsTrue(expected == output.numpy()); } [TestMethod] @@ -102,7 +100,7 @@ public void Swish() public void Mish() { var x = tf.constant(new[] { 1.0, 0.0, 1.0 }, dtype: tf.float32); - var output = keras.activations.Mish(x); + var output = keras.activations.Mish.Apply(x); Assert.AreEqual(new[] { 0.86509836f, 0f, 0.86509836f }, output.numpy()); } } diff --git a/test/TensorFlowNET.Keras.UnitTest/Layers/AttentionTest.cs b/test/TensorFlowNET.Keras.UnitTest/Layers/AttentionTest.cs index e5987f298..95ef923eb 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Layers/AttentionTest.cs +++ b/test/TensorFlowNET.Keras.UnitTest/Layers/AttentionTest.cs @@ -1,15 +1,11 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; -using System.Collections.Generic; +using Tensorflow.Keras.Layers; +using Tensorflow.Keras.Utils; using Tensorflow.NumPy; using static Tensorflow.Binding; using static Tensorflow.KerasApi; -using Tensorflow.Keras.Layers; -using Tensorflow; -using Tensorflow.Keras.ArgsDefinition; -using Tensorflow.Keras.Utils; -namespace TensorFlowNET.Keras.UnitTest +namespace Tensorflow.Keras.UnitTest.Layers { [TestClass] public class AttentionTest : EagerModeTestBase @@ -98,7 +94,7 @@ public void test_calculate_scores_multi_dim() { 7.6400003f, 12.24f, 16.84f }, { 14.24f, 22.84f, 31.439999f } } }, dtype: np.float32); - Assert.AreEqual(expected, actual.numpy()); + Assert.IsTrue(expected == actual.numpy()); } [TestMethod] @@ -118,7 +114,8 @@ public void test_calculate_scores_multi_dim_concat() } }, dtype: np.float32); var attention_layer = (Attention)keras.layers.Attention(score_mode: "concat"); //attention_layer.concat_score_weight = 1; - attention_layer.concat_score_weight = base_layer_utils.make_variable(new VariableArgs() { + attention_layer.concat_score_weight = base_layer_utils.make_variable(new VariableArgs() + { Name = "concat_score_weight", Shape = (1), DType = TF_DataType.TF_FLOAT, @@ -156,7 +153,7 @@ public void test_masked_attention() var query = keras.Input(shape: (4, 8)); var value = keras.Input(shape: (2, 8)); - var mask_tensor = keras.Input(shape:(4, 2)); + var mask_tensor = keras.Input(shape: (4, 2)); var attention_layer = keras.layers.MultiHeadAttention(num_heads: 2, key_dim: 2); attention_layer.Apply(new Tensor[] { query, value, mask_tensor }); diff --git a/test/TensorFlowNET.Keras.UnitTest/Layers/CosineSimilarity.Test.cs b/test/TensorFlowNET.Keras.UnitTest/Layers/CosineSimilarity.Test.cs index 71a436278..5294a838c 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Layers/CosineSimilarity.Test.cs +++ b/test/TensorFlowNET.Keras.UnitTest/Layers/CosineSimilarity.Test.cs @@ -1,11 +1,9 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Tensorflow.NumPy; -using Tensorflow; using Tensorflow.Keras.Losses; -using static Tensorflow.Binding; +using Tensorflow.NumPy; using static Tensorflow.KerasApi; -namespace TensorFlowNET.Keras.UnitTest +namespace Tensorflow.Keras.UnitTest.Layers { [TestClass] public class CosineSimilarity @@ -16,7 +14,7 @@ public class CosineSimilarity NDArray y_pred_float = new float[,] { { 1.0f, 0.0f }, { 1.0f, 1.0f } }; [TestMethod] - + public void _Default() { //>>> # Using 'auto'/'sum_over_batch_size' reduction type. @@ -27,7 +25,7 @@ public void _Default() //>>> # loss = mean(sum(l2_norm(y_true) . l2_norm(y_pred), axis=1)) //>>> # = -((0. + 0.) + (0.5 + 0.5)) / 2 //-0.5 - var loss = keras.losses.CosineSimilarity(axis : 1); + var loss = keras.losses.CosineSimilarity(axis: 1); var call = loss.Call(y_true_float, y_pred_float); Assert.AreEqual((NDArray)(-0.49999997f), call.numpy()); } @@ -41,7 +39,7 @@ public void _Sample_Weight() //- 0.0999 var loss = keras.losses.CosineSimilarity(); var call = loss.Call(y_true_float, y_pred_float, sample_weight: (NDArray)new float[] { 0.8f, 0.2f }); - Assert.AreEqual((NDArray) (- 0.099999994f), call.numpy()); + Assert.AreEqual((NDArray)(-0.099999994f), call.numpy()); } [TestMethod] @@ -53,7 +51,7 @@ public void _SUM() //... reduction = tf.keras.losses.Reduction.SUM) //>>> cosine_loss(y_true, y_pred).numpy() //- 0.999 - var loss = keras.losses.CosineSimilarity(axis: 1,reduction : ReductionV2.SUM); + var loss = keras.losses.CosineSimilarity(axis: 1, reduction: ReductionV2.SUM); var call = loss.Call(y_true_float, y_pred_float); Assert.AreEqual((NDArray)(-0.99999994f), call.numpy()); } @@ -67,7 +65,7 @@ public void _None() //... reduction = tf.keras.losses.Reduction.NONE) //>>> cosine_loss(y_true, y_pred).numpy() //array([-0., -0.999], dtype = float32) - var loss = keras.losses.CosineSimilarity(axis :1, reduction: ReductionV2.NONE); + var loss = keras.losses.CosineSimilarity(axis: 1, reduction: ReductionV2.NONE); var call = loss.Call(y_true_float, y_pred_float); Assert.AreEqual((NDArray)new float[] { -0f, -0.99999994f }, call.numpy()); } diff --git a/test/TensorFlowNET.Keras.UnitTest/Layers/Huber.Test.cs b/test/TensorFlowNET.Keras.UnitTest/Layers/Huber.Test.cs index ca18b743a..7bf5f5191 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Layers/Huber.Test.cs +++ b/test/TensorFlowNET.Keras.UnitTest/Layers/Huber.Test.cs @@ -1,11 +1,9 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Tensorflow.NumPy; -using Tensorflow; using Tensorflow.Keras.Losses; -using static Tensorflow.Binding; +using Tensorflow.NumPy; using static Tensorflow.KerasApi; -namespace TensorFlowNET.Keras.UnitTest +namespace Tensorflow.Keras.UnitTest.Layers { [TestClass] public class Huber @@ -16,7 +14,7 @@ public class Huber NDArray y_pred_float = new float[,] { { 0.6f, 0.4f }, { 0.4f, 0.6f } }; [TestMethod] - + public void _Default() { //>>> # Using 'auto'/'sum_over_batch_size' reduction type. @@ -49,7 +47,7 @@ public void _SUM() //... reduction = tf.keras.losses.Reduction.SUM) //>>> h(y_true, y_pred).numpy() //0.31 - var loss = keras.losses.Huber(reduction : ReductionV2.SUM); + var loss = keras.losses.Huber(reduction: ReductionV2.SUM); var call = loss.Call(y_true_float, y_pred_float); Assert.AreEqual((NDArray)0.31f, call.numpy()); } diff --git a/test/TensorFlowNET.Keras.UnitTest/Layers/Layers.Convolution.Test.cs b/test/TensorFlowNET.Keras.UnitTest/Layers/Layers.Convolution.Test.cs index fbe4330ca..997dcb4f6 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Layers/Layers.Convolution.Test.cs +++ b/test/TensorFlowNET.Keras.UnitTest/Layers/Layers.Convolution.Test.cs @@ -1,10 +1,8 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Tensorflow.NumPy; -using Tensorflow; -using Tensorflow.Operations; using static Tensorflow.KerasApi; -namespace TensorFlowNET.Keras.UnitTest +namespace Tensorflow.Keras.UnitTest.Layers { [TestClass] public class LayersConvolutionTest : EagerModeTestBase @@ -14,7 +12,7 @@ public void BasicConv1D() { var filters = 8; - var conv = keras.layers.Conv1D(filters, kernel_size: 3, activation: "linear"); + var conv = keras.layers.Conv1D(filters, kernel_size: 3, activation: "linear"); var x = np.arange(256.0f).reshape((8, 8, 4)); var y = conv.Apply(x); diff --git a/test/TensorFlowNET.Keras.UnitTest/Layers/Layers.Cropping.Test.cs b/test/TensorFlowNET.Keras.UnitTest/Layers/Layers.Cropping.Test.cs index b99a9abbf..b7981facb 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Layers/Layers.Cropping.Test.cs +++ b/test/TensorFlowNET.Keras.UnitTest/Layers/Layers.Cropping.Test.cs @@ -1,39 +1,43 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Tensorflow; using Tensorflow.NumPy; using static Tensorflow.Binding; using static Tensorflow.KerasApi; -namespace TensorFlowNET.Keras.UnitTest { - [TestClass] - public class LayersCroppingTest : EagerModeTestBase { - [TestMethod] - public void Cropping1D () { - Shape input_shape = (1, 5, 2); - var x = tf.zeros(input_shape); - var cropping_1d = keras.layers.Cropping1D(new[] { 1, 2 }); - var y = cropping_1d.Apply(x); - Assert.AreEqual((1, 2, 2), y.shape); - } +namespace Tensorflow.Keras.UnitTest.Layers +{ + [TestClass] + public class LayersCroppingTest : EagerModeTestBase + { + [TestMethod] + public void Cropping1D() + { + Shape input_shape = (1, 5, 2); + var x = tf.zeros(input_shape); + var cropping_1d = keras.layers.Cropping1D(new[] { 1, 2 }); + var y = cropping_1d.Apply(x); + Assert.AreEqual((1, 2, 2), y.shape); + } - [TestMethod] - public void Cropping2D () { - Shape input_shape = (1, 5, 6, 1); - NDArray cropping = new NDArray(new[,] { { 1, 2 }, { 1, 3 } }); - var x = tf.zeros(input_shape); - var cropping_2d = keras.layers.Cropping2D(cropping); - var y = cropping_2d.Apply(x); - Assert.AreEqual((1, 2, 2, 1), y.shape); - } + [TestMethod] + public void Cropping2D() + { + Shape input_shape = (1, 5, 6, 1); + NDArray cropping = new NDArray(new[,] { { 1, 2 }, { 1, 3 } }); + var x = tf.zeros(input_shape); + var cropping_2d = keras.layers.Cropping2D(cropping); + var y = cropping_2d.Apply(x); + Assert.AreEqual((1, 2, 2, 1), y.shape); + } - [TestMethod] - public void Cropping3D () { - Shape input_shape = new Shape(1, 5, 6, 7, 1); - NDArray cropping = new NDArray(new[,] { { 1, 2 }, { 1, 3 }, { 1, 4 } }); - var x = tf.zeros(input_shape); - var cropping_3d = keras.layers.Cropping3D(cropping); - var y = cropping_3d.Apply(x); - Assert.AreEqual(new Shape(1, 2, 2, 2, 1), y.shape); - } - } + [TestMethod] + public void Cropping3D() + { + Shape input_shape = new Shape(1, 5, 6, 7, 1); + NDArray cropping = new NDArray(new[,] { { 1, 2 }, { 1, 3 }, { 1, 4 } }); + var x = tf.zeros(input_shape); + var cropping_3d = keras.layers.Cropping3D(cropping); + var y = cropping_3d.Apply(x); + Assert.AreEqual(new Shape(1, 2, 2, 2, 1), y.shape); + } + } } diff --git a/test/TensorFlowNET.Keras.UnitTest/Layers/Layers.Merging.Test.cs b/test/TensorFlowNET.Keras.UnitTest/Layers/Layers.Merging.Test.cs index b2faaf477..36e44e482 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Layers/Layers.Merging.Test.cs +++ b/test/TensorFlowNET.Keras.UnitTest/Layers/Layers.Merging.Test.cs @@ -1,9 +1,8 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Tensorflow.NumPy; -using Tensorflow; using static Tensorflow.KerasApi; -namespace TensorFlowNET.Keras.UnitTest +namespace Tensorflow.Keras.UnitTest.Layers { [TestClass] public class LayersMergingTest : EagerModeTestBase diff --git a/test/TensorFlowNET.Keras.UnitTest/Layers/Layers.Reshaping.Test.cs b/test/TensorFlowNET.Keras.UnitTest/Layers/Layers.Reshaping.Test.cs index a79c517bd..748544cb0 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Layers/Layers.Reshaping.Test.cs +++ b/test/TensorFlowNET.Keras.UnitTest/Layers/Layers.Reshaping.Test.cs @@ -1,43 +1,48 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Tensorflow; using Tensorflow.NumPy; using static Tensorflow.Binding; using static Tensorflow.KerasApi; -namespace TensorFlowNET.Keras.UnitTest { - [TestClass] - public class LayersReshapingTest : EagerModeTestBase { - [TestMethod] - public void ZeroPadding2D () { - Shape input_shape = (1, 1, 2, 2); - var x = np.arange(input_shape.size).reshape(input_shape); - var zero_padding_2d = keras.layers.ZeroPadding2D(new[,] { { 1, 0 }, { 1, 0 } }); - var y = zero_padding_2d.Apply(x); - Assert.AreEqual((1, 2, 3, 2), y.shape); - } +namespace Tensorflow.Keras.UnitTest.Layers +{ + [TestClass] + public class LayersReshapingTest : EagerModeTestBase + { + [TestMethod] + public void ZeroPadding2D() + { + Shape input_shape = (1, 1, 2, 2); + var x = np.arange(input_shape.size).reshape(input_shape); + var zero_padding_2d = keras.layers.ZeroPadding2D(new[,] { { 1, 0 }, { 1, 0 } }); + var y = zero_padding_2d.Apply(x); + Assert.AreEqual((1, 2, 3, 2), y.shape); + } - [TestMethod] - public void UpSampling2D () { - Shape input_shape = (2, 2, 1, 3); - var x = np.arange(input_shape.size).reshape(input_shape); - var y = keras.layers.UpSampling2D(size: (1, 2)).Apply(x); - Assert.AreEqual((2, 2, 2, 3), y.shape); - } + [TestMethod] + public void UpSampling2D() + { + Shape input_shape = (2, 2, 1, 3); + var x = np.arange(input_shape.size).reshape(input_shape); + var y = keras.layers.UpSampling2D(size: (1, 2)).Apply(x); + Assert.AreEqual((2, 2, 2, 3), y.shape); + } - [TestMethod] - public void Reshape () { - var inputs = tf.zeros((10, 5, 20)); - var outputs = keras.layers.LeakyReLU().Apply(inputs); - outputs = keras.layers.Reshape((20, 5)).Apply(outputs); - Assert.AreEqual((10, 20, 5), outputs.shape); - } + [TestMethod] + public void Reshape() + { + var inputs = tf.zeros((10, 5, 20)); + var outputs = keras.layers.LeakyReLU().Apply(inputs); + outputs = keras.layers.Reshape((20, 5)).Apply(outputs); + Assert.AreEqual((10, 20, 5), outputs.shape); + } - [TestMethod] - public void Permute () { - var inputs = tf.zeros((2, 3, 4, 5)); - var outputs = keras.layers.Permute(new int[] { 3, 2, 1 }).Apply(inputs); - Assert.AreEqual((2, 5, 4, 3), outputs.shape); - } + [TestMethod] + public void Permute() + { + var inputs = tf.zeros((2, 3, 4, 5)); + var outputs = keras.layers.Permute(new int[] { 3, 2, 1 }).Apply(inputs); + Assert.AreEqual((2, 5, 4, 3), outputs.shape); + } - } + } } diff --git a/test/TensorFlowNET.Keras.UnitTest/Layers/LayersTest.cs b/test/TensorFlowNET.Keras.UnitTest/Layers/LayersTest.cs index f8a6174d9..3de337469 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Layers/LayersTest.cs +++ b/test/TensorFlowNET.Keras.UnitTest/Layers/LayersTest.cs @@ -1,13 +1,10 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Tensorflow.NumPy; using System.Collections.Generic; -using Tensorflow; -using Tensorflow.Keras; +using Tensorflow.NumPy; using static Tensorflow.Binding; using static Tensorflow.KerasApi; -using System.Linq; -namespace TensorFlowNET.Keras.UnitTest +namespace Tensorflow.Keras.UnitTest.Layers { /// /// https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/keras/layers @@ -150,7 +147,6 @@ public void EinsumDense() [TestMethod, Ignore("WIP")] public void SimpleRNN() { - tf.UseKeras(); var inputs = np.arange(6 * 10 * 8).reshape((6, 10, 8)).astype(np.float32); /*var simple_rnn = keras.layers.SimpleRNN(4); var output = simple_rnn.Apply(inputs); @@ -178,6 +174,55 @@ public void LayerNormalization() Assert.IsTrue(output[0].numpy().Equals(new[] { -0.99998f, 0.99998f })); } + /// + /// https://www.tensorflow.org/api_docs/python/tf/keras/layers/Normalization + /// + [TestMethod] + public void Normalization() + { + // Calculate a global mean and variance by analyzing the dataset in adapt(). + var adapt_data = np.array(new[] { 1f, 2f, 3f, 4f, 5f }); + var input_data = np.array(new[] { 1f, 2f, 3f }); + var layer = tf.keras.layers.Normalization(axis: null); + layer.adapt(adapt_data); + var x = layer.Apply(input_data); + Assert.AreEqual(x.numpy(), new[] { -1.4142135f, -0.70710677f, 0f }); + + // Calculate a mean and variance for each index on the last axis. + adapt_data = np.array(new[,] + { + { 0, 7, 4 }, + { 2, 9, 6 }, + { 0, 7, 4 }, + { 2, 9, 6 } + }, dtype: tf.float32); + input_data = np.array(new[,] { { 0, 7, 4 } }, dtype: tf.float32); + layer = tf.keras.layers.Normalization(axis: -1); + layer.adapt(adapt_data); + x = layer.Apply(input_data); + Equal(x.numpy().ToArray(), new[] { -1f, -1f, -1f }); + + // Pass the mean and variance directly. + input_data = np.array(new[,] { { 1f }, { 2f }, { 3f } }, dtype: tf.float32); + layer = tf.keras.layers.Normalization(mean: 3f, variance: 2f); + x = layer.Apply(input_data); + Equal(x.numpy().ToArray(), new[] { -1.4142135f, -0.70710677f, 0f }); + + // Use the layer to de-normalize inputs (after adapting the layer). + adapt_data = np.array(new[,] + { + { 0, 7, 4 }, + { 2, 9, 6 }, + { 0, 7, 4 }, + { 2, 9, 6 } + }, dtype: tf.float32); + input_data = np.array(new[,] { { 1, 2, 3 } }, dtype: tf.float32); + layer = tf.keras.layers.Normalization(axis: -1, invert: true); + layer.adapt(adapt_data); + x = layer.Apply(input_data); + Equal(x.numpy().ToArray(), new[] { -2f, -10f, -8f }); + } + /// /// https://www.tensorflow.org/api_docs/python/tf/keras/layers/CategoryEncoding /// @@ -187,7 +232,7 @@ public void CategoryEncoding() // one-hot var inputs = np.array(new[] { 3, 2, 0, 1 }); var layer = tf.keras.layers.CategoryEncoding(4); - + Tensor output = layer.Apply(inputs); Assert.AreEqual((4, 4), output.shape); Assert.IsTrue(output[0].numpy().Equals(new[] { 0, 0, 0, 1f })); diff --git a/test/TensorFlowNET.Keras.UnitTest/Layers/LogCosh.Test.cs b/test/TensorFlowNET.Keras.UnitTest/Layers/LogCosh.Test.cs index 7c521a509..9bfd28b43 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Layers/LogCosh.Test.cs +++ b/test/TensorFlowNET.Keras.UnitTest/Layers/LogCosh.Test.cs @@ -1,11 +1,9 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Tensorflow.NumPy; -using Tensorflow; using Tensorflow.Keras.Losses; -using static Tensorflow.Binding; +using Tensorflow.NumPy; using static Tensorflow.KerasApi; -namespace TensorFlowNET.Keras.UnitTest +namespace Tensorflow.Keras.UnitTest.Layers { [TestClass] public class LogCosh @@ -16,7 +14,7 @@ public class LogCosh NDArray y_pred_float = new float[,] { { 1.0f, 1.0f }, { 0.0f, 0.0f } }; [TestMethod] - + public void _Default() { //>>> # Using 'auto'/'sum_over_batch_size' reduction type. @@ -32,9 +30,9 @@ public void _Default() public void _Sample_Weight() { - //>>> # Calling with 'sample_weight'. - //>>> l(y_true, y_pred, sample_weight =[0.8, 0.2]).numpy() - //0.087 + //>>> # Calling with 'sample_weight'. + //>>> l(y_true, y_pred, sample_weight =[0.8, 0.2]).numpy() + //0.087 var loss = keras.losses.LogCosh(); var call = loss.Call(y_true_float, y_pred_float, sample_weight: (NDArray)new float[] { 0.8f, 0.2f }); Assert.AreEqual((NDArray)0.08675616f, call.numpy()); @@ -49,7 +47,7 @@ public void _SUM() //... reduction = tf.keras.losses.Reduction.SUM) //>>> l(y_true, y_pred).numpy() //0.217 - var loss = keras.losses.LogCosh(reduction : ReductionV2.SUM); + var loss = keras.losses.LogCosh(reduction: ReductionV2.SUM); var call = loss.Call(y_true_float, y_pred_float); Assert.AreEqual((NDArray)0.2168904f, call.numpy()); } diff --git a/test/TensorFlowNET.Keras.UnitTest/Layers/MeanAbsoluteError.Test.cs b/test/TensorFlowNET.Keras.UnitTest/Layers/MeanAbsoluteError.Test.cs index c303fd745..1ef83adeb 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Layers/MeanAbsoluteError.Test.cs +++ b/test/TensorFlowNET.Keras.UnitTest/Layers/MeanAbsoluteError.Test.cs @@ -1,11 +1,9 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Tensorflow.NumPy; -using Tensorflow; using Tensorflow.Keras.Losses; -using static Tensorflow.Binding; +using Tensorflow.NumPy; using static Tensorflow.KerasApi; -namespace TensorFlowNET.Keras.UnitTest +namespace Tensorflow.Keras.UnitTest.Layers { [TestClass] public class MeanAbsoluteError @@ -50,7 +48,7 @@ public void _SUM() //... reduction = tf.keras.losses.Reduction.SUM) //>>> mae(y_true, y_pred).numpy() //1.0 - var loss = keras.losses.MeanAbsoluteError( reduction: ReductionV2.SUM); + var loss = keras.losses.MeanAbsoluteError(reduction: ReductionV2.SUM); var call = loss.Call(y_true_float, y_pred_float); Assert.AreEqual((NDArray)(1.0f), call.numpy()); } diff --git a/test/TensorFlowNET.Keras.UnitTest/Layers/MeanAbsolutePercentageError.Test.cs b/test/TensorFlowNET.Keras.UnitTest/Layers/MeanAbsolutePercentageError.Test.cs index 4adda82ab..440168396 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Layers/MeanAbsolutePercentageError.Test.cs +++ b/test/TensorFlowNET.Keras.UnitTest/Layers/MeanAbsolutePercentageError.Test.cs @@ -1,11 +1,9 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Tensorflow.NumPy; -using Tensorflow; using Tensorflow.Keras.Losses; -using static Tensorflow.Binding; +using Tensorflow.NumPy; using static Tensorflow.KerasApi; -namespace TensorFlowNET.Keras.UnitTest +namespace Tensorflow.Keras.UnitTest.Layers { [TestClass] public class MeanAbsolutePercentageError @@ -49,7 +47,7 @@ public void _SUM() //... reduction = tf.keras.losses.Reduction.SUM) //>>> mape(y_true, y_pred).numpy() //100. - var loss = keras.losses.MeanAbsolutePercentageError( reduction: ReductionV2.SUM); + var loss = keras.losses.MeanAbsolutePercentageError(reduction: ReductionV2.SUM); var call = loss.Call(y_true_float, y_pred_float); Assert.AreEqual((NDArray)(100f), call.numpy()); } diff --git a/test/TensorFlowNET.Keras.UnitTest/Layers/MeanSquaredError.Test.cs b/test/TensorFlowNET.Keras.UnitTest/Layers/MeanSquaredError.Test.cs index 8d43fae44..828d65e55 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Layers/MeanSquaredError.Test.cs +++ b/test/TensorFlowNET.Keras.UnitTest/Layers/MeanSquaredError.Test.cs @@ -1,14 +1,11 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Tensorflow.NumPy; -using Tensorflow; -using Tensorflow.Keras.Losses; -using static Tensorflow.Binding; using static Tensorflow.KerasApi; -namespace TensorFlowNET.Keras.UnitTest +namespace Tensorflow.Keras.UnitTest.Layers { [TestClass] - public class MeanSquaredErrorTest + public class MeanSquaredErrorTest { //https://keras.io/api/losses/regression_losses/#meansquarederror-class @@ -16,7 +13,7 @@ public class MeanSquaredErrorTest private NDArray y_pred = new double[,] { { 1.0, 1.0 }, { 1.0, 0.0 } }; [TestMethod] - + public void Mse_Double() { var mse = keras.losses.MeanSquaredError(); @@ -25,7 +22,7 @@ public void Mse_Double() } [TestMethod] - + public void Mse_Float() { NDArray y_true_float = new float[,] { { 0.0f, 1.0f }, { 0.0f, 0.0f } }; diff --git a/test/TensorFlowNET.Keras.UnitTest/Layers/MeanSquaredLogarithmicError.Test.cs b/test/TensorFlowNET.Keras.UnitTest/Layers/MeanSquaredLogarithmicError.Test.cs index e6b222777..5cecab0cc 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Layers/MeanSquaredLogarithmicError.Test.cs +++ b/test/TensorFlowNET.Keras.UnitTest/Layers/MeanSquaredLogarithmicError.Test.cs @@ -1,11 +1,9 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using Tensorflow.NumPy; -using Tensorflow; using Tensorflow.Keras.Losses; -using static Tensorflow.Binding; +using Tensorflow.NumPy; using static Tensorflow.KerasApi; -namespace TensorFlowNET.Keras.UnitTest +namespace Tensorflow.Keras.UnitTest.Layers { [TestClass] public class MeanSquaredLogarithmicError @@ -49,7 +47,7 @@ public void _SUM() //... reduction = tf.keras.losses.Reduction.SUM) //>>> msle(y_true, y_pred).numpy() //0.480 - var loss = keras.losses.MeanSquaredLogarithmicError( reduction: ReductionV2.SUM); + var loss = keras.losses.MeanSquaredLogarithmicError(reduction: ReductionV2.SUM); var call = loss.Call(y_true_float, y_pred_float); Assert.AreEqual((NDArray)(0.48045287f), call.numpy()); } diff --git a/test/TensorFlowNET.Keras.UnitTest/Layers/ModelSaveTest.cs b/test/TensorFlowNET.Keras.UnitTest/Layers/ModelSaveTest.cs deleted file mode 100644 index 67e8ff797..000000000 --- a/test/TensorFlowNET.Keras.UnitTest/Layers/ModelSaveTest.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Tensorflow.Keras.Engine; -using System.Diagnostics; -using static Tensorflow.KerasApi; -using Tensorflow.Keras.Saving; - -namespace TensorFlowNET.Keras.UnitTest -{ - /// - /// https://www.tensorflow.org/guide/keras/save_and_serialize - /// - [TestClass] - public class ModelSaveTest : EagerModeTestBase - { - [TestMethod] - public void GetAndFromConfig() - { - var model = GetFunctionalModel(); - var config = model.get_config(); - Debug.Assert(config is ModelConfig); - var new_model = keras.models.from_config(config as ModelConfig); - Assert.AreEqual(model.Layers.Count, new_model.Layers.Count); - } - - Functional GetFunctionalModel() - { - // Create a simple model. - var inputs = keras.Input(shape: 32); - var dense_layer = keras.layers.Dense(1); - var outputs = dense_layer.Apply(inputs); - return keras.Model(inputs, outputs); - } - } -} diff --git a/test/TensorFlowNET.Keras.UnitTest/Layers/PoolingTest.cs b/test/TensorFlowNET.Keras.UnitTest/Layers/PoolingTest.cs index 0eab0a986..a3516bc83 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Layers/PoolingTest.cs +++ b/test/TensorFlowNET.Keras.UnitTest/Layers/PoolingTest.cs @@ -1,12 +1,8 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Tensorflow.NumPy; -using System.Linq; -using Tensorflow; -using static Tensorflow.Binding; using static Tensorflow.KerasApi; -using Microsoft.VisualBasic; -namespace TensorFlowNET.Keras.UnitTest +namespace Tensorflow.Keras.UnitTest.Layers { /// /// https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/keras/layers @@ -231,7 +227,7 @@ public void GlobalMax2DPoolingChannelsFirst() public void Max1DPoolingChannelsLast() { var x = input_array_1D; - var pool = keras.layers.MaxPooling1D(pool_size:2, strides:1); + var pool = keras.layers.MaxPooling1D(pool_size: 2, strides: 1); var y = pool.Apply(x); Assert.AreEqual(4, y.shape[0]); diff --git a/test/TensorFlowNET.Keras.UnitTest/Losses/LossesTest.cs b/test/TensorFlowNET.Keras.UnitTest/Losses/LossesTest.cs index 98fa1de12..0bb1d0110 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Losses/LossesTest.cs +++ b/test/TensorFlowNET.Keras.UnitTest/Losses/LossesTest.cs @@ -1,16 +1,8 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tensorflow; using Tensorflow.NumPy; -using TensorFlowNET.Keras.UnitTest; using static Tensorflow.Binding; -using static Tensorflow.KerasApi; -namespace TensorFlowNET.Keras.UnitTest; +namespace Tensorflow.Keras.UnitTest.Losses; [TestClass] public class LossesTest : EagerModeTestBase @@ -47,7 +39,7 @@ public void BinaryCrossentropy() // Using 'none' reduction type. bce = tf.keras.losses.BinaryCrossentropy(from_logits: true, reduction: Reduction.NONE); loss = bce.Call(y_true, y_pred); - Assert.AreEqual(new float[] { 0.23515666f, 1.4957594f}, loss.numpy()); + Assert.IsTrue(new NDArray(new float[] { 0.23515666f, 1.4957594f }) == loss.numpy()); } /// diff --git a/test/TensorFlowNET.Keras.UnitTest/Metrics/MetricsTest.cs b/test/TensorFlowNET.Keras.UnitTest/Metrics/MetricsTest.cs index 04810db31..560d3580c 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Metrics/MetricsTest.cs +++ b/test/TensorFlowNET.Keras.UnitTest/Metrics/MetricsTest.cs @@ -1,15 +1,8 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tensorflow; using Tensorflow.NumPy; using static Tensorflow.Binding; -using static Tensorflow.KerasApi; -namespace TensorFlowNET.Keras.UnitTest; +namespace Tensorflow.Keras.UnitTest.Layers.Metrics; [TestClass] public class MetricsTest : EagerModeTestBase @@ -40,7 +33,7 @@ public void Accuracy() [TestMethod] public void BinaryAccuracy() { - var y_true = np.array(new[,] { { 1 }, { 1 },{ 0 }, { 0 } }); + var y_true = np.array(new[,] { { 1 }, { 1 }, { 0 }, { 0 } }); var y_pred = np.array(new[,] { { 0.98f }, { 1f }, { 0f }, { 0.6f } }); var m = tf.keras.metrics.BinaryAccuracy(); m.update_state(y_true, y_pred); @@ -183,17 +176,17 @@ public void FBetaScore() public void HammingLoss() { // multi-class hamming loss - var y_true = np.array(new[,] - { - { 1, 0, 0, 0 }, - { 0, 0, 1, 0 }, - { 0, 0, 0, 1 }, - { 0, 1, 0, 0 } + var y_true = np.array(new[,] + { + { 1, 0, 0, 0 }, + { 0, 0, 1, 0 }, + { 0, 0, 0, 1 }, + { 0, 1, 0, 0 } }); - var y_pred = np.array(new[,] - { - { 0.8f, 0.1f, 0.1f, 0.0f }, - { 0.2f, 0.0f, 0.8f, 0.0f }, + var y_pred = np.array(new[,] + { + { 0.8f, 0.1f, 0.1f, 0.0f }, + { 0.2f, 0.0f, 0.8f, 0.0f }, { 0.05f, 0.05f, 0.1f, 0.8f }, { 1.0f, 0.0f, 0.0f, 0.0f } }); diff --git a/test/TensorFlowNET.Keras.UnitTest/Model/ModelBuildTest.cs b/test/TensorFlowNET.Keras.UnitTest/Model/ModelBuildTest.cs new file mode 100644 index 000000000..e1fe9ff4f --- /dev/null +++ b/test/TensorFlowNET.Keras.UnitTest/Model/ModelBuildTest.cs @@ -0,0 +1,37 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using static Tensorflow.Binding; + +namespace Tensorflow.Keras.UnitTest.Model +{ + [TestClass] + public class ModelBuildTest + { + [TestMethod] + public void DenseBuild() + { + // two dimensions input with unknown batchsize + var input = tf.keras.layers.Input((17, 60)); + var dense = tf.keras.layers.Dense(64); + var output = dense.Apply(input); + var model = tf.keras.Model(input, output); + + // one dimensions input with unknown batchsize + var input_2 = tf.keras.layers.Input((60)); + var dense_2 = tf.keras.layers.Dense(64); + var output_2 = dense.Apply(input_2); + var model_2 = tf.keras.Model(input_2, output_2); + + // two dimensions input with specified batchsize + var input_3 = tf.keras.layers.Input((17, 60), 8); + var dense_3 = tf.keras.layers.Dense(64); + var output_3 = dense.Apply(input_3); + var model_3 = tf.keras.Model(input_3, output_3); + + // one dimensions input with specified batchsize + var input_4 = tf.keras.layers.Input((60), 8); + var dense_4 = tf.keras.layers.Dense(64); + var output_4 = dense.Apply(input_4); + var model_4 = tf.keras.Model(input_4, output_4); + } + } +} diff --git a/test/TensorFlowNET.Keras.UnitTest/Model/ModelLoadTest.cs b/test/TensorFlowNET.Keras.UnitTest/Model/ModelLoadTest.cs new file mode 100644 index 000000000..10db2bd11 --- /dev/null +++ b/test/TensorFlowNET.Keras.UnitTest/Model/ModelLoadTest.cs @@ -0,0 +1,113 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Linq; +using Tensorflow.Keras.Optimizers; +using Tensorflow.Keras.UnitTest.Helpers; +using Tensorflow.NumPy; +using static Tensorflow.Binding; +using static Tensorflow.KerasApi; + +namespace Tensorflow.Keras.UnitTest.Model; + +[TestClass] +public class ModelLoadTest +{ + [TestMethod] + public void SimpleModelFromAutoCompile() + { + var model = tf.keras.models.load_model(@"Assets/simple_model_from_auto_compile"); + model.summary(); + + model.compile(new Adam(0.0001f), tf.keras.losses.SparseCategoricalCrossentropy(), new string[] { "accuracy" }); + + // check the weights + var kernel1 = np.load(@"Assets/simple_model_from_auto_compile/kernel1.npy"); + var bias0 = np.load(@"Assets/simple_model_from_auto_compile/bias0.npy"); + + Assert.IsTrue(kernel1.Zip(model.TrainableWeights[2].numpy()).All(x => x.First == x.Second)); + Assert.IsTrue(bias0.Zip(model.TrainableWeights[1].numpy()).All(x => x.First == x.Second)); + + var data_loader = new MnistModelLoader(); + var num_epochs = 1; + var batch_size = 8; + + var dataset = data_loader.LoadAsync(new ModelLoadSetting + { + TrainDir = "mnist", + OneHot = false, + ValidationSize = 58000, + }).Result; + + model.fit(dataset.Train.Data, dataset.Train.Labels, batch_size, num_epochs); + } + + [TestMethod] + public void AlexnetFromSequential() + { + new ModelSaveTest().AlexnetFromSequential(); + var model = tf.keras.models.load_model(@"./alexnet_from_sequential"); + model.summary(); + + model.compile(new Adam(0.001f), tf.keras.losses.SparseCategoricalCrossentropy(from_logits: true), new string[] { "accuracy" }); + + var num_epochs = 1; + var batch_size = 8; + + var dataset = new RandomDataSet(new Shape(227, 227, 3), 16); + + model.fit(dataset.Data, dataset.Labels, batch_size, num_epochs); + } + + [TestMethod] + public void ModelWithSelfDefinedModule() + { + var model = tf.keras.models.load_model(@"Assets/python_func_model"); + model.summary(); + + model.compile(tf.keras.optimizers.Adam(), tf.keras.losses.SparseCategoricalCrossentropy(), new string[] { "accuracy" }); + + var data_loader = new MnistModelLoader(); + var num_epochs = 1; + var batch_size = 8; + + var dataset = data_loader.LoadAsync(new ModelLoadSetting + { + TrainDir = "mnist", + OneHot = false, + ValidationSize = 55000, + }).Result; + + model.fit(dataset.Train.Data, dataset.Train.Labels, batch_size, num_epochs); + } + + [Ignore] + [TestMethod] + public void VGG19() + { + var model = tf.keras.models.load_model(@"D:\development\tf.net\models\VGG19"); + model.summary(); + + var classify_model = keras.Sequential(new System.Collections.Generic.List() + { + model, + keras.layers.Flatten(), + keras.layers.Dense(10), + }); + classify_model.summary(); + + classify_model.compile(tf.keras.optimizers.Adam(), tf.keras.losses.SparseCategoricalCrossentropy(), new string[] { "accuracy" }); + + var x = np.random.uniform(0, 1, (8, 512, 512, 3)); + var y = np.ones(8); + + classify_model.fit(x, y, batch_size: 4); + } + + [Ignore] + [TestMethod] + public void TestModelBeforeTF2_5() + { + var a = keras.layers; + var model = tf.saved_model.load(@"D:\development\temp\saved_model") as Tensorflow.Keras.Engine.Model; + model.summary(); + } +} diff --git a/test/TensorFlowNET.Keras.UnitTest/Model/ModelSaveTest.cs b/test/TensorFlowNET.Keras.UnitTest/Model/ModelSaveTest.cs new file mode 100644 index 000000000..0854a09da --- /dev/null +++ b/test/TensorFlowNET.Keras.UnitTest/Model/ModelSaveTest.cs @@ -0,0 +1,212 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Collections.Generic; +using System.Diagnostics; +using Tensorflow.Keras.Engine; +using Tensorflow.Keras.Models; +using Tensorflow.Keras.Optimizers; +using Tensorflow.Keras.Saving; +using Tensorflow.Keras.UnitTest.Helpers; +using static Tensorflow.Binding; +using static Tensorflow.KerasApi; + +namespace Tensorflow.Keras.UnitTest.Model +{ + /// + /// https://www.tensorflow.org/guide/keras/save_and_serialize + /// + [TestClass] + public class ModelSaveTest : EagerModeTestBase + { + [TestMethod] + public void GetAndFromConfig() + { + var model = GetFunctionalModel(); + var config = model.get_config(); + Debug.Assert(config is FunctionalConfig); + var new_model = new ModelsApi().from_config(config as FunctionalConfig); + Assert.AreEqual(model.Layers.Count, new_model.Layers.Count); + } + + IModel GetFunctionalModel() + { + // Create a simple model. + var inputs = keras.Input(shape: 32); + var dense_layer = keras.layers.Dense(1); + var outputs = dense_layer.Apply(inputs); + return keras.Model(inputs, outputs); + } + + [TestMethod] + public void SimpleModelFromAutoCompile() + { + var inputs = tf.keras.layers.Input((28, 28, 1)); + var x = tf.keras.layers.Flatten().Apply(inputs); + x = tf.keras.layers.Dense(100, activation: "relu").Apply(x); + x = tf.keras.layers.Dense(units: 10).Apply(x); + var outputs = tf.keras.layers.Softmax(axis: 1).Apply(x); + var model = tf.keras.Model(inputs, outputs); + + model.compile(new Adam(0.001f), + tf.keras.losses.SparseCategoricalCrossentropy(), + new string[] { "accuracy" }); + + var data_loader = new MnistModelLoader(); + var num_epochs = 1; + var batch_size = 50; + + var dataset = data_loader.LoadAsync(new ModelLoadSetting + { + TrainDir = "mnist", + OneHot = false, + ValidationSize = 58000, + }).Result; + + model.fit(dataset.Train.Data, dataset.Train.Labels, batch_size, num_epochs); + + model.save("./pb_simple_compile", save_format: "tf"); + } + + [TestMethod] + public void SimpleModelFromSequential() + { + var model = keras.Sequential(new List() + { + tf.keras.layers.InputLayer((28, 28, 1)), + tf.keras.layers.Flatten(), + tf.keras.layers.Dense(100, "relu"), + tf.keras.layers.Dense(10), + tf.keras.layers.Softmax() + }); + + model.summary(); + + model.compile(new Adam(0.001f), tf.keras.losses.SparseCategoricalCrossentropy(), new string[] { "accuracy" }); + + var data_loader = new MnistModelLoader(); + var num_epochs = 1; + var batch_size = 50; + + var dataset = data_loader.LoadAsync(new ModelLoadSetting + { + TrainDir = "mnist", + OneHot = false, + ValidationSize = 58000, + }).Result; + + model.fit(dataset.Train.Data, dataset.Train.Labels, batch_size, num_epochs); + + model.save("./pb_simple_sequential", save_format: "tf"); + } + + [TestMethod] + public void AlexnetFromSequential() + { + var model = keras.Sequential(new List() + { + tf.keras.layers.InputLayer((227, 227, 3)), + tf.keras.layers.Conv2D(96, (11, 11), (4, 4), activation:"relu", padding:"valid"), + tf.keras.layers.BatchNormalization(), + tf.keras.layers.MaxPooling2D((3, 3), strides:(2, 2)), + + tf.keras.layers.Conv2D(256, (5, 5), (1, 1), "same", activation: "relu"), + tf.keras.layers.BatchNormalization(), + tf.keras.layers.MaxPooling2D((3, 3), (2, 2)), + + tf.keras.layers.Conv2D(384, (3, 3), (1, 1), "same", activation: "relu"), + tf.keras.layers.BatchNormalization(), + + tf.keras.layers.Conv2D(384, (3, 3), (1, 1), "same", activation: "relu"), + tf.keras.layers.BatchNormalization(), + + tf.keras.layers.Conv2D(256, (3, 3), (1, 1), "same", activation: "relu"), + tf.keras.layers.BatchNormalization(), + tf.keras.layers.MaxPooling2D((3, 3), (2, 2)), + + tf.keras.layers.Flatten(), + tf.keras.layers.Dense(4096, activation: "relu"), + tf.keras.layers.Dropout(0.5f), + + tf.keras.layers.Dense(4096, activation: "relu"), + tf.keras.layers.Dropout(0.5f), + + tf.keras.layers.Dense(1000, activation: "linear"), + tf.keras.layers.Softmax(1) + }); + + model.compile(tf.keras.optimizers.Adam(), tf.keras.losses.SparseCategoricalCrossentropy(from_logits: true), new string[] { "accuracy" }); + + var num_epochs = 1; + var batch_size = 8; + + var dataset = new RandomDataSet(new Shape(227, 227, 3), 16); + + model.fit(dataset.Data, dataset.Labels, batch_size, num_epochs); + + model.save("./alexnet_from_sequential", save_format: "tf"); + + // The saved model can be test with the following python code: + #region alexnet_python_code + //import pathlib + //import tensorflow as tf + + //def func(a): + // return -a + + //if __name__ == '__main__': + // model = tf.keras.models.load_model("./pb_alex_sequential") + // model.summary() + + // num_classes = 5 + // batch_size = 128 + // img_height = 227 + // img_width = 227 + // epochs = 100 + + // dataset_url = "https://storage.googleapis.com/download.tensorflow.org/example_images/flower_photos.tgz" + // data_dir = tf.keras.utils.get_file('flower_photos', origin = dataset_url, untar = True) + // data_dir = pathlib.Path(data_dir) + + // train_ds = tf.keras.preprocessing.image_dataset_from_directory( + // data_dir, + // validation_split = 0.2, + // subset = "training", + // seed = 123, + // image_size = (img_height, img_width), + // batch_size = batch_size) + + // val_ds = tf.keras.preprocessing.image_dataset_from_directory( + // data_dir, + // validation_split = 0.2, + // subset = "validation", + // seed = 123, + // image_size = (img_height, img_width), + // batch_size = batch_size) + + + // model.compile(optimizer = 'adam', + // loss = tf.keras.losses.SparseCategoricalCrossentropy(from_logits = True), + // metrics =['accuracy']) + + // model.build((None, img_height, img_width, 3)) + + // history = model.fit( + // train_ds, + // validation_data = val_ds, + // epochs = epochs + // ) + #endregion + } + + [TestMethod] + public void SaveAfterLoad() + { + var model = tf.keras.models.load_model(@"Assets/simple_model_from_auto_compile"); + model.summary(); + + model.save("Assets/saved_auto_compile_after_loading"); + + //model = tf.keras.models.load_model(@"Assets/saved_auto_compile_after_loading"); + //model.summary(); + } + } +} diff --git a/test/TensorFlowNET.Keras.UnitTest/MultiInputModelTest.cs b/test/TensorFlowNET.Keras.UnitTest/MultiInputModelTest.cs new file mode 100644 index 000000000..dd8ef8f91 --- /dev/null +++ b/test/TensorFlowNET.Keras.UnitTest/MultiInputModelTest.cs @@ -0,0 +1,63 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using Tensorflow.Keras.Optimizers; +using Tensorflow.NumPy; +using static Tensorflow.KerasApi; + +namespace Tensorflow.Keras.UnitTest +{ + [TestClass] + public class MultiInputModelTest + { + [TestMethod] + public void LeNetModel() + { + var inputs = keras.Input((28, 28, 1)); + var conv1 = keras.layers.Conv2D(16, (3, 3), activation: "relu", padding: "same").Apply(inputs); + var pool1 = keras.layers.MaxPooling2D((2, 2), 2).Apply(conv1); + var conv2 = keras.layers.Conv2D(32, (3, 3), activation: "relu", padding: "same").Apply(pool1); + var pool2 = keras.layers.MaxPooling2D((2, 2), 2).Apply(conv2); + var flat1 = keras.layers.Flatten().Apply(pool2); + + var inputs_2 = keras.Input((28, 28, 1)); + var conv1_2 = keras.layers.Conv2D(16, (3, 3), activation: "relu", padding: "same").Apply(inputs_2); + var pool1_2 = keras.layers.MaxPooling2D((4, 4), 4).Apply(conv1_2); + var conv2_2 = keras.layers.Conv2D(32, (1, 1), activation: "relu", padding: "same").Apply(pool1_2); + var pool2_2 = keras.layers.MaxPooling2D((2, 2), 2).Apply(conv2_2); + var flat1_2 = keras.layers.Flatten().Apply(pool2_2); + + var concat = keras.layers.Concatenate().Apply((flat1, flat1_2)); + var dense1 = keras.layers.Dense(512, activation: "relu").Apply(concat); + var dense2 = keras.layers.Dense(128, activation: "relu").Apply(dense1); + var dense3 = keras.layers.Dense(10, activation: "relu").Apply(dense2); + var output = keras.layers.Softmax(-1).Apply(dense3); + + var model = keras.Model((inputs, inputs_2), output); + model.summary(); + + var data_loader = new MnistModelLoader(); + + var dataset = data_loader.LoadAsync(new ModelLoadSetting + { + TrainDir = "mnist", + OneHot = false, + ValidationSize = 59900, + }).Result; + + var loss = keras.losses.SparseCategoricalCrossentropy(); + var optimizer = new Adam(0.001f); + model.compile(optimizer, loss, new string[] { "accuracy" }); + + NDArray x1 = np.reshape(dataset.Train.Data, (dataset.Train.Data.shape[0], 28, 28, 1)); + NDArray x2 = x1; + + var x = new NDArray[] { x1, x2 }; + model.fit(x, dataset.Train.Labels, batch_size: 8, epochs: 3); + + x1 = np.ones((1, 28, 28, 1), TF_DataType.TF_FLOAT); + x2 = np.zeros((1, 28, 28, 1), TF_DataType.TF_FLOAT); + var pred = model.predict((x1, x2)); + Console.WriteLine(pred); + } + } +} diff --git a/test/TensorFlowNET.Keras.UnitTest/MultiThreadsTest.cs b/test/TensorFlowNET.Keras.UnitTest/MultiThreadsTest.cs index 2d487087d..3706e65c8 100644 --- a/test/TensorFlowNET.Keras.UnitTest/MultiThreadsTest.cs +++ b/test/TensorFlowNET.Keras.UnitTest/MultiThreadsTest.cs @@ -1,12 +1,12 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; using System; +using System.Threading.Tasks; using Tensorflow.Keras.Engine; +using Tensorflow.NumPy; using static Tensorflow.Binding; using static Tensorflow.KerasApi; -using System.Threading.Tasks; -using Tensorflow.NumPy; -using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace TensorFlowNET.Keras.UnitTest +namespace Tensorflow.Keras.UnitTest { [TestClass] public class MultiThreads @@ -51,7 +51,7 @@ public void Test3Multithreading() //Sanity check without multithreading for (int i = 0; i < 2; i++) { - Functional clone = BuildModel(); + var clone = BuildModel(); clone.load_weights(savefile); //Predict something @@ -71,7 +71,7 @@ public void Test3Multithreading() }); } - Functional BuildModel() + IModel BuildModel() { tf.Context.reset_context(); var inputs = keras.Input(shape: 2); @@ -81,7 +81,7 @@ Functional BuildModel() var outputs = DenseLayer.Apply(inputs); // build keras model - Functional model = keras.Model(inputs, outputs, name: Guid.NewGuid().ToString()); + var model = tf.keras.Model(inputs, outputs, name: Guid.NewGuid().ToString()); // show model summary model.summary(); diff --git a/test/TensorFlowNET.Keras.UnitTest/OutputTest.cs b/test/TensorFlowNET.Keras.UnitTest/OutputTest.cs index bdb06da7f..15fbe11a4 100644 --- a/test/TensorFlowNET.Keras.UnitTest/OutputTest.cs +++ b/test/TensorFlowNET.Keras.UnitTest/OutputTest.cs @@ -1,14 +1,8 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using static Tensorflow.Binding; using static Tensorflow.KerasApi; -using Tensorflow.Keras; -namespace TensorFlowNET.Keras.UnitTest +namespace Tensorflow.Keras.UnitTest { [TestClass] public class OutputTest diff --git a/test/TensorFlowNET.Keras.UnitTest/PreprocessingTests.cs b/test/TensorFlowNET.Keras.UnitTest/PreprocessingTests.cs index 0a621e45a..82c84e794 100644 --- a/test/TensorFlowNET.Keras.UnitTest/PreprocessingTests.cs +++ b/test/TensorFlowNET.Keras.UnitTest/PreprocessingTests.cs @@ -1,14 +1,8 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; using System.Linq; -using System.Collections.Generic; -using System.Text; -using Tensorflow.NumPy; using static Tensorflow.KerasApi; -using Tensorflow; -using Tensorflow.Keras.Datasets; -namespace TensorFlowNET.Keras.UnitTest +namespace Tensorflow.Keras.UnitTest { [TestClass] public class PreprocessingTests : EagerModeTestBase @@ -71,8 +65,8 @@ public void TokenizeWithOOV() Assert.AreEqual(28, tokenizer.word_index.Count); - Assert.AreEqual(1, tokenizer.word_index[OOV]); - Assert.AreEqual(8, tokenizer.word_index["worst"]); + Assert.AreEqual(1, tokenizer.word_index[OOV]); + Assert.AreEqual(8, tokenizer.word_index["worst"]); Assert.AreEqual(13, tokenizer.word_index["number"]); Assert.AreEqual(17, tokenizer.word_index["were"]); } @@ -204,13 +198,13 @@ public void TokenizeTextsToSequencesWithOOV() for (var i = 0; i < sequences.Count; i++) for (var j = 0; j < sequences[i].Length; j++) - Assert.AreNotEqual(tokenizer.word_index[OOV], sequences[i][j]); + Assert.AreNotEqual(tokenizer.word_index[OOV], sequences[i][j]); } [TestMethod] public void TokenizeTextsToSequencesWithOOVPresent() { - var tokenizer = keras.preprocessing.text.Tokenizer(oov_token: OOV, num_words:20); + var tokenizer = keras.preprocessing.text.Tokenizer(oov_token: OOV, num_words: 20); tokenizer.fit_on_texts(texts); var sequences = tokenizer.texts_to_sequences(texts); @@ -255,7 +249,7 @@ public void PadSequencesPrePaddingTrunc() tokenizer.fit_on_texts(texts); var sequences = tokenizer.texts_to_sequences(texts); - var padded = keras.preprocessing.sequence.pad_sequences(sequences,maxlen:15); + var padded = keras.preprocessing.sequence.pad_sequences(sequences, maxlen: 15); Assert.AreEqual(4, padded.dims[0]); Assert.AreEqual(15, padded.dims[1]); @@ -348,7 +342,7 @@ public void TextToMatrixCount() Assert.AreEqual(27, tokenizer.word_index.Count); - var matrix = tokenizer.texts_to_matrix(texts, mode:"count"); + var matrix = tokenizer.texts_to_matrix(texts, mode: "count"); Assert.AreEqual(texts.Length, matrix.dims[0]); diff --git a/test/TensorFlowNET.Keras.UnitTest/SaveModel/SequentialModelLoad.cs b/test/TensorFlowNET.Keras.UnitTest/SaveModel/SequentialModelLoad.cs deleted file mode 100644 index e778a5a4a..000000000 --- a/test/TensorFlowNET.Keras.UnitTest/SaveModel/SequentialModelLoad.cs +++ /dev/null @@ -1,68 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tensorflow.Keras.Engine; -using Tensorflow.Keras.Saving.SavedModel; -using Tensorflow.Keras.Losses; -using Tensorflow.Keras.Metrics; -using Tensorflow; -using Tensorflow.Keras.Optimizers; -using static Tensorflow.KerasApi; -using Tensorflow.NumPy; -using static TensorFlowNET.Keras.UnitTest.SaveModel.SequentialModelSave; - -namespace TensorFlowNET.Keras.UnitTest.SaveModel; - -[TestClass] -public class SequentialModelLoad -{ - [TestMethod] - public void SimpleModelFromAutoCompile() - { - var model = keras.models.load_model(@"Assets/simple_model_from_auto_compile"); - model.summary(); - - model.compile(new Adam(0.0001f), new LossesApi().SparseCategoricalCrossentropy(), new string[] { "accuracy" }); - - // check the weights - var kernel1 = np.load(@"Assets/simple_model_from_auto_compile/kernel1.npy"); - var bias0 = np.load(@"Assets/simple_model_from_auto_compile/bias0.npy"); - - Assert.IsTrue(kernel1.Zip(model.TrainableWeights[2].numpy()).All(x => x.First == x.Second)); - Assert.IsTrue(bias0.Zip(model.TrainableWeights[1].numpy()).All(x => x.First == x.Second)); - - var data_loader = new MnistModelLoader(); - var num_epochs = 1; - var batch_size = 8; - - var dataset = data_loader.LoadAsync(new ModelLoadSetting - { - TrainDir = "mnist", - OneHot = false, - ValidationSize = 50000, - }).Result; - - model.fit(dataset.Train.Data, dataset.Train.Labels, batch_size, num_epochs); - } - - [TestMethod] - public void AlexnetFromSequential() - { - new SequentialModelSave().AlexnetFromSequential(); - var model = keras.models.load_model(@"./alexnet_from_sequential"); - model.summary(); - - model.compile(new Adam(0.001f), new LossesApi().SparseCategoricalCrossentropy(from_logits: true), new string[] { "accuracy" }); - - var num_epochs = 1; - var batch_size = 8; - - var dataset = new RandomDataSet(new Shape(227, 227, 3), 16); - - model.fit(dataset.Data, dataset.Labels, batch_size, num_epochs); - } -} diff --git a/test/TensorFlowNET.Keras.UnitTest/SaveModel/SequentialModelSave.cs b/test/TensorFlowNET.Keras.UnitTest/SaveModel/SequentialModelSave.cs deleted file mode 100644 index fe9b8b71f..000000000 --- a/test/TensorFlowNET.Keras.UnitTest/SaveModel/SequentialModelSave.cs +++ /dev/null @@ -1,198 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Collections.Generic; -using System.Diagnostics; -using Tensorflow; -using Tensorflow.Keras; -using Tensorflow.Keras.ArgsDefinition; -using Tensorflow.Keras.Engine; -using Tensorflow.Keras.Layers; -using Tensorflow.Keras.Losses; -using Tensorflow.Keras.Optimizers; -using Tensorflow.NumPy; -using static Tensorflow.Binding; -using static Tensorflow.KerasApi; - -namespace TensorFlowNET.Keras.UnitTest.SaveModel; - -[TestClass] -public class SequentialModelSave -{ - [TestMethod] - public void SimpleModelFromAutoCompile() - { - var inputs = new KerasInterface().Input((28, 28, 1)); - var x = new Flatten(new FlattenArgs()).Apply(inputs); - x = new Dense(new DenseArgs() { Units = 100, Activation = tf.nn.relu }).Apply(x); - x = new LayersApi().Dense(units: 10).Apply(x); - var outputs = new LayersApi().Softmax(axis: 1).Apply(x); - var model = new KerasInterface().Model(inputs, outputs); - - model.compile(new Adam(0.001f), new LossesApi().SparseCategoricalCrossentropy(), new string[] { "accuracy" }); - - var data_loader = new MnistModelLoader(); - var num_epochs = 1; - var batch_size = 50; - - var dataset = data_loader.LoadAsync(new ModelLoadSetting - { - TrainDir = "mnist", - OneHot = false, - ValidationSize = 10000, - }).Result; - - model.fit(dataset.Train.Data, dataset.Train.Labels, batch_size, num_epochs); - - model.save("./pb_simple_compile", save_format: "tf"); - } - - [TestMethod] - public void SimpleModelFromSequential() - { - Model model = KerasApi.keras.Sequential(new List() - { - keras.layers.InputLayer((28, 28, 1)), - keras.layers.Flatten(), - keras.layers.Dense(100, "relu"), - keras.layers.Dense(10), - keras.layers.Softmax(1) - }); - - model.summary(); - - model.compile(new Adam(0.001f), new LossesApi().SparseCategoricalCrossentropy(), new string[] { "accuracy" }); - - var data_loader = new MnistModelLoader(); - var num_epochs = 1; - var batch_size = 50; - - var dataset = data_loader.LoadAsync(new ModelLoadSetting - { - TrainDir = "mnist", - OneHot = false, - ValidationSize = 50000, - }).Result; - - model.fit(dataset.Train.Data, dataset.Train.Labels, batch_size, num_epochs); - - model.save("./pb_simple_sequential", save_format: "tf"); - } - - [TestMethod] - public void AlexnetFromSequential() - { - Model model = KerasApi.keras.Sequential(new List() - { - keras.layers.InputLayer((227, 227, 3)), - keras.layers.Conv2D(96, (11, 11), (4, 4), activation:"relu", padding:"valid"), - keras.layers.BatchNormalization(), - keras.layers.MaxPooling2D((3, 3), strides:(2, 2)), - - keras.layers.Conv2D(256, (5, 5), (1, 1), "same", activation: "relu"), - keras.layers.BatchNormalization(), - keras.layers.MaxPooling2D((3, 3), (2, 2)), - - keras.layers.Conv2D(384, (3, 3), (1, 1), "same", activation: "relu"), - keras.layers.BatchNormalization(), - - keras.layers.Conv2D(384, (3, 3), (1, 1), "same", activation: "relu"), - keras.layers.BatchNormalization(), - - keras.layers.Conv2D(256, (3, 3), (1, 1), "same", activation: "relu"), - keras.layers.BatchNormalization(), - keras.layers.MaxPooling2D((3, 3), (2, 2)), - - keras.layers.Flatten(), - keras.layers.Dense(4096, activation: "relu"), - keras.layers.Dropout(0.5f), - - keras.layers.Dense(4096, activation: "relu"), - keras.layers.Dropout(0.5f), - - keras.layers.Dense(1000, activation: "linear"), - keras.layers.Softmax(1) - }); - - model.compile(new Adam(0.001f), new LossesApi().SparseCategoricalCrossentropy(from_logits: true), new string[] { "accuracy" }); - - var num_epochs = 1; - var batch_size = 8; - - var dataset = new RandomDataSet(new Shape(227, 227, 3), 16); - - model.fit(dataset.Data, dataset.Labels, batch_size, num_epochs); - - model.save("./alexnet_from_sequential", save_format: "tf"); - - // The saved model can be test with the following python code: - #region alexnet_python_code - //import pathlib - //import tensorflow as tf - - //def func(a): - // return -a - - //if __name__ == '__main__': - // model = tf.keras.models.load_model("./pb_alex_sequential") - // model.summary() - - // num_classes = 5 - // batch_size = 128 - // img_height = 227 - // img_width = 227 - // epochs = 100 - - // dataset_url = "https://storage.googleapis.com/download.tensorflow.org/example_images/flower_photos.tgz" - // data_dir = tf.keras.utils.get_file('flower_photos', origin = dataset_url, untar = True) - // data_dir = pathlib.Path(data_dir) - - // train_ds = tf.keras.preprocessing.image_dataset_from_directory( - // data_dir, - // validation_split = 0.2, - // subset = "training", - // seed = 123, - // image_size = (img_height, img_width), - // batch_size = batch_size) - - // val_ds = tf.keras.preprocessing.image_dataset_from_directory( - // data_dir, - // validation_split = 0.2, - // subset = "validation", - // seed = 123, - // image_size = (img_height, img_width), - // batch_size = batch_size) - - - // model.compile(optimizer = 'adam', - // loss = tf.keras.losses.SparseCategoricalCrossentropy(from_logits = True), - // metrics =['accuracy']) - - // model.build((None, img_height, img_width, 3)) - - // history = model.fit( - // train_ds, - // validation_data = val_ds, - // epochs = epochs - // ) - #endregion - } - - public class RandomDataSet : DataSetBase - { - private Shape _shape; - - public RandomDataSet(Shape shape, int count) - { - _shape = shape; - Debug.Assert(_shape.ndim == 3); - long[] dims = new long[4]; - dims[0] = count; - for (int i = 1; i < 4; i++) - { - dims[i] = _shape[i - 1]; - } - Shape s = new Shape(dims); - Data = np.random.normal(0, 2, s); - Labels = np.random.uniform(0, 1, (count, 1)); - } - } -} \ No newline at end of file diff --git a/test/TensorFlowNET.Keras.UnitTest/Tensorflow.Keras.UnitTest.csproj b/test/TensorFlowNET.Keras.UnitTest/Tensorflow.Keras.UnitTest.csproj index bcd52c228..b964d1178 100644 --- a/test/TensorFlowNET.Keras.UnitTest/Tensorflow.Keras.UnitTest.csproj +++ b/test/TensorFlowNET.Keras.UnitTest/Tensorflow.Keras.UnitTest.csproj @@ -16,14 +16,14 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + @@ -49,6 +49,22 @@ PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + diff --git a/test/TensorFlowNET.Native.UnitTest/Attributes/AttributesTestcs.cs b/test/TensorFlowNET.Native.UnitTest/Attributes/AttributesTestcs.cs index f1df976bc..4db19ed55 100644 --- a/test/TensorFlowNET.Native.UnitTest/Attributes/AttributesTestcs.cs +++ b/test/TensorFlowNET.Native.UnitTest/Attributes/AttributesTestcs.cs @@ -48,7 +48,7 @@ private void ATTR_TEST_REGISTER_OP(string type) private void EXPECT_TF_META(Operation oper, string attr_name, int expected_list_size, TF_AttrType expected_type, uint expected_total_size) { - var m = c_api.TF_OperationGetAttrMetadata(oper, attr_name, s_.Handle); + var m = c_api.TF_OperationGetAttrMetadata(oper, attr_name, s_); EXPECT_EQ(TF_Code.TF_OK, s_.Code); char e = expected_list_size >= 0 ? (char)1 : (char)0; /*EXPECT_EQ(e, m.is_list); @@ -63,7 +63,7 @@ public void String() var desc = init("string"); c_api.TF_SetAttrString(desc, "v", "bunny", 5); - var oper = c_api.TF_FinishOperation(desc, s_.Handle); + var oper = c_api.TF_FinishOperation(desc, s_); //ASSERT_EQ(TF_Code.TF_OK, s_.Code); //EXPECT_TF_META(oper, "v", -1, TF_AttrType.TF_ATTR_STRING, 5); //var value = new char[5]; @@ -86,8 +86,6 @@ public void GetAttributesTest() public void Dispose() { - graph_.Dispose(); - s_.Dispose(); } } } diff --git a/test/TensorFlowNET.Native.UnitTest/CApiColocationTest.cs b/test/TensorFlowNET.Native.UnitTest/CApiColocationTest.cs index 09b88e139..c162cb725 100644 --- a/test/TensorFlowNET.Native.UnitTest/CApiColocationTest.cs +++ b/test/TensorFlowNET.Native.UnitTest/CApiColocationTest.cs @@ -59,7 +59,7 @@ private void FinishAndVerify(OperationDescription desc, string[] expected) private void VerifyCollocation(Operation op, string[] expected) { - var handle = c_api.TF_OperationGetAttrMetadata(op, "_class", s_.Handle); + var handle = c_api.TF_OperationGetAttrMetadata(op, "_class", s_); TF_AttrMetadata m = new TF_AttrMetadata(); if (expected.Length == 0) { @@ -98,8 +98,6 @@ public void StringList() public void Dispose() { - graph_.Dispose(); - s_.Dispose(); } } } diff --git a/test/TensorFlowNET.Native.UnitTest/CApiTest.cs b/test/TensorFlowNET.Native.UnitTest/CApiTest.cs index 2432ec1fd..fb4ed482e 100644 --- a/test/TensorFlowNET.Native.UnitTest/CApiTest.cs +++ b/test/TensorFlowNET.Native.UnitTest/CApiTest.cs @@ -45,10 +45,10 @@ protected void TF_AddInput(OperationDescription desc, TF_Output input) => c_api.TF_AddInput(desc, input); protected Operation TF_FinishOperation(OperationDescription desc, Status s) - => c_api.TF_FinishOperation(desc, s.Handle); + => c_api.TF_FinishOperation(desc, s); protected void TF_SetAttrTensor(OperationDescription desc, string attrName, Tensor value, Status s) - => c_api.TF_SetAttrTensor(desc, attrName, value, s.Handle); + => c_api.TF_SetAttrTensor(desc, attrName, value, s); protected void TF_SetAttrType(OperationDescription desc, string attrName, TF_DataType dtype) => c_api.TF_SetAttrType(desc, attrName, dtype); diff --git a/test/TensorFlowNET.Native.UnitTest/Functions/FunctionTest.cs b/test/TensorFlowNET.Native.UnitTest/Functions/FunctionTest.cs index 265509aec..9230bc731 100644 --- a/test/TensorFlowNET.Native.UnitTest/Functions/FunctionTest.cs +++ b/test/TensorFlowNET.Native.UnitTest/Functions/FunctionTest.cs @@ -18,7 +18,7 @@ public class FunctionTest : CApiTest, IDisposable string func_name_ = "MyFunc"; string func_node_name_ = "MyFunc_0"; Status s_; - IntPtr func_; + SafeFuncGraphHandle func_; [TestInitialize] public void Initialize() @@ -402,7 +402,7 @@ void DefineT(int num_opers, Operation[] opers, inputs.Length, inputs.ToArray(), outputs.Length, outputs.ToArray(), output_names == null || output_names.Length == 0 ? null : output_names, - IntPtr.Zero, null, s_.Handle); + IntPtr.Zero, null, s_); if (expect_failure) { @@ -413,7 +413,7 @@ void DefineT(int num_opers, Operation[] opers, ASSERT_EQ(TF_OK, s_.Code, s_.Message); ASSERT_NE(func_, IntPtr.Zero); ASSERT_EQ(func_name_, c_api.StringPiece(c_api.TF_FunctionName(func_))); - c_api.TF_GraphCopyFunction(host_graph_, func_, IntPtr.Zero, s_.Handle); + c_api.TF_GraphCopyFunction(host_graph_, func_, new SafeFuncGraphHandle(IntPtr.Zero), s_); ASSERT_EQ(TF_OK, s_.Code, s_.Message); } diff --git a/test/TensorFlowNET.Native.UnitTest/Gradients/GradientsTest.cs b/test/TensorFlowNET.Native.UnitTest/Gradients/GradientsTest.cs index 2cdd50193..79fa44890 100644 --- a/test/TensorFlowNET.Native.UnitTest/Gradients/GradientsTest.cs +++ b/test/TensorFlowNET.Native.UnitTest/Gradients/GradientsTest.cs @@ -44,18 +44,14 @@ private void TestGradientsSuccess(bool grad_inputs_provided) private bool GetGraphDef(Graph graph, out GraphDef graph_def) { graph_def = null; - using (var s = new Status()) - { - using (var buffer = new Buffer()) - { - c_api.TF_GraphToGraphDef(graph, buffer.Handle, s.Handle); - bool ret = TF_GetCode(s) == TF_OK; - EXPECT_EQ(TF_OK, TF_GetCode(s)); - if (ret) - graph_def = GraphDef.Parser.ParseFrom(buffer.ToArray()); - return ret; - } - } + var s = new Status(); + var buffer = new Buffer(); + c_api.TF_GraphToGraphDef(graph, buffer, s); + bool ret = TF_GetCode(s) == TF_OK; + EXPECT_EQ(TF_OK, TF_GetCode(s)); + if (ret) + graph_def = GraphDef.Parser.ParseFrom(buffer.ToArray()); + return ret; } private void RunGraphsAndCompareOutputs(TF_Output[] grad_outputs, TF_Output[] expected_grad_outputs) @@ -111,9 +107,9 @@ private void AddGradients(bool grad_inputs_provided, string prefix, TF_Output[] IntPtr[] handles = new IntPtr[2] { IntPtr.Zero, IntPtr.Zero }; c_api.TF_AddGradientsWithPrefix(graph_, prefix, outputs, noutputs, inputs, - ninputs, grad_inputs, s_.Handle, handles); + ninputs, grad_inputs, s_, handles); - var op = new Operation(handles[0]); + // var op = new Operation(handles[0]); } else { @@ -275,9 +271,6 @@ public void OpWithNoGradientRegistered_NoGradInputs() public void Dispose() { - graph_.Dispose(); - expected_graph_.Dispose(); - s_.Dispose(); } } } diff --git a/test/TensorFlowNET.Native.UnitTest/Graphs/GraphBuildTest.cs b/test/TensorFlowNET.Native.UnitTest/Graphs/GraphBuildTest.cs index 751dc3555..ed39882e5 100644 --- a/test/TensorFlowNET.Native.UnitTest/Graphs/GraphBuildTest.cs +++ b/test/TensorFlowNET.Native.UnitTest/Graphs/GraphBuildTest.cs @@ -9,7 +9,7 @@ public class GraphBuildTest : CApiTest [TestMethod, Ignore("Waiting to merge https://github.com/tensorflow/tensorflow/pull/43383")] public void UpdateEdge() { - using var graph = new Graph().as_default(); + var graph = new Graph().as_default(); var one = tf.constant(1, name: "one"); var two = tf.constant(2, name: "two"); diff --git a/test/TensorFlowNET.Native.UnitTest/Graphs/GraphTest.cs b/test/TensorFlowNET.Native.UnitTest/Graphs/GraphTest.cs index e40fd5c8a..33b5cd9f3 100644 --- a/test/TensorFlowNET.Native.UnitTest/Graphs/GraphTest.cs +++ b/test/TensorFlowNET.Native.UnitTest/Graphs/GraphTest.cs @@ -35,7 +35,7 @@ public void Graph() EXPECT_EQ(attr_value.Type, DataType.DtInt32); // Test not found errors in TF_Operation*() query functions. - EXPECT_EQ(-1, c_api.TF_OperationOutputListLength(feed, "bogus", s.Handle)); + EXPECT_EQ(-1, c_api.TF_OperationOutputListLength(feed, "bogus", s)); EXPECT_EQ(TF_Code.TF_INVALID_ARGUMENT, s.Code); Assert.IsFalse(c_test_util.GetAttrValue(feed, "missing", ref attr_value, s)); EXPECT_EQ("Operation 'feed' has no attr named 'missing'.", s.Message); @@ -191,9 +191,6 @@ public void Graph() ASSERT_TRUE(found_scalar_const); ASSERT_TRUE(found_add); ASSERT_TRUE(found_neg); - - graph.Dispose(); - s.Dispose(); } /// @@ -213,16 +210,15 @@ public void ImportGraphDef() // Export to a GraphDef. var graph_def = new Buffer(); - c_api.TF_GraphToGraphDef(graph, graph_def.Handle, s.Handle); + c_api.TF_GraphToGraphDef(graph, graph_def, s); EXPECT_EQ(TF_Code.TF_OK, s.Code); // Import it, with a prefix, in a fresh graph. - graph.Dispose(); graph = new Graph().as_default(); using (var opts = c_api.TF_NewImportGraphDefOptions()) { c_api.TF_ImportGraphDefOptionsSetPrefix(opts, "imported"); - c_api.TF_GraphImportGraphDef(graph, graph_def.Handle, opts, s.Handle); + c_api.TF_GraphImportGraphDef(graph, graph_def, opts, s); EXPECT_EQ(TF_Code.TF_OK, s.Code); } @@ -265,7 +261,7 @@ static SafeImportGraphDefResultsHandle ImportGraph(Status s, Graph graph, Buffer EXPECT_EQ(2, c_api.TF_ImportGraphDefOptionsNumReturnOutputs(opts)); c_api.TF_ImportGraphDefOptionsAddReturnOperation(opts, "scalar"); EXPECT_EQ(1, c_api.TF_ImportGraphDefOptionsNumReturnOperations(opts)); - var results = c_api.TF_GraphImportGraphDefWithResults(graph, graph_def.Handle, opts, s.Handle); + var results = c_api.TF_GraphImportGraphDefWithResults(graph, graph_def, opts, s); EXPECT_EQ(TF_Code.TF_OK, s.Code); return results; @@ -305,7 +301,7 @@ static SafeImportGraphDefResultsHandle ImportGraph(Status s, Graph graph, Buffer c_api.TF_ImportGraphDefOptionsSetPrefix(opts, "imported3"); c_api.TF_ImportGraphDefOptionsAddControlDependency(opts, feed); c_api.TF_ImportGraphDefOptionsAddControlDependency(opts, feed2); - c_api.TF_GraphImportGraphDef(graph, graph_def.Handle, opts, s.Handle); + c_api.TF_GraphImportGraphDef(graph, graph_def, opts, s); EXPECT_EQ(TF_Code.TF_OK, s.Code); } @@ -330,7 +326,7 @@ static SafeImportGraphDefResultsHandle ImportGraph(Status s, Graph graph, Buffer // Export to a graph def so we can import a graph with control dependencies graph_def = new Buffer(); - c_api.TF_GraphToGraphDef(graph, graph_def.Handle, s.Handle); + c_api.TF_GraphToGraphDef(graph, graph_def, s); EXPECT_EQ(TF_Code.TF_OK, s.Code); // Import again, with remapped control dependency, into the same graph @@ -338,7 +334,7 @@ static SafeImportGraphDefResultsHandle ImportGraph(Status s, Graph graph, Buffer { c_api.TF_ImportGraphDefOptionsSetPrefix(opts, "imported4"); c_api.TF_ImportGraphDefOptionsRemapControlDependency(opts, "imported/feed", feed); - c_api.TF_GraphImportGraphDef(graph, graph_def.Handle, opts, s.Handle); + c_api.TF_GraphImportGraphDef(graph, graph_def, opts, s); ASSERT_EQ(TF_Code.TF_OK, s.Code); } @@ -380,7 +376,6 @@ public void ImportGraphDef_WithReturnOutputs() ASSERT_EQ(TF_Code.TF_OK, s.Code); // Import it in a fresh graph with return outputs. - graph.Dispose(); graph = new Graph().as_default(); var opts = new ImportGraphDefOptions(); opts.AddReturnOutput("feed", 0); @@ -401,11 +396,6 @@ public void ImportGraphDef_WithReturnOutputs() EXPECT_EQ(0, return_outputs[0].index); EXPECT_EQ(scalar, return_outputs[1].oper); EXPECT_EQ(0, return_outputs[1].index); - - opts.Dispose(); - graph_def.Dispose(); - graph.Dispose(); - s.Dispose(); } /// @@ -422,16 +412,14 @@ public void ImportGraphDef_MissingUnusedInputMappings() public void ImportGraphMeta() { var dir = "my-save-dir/"; - using (var sess = tf.Session()) - { - var new_saver = tf.train.import_meta_graph(dir + "my-model-10000.meta"); - new_saver.restore(sess, dir + "my-model-10000"); - var labels = tf.constant(0, dtype: tf.int32, shape: new int[] { 100 }, name: "labels"); - var batch_size = tf.size(labels); - var logits = tf.get_collection("logits")[0] as Tensor; - var loss = tf.losses.sparse_softmax_cross_entropy(labels: labels, - logits: logits); - } + var sess = tf.Session(); + var new_saver = tf.train.import_meta_graph(dir + "my-model-10000.meta"); + new_saver.restore(sess, dir + "my-model-10000"); + var labels = tf.constant(0, dtype: tf.int32, shape: new int[] { 100 }, name: "labels"); + var batch_size = tf.size(labels); + var logits = tf.get_collection("logits")[0] as Tensor; + var loss = tf.losses.sparse_softmax_cross_entropy(labels: labels, + logits: logits); } } } diff --git a/test/TensorFlowNET.Native.UnitTest/Sessions/CSession.cs b/test/TensorFlowNET.Native.UnitTest/Sessions/CSession.cs index ee0f6edf5..e79571000 100644 --- a/test/TensorFlowNET.Native.UnitTest/Sessions/CSession.cs +++ b/test/TensorFlowNET.Native.UnitTest/Sessions/CSession.cs @@ -11,7 +11,7 @@ namespace Tensorflow.Native.UnitTest /// public class CSession { - private IntPtr session_; + private SafeSessionHandle session_; private List inputs_ = new List(); private List input_values_ = new List(); @@ -22,11 +22,8 @@ public class CSession public CSession(Graph graph, Status s, bool user_XLA = false) { - lock (Locks.ProcessWide) - { - var config = new ConfigProto { InterOpParallelismThreads = 4 }; - session_ = new Session(graph, config, s); - } + var config = new ConfigProto { InterOpParallelismThreads = 4 }; + session_ = new Session(graph, config, s); } public void SetInputs(Dictionary inputs) @@ -85,7 +82,7 @@ public unsafe void Run(Status s) c_api.TF_SessionRun(session_, null, inputs_ptr, input_values_ptr, inputs_ptr.Length, outputs_ptr, output_values_ptr, outputs_.Count, targets_ptr, targets_.Count, - IntPtr.Zero, s.Handle); + IntPtr.Zero, s); s.Check(); diff --git a/test/TensorFlowNET.Native.UnitTest/Sessions/SessionTest.cs b/test/TensorFlowNET.Native.UnitTest/Sessions/SessionTest.cs index 066c705c6..74f9366c7 100644 --- a/test/TensorFlowNET.Native.UnitTest/Sessions/SessionTest.cs +++ b/test/TensorFlowNET.Native.UnitTest/Sessions/SessionTest.cs @@ -14,8 +14,8 @@ public class SessionTest : CApiTest [TestMethod] public void Session() { - using var s = new Status(); - using var graph = new Graph(); + var s = new Status(); + var graph = new Graph(); // Make a placeholder operation. var feed = c_test_util.Placeholder(graph, s); diff --git a/test/TensorFlowNET.Native.UnitTest/Tensorflow.Native.UnitTest.csproj b/test/TensorFlowNET.Native.UnitTest/Tensorflow.Native.UnitTest.csproj index d7af03765..61373d2dc 100644 --- a/test/TensorFlowNET.Native.UnitTest/Tensorflow.Native.UnitTest.csproj +++ b/test/TensorFlowNET.Native.UnitTest/Tensorflow.Native.UnitTest.csproj @@ -1,4 +1,4 @@ - + net6.0 @@ -47,15 +47,14 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + diff --git a/test/TensorFlowNET.Native.UnitTest/Tensors/TensorTest.cs b/test/TensorFlowNET.Native.UnitTest/Tensors/TensorTest.cs index 74fc8da4e..6ccc6cdd1 100644 --- a/test/TensorFlowNET.Native.UnitTest/Tensors/TensorTest.cs +++ b/test/TensorFlowNET.Native.UnitTest/Tensors/TensorTest.cs @@ -139,45 +139,45 @@ public void SetShape() var feed_out_0 = new TF_Output(feed, 0); // Fetch the shape, it should be completely unknown. - int num_dims = c_api.TF_GraphGetTensorNumDims(graph, feed_out_0, s.Handle); + int num_dims = c_api.TF_GraphGetTensorNumDims(graph, feed_out_0, s); Assert.IsTrue(s.Code == TF_Code.TF_OK); EXPECT_EQ(-1, num_dims); // Set the shape to be unknown, expect no change. - c_api.TF_GraphSetTensorShape(graph, feed_out_0, null, -1, s.Handle); + c_api.TF_GraphSetTensorShape(graph, feed_out_0, null, -1, s); Assert.IsTrue(s.Code == TF_Code.TF_OK); - num_dims = c_api.TF_GraphGetTensorNumDims(graph, feed_out_0, s.Handle); + num_dims = c_api.TF_GraphGetTensorNumDims(graph, feed_out_0, s); EXPECT_EQ(-1, num_dims); // Set the shape to be 2 x Unknown long[] dims = { 2, -1 }; - c_api.TF_GraphSetTensorShape(graph, feed_out_0, dims, dims.Length, s.Handle); + c_api.TF_GraphSetTensorShape(graph, feed_out_0, dims, dims.Length, s); Assert.IsTrue(s.Code == TF_Code.TF_OK); - num_dims = c_api.TF_GraphGetTensorNumDims(graph, feed_out_0, s.Handle); + num_dims = c_api.TF_GraphGetTensorNumDims(graph, feed_out_0, s); EXPECT_EQ(2, num_dims); // Get the dimension vector appropriately. var returned_dims = new long[dims.Length]; - c_api.TF_GraphGetTensorShape(graph, feed_out_0, returned_dims, num_dims, s.Handle); + c_api.TF_GraphGetTensorShape(graph, feed_out_0, returned_dims, num_dims, s); Assert.IsTrue(s.Code == TF_Code.TF_OK); Assert.IsTrue(Enumerable.SequenceEqual(dims, returned_dims)); // Set to a new valid shape: [2, 3] dims[1] = 3; - c_api.TF_GraphSetTensorShape(graph, feed_out_0, dims, dims.Length, s.Handle); + c_api.TF_GraphSetTensorShape(graph, feed_out_0, dims, dims.Length, s); Assert.IsTrue(s.Code == TF_Code.TF_OK); // Fetch and see that the new value is returned. - c_api.TF_GraphGetTensorShape(graph, feed_out_0, returned_dims, num_dims, s.Handle); + c_api.TF_GraphGetTensorShape(graph, feed_out_0, returned_dims, num_dims, s); Assert.IsTrue(s.Code == TF_Code.TF_OK); Assert.IsTrue(Enumerable.SequenceEqual(dims, returned_dims)); // Try to set 'unknown' with unknown rank on the shape and see that // it doesn't change. - c_api.TF_GraphSetTensorShape(graph, feed_out_0, null, -1, s.Handle); + c_api.TF_GraphSetTensorShape(graph, feed_out_0, null, -1, s); Assert.IsTrue(s.Code == TF_Code.TF_OK); - c_api.TF_GraphGetTensorShape(graph, feed_out_0, returned_dims, num_dims, s.Handle); + c_api.TF_GraphGetTensorShape(graph, feed_out_0, returned_dims, num_dims, s); Assert.IsTrue(s.Code == TF_Code.TF_OK); EXPECT_EQ(2, num_dims); EXPECT_EQ(2, (int)returned_dims[0]); @@ -187,21 +187,21 @@ public void SetShape() // it doesn't change. dims[0] = -1; dims[1] = -1; - c_api.TF_GraphSetTensorShape(graph, feed_out_0, dims, 2, s.Handle); + c_api.TF_GraphSetTensorShape(graph, feed_out_0, dims, 2, s); Assert.IsTrue(s.Code == TF_Code.TF_OK); - c_api.TF_GraphGetTensorShape(graph, feed_out_0, returned_dims, num_dims, s.Handle); + c_api.TF_GraphGetTensorShape(graph, feed_out_0, returned_dims, num_dims, s); Assert.IsTrue(s.Code == TF_Code.TF_OK); EXPECT_EQ(2, num_dims); EXPECT_EQ(2, (int)returned_dims[0]); EXPECT_EQ(3, (int)returned_dims[1]); // Try to fetch a shape with the wrong num_dims - c_api.TF_GraphGetTensorShape(graph, feed_out_0, returned_dims, 5, s.Handle); + c_api.TF_GraphGetTensorShape(graph, feed_out_0, returned_dims, 5, s); Assert.IsTrue(s.Code == TF_Code.TF_INVALID_ARGUMENT); // Try to set an invalid shape (cannot change 2x3 to a 2x5). dims[1] = 5; - c_api.TF_GraphSetTensorShape(graph, feed_out_0, dims, 2, s.Handle); + c_api.TF_GraphSetTensorShape(graph, feed_out_0, dims, 2, s); Assert.IsTrue(s.Code == TF_Code.TF_INVALID_ARGUMENT); // Test for a scalar. @@ -209,14 +209,13 @@ public void SetShape() Assert.IsTrue(s.Code == TF_Code.TF_OK); var three_out_0 = new TF_Output(three, 0); - num_dims = c_api.TF_GraphGetTensorNumDims(graph, three_out_0, s.Handle); + num_dims = c_api.TF_GraphGetTensorNumDims(graph, three_out_0, s); Assert.IsTrue(s.Code == TF_Code.TF_OK); EXPECT_EQ(0, num_dims); - c_api.TF_GraphGetTensorShape(graph, feed_out_0, dims, num_dims, s.Handle); + c_api.TF_GraphGetTensorShape(graph, feed_out_0, dims, num_dims, s); Assert.IsTrue(s.Code == TF_Code.TF_INVALID_ARGUMENT); graph.Exit(); - s.Dispose(); } } } \ No newline at end of file diff --git a/test/TensorFlowNET.Native.UnitTest/c_test_util.cs b/test/TensorFlowNET.Native.UnitTest/c_test_util.cs index 50e747e90..4044046bd 100644 --- a/test/TensorFlowNET.Native.UnitTest/c_test_util.cs +++ b/test/TensorFlowNET.Native.UnitTest/c_test_util.cs @@ -23,7 +23,7 @@ public static Operation Add(Operation l, Operation r, Graph graph, Status s, str c_api.TF_AddInputList(desc, inputs, inputs.Length); - var op = c_api.TF_FinishOperation(desc, s.Handle); + var op = c_api.TF_FinishOperation(desc, s); s.Check(); return op; @@ -33,37 +33,29 @@ public static Operation Add(Operation l, Operation r, Graph graph, Status s, str [SuppressMessage("ReSharper", "RedundantAssignment")] public static bool GetAttrValue(Operation oper, string attr_name, ref AttrValue attr_value, Status s) { - lock (Locks.ProcessWide) - { - using (var buffer = new Buffer()) - { - c_api.TF_OperationGetAttrValueProto(oper, attr_name, buffer.Handle, s.Handle); - attr_value = AttrValue.Parser.ParseFrom(buffer.ToArray()); - } + var buffer = new Buffer(); - return s.Code == TF_Code.TF_OK; - } + c_api.TF_OperationGetAttrValueProto(oper, attr_name, buffer, s); + attr_value = AttrValue.Parser.ParseFrom(buffer.ToArray()); + + return s.Code == TF_Code.TF_OK; } public static GraphDef GetGraphDef(Graph graph) { - lock (Locks.ProcessWide) - { - using (var s = new Status()) - using (var buffer = new Buffer()) - { - c_api.TF_GraphToGraphDef(graph, buffer.Handle, s.Handle); - s.Check(); - return GraphDef.Parser.ParseFrom(buffer.ToArray()); - } - } + var s = new Status(); + var buffer = new Buffer(); + + c_api.TF_GraphToGraphDef(graph, buffer, s); + s.Check(); + return GraphDef.Parser.ParseFrom(buffer.ToArray()); } - public static FunctionDef GetFunctionDef(IntPtr func) + public static FunctionDef GetFunctionDef(SafeFuncGraphHandle func) { - using var s = new Status(); - using var buffer = new Buffer(); - c_api.TF_FunctionToFunctionDef(func, buffer.Handle, s.Handle); + var s = new Status(); + var buffer = new Buffer(); + c_api.TF_FunctionToFunctionDef(func, buffer, s); s.Check(true); var func_def = FunctionDef.Parser.ParseFrom(buffer.ToArray()); return func_def; @@ -192,7 +184,7 @@ public static Operation Neg(Operation n, Graph graph, Status s, string name = "n OperationDescription desc = c_api.TF_NewOperation(graph, "Neg", name); var neg_input = new TF_Output(n, 0); c_api.TF_AddInput(desc, neg_input); - var op = c_api.TF_FinishOperation(desc, s.Handle); + var op = c_api.TF_FinishOperation(desc, s); s.Check(); return op; @@ -210,7 +202,7 @@ public static Operation Placeholder(Graph graph, Status s, string name = "feed", c_api.TF_SetAttrShape(desc, "shape", dims, dims.Length); } - var op = c_api.TF_FinishOperation(desc, s.Handle); + var op = c_api.TF_FinishOperation(desc, s); s.Check(); return op; @@ -222,10 +214,10 @@ public static Operation Const(Tensor t, Graph graph, Status s, string name) lock (Locks.ProcessWide) { var desc = c_api.TF_NewOperation(graph, "Const", name); - c_api.TF_SetAttrTensor(desc, "value", t, s.Handle); + c_api.TF_SetAttrTensor(desc, "value", t, s); s.Check(); c_api.TF_SetAttrType(desc, "dtype", t.dtype); - var op = c_api.TF_FinishOperation(desc, s.Handle); + var op = c_api.TF_FinishOperation(desc, s); s.Check(); return op; diff --git a/test/TensorFlowNET.UnitTest/Basics/TrainSaverTest.cs b/test/TensorFlowNET.UnitTest/Basics/TrainSaverTest.cs index 2a4a79dcb..ca073e1ef 100644 --- a/test/TensorFlowNET.UnitTest/Basics/TrainSaverTest.cs +++ b/test/TensorFlowNET.UnitTest/Basics/TrainSaverTest.cs @@ -17,10 +17,8 @@ public void ExportGraph() public void ImportGraph() { - using (var sess = tf.Session()) - { - var new_saver = tf.train.import_meta_graph("C:/tmp/my-model.meta"); - } + var sess = tf.Session(); + var new_saver = tf.train.import_meta_graph("C:/tmp/my-model.meta"); //tf.train.export_meta_graph(filename: "linear_regression.meta.bin"); // import meta @@ -60,14 +58,12 @@ public void Save1() // Add ops to save and restore all the variables. var saver = tf.train.Saver(); - using (var sess = tf.Session()) - { - sess.run(init_op); + var sess = tf.Session(); + sess.run(init_op); - // Save the variables to disk. - var save_path = saver.save(sess, "/tmp/model1.ckpt"); - Console.WriteLine($"Model saved in path: {save_path}"); - } + // Save the variables to disk. + var save_path = saver.save(sess, "/tmp/model1.ckpt"); + Console.WriteLine($"Model saved in path: {save_path}"); } public void Save2() @@ -84,17 +80,15 @@ public void Save2() // Add ops to save and restore all the variables. var saver = tf.train.Saver(); - using (var sess = tf.Session()) - { - sess.run(init_op); - // o some work with the model. - inc_v1.op.run(); - dec_v2.op.run(); - - // Save the variables to disk. - var save_path = saver.save(sess, "/tmp/model2.ckpt"); - Console.WriteLine($"Model saved in path: {save_path}"); - } + var sess = tf.Session(); + sess.run(init_op); + // o some work with the model. + inc_v1.op.run(); + dec_v2.op.run(); + + // Save the variables to disk. + var save_path = saver.save(sess, "/tmp/model2.ckpt"); + Console.WriteLine($"Model saved in path: {save_path}"); } } } diff --git a/test/TensorFlowNET.UnitTest/ManagedAPI/ControlFlowApiTest.cs b/test/TensorFlowNET.UnitTest/ManagedAPI/ControlFlowApiTest.cs index 8366c070c..6d7182e09 100644 --- a/test/TensorFlowNET.UnitTest/ManagedAPI/ControlFlowApiTest.cs +++ b/test/TensorFlowNET.UnitTest/ManagedAPI/ControlFlowApiTest.cs @@ -57,12 +57,10 @@ public void ScanFunctionGraphMode() var input = tf.placeholder(TF_DataType.TF_FLOAT, new Shape(6)); var scan = tf.scan(fn, input); - using (var sess = tf.Session()) - { - sess.run(tf.global_variables_initializer()); - var result = sess.run(scan, new FeedItem(input, np.array(1, 2, 3, 4, 5, 6))); - Assert.AreEqual(new float[] { 1, 3, 6, 10, 15, 21 }, result.ToArray()); - } + var sess = tf.Session(); + sess.run(tf.global_variables_initializer()); + var result = sess.run(scan, new FeedItem(input, np.array(1, 2, 3, 4, 5, 6))); + Assert.AreEqual(new float[] { 1, 3, 6, 10, 15, 21 }, result.ToArray()); } } } diff --git a/test/TensorFlowNET.UnitTest/NumPy/Array.Sorting.Test.cs b/test/TensorFlowNET.UnitTest/NumPy/Array.Sorting.Test.cs index 13a5d9739..289172a45 100644 --- a/test/TensorFlowNET.UnitTest/NumPy/Array.Sorting.Test.cs +++ b/test/TensorFlowNET.UnitTest/NumPy/Array.Sorting.Test.cs @@ -38,7 +38,7 @@ public void sort() { var x = np.array(new int[] { 3, 1, 2 }); var sorted = np.sort(x); - Assert.IsTrue(sorted.ToArray() is [1, 2, 3]); + // Assert.IsTrue(sorted.ToArray() is [1, 2, 3]); } } } diff --git a/test/TensorFlowNET.UnitTest/PythonTest.cs b/test/TensorFlowNET.UnitTest/PythonTest.cs index 0ee8762c5..50cc2b328 100644 --- a/test/TensorFlowNET.UnitTest/PythonTest.cs +++ b/test/TensorFlowNET.UnitTest/PythonTest.cs @@ -196,23 +196,21 @@ public T evaluate(Tensor tensor) // return self._eval_helper(tensors) // else: { - using (var sess = tf.Session()) + var sess = tf.Session(); + var ndarray = tensor.eval(sess); + if (typeof(T) == typeof(double)) { - var ndarray = tensor.eval(sess); - if (typeof(T) == typeof(double)) - { - double x = ndarray; - result = x; - } - else if (typeof(T) == typeof(int)) - { - int x = ndarray; - result = x; - } - else - { - result = ndarray; - } + double x = ndarray; + result = x; + } + else if (typeof(T) == typeof(int)) + { + int x = ndarray; + result = x; + } + else + { + result = ndarray; } return (T)result; diff --git a/test/TensorFlowNET.UnitTest/StatusTest.cs b/test/TensorFlowNET.UnitTest/StatusTest.cs index 5106cb6f4..6dcdc158e 100644 --- a/test/TensorFlowNET.UnitTest/StatusTest.cs +++ b/test/TensorFlowNET.UnitTest/StatusTest.cs @@ -28,7 +28,6 @@ public void SetStatus() public void DeleteStatus() { var s = new Status(); - s.Dispose(); } } } diff --git a/test/TensorFlowNET.UnitTest/Tensorflow.Binding.UnitTest.csproj b/test/TensorFlowNET.UnitTest/Tensorflow.Binding.UnitTest.csproj index 56c212d0e..3a5562e2c 100644 --- a/test/TensorFlowNET.UnitTest/Tensorflow.Binding.UnitTest.csproj +++ b/test/TensorFlowNET.UnitTest/Tensorflow.Binding.UnitTest.csproj @@ -2,17 +2,11 @@ net6.0 - false - false - false - Open.snk - - 11.0 - + 10.0 AnyCPU;x64 @@ -51,10 +45,10 @@ - + diff --git a/test/TensorflowNET.Hub.Unittest/KerasLayerTest.cs b/test/TensorflowNET.Hub.Unittest/KerasLayerTest.cs new file mode 100644 index 000000000..4ee4d54c4 --- /dev/null +++ b/test/TensorflowNET.Hub.Unittest/KerasLayerTest.cs @@ -0,0 +1,46 @@ +using static Tensorflow.Binding; +using static Tensorflow.HubAPI; + +namespace Tensorflow.Hub.Unittest +{ + [TestClass] + public class KerasLayerTest + { + [TestMethod] + public void SmallBert() + { + var layer = hub.KerasLayer("https://tfhub.dev/tensorflow/small_bert/bert_en_uncased_L-6_H-256_A-4/1"); + + var input_type_ids = tf.convert_to_tensor(new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, dtype: tf.int32); + input_type_ids = tf.reshape(input_type_ids, (1, 128)); + var input_word_ids = tf.convert_to_tensor(new int[] { 101, 2129, 2024, 2017, 102, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 }, dtype: tf.int32); + input_word_ids = tf.reshape(input_word_ids, (1, 128)); + var input_mask = tf.convert_to_tensor(new int[] { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, dtype: dtypes.int32); + input_mask = tf.reshape(input_mask, (1, 128)); + + var result = layer.Apply(new Tensors(input_type_ids, input_word_ids, input_mask)); + } + + } +} \ No newline at end of file diff --git a/test/TensorflowNET.Hub.Unittest/Tensorflow.Hub.Unittest.csproj b/test/TensorflowNET.Hub.Unittest/Tensorflow.Hub.Unittest.csproj new file mode 100644 index 000000000..35cb9f16d --- /dev/null +++ b/test/TensorflowNET.Hub.Unittest/Tensorflow.Hub.Unittest.csproj @@ -0,0 +1,23 @@ + + + + net6 + enable + enable + + false + + + + + + + + + + + + + + + diff --git a/test/TensorflowNET.Hub.Unittest/Usings.cs b/test/TensorflowNET.Hub.Unittest/Usings.cs new file mode 100644 index 000000000..ab67c7ea9 --- /dev/null +++ b/test/TensorflowNET.Hub.Unittest/Usings.cs @@ -0,0 +1 @@ +global using Microsoft.VisualStudio.TestTools.UnitTesting; \ No newline at end of file